code cleanup
Signed-off-by: yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
5c3890d438
Commit
6218235875
@ -78,13 +78,20 @@ public class SchematicCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("load")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
|
||||
if(schematic == null)
|
||||
schematic = Schematic.getSchemFromDB(args[1], 0); //public schematic
|
||||
|
||||
if (schematic != null) {
|
||||
if (schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
Actor actor = SchematicSystem.getWorldEditPlugin().wrapCommandSender(player);
|
||||
@ -106,23 +113,24 @@ public class SchematicCommand implements CommandExecutor {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("delete")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cZum Löschen musst du der Owner der Schematic sein!");
|
||||
return false;
|
||||
}
|
||||
|
||||
TextComponent message = new TextComponent("§6Möchtest du die Schematic wirklich löschen?");
|
||||
message.setBold(true);
|
||||
@ -136,25 +144,25 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.spigot().sendMessage(message);
|
||||
player.spigot().sendMessage(ja);
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cZum Löschen musst du der Owner der Schematic sein!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("savedelete")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cZum Löschen musst du der Owner der Schematic sein!");
|
||||
return false;
|
||||
}
|
||||
|
||||
File file = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/" + args[1] + ".schematic");
|
||||
file.delete();
|
||||
schematic.remove();
|
||||
@ -168,25 +176,21 @@ public class SchematicCommand implements CommandExecutor {
|
||||
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gelöscht.");
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cZum Löschen musst du der Owner der Schematic sein!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("save")) {
|
||||
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if(FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard() != null) {
|
||||
if(FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard() == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(schematic.getSchemType() != SchematicType.normal) {
|
||||
@ -229,21 +233,21 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gespeichert!");
|
||||
}
|
||||
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer!");
|
||||
return false;
|
||||
}
|
||||
} catch (IOException ex) { ex.printStackTrace(); } catch (EmptyClipboardException ex) { ex.printStackTrace(); }
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("getschemchangetype")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
TextComponent normal = new TextComponent("§7[§anormal§7]");
|
||||
normal.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " normal"));
|
||||
|
||||
@ -264,20 +268,20 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.spigot().sendMessage(miniwargear);
|
||||
player.spigot().sendMessage(airship);
|
||||
player.spigot().sendMessage(warship);
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("getmoreinfo")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
||||
if(checkedSchematic.getSchemName().equals(schematic.getSchemName()) &&
|
||||
@ -288,27 +292,27 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.sendMessage("§bGrund: " + checkedSchematic.getDeclineReason());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
case 3:
|
||||
if(args[0].equalsIgnoreCase("info")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
WarkingUser warkingUser = WarkingUser.get(Integer.valueOf(args[2]));
|
||||
if(warkingUser.getUUID() == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Benutzer hat keine Schematic mit diesem Namen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], warkingUser.getId());
|
||||
if(schematic != null) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.sendMessage("§6Name: §7" + schematic.getSchemName());
|
||||
|
||||
@ -360,14 +364,6 @@ public class SchematicCommand implements CommandExecutor {
|
||||
player.spigot().sendMessage(deleteSchematic);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("list")) {
|
||||
@ -385,7 +381,11 @@ public class SchematicCommand implements CommandExecutor {
|
||||
|
||||
if(args[0].equalsIgnoreCase("changetype")) {
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Clipboard clipboard;
|
||||
try {
|
||||
clipboard = FaweAPI.load(new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/" + args[1] + ".schematic")).getClipboard();
|
||||
@ -481,17 +481,21 @@ public class SchematicCommand implements CommandExecutor {
|
||||
}
|
||||
player.sendMessage("§8/schem changetype <Name> <airship/warship/miniwargear/wargear/normal>");
|
||||
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("addmember")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(schematic.getSchemOwner() != WarkingUser.get(player.getUniqueId()).getId()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDafür musst du der Owner der Schematic sein!");
|
||||
return false;
|
||||
@ -521,29 +525,40 @@ public class SchematicCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("delmember")) {
|
||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||
if(schematic != null) {
|
||||
if(schematic == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(schematic.getSchemOwner() != WarkingUser.get(player.getUniqueId()).getId()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDafür musst du der Owner der Schematic sein!");
|
||||
return false;
|
||||
} else {
|
||||
WarkingUser warkingUser = WarkingUser.get(args[2]);
|
||||
if(warkingUser.getUUID() != null) {
|
||||
if(schematic.getSchemOwner() != warkingUser.getId()) {
|
||||
if(warkingUser.getUUID() == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(schematic.getSchemOwner() == warkingUser.getId()) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst dich nicht von deiner eigenen Schematic removen!");
|
||||
return false;
|
||||
}
|
||||
|
||||
SchematicMember schematicMember = SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), WarkingUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID());
|
||||
if(schematicMember != null) {
|
||||
if(schematicMember == null) {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist nicht auf die Schematic geaddet!");
|
||||
return false;
|
||||
}
|
||||
|
||||
schematicMember.remove();
|
||||
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §6" + warkingUser.getUserName() + " §7hat keinen Zugriff mehr auf die Schematic §6" + schematic.getSchemName() + "§7.");
|
||||
@ -552,27 +567,6 @@ public class SchematicCommand implements CommandExecutor {
|
||||
if(target != null)
|
||||
target.sendMessage(SchematicSystem.PREFIX + "Du hast keinen Zugriff mehr auf die Schematic §6" + schematic.getSchemName() + "§7von §6" + WarkingUser.get(schematic.getSchemOwner()).getUserName() + "§7.");
|
||||
return false;
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist nicht auf die Schematic geaddet!");
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst dich nicht von deiner eigenen Schematic removen!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren