From 05d2ef4632aa5a15e77d487a00277fe758494f8a Mon Sep 17 00:00:00 2001 From: Jan9103 Date: Thu, 25 Jun 2020 11:57:16 +0200 Subject: [PATCH 1/2] added Command "/gills" & registered it this is a slightly modified version of "/nv" --- .../src/de/steamwar/bausystem/BauSystem.java | 1 + .../bausystem/commands/CommandGills.java | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGills.java 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; + } +} From 68e44aa6706cac3870b2382dcdcbcb6d2e424142 Mon Sep 17 00:00:00 2001 From: Jan9103 Date: Tue, 30 Jun 2020 07:34:19 +0200 Subject: [PATCH 2/2] =?UTF-8?q?YML=20=C3=BCberabreitet=20und=20Befehl=20um?= =?UTF-8?q?benannt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 2 +- .../src/de/steamwar/bausystem/commands/CommandGills.java | 4 ++-- BauSystem_Main/src/plugin.yml | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 9235b2e..95e14c7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -88,7 +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()); + 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 index 6f38401..66f321b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGills.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGills.java @@ -19,13 +19,13 @@ public class CommandGills implements CommandExecutor { for(PotionEffect effect : player.getActivePotionEffects()){ if(effect.getType().equals(PotionEffectType.WATER_BREATHING)){ - player.sendMessage(BauSystem.PREFIX + "Kiemen deaktiviert"); + 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 + "Kiemen aktiviert"); + player.sendMessage(BauSystem.PREFIX + "Wassersicht aktiviert"); return false; } } diff --git a/BauSystem_Main/src/plugin.yml b/BauSystem_Main/src/plugin.yml index 0f92685..32285a4 100644 --- a/BauSystem_Main/src/plugin.yml +++ b/BauSystem_Main/src/plugin.yml @@ -26,4 +26,6 @@ commands: loader: nightvision: aliases: nv + watervision: + aliases: wv lockschem: \ No newline at end of file