From 0c6cfba029f61b55340c7760834a0a4fe8160c42 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sun, 19 Dec 2021 14:45:19 +0100 Subject: [PATCH] Anti Ice and Snow Melt --- .../de/steamwar/fightsystem/FightSystem.java | 1 + .../listener/BlockFadeListener.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java index 1ef5115..02473ff 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java @@ -84,6 +84,7 @@ public class FightSystem extends JavaPlugin { new PersonalKitCreator(); new ArrowStopper(); new ArrowPickup(); + new BlockFadeListener(); new EnterHandler(); new TechHider(); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java b/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java new file mode 100644 index 0000000..704ec6b --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFadeListener.java @@ -0,0 +1,24 @@ +package de.steamwar.fightsystem.listener; + +import de.steamwar.fightsystem.ArenaMode; +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentListener; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockFadeEvent; + +public class BlockFadeListener implements Listener { + + public BlockFadeListener() { + new StateDependentListener(ArenaMode.Check, FightState.All, this); + } + + @EventHandler + public void onBlockFade(BlockFadeEvent event) { + if (event.getBlock().getType() == Material.SNOW_BLOCK || event.getBlock().getType() == Material.SNOW || event.getBlock().getType() == Material.ICE) { + event.setCancelled(true); + } + } + +}