First Prototype of ChaosBauGUI
Dieser Commit ist enthalten in:
Ursprung
faf31bc883
Commit
080d810bc4
@ -97,6 +97,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
getCommand("detonator").setExecutor(new CommandDetonator());
|
||||
getCommand("detonator").setTabCompleter(new CommandDetonatorTabCompleter());
|
||||
getCommand("script").setExecutor(new CommandScript());
|
||||
getCommand("gui").setExecutor(new CommandGUI());
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getPluginManager().registerEvents(new RegionListener(), this);
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
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.block.*;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
|
120
BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java
Normale Datei
120
BauSystem_Main/src/de/steamwar/bausystem/commands/CommandGUI.java
Normale Datei
@ -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;
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -26,8 +27,6 @@ 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
|
||||
@ -35,16 +34,17 @@ public class CommandGills implements CommandExecutor {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
toggleGills(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
public static void toggleGills(Player player) {
|
||||
if(player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Wassersicht deaktiviert");
|
||||
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
||||
return;
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 1000000, 255, false, false));
|
||||
player.sendMessage(BauSystem.PREFIX + "Wassersicht aktiviert");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -34,16 +34,18 @@ public class CommandNV implements CommandExecutor {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
for(PotionEffect effect : player.getActivePotionEffects()){
|
||||
if(effect.getType().equals(PotionEffectType.NIGHT_VISION)){
|
||||
player.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert");
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255, false, false));
|
||||
player.sendMessage(BauSystem.PREFIX + "Nachtsicht aktiviert");
|
||||
toggleNightvision(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void toggleNightvision(Player player) {
|
||||
if(player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
||||
player.sendMessage(BauSystem.PREFIX + "Nachtsicht deaktiviert");
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
return;
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 1000000, 255, false, false));
|
||||
player.sendMessage(BauSystem.PREFIX + "Nachtsicht aktiviert");
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,10 @@ public class CommandTNT implements CommandExecutor, Listener {
|
||||
return tntMode;
|
||||
}
|
||||
|
||||
public static void setTntMode(TNTMode tntMode) {
|
||||
CommandTNT.tntMode = tntMode;
|
||||
}
|
||||
|
||||
public enum TNTMode {
|
||||
ON("§aan"),
|
||||
ONLY_TB("§7nur §eTestblock"),
|
||||
|
@ -33,4 +33,5 @@ commands:
|
||||
lockschem:
|
||||
detonator:
|
||||
aliases: dt
|
||||
script:
|
||||
script:
|
||||
gui:
|
In neuem Issue referenzieren
Einen Benutzer sperren