SteamWar/BauSystem
Archiviert
13
0

added Command "/gills" & registered it

this is a slightly modified version of "/nv"
Dieser Commit ist enthalten in:
Jan9103 2020-06-25 11:57:16 +02:00
Ursprung bce1f156ca
Commit 05d2ef4632
2 geänderte Dateien mit 32 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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);

Datei anzeigen

@ -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;
}
}