Small Überarbeitungen + FireSpread Bugfix
Dieser Commit ist enthalten in:
Ursprung
758153f5b9
Commit
4f2425c8c2
@ -180,7 +180,6 @@ public class CommandFramework implements CommandExecutor {
|
||||
|
||||
private void registerCommand(Command command, String label, Method m, Object obj) {
|
||||
commandMap.put(label.toLowerCase(), new AbstractMap.SimpleEntry<>(m, obj));
|
||||
commandMap.put(this.plugin.getName() + ':' + label.toLowerCase(), new AbstractMap.SimpleEntry<>(m, obj));
|
||||
String cmdLabel = label.replace(".", ",").split(",")[0].toLowerCase();
|
||||
if (map.getCommand(cmdLabel) == null) {
|
||||
org.bukkit.command.Command cmd = new BukkitCommand(cmdLabel, this, plugin);
|
||||
|
@ -9,6 +9,7 @@ import de.warking.bausystem.commands.*;
|
||||
import de.warking.bausystem.config.Config;
|
||||
import de.warking.bausystem.world.LagDetectorRunnable;
|
||||
import de.warking.bausystem.world.RegionListener;
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.WarkingUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
@ -82,16 +83,15 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
saveRegionData();
|
||||
}
|
||||
|
||||
// Time to replace the vanillacommands with BauSystem's own versions
|
||||
try {
|
||||
CommandRemover.removeCommand("tp");
|
||||
CommandInjector.injectCommand(new CommandTeleport());
|
||||
CommandRemover.removeCommand("gamemode");
|
||||
CommandInjector.injectCommand(new CommandGamemode());
|
||||
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
new File("plugins/BauSystem/worlds/").mkdirs();
|
||||
config = new Config();
|
||||
config.initConfig();
|
||||
@ -149,9 +149,11 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
plugin = this;
|
||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), new LagDetectorRunnable(), 20, 20);
|
||||
}
|
||||
|
||||
public static BauSystem getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static WorldEditPlugin getWorldEdit() {
|
||||
return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||
}
|
||||
@ -159,6 +161,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
public static WorldGuardPlugin getWorldGuard() {
|
||||
return (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
}
|
||||
@ -167,7 +170,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
return JavaPlugin.getPlugin(BauSystem.class);
|
||||
}
|
||||
|
||||
@Completer(name = "bau")
|
||||
@Completer(name = "bau", aliases = "gs")
|
||||
public List<String> completeCommands(CommandArgs args) {
|
||||
List<String> ret = new ArrayList<>();
|
||||
StringBuilder label = new StringBuilder(args.getCommand().getLabel());
|
||||
@ -176,31 +179,6 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
}
|
||||
for (String currentLabel : this.cmdFramework.getCommandLabels()) {
|
||||
String current = currentLabel.replace('.', ' ');
|
||||
if (currentLabel.contains("BauFactory"))
|
||||
continue;
|
||||
if (current.contains(label.toString())) {
|
||||
current = current.substring(label.toString().lastIndexOf(' ')).trim();
|
||||
current = current.substring(0, current.indexOf(' ') != -1 ? current.indexOf(' ') : current.length())
|
||||
.trim();
|
||||
if (!ret.contains(current)) {
|
||||
ret.add(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Completer(name = "gs")
|
||||
public List<String> completeCommands1(CommandArgs args) {
|
||||
List<String> ret = new ArrayList<>();
|
||||
StringBuilder label = new StringBuilder(args.getCommand().getLabel());
|
||||
for (String arg : args.getArgs()) {
|
||||
label.append(" ").append(arg);
|
||||
}
|
||||
for (String currentLabel : this.cmdFramework.getCommandLabels()) {
|
||||
String current = currentLabel.replace('.', ' ');
|
||||
if (currentLabel.contains("BauFactory"))
|
||||
continue;
|
||||
if (current.contains(label.toString())) {
|
||||
current = current.substring(label.toString().lastIndexOf(' ')).trim();
|
||||
current = current.substring(0, current.indexOf(' ') != -1 ? current.indexOf(' ') : current.length())
|
||||
@ -226,7 +204,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
Field f1 = serverClass.getDeclaredField("commandMap");
|
||||
f1.setAccessible(true);
|
||||
SimpleCommandMap commandMap = (SimpleCommandMap) f1.get(Bukkit.getServer());
|
||||
commandMap.register("baufactory", cmd);
|
||||
commandMap.register("BauSystem", cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,8 +216,10 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (Bukkit.getWorld(p.getUniqueId()) != null) {
|
||||
e.setRespawnLocation(Bukkit.getWorld(p.getUniqueId()).getSpawnLocation());
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()) == null) {
|
||||
e.setRespawnLocation(config.spawn);
|
||||
}else{
|
||||
e.setRespawnLocation(Bukkit.getWorld(p.getUniqueId().toString()).getSpawnLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +250,7 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
}
|
||||
if (e.getCause() == TeleportCause.SPECTATE) {
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage(BauSystem.PREFIX + "§cDu darfst die GM3 Teleportfunktion nicht benutzen!");
|
||||
e.getPlayer().sendMessage(BauSystem.PREFIX + "§cDu darfst die Zuschauer-Teleportfunktion nicht benutzen!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import de.pro_crafting.commandframework.Command;
|
||||
import de.pro_crafting.commandframework.CommandArgs;
|
||||
import de.warking.bausystem.BauSystem;
|
||||
import de.warking.bausystem.world.BauWorld;
|
||||
import de.warking.bausystem.world.Permission;
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import de.warking.hunjy.MySQL.WarkingUser;
|
||||
@ -30,54 +31,45 @@ import java.util.UUID;
|
||||
|
||||
public class CommandBau {
|
||||
|
||||
@Command(name = "bau", aliases = "gs", inGameOnly = true)
|
||||
public void onBau(CommandArgs args) {
|
||||
onHelp(args);
|
||||
}
|
||||
|
||||
@Command(name = "bau.help", aliases = "gs.help", inGameOnly = true)
|
||||
@Command(name = "bau", aliases = {"bau.help", "gs", "gs.help"}, inGameOnly = true)
|
||||
public void onHelp(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
p.sendMessage(BauSystem.PREFIX + "Hilfeseite 1 von 2:");
|
||||
p.sendMessage("§6/bau help §7- Zeigt dir diese Hilfe");
|
||||
p.sendMessage("§6/bau help 2 §7- Zeigt dir Seite 2 der Hilfe");
|
||||
p.sendMessage("§6/bau home §7- Teleportiert dich auf deine Welt");
|
||||
p.sendMessage("§6/bau addmember §7- Fügt zu deiner Welt einen Spieler hinzu");
|
||||
p.sendMessage("§6/bau delmember §7- Entfernt einen Spieler von deiner Welt");
|
||||
p.sendMessage("§6/bau tntdmg §7- Erlaubt / verbietet Explosionen");
|
||||
p.sendMessage("§6/bau firedmg §7- Erlaubt / verbietet Feuerschaden");
|
||||
p.sendMessage("§6/bau testblock §7- Erneuert den nächsten Testblock");
|
||||
p.sendMessage("§6/bau reset §7- Setzt die derzeitige Region zurück");
|
||||
p.sendMessage("§6/bau help 2 §7- Zeigt dir die Hilfe zum Member-System");
|
||||
p.sendMessage("§6/home §7- Teleportiert dich auf deine Welt");
|
||||
p.sendMessage("§6/tnt §7- (de)aktiviert Explosionsschaden");
|
||||
p.sendMessage("§6/fire §7- (de)aktiviert Feuerschaden");
|
||||
p.sendMessage("§6/testblock §7- Erneuert den nächsten Testblock");
|
||||
p.sendMessage("§6/reset §7- Setzt die derzeitige Region zurück");
|
||||
p.sendMessage("§6/bau resetall §7- Setzt deine Welt zurück");
|
||||
p.sendMessage("§6/bau replace §7- Ersetzt in einer Region Obsidian zu TNT und Grundgestein zu Schleim");
|
||||
p.sendMessage("§6/bau speed §7- Ändert deine Fluggeschwindigkeit");
|
||||
p.sendMessage("§6/bau tp §7- Teleportiert dich auf eine Welt");
|
||||
p.sendMessage("§6/bau info §7- Informationen über die aktuelle Welt");
|
||||
p.sendMessage("§6/speed §7- Ändert deine Fluggeschwindigkeit");
|
||||
p.sendMessage("§6/nv §7- (de)aktiviert Nachtsicht");
|
||||
p.sendMessage("§6/trace §7- Gibt einen Überblick über den TNT-Tracer");
|
||||
//p.sendMessage("§6/bau gui §7- Öffnet eine GUI");
|
||||
}
|
||||
|
||||
@Command(name = "bau.help.2", aliases = "gs.help.2", inGameOnly = true)
|
||||
@Command(name = "bau.help.2", aliases = {"gs.help.2", "bau.2", "gs.2"}, inGameOnly = true)
|
||||
public void onHelp2(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
p.sendMessage(BauSystem.PREFIX + "Hilfeseite 2 von 2:");
|
||||
p.sendMessage("§6/bau togglewe §7- Darf ein Spieler WorldEdit verwenden");
|
||||
p.sendMessage("§6/bau togglebuild §7- Darf ein Spieler bauen");
|
||||
p.sendMessage("§6/bau toggletp §7- Darf ein Spieler sich teleportieren");
|
||||
p.sendMessage("§6/bau toggletestblock §7- Darf ein Spieler einen TestBlock erneuern");
|
||||
p.sendMessage("§6/bau togglereset §7- Darf ein Spieler eine Region erneuern");
|
||||
p.sendMessage("§6/bau togglereplace §7- Darf ein Spieler in einer Region replacen");
|
||||
p.sendMessage("§6/bau togglechgm §7- Darf ein Spieler seinen Spielmodus ändern");
|
||||
p.sendMessage("§6/nv §7- Aktiviert/Deaktiviert Nachtsicht");
|
||||
p.sendMessage("§6/trace §7- Gibt einen Überblick über die Funktionen des TNT-Tracers");
|
||||
p.sendMessage("§6/bau addmember §7- Fügt zu deiner Welt einen Spieler hinzu");
|
||||
p.sendMessage("§6/bau delmember §7- Entfernt einen Spieler von deiner Welt");
|
||||
p.sendMessage("§6/bau togglebuild §7- Berechtigung zum Bauen, Spielmodus wechseln, /tp");
|
||||
p.sendMessage("§6/bau togglewe §7- Berechtigung für: WorldEdit, /bau replace, /bau testblock");
|
||||
p.sendMessage("§6/bau toggleworld §7- Berechtigung für: /bau reset, /trace, /fire, /tnt");
|
||||
}
|
||||
|
||||
@Command(name = "bau.home", aliases = "gs.home", inGameOnly = true)
|
||||
@Command(name = "bau.home", aliases = {"gs.home", "home"}, inGameOnly = true)
|
||||
public void onHome(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()) == null) {
|
||||
new Bauwelt(p.getUniqueId(), false, false);
|
||||
}
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null){
|
||||
if (Bukkit.getWorld(p.getUniqueId().toString()) == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§aEinen Moment bitte... Deine Welt wird vorbereitet");
|
||||
try {
|
||||
BauWorld.loadWorld(p.getUniqueId());
|
||||
@ -87,15 +79,44 @@ public class CommandBau {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
p.teleport(Bukkit.getWorld(p.getUniqueId().toString()).getSpawnLocation());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(BauSystem.getInstance(), () -> p.setGameMode(GameMode.CREATIVE),20L);
|
||||
}
|
||||
|
||||
@Command(name = "bau.tp", aliases = "gs.tp", inGameOnly = true)
|
||||
public void onTp(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau tp <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID worldOwner = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.member)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich nicht auf diese Welt teleportieren");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.getWorld(worldOwner.toString()) == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§aEinen Moment bitte... Die Welt wird vorbereitet");
|
||||
try {
|
||||
BauWorld.loadWorld(worldOwner);
|
||||
} catch (IOException e) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cBeim Laden der Welt ist ein Fehler aufgetreten");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
p.teleport(Bukkit.getWorld(worldOwner.toString()).getSpawnLocation());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(BauSystem.getInstance(), () -> p.setGameMode(GameMode.CREATIVE), 20);
|
||||
}
|
||||
|
||||
@Command(name = "bau.addmember", aliases = "gs.addmember", inGameOnly = true)
|
||||
public void onAdd(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast noch keine Welt");
|
||||
if (!hasWorld(p)){
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau addmember <Spieler>");
|
||||
@ -113,6 +134,7 @@ public class CommandBau {
|
||||
|
||||
new BauweltMember(p.getUniqueId(), id, true, false, false, false, false);
|
||||
p.sendMessage(BauSystem.PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt");
|
||||
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if(z != null)
|
||||
z.sendMessage(BauSystem.PREFIX + "§aDu wurdest zu der Welt von §6" + p.getName() + " §ahinzugefügt");
|
||||
@ -121,71 +143,18 @@ public class CommandBau {
|
||||
@Command(name = "bau.delmember", aliases = "gs.delmember", inGameOnly = true)
|
||||
public void onDel(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast noch keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau delmember <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
BauWorld.removePlayer(p, id);
|
||||
}
|
||||
@Command(name = "bau.tp", aliases = "gs.tp", inGameOnly = true)
|
||||
public void onTp(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau tp <Spieler>");
|
||||
return;
|
||||
}
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}else if (BauweltMember.getBauMember(id, p.getUniqueId()) == null && !p.hasPermission("bau.team")) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist kein Mitglied dieser Welt");
|
||||
if(!toggleCheck(args, p, id)){
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§aEinen Moment bitte... Deine Welt wird vorbereitet");
|
||||
try {
|
||||
BauWorld.loadWorld(id);
|
||||
} catch (IOException e) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cBeim Laden der Welt ist ein Fehler aufgetreten");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
p.teleport(Bukkit.getWorld(id.toString()).getSpawnLocation());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(BauSystem.getInstance(), () -> p.setGameMode(GameMode.CREATIVE), 20);
|
||||
}
|
||||
|
||||
@Command(name = "bau.speed", aliases = "gs.speed", inGameOnly = true)
|
||||
public void onSpeed(CommandArgs args){
|
||||
final Player player = args.getPlayer();
|
||||
if (args.length() == 0){
|
||||
player.sendMessage(BauSystem.PREFIX + "/bau speed [Geschwindigkeit]");
|
||||
return;
|
||||
}
|
||||
|
||||
float speed;
|
||||
try{
|
||||
speed = Float.valueOf(args.getArgs(0));
|
||||
}catch(NumberFormatException e){
|
||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
|
||||
return;
|
||||
}
|
||||
if (speed < 0 || speed > 10) {
|
||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
|
||||
return;
|
||||
}
|
||||
|
||||
player.setFlySpeed(speed / 10);
|
||||
player.setWalkSpeed(speed / 10);
|
||||
player.sendMessage("§aGeschwindigkeit wurde auf §6" + speed + " §agesetzt");
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
BauWorld.removePlayer(p, target);
|
||||
}
|
||||
|
||||
/*@Command(name = "bau.gui", aliases = "gs.gui", inGameOnly = true)
|
||||
@ -195,201 +164,67 @@ public class CommandBau {
|
||||
return true;
|
||||
}*/
|
||||
|
||||
@Command(name = "bau.togglewe", aliases = "gs.togglewe", inGameOnly = true)
|
||||
public void onToggleWE(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau togglewe <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleWE(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.toggletp", aliases = "gs.toggletp", inGameOnly = true)
|
||||
public void onToggleTP(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau toggletp <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleTP(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.togglebuild", aliases = "gs.togglebuild", inGameOnly = true)
|
||||
public void onToggleBD(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau togglebuild <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
if(!toggleCheck(args, p, id)){
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleBuild(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.togglechgm", aliases = "gs.togglechgm", inGameOnly = true)
|
||||
public void onToggleCHG(CommandArgs args) {
|
||||
@Command(name = "bau.togglewe", aliases = "gs.togglewe", inGameOnly = true)
|
||||
public void onToggleWE(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau togglechgm <Spieler>");
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau togglewe <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
if(!toggleCheck(args, p, id)){
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleGM(p, target);
|
||||
BauWorld.toggleWE(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.toggletestblock", aliases = "gs.toggletestblock", inGameOnly = true)
|
||||
@Command(name = "bau.toggleworld", aliases = "gs.toggleworld", inGameOnly = true)
|
||||
public void onToggleTestblock(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau toggletestblock <Spieler>");
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau toggleworld <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
if(!toggleCheck(args, p, id)){
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleTestblock(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.togglereset", aliases = "gs.togglereset", inGameOnly = true)
|
||||
public void onTogglereset(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau togglereset <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleTestblock(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.togglereplace", aliases = "gs.togglereplace", inGameOnly = true)
|
||||
public void onToggleReplace(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}else if (args.length() == 0) {
|
||||
p.sendMessage(BauSystem.PREFIX + "/bau togglereplace <Spieler>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID id = WarkingUser.get(args.getArgs(0)).getUUID();
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
BauWorld.toggleTestblock(p, target);
|
||||
}
|
||||
|
||||
@Command(name = "bau.testblock", aliases = "gs.testblock", inGameOnly = true)
|
||||
@Command(name = "bau.testblock", aliases = {"gs.testblock", "testblock"}, inGameOnly = true)
|
||||
public void onTestblock(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(p.getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist auf keiner Bauwelt");
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.worldedit)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock erneuern");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!p.getUniqueId().equals(worldOwner)){
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
if(member == null || !member.isTestblock()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst den Testblock nicht erneuern");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Location playerLocation = p.getLocation();
|
||||
World playerWorld = p.getWorld();
|
||||
|
||||
@ -408,25 +243,16 @@ public class CommandBau {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(name = "bau.reset", aliases = "gs.reset", inGameOnly = true)
|
||||
@Command(name = "bau.reset", aliases = {"gs.reset", "reset"}, inGameOnly = true)
|
||||
public void onReset(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(p.getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist auf keiner Bauwelt");
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Regionen erneuern");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!p.getUniqueId().equals(worldOwner)){
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
if(member == null || !member.isTestblock()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst keine Regionen erneuern");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Location playerLocation = p.getLocation();
|
||||
World playerWorld = p.getWorld();
|
||||
|
||||
@ -459,22 +285,12 @@ public class CommandBau {
|
||||
@Command(name = "bau.replace", aliases = "gs.replace", inGameOnly = true)
|
||||
public void onReplace(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(p.getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist auf keiner Bauwelt");
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.worldedit)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht Obsidian und Grundgestein ersetzen");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!p.getUniqueId().equals(worldOwner)){
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
if(member == null || !member.isTestblock()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst nicht Obsidian & Grundgestein ersetzen");
|
||||
return;
|
||||
}
|
||||
}
|
||||
World world = p.getWorld();
|
||||
for(ProtectedRegion rg : BauSystem.getWorldGuard().getRegionManager(world).getApplicableRegions(p.getLocation())) {
|
||||
String rgID = rg.getId();
|
||||
@ -495,7 +311,7 @@ public class CommandBau {
|
||||
int slime = editSession.replaceBlocks(selection.getRegionSelector().getRegion(), targetBedrock, new BaseBlock(165));
|
||||
editSession.flushQueue();
|
||||
|
||||
p.sendMessage(BauSystem.PREFIX + "§aIn Region " + rgID + " wurden " + tnt + " Blöcke Obsidian zu TNT und " + slime + " Blöcke Grundgestein zu Schleim ersetzt");
|
||||
p.sendMessage(BauSystem.PREFIX + "§aEs wurden " + (tnt + slime) + " Obsidian und Grundgestein ersetzt");
|
||||
|
||||
} catch(Exception ex) { ex.printStackTrace(); }
|
||||
}
|
||||
@ -504,53 +320,109 @@ public class CommandBau {
|
||||
@Command(name = "bau.info", aliases = "gs.info", inGameOnly = true)
|
||||
public void onInfo(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
UUID worldOwner;
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(p.getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
if(worldOwner == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist auf keiner Bauwelt");
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(BauSystem.getInstance(), () -> {
|
||||
Bauwelt welt = Bauwelt.getBauwelt(worldOwner);
|
||||
|
||||
p.sendMessage(BauSystem.PREFIX + "ID§8: §6" + welt.getUserID());
|
||||
p.sendMessage(BauSystem.PREFIX + "Besitzer§8: §6" + WarkingUser.get(welt.getUserID()).getUserName());
|
||||
p.sendMessage("§6Besitzer§8: §6" + WarkingUser.get(welt.getUserID()).getUserName());
|
||||
|
||||
if(welt.isTNTDmg())
|
||||
p.sendMessage(BauSystem.PREFIX + "TNT-Schaden§8: §aerlaubt");
|
||||
p.sendMessage("§6TNT-Schaden§8: §aerlaubt");
|
||||
else
|
||||
p.sendMessage(BauSystem.PREFIX + "TNT-Schaden§8: §cverboten");
|
||||
p.sendMessage("§6TNT-Schaden§8: §cverboten");
|
||||
if(welt.isFireDmg())
|
||||
p.sendMessage(BauSystem.PREFIX + "Feuer-Schaden§8: §aerlaubt");
|
||||
p.sendMessage("§6Feuer-Schaden§8: §aerlaubt");
|
||||
else
|
||||
p.sendMessage(BauSystem.PREFIX + "Feuer-Schaden§8: §cverboten");
|
||||
p.sendMessage("§6Feuer-Schaden§8: §cverboten");
|
||||
|
||||
List<BauweltMember> memberList = BauweltMember.getMembers(worldOwner);
|
||||
if(!memberList.isEmpty()){
|
||||
StringBuilder members = new StringBuilder();
|
||||
members.append(BauSystem.PREFIX);
|
||||
members.append("Mitglieder§8: ");
|
||||
|
||||
for(BauweltMember member : memberList){
|
||||
members.append("§6");
|
||||
members.append(WarkingUser.get(member.getMemberID()).getUserName());
|
||||
members.append("§8, ");
|
||||
}
|
||||
p.sendMessage(members.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Command(name = "bau.tntdmg", aliases = "gs.tntdmg", inGameOnly = true)
|
||||
@Command(name = "bau.tntdmg", aliases = {"gs.tntdmg", "bau.tnt", "gs.tnt", "tnt"}, inGameOnly = true)
|
||||
public void onTntdmg(CommandArgs args){
|
||||
BauWorld.switchTNT(args.getPlayer());
|
||||
}
|
||||
|
||||
@Command(name = "bau.firedmg", aliases = "gs.firedmg", inGameOnly = true)
|
||||
@Command(name = "bau.firedmg", aliases = {"gs.firedmg", "bau.fire", "gs.fire", "fire"}, inGameOnly = true)
|
||||
public void onFiredmg(CommandArgs args) {
|
||||
BauWorld.switchFire(args.getPlayer());
|
||||
}
|
||||
|
||||
@Command(name = "bau.speed", aliases = {"gs.speed", "speed"}, inGameOnly = true)
|
||||
public void onSpeed(CommandArgs args){
|
||||
final Player player = args.getPlayer();
|
||||
if (args.length() == 0){
|
||||
player.sendMessage(BauSystem.PREFIX + "/speed [Geschwindigkeit]");
|
||||
return;
|
||||
}
|
||||
|
||||
float speed;
|
||||
try{
|
||||
speed = Float.valueOf(args.getArgs(0));
|
||||
}catch(NumberFormatException e){
|
||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
|
||||
return;
|
||||
}
|
||||
if (speed < 0 || speed > 10) {
|
||||
player.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 10 an");
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage("§aGeschwindigkeit wurde auf §6" + speed + " §agesetzt");
|
||||
if(speed == 1.0f){
|
||||
speed = 1.25f;
|
||||
}
|
||||
player.setFlySpeed(speed / 10);
|
||||
player.setWalkSpeed(speed / 10);
|
||||
|
||||
}
|
||||
|
||||
@Command(name = "bau.time", inGameOnly = true)
|
||||
public void onTime(CommandArgs args){
|
||||
Player p = args.getPlayer();
|
||||
if(args.length() == 0){
|
||||
p.sendMessage(BauSystem.PREFIX + "/time <Zeit 0=Morgen, 6000=Mittag, 18000=Mitternacht>");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Zeit ändern");
|
||||
return;
|
||||
}
|
||||
|
||||
int time;
|
||||
try{
|
||||
time = Integer.valueOf(args.getArgs(0));
|
||||
}catch(NumberFormatException e){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 24000 an");
|
||||
return;
|
||||
}
|
||||
if (time < 0 || time > 24000) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cBitte gib eine Zahl zwischen 0 und 24000 an");
|
||||
return;
|
||||
}
|
||||
|
||||
p.getWorld().setTime(time);
|
||||
}
|
||||
|
||||
private void pasteSchematic(Player player, File schematic, Vector position) {
|
||||
|
||||
int count = 0;
|
||||
@ -588,4 +460,31 @@ public class CommandBau {
|
||||
dir.delete();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasWorld(Player p){
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast keine Bauwelt");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean toggleCheck(CommandArgs args, Player p, UUID id){
|
||||
if (!hasWorld(p)) {
|
||||
//p.sendMessage(BauSystem.PREFIX + "§cDu hast noch keine Bauwelt");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return false;
|
||||
}
|
||||
|
||||
BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
if (target == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class CommandGamemode extends BukkitCommand {
|
||||
}
|
||||
return true;
|
||||
}else if(args.length > 1){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst nicht den Spielmodus anderer Spieler ändern.");
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst den Spielmodus anderer Spieler nicht ändern");
|
||||
return false;
|
||||
}else{
|
||||
UUID worldOwner;
|
||||
@ -74,14 +74,14 @@ public class CommandGamemode extends BukkitCommand {
|
||||
try{
|
||||
worldOwner = UUID.fromString(p.getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu befindest dich auf keiner Bauwelt!");
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu befindest dich auf keiner Bauwelt");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!p.getUniqueId().equals(worldOwner)){
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
if(member == null || !member.isChangeGM()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier deinen Spielmodus nicht ändern.");
|
||||
if(member == null || !member.isBuild()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier deinen Spielmodus nicht ändern");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class CommandGamemode extends BukkitCommand {
|
||||
GameMode mode = createMode(args[0]);
|
||||
|
||||
if(mode == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spielmodus.");
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spielmodus");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class CommandTeleport extends BukkitCommand {
|
||||
|
||||
if(!worldOwner.equals(p.getUniqueId())){
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
if(member == null || !member.isTeleport()){
|
||||
if(member == null || !member.isBuild()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst dich auf dieser Welt nicht teleportieren!");
|
||||
return false;
|
||||
}
|
||||
|
@ -3,8 +3,9 @@ package de.warking.bausystem.commands;
|
||||
import de.pro_crafting.commandframework.Command;
|
||||
import de.pro_crafting.commandframework.CommandArgs;
|
||||
import de.warking.bausystem.BauSystem;
|
||||
import de.warking.bausystem.world.BauWorld;
|
||||
import de.warking.bausystem.world.Permission;
|
||||
import de.warking.bausystem.world.TNTTracer;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -23,73 +24,70 @@ public class CommandTrace {
|
||||
@Command(name = "trace.start", inGameOnly = true)
|
||||
public void onStart(CommandArgs args){
|
||||
Player p = args.getPlayer();
|
||||
if(checkPerm(p)){
|
||||
UUID id = BauWorld.getWorldUUID(p.getWorld());
|
||||
if(!BauWorld.hasPermission(id, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||
return;
|
||||
}
|
||||
|
||||
TNTTracer.newTracer(p.getWorld());
|
||||
p.sendMessage(BauSystem.PREFIX + "§aAufnahme gestartet");
|
||||
}
|
||||
}
|
||||
|
||||
@Command(name = "trace.stop", inGameOnly = true)
|
||||
public void onStop(CommandArgs args){
|
||||
Player p = args.getPlayer();
|
||||
if(checkPerm(p)){
|
||||
UUID id = BauWorld.getWorldUUID(p.getWorld());
|
||||
if(!BauWorld.hasPermission(id, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||
return;
|
||||
}
|
||||
|
||||
TNTTracer t = TNTTracer.get(p.getWorld());
|
||||
if(t == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cKein laufender TNT-Tracer");
|
||||
return;
|
||||
}
|
||||
|
||||
t.end();
|
||||
p.sendMessage(BauSystem.PREFIX + "§aAufnahme abgebrochen");
|
||||
}
|
||||
}
|
||||
|
||||
@Command(name = "trace.show", inGameOnly = true)
|
||||
public void onShow(CommandArgs args){
|
||||
Player p = args.getPlayer();
|
||||
if(checkPerm(p)){
|
||||
UUID id = BauWorld.getWorldUUID(p.getWorld());
|
||||
if(!BauWorld.hasPermission(id, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||
return;
|
||||
}
|
||||
|
||||
TNTTracer t = TNTTracer.get(p.getWorld());
|
||||
if(t == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cKein laufender TNT-Tracer");
|
||||
return;
|
||||
}
|
||||
|
||||
t.show();
|
||||
p.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen angezeigt");
|
||||
}
|
||||
}
|
||||
|
||||
@Command(name = "trace.hide", inGameOnly = true)
|
||||
public void onHide(CommandArgs args){
|
||||
Player p = args.getPlayer();
|
||||
if(checkPerm(p)){
|
||||
UUID id = BauWorld.getWorldUUID(p.getWorld());
|
||||
if(!BauWorld.hasPermission(id, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||
return;
|
||||
}
|
||||
|
||||
TNTTracer t = TNTTracer.get(p.getWorld());
|
||||
if(t == null){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cKein laufender TNT-Tracer");
|
||||
return;
|
||||
}
|
||||
|
||||
t.hide();
|
||||
p.sendMessage(BauSystem.PREFIX + "§aTNT-Positionen versteckt");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPerm(Player p){
|
||||
UUID id;
|
||||
try{
|
||||
id = UUID.fromString(p.getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu bist auf keiner Bauwelt");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(p.getUniqueId().equals(id)){
|
||||
return true;
|
||||
}else{
|
||||
BauweltMember member = BauweltMember.getBauMember(id, p.getUniqueId());
|
||||
if(member == null || member.isTestblock()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den TNT-Tracer nutzen");
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ public class BauWorld {
|
||||
|
||||
if(!Bukkit.unloadWorld(world, true))
|
||||
System.out.println("Unloading world failed!");
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,30 +59,67 @@ public class BauWorld {
|
||||
return Bukkit.getWorld(owner.toString());
|
||||
}
|
||||
|
||||
public static boolean hasPermission(UUID owner, Player member, Permission perm){
|
||||
if(owner == null)
|
||||
return false;
|
||||
if(member.hasPermission("bau.team") || member.getUniqueId().equals(owner))
|
||||
return true;
|
||||
|
||||
BauweltMember member1 = BauweltMember.getBauMember(owner, member.getUniqueId());
|
||||
if(member1 == null)
|
||||
return false;
|
||||
|
||||
switch(perm){
|
||||
case build:
|
||||
return member1.isBuild();
|
||||
case worldedit:
|
||||
return member1.isWorldEdit();
|
||||
case world:
|
||||
return member1.isTestblock();
|
||||
case member:
|
||||
return true;
|
||||
case owner:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static UUID getWorldUUID(World w){
|
||||
try{
|
||||
return UUID.fromString(w.getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void switchTNT(Player p){
|
||||
Bauwelt welt = Bauwelt.getBauwelt(p.getUniqueId());
|
||||
if (welt.getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast noch keine Welt");
|
||||
UUID worldOwner = getWorldUUID(p.getWorld());
|
||||
if (!hasPermission(worldOwner, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht TNT-Schaden (de)aktivieren");
|
||||
return;
|
||||
}
|
||||
|
||||
Bauwelt welt = Bauwelt.getBauwelt(worldOwner);
|
||||
welt.setTNTDmg(!welt.isTNTDmg());
|
||||
if (welt.isTNTDmg())
|
||||
p.sendMessage(BauSystem.PREFIX + "§aTNT-Schaden erlaubt");
|
||||
broadcast(worldOwner, BauSystem.PREFIX + "§aTNT-Schaden erlaubt");
|
||||
else
|
||||
p.sendMessage(BauSystem.PREFIX + "§cTNT-Schaden verboten");
|
||||
broadcast(worldOwner, BauSystem.PREFIX + "§cTNT-Schaden verboten");
|
||||
}
|
||||
|
||||
public static void switchFire(Player p){
|
||||
Bauwelt welt = Bauwelt.getBauwelt(p.getUniqueId());
|
||||
if (welt.getUUID() == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu hast noch keine Welt");
|
||||
UUID worldOwner = getWorldUUID(p.getWorld());
|
||||
if (!hasPermission(worldOwner, p, Permission.world)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht Feuerschaden (de)aktivieren");
|
||||
return;
|
||||
}
|
||||
|
||||
Bauwelt welt = Bauwelt.getBauwelt(worldOwner);
|
||||
welt.setFireDmg(!welt.isFireDmg());
|
||||
if (welt.isFireDmg())
|
||||
p.sendMessage(BauSystem.PREFIX + "§aFeuer-Schaden erlaubt");
|
||||
broadcast(worldOwner, BauSystem.PREFIX + "§aFeuer-Schaden erlaubt");
|
||||
else
|
||||
p.sendMessage(BauSystem.PREFIX + "§cFeuer-Schaden verboten");
|
||||
broadcast(worldOwner, BauSystem.PREFIX + "§cFeuer-Schaden verboten");
|
||||
}
|
||||
|
||||
public static void toggleBuild(Player p, BauweltMember target){
|
||||
@ -118,74 +156,33 @@ public class BauWorld {
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggleTP(Player p, BauweltMember target){
|
||||
target.setTeleport(!target.isTeleport());
|
||||
Player z = Bukkit.getPlayer(WarkingUser.get(target.getMemberID()).getUUID());
|
||||
if (z != null) {
|
||||
if (target.isTeleport()) {
|
||||
z.sendMessage(BauSystem.PREFIX + "§aDu kannst dich nun auf der Welt von §6" + p.getName() + "§a teleportieren");
|
||||
}else {
|
||||
z.sendMessage(BauSystem.PREFIX + "§cDu kannst dich nun nicht mehr auf der Welt von §6" + p.getName() + "§c teleportieren");
|
||||
}
|
||||
}
|
||||
if (target.isTeleport()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§aDer Spieler darf sich nun teleportieren");
|
||||
} else {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler darf sich nun nicht mehr teleportieren");
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggleGM(Player p, BauweltMember target){
|
||||
target.setChangeGM(!target.isChangeGM());
|
||||
Player z = Bukkit.getPlayer(WarkingUser.get(target.getMemberID()).getUUID());
|
||||
if (z != null) {
|
||||
if (target.isChangeGM()) {
|
||||
z.sendMessage(BauSystem.PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a den Spielmodus wechseln");
|
||||
}else {
|
||||
z.sendMessage(BauSystem.PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c den Spielmodus wechseln");
|
||||
}
|
||||
}
|
||||
if (target.isChangeGM()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§aDer Spieler darf nun den Spielmodus wechseln");
|
||||
} else {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler darf nun nicht mehr den Spielmodus wechseln");
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggleTestblock(Player p, BauweltMember target){
|
||||
target.setTestblock(!target.isTestblock());
|
||||
Player z = Bukkit.getPlayer(WarkingUser.get(target.getMemberID()).getUUID());
|
||||
if (z != null) {
|
||||
if (target.isTestblock()) {
|
||||
z.sendMessage(BauSystem.PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a den Testblock zurücksetzen");
|
||||
z.sendMessage(BauSystem.PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a Einstellungen vornehmen");
|
||||
}else {
|
||||
z.sendMessage(BauSystem.PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c den Testblock zurücksetzen");
|
||||
z.sendMessage(BauSystem.PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c Einstellungen vornehmen");
|
||||
}
|
||||
}
|
||||
if (target.isTestblock()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§aDer Spieler darf nun den Testblock zurücksetzen");
|
||||
p.sendMessage(BauSystem.PREFIX + "§aDer Spieler darf nun Einstellungen vornehmen");
|
||||
} else {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler darf nun nicht mehr den Testblock zurücksetzen");
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler darf nun nicht mehr Einstellungen vornehmen");
|
||||
}
|
||||
}
|
||||
|
||||
public static void removePlayer(Player p, UUID id){
|
||||
if (id == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}else if (BauweltMember.getBauMember(p.getUniqueId(), id) == null) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDieser Spieler ist kein Mitglied auf deiner Welt");
|
||||
return;
|
||||
}
|
||||
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).remove();
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler wurde entfernt");
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
public static void removePlayer(Player p, BauweltMember target){
|
||||
target.remove();
|
||||
Player z = Bukkit.getPlayer(WarkingUser.get(target.getMemberID()).getUUID());
|
||||
if(z != null){
|
||||
z.sendMessage(BauSystem.PREFIX + "§cDu wurdest von der Welt von §6" + p.getName() + " §centfernt");
|
||||
if (z.getWorld().getName().equals(p.getUniqueId().toString())) {
|
||||
z.teleport(BauSystem.getInstance().config.spawn);
|
||||
z.setGameMode(GameMode.ADVENTURE);
|
||||
}
|
||||
}
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDer Spieler wurde entfernt");
|
||||
}
|
||||
}
|
||||
|
9
src/de/warking/bausystem/world/Permission.java
Normale Datei
9
src/de/warking/bausystem/world/Permission.java
Normale Datei
@ -0,0 +1,9 @@
|
||||
package de.warking.bausystem.world;
|
||||
|
||||
public enum Permission {
|
||||
world,
|
||||
worldedit,
|
||||
build,
|
||||
member,
|
||||
owner
|
||||
}
|
@ -4,7 +4,6 @@ package de.warking.bausystem.world;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import de.warking.bausystem.BauSystem;
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -13,6 +12,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -31,23 +31,10 @@ public class RegionListener implements Listener {
|
||||
return;
|
||||
|
||||
Player p = e.getPlayer();
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(e.getPlayer().getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein Worldedit benutzen.");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p.hasPermission("bau.team") || p.getUniqueId().equals(worldOwner))
|
||||
return;
|
||||
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
|
||||
if(member == null || !member.isWorldEdit()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein Worldedit benutzen.");
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.worldedit)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier kein WorldEdit benutzen");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -55,22 +42,9 @@ public class RegionListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(e.getPlayer().getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p.hasPermission("bau.team") || p.getUniqueId().equals(worldOwner))
|
||||
return;
|
||||
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
|
||||
if (member == null || !member.isBuild()) {
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht bauen.");
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.build)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke abbauen");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -78,22 +52,9 @@ public class RegionListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(e.getPlayer().getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p.hasPermission("bau.team") || p.getUniqueId().equals(worldOwner))
|
||||
return;
|
||||
|
||||
BauweltMember member = BauweltMember.getBauMember(worldOwner, p.getUniqueId());
|
||||
|
||||
if(member == null || !member.isBuild()){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht bauen.");
|
||||
UUID worldOwner = BauWorld.getWorldUUID(p.getWorld());
|
||||
if (!BauWorld.hasPermission(worldOwner, p, Permission.build)){
|
||||
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -109,14 +70,7 @@ public class RegionListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(e.getLocation().getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
UUID worldOwner = BauWorld.getWorldUUID(e.getLocation().getWorld());
|
||||
|
||||
if(worldOwner == null || !Bauwelt.getBauwelt(worldOwner).isTNTDmg())
|
||||
e.setCancelled(true);
|
||||
@ -124,17 +78,17 @@ public class RegionListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onFireDamage(BlockBurnEvent e) {
|
||||
UUID worldOwner;
|
||||
|
||||
try{
|
||||
worldOwner = UUID.fromString(e.getBlock().getWorld().getName());
|
||||
}catch(IllegalArgumentException E){
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
UUID worldOwner = BauWorld.getWorldUUID(e.getBlock().getWorld());
|
||||
|
||||
if(worldOwner == null || !Bauwelt.getBauwelt(worldOwner).isFireDmg())
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFireSpread(BlockSpreadEvent e){
|
||||
UUID worldOwner = BauWorld.getWorldUUID(e.getBlock().getWorld());
|
||||
|
||||
if(worldOwner == null || Bauwelt.getBauwelt(worldOwner) == null || !Bauwelt.getBauwelt(worldOwner).isFireDmg())
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ public class TNTTracer implements Listener, Runnable {
|
||||
@EventHandler
|
||||
public void onUnloadWorld(WorldUnloadEvent e){
|
||||
if(e.getWorld().equals(world)){
|
||||
printed = false;
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren