SteamWar/BauSystem
Archiviert
13
0

ChaosBauGUI #183

Manuell gemergt
YoyoNow hat 20 Commits von ChaosBauGUI nach master 2021-02-24 19:16:17 +01:00 zusammengeführt
7 geänderte Dateien mit 148 neuen und 22 gelöschten Zeilen
Nur Änderungen aus Commit 080d810bc4 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -97,6 +97,7 @@ public class BauSystem extends JavaPlugin implements Listener {
getCommand("detonator").setExecutor(new CommandDetonator()); getCommand("detonator").setExecutor(new CommandDetonator());
getCommand("detonator").setTabCompleter(new CommandDetonatorTabCompleter()); getCommand("detonator").setTabCompleter(new CommandDetonatorTabCompleter());
getCommand("script").setExecutor(new CommandScript()); getCommand("script").setExecutor(new CommandScript());
getCommand("gui").setExecutor(new CommandGUI());
Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getPluginManager().registerEvents(new RegionListener(), this); Bukkit.getPluginManager().registerEvents(new RegionListener(), this);

Datei anzeigen

@ -19,8 +19,6 @@
package de.steamwar.bausystem.commands; package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.world.Region;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.*; import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;

Datei anzeigen

@ -0,0 +1,120 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Detonator;
import de.steamwar.core.VersionedCallable;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
public class CommandGUI implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player))
return false;
Player player = ((Player) commandSender);
openBauGui(player);
return true;
}
public static void openBauGui(Player player) {
SWInventory inv = new SWInventory(player, 5*9, SteamwarUser.get(BauSystem.getOwner()).getUserName() + "s Bau");
inv.setItem(3, Detonator.WAND, clickType -> {
player.closeInventory();
player.getInventory().setItemInMainHand(Detonator.WAND);
});
inv.setItem(4, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", clickType -> {
player.closeInventory();
player.performCommand("/wand");
});
if(CommandFreeze.getInstance().isOn()) {
inv.setItem(30, Material.GUNPOWDER, "§7Freeze: §eEingeschaltet", clickType -> {
CommandFreeze.getInstance().toggle();
openBauGui(player);
});
} else {
inv.setItem(30, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", clickType -> {
CommandFreeze.getInstance().toggle();
openBauGui(player);
});
}
switch (CommandTNT.getTntMode()) {
case OFF:
inv.setItem(31, Material.MINECART, "§7TNT: §eAusgeschaltet", clickType -> {
CommandTNT.setTntMode(CommandTNT.TNTMode.ONLY_TB);
openBauGui(player);
});
break;
case ONLY_TB:
inv.setItem(31, Material.TNT_MINECART, "§7TNT: §enur Testblock", clickType -> {
CommandTNT.setTntMode(CommandTNT.TNTMode.ON);
openBauGui(player);
});
break;
default:
inv.setItem(31, Material.TNT, "§7TNT: §eEingeschaltet", clickType -> {
CommandTNT.setTntMode(CommandTNT.TNTMode.OFF);
openBauGui(player);
});
}
if(CommandFire.getInstance().isOn()) {
inv.setItem(32, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", clickType -> {
CommandFire.getInstance().toggle();
openBauGui(player);
});
} else {
inv.setItem(32, Material.FIRE_CHARGE, "§7Fire: §eEingeschaltet", clickType -> {
CommandFire.getInstance().toggle();
openBauGui(player);
});
}
if(player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
inv.setItem(38, Material.POTION, "§7Nightvision: §eEingeschaltet", clickType -> {
CommandNV.toggleNightvision(player);
openBauGui(player);
});
} else {
inv.setItem(38, Material.GLASS_BOTTLE, "§7Nightvision: §eAusgeschaltet", clickType -> {
CommandNV.toggleNightvision(player);
openBauGui(player);
});
}
if(player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
inv.setItem(40, Material.WATER_BUCKET, "§7Waterbreathing: §eEingeschaltet", clickType -> {
CommandGills.toggleGills(player);
openBauGui(player);
});
} else {
inv.setItem(40, Material.BUCKET, "§7Waterbreathing: §eAusgeschaltet", clickType -> {
CommandGills.toggleGills(player);
openBauGui(player);
});
}
inv.open();
}
private static Material getMaterial(String... names) {
for (String name:names) {
try {
Material mat = Material.valueOf(name);
return mat;
}catch (NullPointerException ignored) {}
}
return null;
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.commands; package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -26,8 +27,6 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import de.steamwar.bausystem.BauSystem;
public class CommandGills implements CommandExecutor { public class CommandGills implements CommandExecutor {
@Override @Override
@ -35,16 +34,17 @@ public class CommandGills implements CommandExecutor {
if(!(sender instanceof Player)) if(!(sender instanceof Player))
return false; return false;
Player player = (Player) sender; Player player = (Player) sender;
toggleGills(player);
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; return false;
} }
public static void toggleGills(Player player) {
if(player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
Review

Mal mit 1.12 testen, ob es da auch schon die Funktion gab.

Mal mit 1.12 testen, ob es da auch schon die Funktion gab.
player.sendMessage(BauSystem.PREFIX + "Wassersicht deaktiviert");
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
return;
} }
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 255, false, false)); player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 255, false, false));
player.sendMessage(BauSystem.PREFIX + "Wassersicht aktiviert"); player.sendMessage(BauSystem.PREFIX + "Wassersicht aktiviert");
return false;
} }
} }

Datei anzeigen

@ -34,16 +34,18 @@ public class CommandNV implements CommandExecutor {
if(!(sender instanceof Player)) if(!(sender instanceof Player))
return false; return false;
Player player = (Player) sender; Player player = (Player) sender;
toggleNightvision(player);
return false;
}
for(PotionEffect effect : player.getActivePotionEffects()){ public static void toggleNightvision(Player player) {
if(effect.getType().equals(PotionEffectType.NIGHT_VISION)){ if(player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
Review

Ebenso mal testen. (1.12)

Ebenso mal testen. (1.12)
player.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert"); player.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert");
player.removePotionEffect(PotionEffectType.NIGHT_VISION); player.removePotionEffect(PotionEffectType.NIGHT_VISION);
return false; return;
}
} }
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255, false, false)); player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255, false, false));
player.sendMessage(BauSystem.PREFIX + "Nachtsicht aktiviert"); player.sendMessage(BauSystem.PREFIX + "Nachtsicht aktiviert");
return false;
} }
} }

Datei anzeigen

@ -42,6 +42,10 @@ public class CommandTNT implements CommandExecutor, Listener {
return tntMode; return tntMode;
} }
public static void setTntMode(TNTMode tntMode) {
CommandTNT.tntMode = tntMode;
}
public enum TNTMode { public enum TNTMode {
ON("§aan"), ON("§aan"),
ONLY_TB("§7nur §eTestblock"), ONLY_TB("§7nur §eTestblock"),

Datei anzeigen

@ -34,3 +34,4 @@ commands:
detonator: detonator:
aliases: dt aliases: dt
script: script:
gui: