Disabling Signs-dying protection from DYE flag for non-1.14 servers

#669
This commit is contained in:
Florian CUNY 2019-05-08 00:20:57 +02:00
parent cfdd0c728a
commit 7ba3cd4570

View File

@ -8,6 +8,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener; import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags; import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.versions.ServerCompatibility;
/** /**
* Protects against dying things. * Protects against dying things.
@ -17,11 +18,16 @@ import world.bentobox.bentobox.lists.Flags;
public class DyeListener extends FlagListener { public class DyeListener extends FlagListener {
/** /**
* Prevent dying * Prevent dying signs.
* @param e - event * @param e - event
*/ */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEvent e) { public void onPlayerInteract(final PlayerInteractEvent e) {
if (!ServerCompatibility.getInstance().isVersion(ServerCompatibility.ServerVersion.V1_14)) {
// We're disabling this check for non-1.14 servers.
return;
}
if (e.getClickedBlock() == null || e.getItem() == null) { if (e.getClickedBlock() == null || e.getItem() == null) {
return; return;
} }