diff --git a/varo/src/main/java/de/cliffbreak/varo/Varo.java b/varo/src/main/java/de/cliffbreak/varo/Varo.java index 4093388..d241b2c 100644 --- a/varo/src/main/java/de/cliffbreak/varo/Varo.java +++ b/varo/src/main/java/de/cliffbreak/varo/Varo.java @@ -15,6 +15,7 @@ import org.bukkit.configuration.file.YamlConfiguration; import de.cliffbreak.varo.commands.VaroCommand; import de.cliffbreak.varo.listeners.BannedItemListener; import de.cliffbreak.varo.listeners.ChatListener; +import de.cliffbreak.varo.listeners.CreatureSpawnListener; import de.cliffbreak.varo.listeners.EntityRegainHealthListener; import de.cliffbreak.varo.listeners.PlayerDeathListener; import de.cliffbreak.varo.listeners.PlayerJoinQuitListener; @@ -43,6 +44,7 @@ public class Varo extends JavaPlugin { getServer().getPluginManager().registerEvents(new EntityRegainHealthListener(), this); getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this); getServer().getPluginManager().registerEvents(new BannedItemListener(), this); + getServer().getPluginManager().registerEvents(new CreatureSpawnListener(), this); getCommand("varo").setExecutor(new VaroCommand(this)); diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/CreatureSpawnListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/CreatureSpawnListener.java new file mode 100644 index 0000000..970e935 --- /dev/null +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/CreatureSpawnListener.java @@ -0,0 +1,21 @@ +package de.cliffbreak.varo.listeners; + +import org.bukkit.Bukkit; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; + +public class CreatureSpawnListener implements Listener { + + @EventHandler() + public void onCreatureSpawn(CreatureSpawnEvent e) { + LivingEntity livingEntity = e.getEntity(); + if (livingEntity.getType().equals(EntityType.WANDERING_TRADER) + || livingEntity.getType().equals(EntityType.TRADER_LLAMA)) { + Bukkit.getLogger().info("Denied Wandering-Trader Spawn"); + e.setCancelled(true); + } + } +} \ No newline at end of file