feat: disable spawn from wandering trader
This commit is contained in:
parent
7b5c215742
commit
bdb213e3e1
2 changed files with 23 additions and 0 deletions
|
@ -15,6 +15,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import de.cliffbreak.varo.commands.VaroCommand;
|
import de.cliffbreak.varo.commands.VaroCommand;
|
||||||
import de.cliffbreak.varo.listeners.BannedItemListener;
|
import de.cliffbreak.varo.listeners.BannedItemListener;
|
||||||
import de.cliffbreak.varo.listeners.ChatListener;
|
import de.cliffbreak.varo.listeners.ChatListener;
|
||||||
|
import de.cliffbreak.varo.listeners.CreatureSpawnListener;
|
||||||
import de.cliffbreak.varo.listeners.EntityRegainHealthListener;
|
import de.cliffbreak.varo.listeners.EntityRegainHealthListener;
|
||||||
import de.cliffbreak.varo.listeners.PlayerDeathListener;
|
import de.cliffbreak.varo.listeners.PlayerDeathListener;
|
||||||
import de.cliffbreak.varo.listeners.PlayerJoinQuitListener;
|
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 EntityRegainHealthListener(), this);
|
||||||
getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this);
|
getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new BannedItemListener(), this);
|
getServer().getPluginManager().registerEvents(new BannedItemListener(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new CreatureSpawnListener(), this);
|
||||||
|
|
||||||
getCommand("varo").setExecutor(new VaroCommand(this));
|
getCommand("varo").setExecutor(new VaroCommand(this));
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue