diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index d481ced..d06eed5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -89,6 +89,7 @@ public class BauSystem extends JavaPlugin implements Listener { getCommand("loader").setExecutor(new CommandLoader()); getCommand("lockschem").setExecutor(new CommandLockschem()); getCommand("debugstick").setExecutor(new CommandDebugStick()); + getCommand("watervision").setExecutor(new CommandGills()); Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(new RegionListener(), this); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGills.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGills.java new file mode 100644 index 0000000..66f321b --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGills.java @@ -0,0 +1,31 @@ +package de.steamwar.bausystem.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import de.steamwar.bausystem.BauSystem; + +public class CommandGills implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) + return false; + Player player = (Player) sender; + + for(PotionEffect effect : player.getActivePotionEffects()){ + if(effect.getType().equals(PotionEffectType.WATER_BREATHING)){ + player.sendMessage(BauSystem.PREFIX + "Wassersicht deaktiviert"); + player.removePotionEffect(PotionEffectType.WATER_BREATHING); + return false; + } + } + player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 255, false, false)); + player.sendMessage(BauSystem.PREFIX + "Wassersicht aktiviert"); + return false; + } +} diff --git a/BauSystem_Main/src/plugin.yml b/BauSystem_Main/src/plugin.yml index 60d1131..6eac2b7 100644 --- a/BauSystem_Main/src/plugin.yml +++ b/BauSystem_Main/src/plugin.yml @@ -27,4 +27,6 @@ commands: loader: nightvision: aliases: nv + watervision: + aliases: wv lockschem: \ No newline at end of file