1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

On painting destory ???

Discussion in 'Skript' started by Pierrelasse, Oct 3, 2022.

Tags:
  1. Pierrelasse

    Pierrelasse Active Member

    Joined:
    Apr 20, 2022
    Messages:
    114
    Likes Received:
    4
    How do i know when a painting gets hit / destoryed?
     
  2. Allan Noyd

    Allan Noyd Member

    Joined:
    Apr 29, 2021
    Messages:
    48
    Likes Received:
    0
    Paintings are not a block but an entity just like item frames for instance. Might want look into 'on death' event or something. Not sure though.
     
  3. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    138
    Likes Received:
    22
    Best way to handle paintings is using Skript-reflect:

    Code (Text):
    1. import:
    2.   org.bukkit.event.hanging.HangingBreakEvent
    3.   org.bukkit.event.hanging.HangingBreakByEntityEvent
    4. on HangingBreakEvent:
    5.   if event.getEntity() is painting:
    6.     cancel event
    7. on HangingBreakByEntityEvent:
    8.   if event.getEntity() is painting:
    9.     cancel event
    But vanilla Skript also can handle this event:
    Code (Text):
    1. on break:
    2.   if hanging entity is set:
    3.     if hanging entity is painting:
    4.       cancel event
     
  4. Pierrelasse

    Pierrelasse Active Member

    Joined:
    Apr 20, 2022
    Messages:
    114
    Likes Received:
    4
    I did that alr

    on death nothing
    on damage nothing
    no on painting destory

    but how i see, iotzy got a solution with skript-reflect...
     
  5. lotzy

    lotzy Active Member

    Joined:
    Mar 15, 2022
    Messages:
    138
    Likes Received:
    22
    I got BINGO with pure skript and skript reflect
     

Share This Page

Loading...