diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index f60499f..9235b2e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -88,6 +88,7 @@ public class BauSystem extends JavaPlugin implements Listener { getCommand("skull").setExecutor(new CommandSkull()); getCommand("loader").setExecutor(new CommandLoader()); getCommand("lockschem").setExecutor(new CommandLockschem()); + getCommand("gills").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..6f38401 --- /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 + "Kiemen deaktiviert"); + player.removePotionEffect(PotionEffectType.WATER_BREATHING); + return false; + } + } + player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 255, false, false)); + player.sendMessage(BauSystem.PREFIX + "Kiemen aktiviert"); + return false; + } +}