code cleanup
Signed-off-by: yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
5c3890d438
Commit
6218235875
@ -78,296 +78,292 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("load")) {
|
if(args[0].equalsIgnoreCase("load")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(schematic == null)
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
schematic = Schematic.getSchemFromDB(args[1], 0); //public schematic
|
|
||||||
|
|
||||||
if (schematic != null) {
|
if(schematic == null)
|
||||||
|
schematic = Schematic.getSchemFromDB(args[1], 0); //public schematic
|
||||||
|
|
||||||
try {
|
if (schematic == null) {
|
||||||
Actor actor = SchematicSystem.getWorldEditPlugin().wrapCommandSender(player);
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
File folder = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId().toString() + "/");
|
try {
|
||||||
if(!folder.exists()) {
|
Actor actor = SchematicSystem.getWorldEditPlugin().wrapCommandSender(player);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
File file;
|
|
||||||
|
|
||||||
if(WarkingUser.get(schematic.getSchemOwner()).getUUID() != player.getUniqueId()) {
|
File folder = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId().toString() + "/");
|
||||||
file = new File(SchematicSystem.SCHEM_DIR + WarkingUser.get(schematic.getSchemOwner()).getUUID() + "/", args[1] + ".schematic");
|
if(!folder.exists()) {
|
||||||
} else {
|
|
||||||
file = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/", args[1] + ".schematic");
|
|
||||||
}
|
|
||||||
SchematicSystem.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(FaweAPI.load(file).getClipboard(), FaweAPI.getWorld(player.getWorld().getName()).getWorldData()));
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7geladen.");
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDie angegebene Schematic existiert nicht!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
File file;
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
|
||||||
return false;
|
if(WarkingUser.get(schematic.getSchemOwner()).getUUID() != player.getUniqueId()) {
|
||||||
|
file = new File(SchematicSystem.SCHEM_DIR + WarkingUser.get(schematic.getSchemOwner()).getUUID() + "/", args[1] + ".schematic");
|
||||||
|
} else {
|
||||||
|
file = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/", args[1] + ".schematic");
|
||||||
|
}
|
||||||
|
SchematicSystem.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(FaweAPI.load(file).getClipboard(), FaweAPI.getWorld(player.getWorld().getName()).getWorldData()));
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7geladen.");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("delete")) {
|
if(args[0].equalsIgnoreCase("delete")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
|
||||||
if(schematic != null) {
|
|
||||||
if(WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
|
||||||
|
|
||||||
TextComponent message = new TextComponent("§6Möchtest du die Schematic wirklich löschen?");
|
|
||||||
message.setBold(true);
|
|
||||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Wähle eine Option...").create()));
|
|
||||||
|
|
||||||
TextComponent ja = new TextComponent("§aja");
|
|
||||||
ja.setBold(true);
|
|
||||||
ja.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§4Schematic löschen...").create()));
|
|
||||||
ja.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem savedelete " + args[1]));
|
|
||||||
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Schematic schematic = Schematic.getSchemFromDB(args[1], 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);
|
||||||
|
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Wähle eine Option...").create()));
|
||||||
|
|
||||||
|
TextComponent ja = new TextComponent("§aja");
|
||||||
|
ja.setBold(true);
|
||||||
|
ja.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§4Schematic löschen...").create()));
|
||||||
|
ja.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem savedelete " + args[1]));
|
||||||
|
|
||||||
|
player.spigot().sendMessage(message);
|
||||||
|
player.spigot().sendMessage(ja);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("savedelete")) {
|
if(args[0].equalsIgnoreCase("savedelete")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
|
||||||
if(schematic != null) {
|
|
||||||
if(WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
|
||||||
File file = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/" + args[1] + ".schematic");
|
|
||||||
file.delete();
|
|
||||||
schematic.remove();
|
|
||||||
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
|
||||||
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
|
||||||
if(checkedSchematic.getSchemOwner() == schematic.getSchemOwner() &&
|
|
||||||
checkedSchematic.getSchemName() == schematic.getSchemName())
|
|
||||||
checkedSchematic.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Schematic schematic = Schematic.getSchemFromDB(args[1], 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();
|
||||||
|
|
||||||
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||||
|
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
||||||
|
if(checkedSchematic.getSchemOwner() == schematic.getSchemOwner() &&
|
||||||
|
checkedSchematic.getSchemName() == schematic.getSchemName())
|
||||||
|
checkedSchematic.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gelöscht.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("save")) {
|
if(args[0].equalsIgnoreCase("save")) {
|
||||||
|
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
try {
|
|
||||||
if(FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard() != null) {
|
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
|
||||||
if(schematic != null) {
|
|
||||||
if(schematic.getSchemType() != SchematicType.normal) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diesen Schematic Typ nicht überschreiben!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File folder = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId().toString() + "/");
|
|
||||||
if(!folder.exists()) {
|
|
||||||
folder.mkdir();
|
|
||||||
Files.setPosixFilePermissions(folder.toPath(),
|
|
||||||
EnumSet.of(PosixFilePermission.OWNER_READ,
|
|
||||||
PosixFilePermission.OWNER_WRITE,
|
|
||||||
PosixFilePermission.GROUP_READ,
|
|
||||||
PosixFilePermission.OTHERS_READ,
|
|
||||||
PosixFilePermission.OTHERS_WRITE,
|
|
||||||
PosixFilePermission.OWNER_EXECUTE,
|
|
||||||
PosixFilePermission.OTHERS_EXECUTE));
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(folder, args[1] + ".schematic");
|
|
||||||
file.createNewFile();
|
|
||||||
Files.setPosixFilePermissions(file.toPath(),
|
|
||||||
EnumSet.of(PosixFilePermission.OWNER_READ,
|
|
||||||
PosixFilePermission.OWNER_WRITE,
|
|
||||||
PosixFilePermission.GROUP_READ,
|
|
||||||
PosixFilePermission.OTHERS_READ,
|
|
||||||
PosixFilePermission.OTHERS_WRITE));
|
|
||||||
|
|
||||||
ClipboardFormat.SCHEMATIC.getWriter(new FileOutputStream(file)).write(
|
|
||||||
FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard(),
|
|
||||||
FaweAPI.wrapPlayer(player).getSession().getClipboard().getWorldData());
|
|
||||||
|
|
||||||
|
|
||||||
if(schematic != null && schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7überschrieben!");
|
|
||||||
} else {
|
|
||||||
Schematic newSchematic = new Schematic(args[1], player.getUniqueId(), "", SchematicType.normal);
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
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) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diesen Schematic Typ nicht überschreiben!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
File folder = new File(SchematicSystem.SCHEM_DIR + player.getUniqueId().toString() + "/");
|
||||||
|
if(!folder.exists()) {
|
||||||
|
folder.mkdir();
|
||||||
|
Files.setPosixFilePermissions(folder.toPath(),
|
||||||
|
EnumSet.of(PosixFilePermission.OWNER_READ,
|
||||||
|
PosixFilePermission.OWNER_WRITE,
|
||||||
|
PosixFilePermission.GROUP_READ,
|
||||||
|
PosixFilePermission.OTHERS_READ,
|
||||||
|
PosixFilePermission.OTHERS_WRITE,
|
||||||
|
PosixFilePermission.OWNER_EXECUTE,
|
||||||
|
PosixFilePermission.OTHERS_EXECUTE));
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(folder, args[1] + ".schematic");
|
||||||
|
file.createNewFile();
|
||||||
|
Files.setPosixFilePermissions(file.toPath(),
|
||||||
|
EnumSet.of(PosixFilePermission.OWNER_READ,
|
||||||
|
PosixFilePermission.OWNER_WRITE,
|
||||||
|
PosixFilePermission.GROUP_READ,
|
||||||
|
PosixFilePermission.OTHERS_READ,
|
||||||
|
PosixFilePermission.OTHERS_WRITE));
|
||||||
|
|
||||||
|
ClipboardFormat.SCHEMATIC.getWriter(new FileOutputStream(file)).write(
|
||||||
|
FaweAPI.wrapPlayer(player).getSession().getClipboard().getClipboard(),
|
||||||
|
FaweAPI.wrapPlayer(player).getSession().getClipboard().getWorldData());
|
||||||
|
|
||||||
|
|
||||||
|
if(schematic != null && schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7überschrieben!");
|
||||||
|
} else {
|
||||||
|
Schematic newSchematic = new Schematic(args[1], player.getUniqueId(), "", SchematicType.normal);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7gespeichert!");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException ex) { ex.printStackTrace(); } catch (EmptyClipboardException ex) { ex.printStackTrace(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("getschemchangetype")) {
|
if(args[0].equalsIgnoreCase("getschemchangetype")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
|
||||||
if(schematic != null) {
|
|
||||||
TextComponent normal = new TextComponent("§7[§anormal§7]");
|
|
||||||
normal.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " normal"));
|
|
||||||
|
|
||||||
TextComponent wargear = new TextComponent("§7[§awargear§7]");
|
|
||||||
wargear.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " wargear"));
|
|
||||||
|
|
||||||
TextComponent miniwargear = new TextComponent("§7[§aminiwargear§7]");
|
|
||||||
miniwargear.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " miniwargear"));
|
|
||||||
|
|
||||||
TextComponent airship = new TextComponent("§7[§aairship§7]");
|
|
||||||
airship.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " airship"));
|
|
||||||
|
|
||||||
TextComponent warship = new TextComponent("§7[§awarship§7]");
|
|
||||||
warship.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " warship"));
|
|
||||||
|
|
||||||
player.spigot().sendMessage(normal);
|
|
||||||
player.spigot().sendMessage(wargear);
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
|
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"));
|
||||||
|
|
||||||
|
TextComponent wargear = new TextComponent("§7[§awargear§7]");
|
||||||
|
wargear.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " wargear"));
|
||||||
|
|
||||||
|
TextComponent miniwargear = new TextComponent("§7[§aminiwargear§7]");
|
||||||
|
miniwargear.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " miniwargear"));
|
||||||
|
|
||||||
|
TextComponent airship = new TextComponent("§7[§aairship§7]");
|
||||||
|
airship.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " airship"));
|
||||||
|
|
||||||
|
TextComponent warship = new TextComponent("§7[§awarship§7]");
|
||||||
|
warship.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + schematic.getSchemName() + " warship"));
|
||||||
|
|
||||||
|
player.spigot().sendMessage(normal);
|
||||||
|
player.spigot().sendMessage(wargear);
|
||||||
|
player.spigot().sendMessage(miniwargear);
|
||||||
|
player.spigot().sendMessage(airship);
|
||||||
|
player.spigot().sendMessage(warship);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("getmoreinfo")) {
|
if(args[0].equalsIgnoreCase("getmoreinfo")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
|
||||||
if(schematic != null) {
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
|
||||||
for(CheckedSchematic checkedSchematic : checkedSchematics) {
|
|
||||||
if(checkedSchematic.getSchemName().equals(schematic.getSchemName()) &&
|
|
||||||
checkedSchematic.getSchemOwner() == schematic.getSchemOwner()) {
|
|
||||||
player.sendMessage("§bStart: " + checkedSchematic.getStartTime());
|
|
||||||
player.sendMessage("§bEnde: " + checkedSchematic.getEndTime());
|
|
||||||
player.sendMessage("§bPrüfer: " + WarkingUser.get(checkedSchematic.getValidator()).getUserName());
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
|
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()) &&
|
||||||
|
checkedSchematic.getSchemOwner() == schematic.getSchemOwner()) {
|
||||||
|
player.sendMessage("§bStart: " + checkedSchematic.getStartTime());
|
||||||
|
player.sendMessage("§bEnde: " + checkedSchematic.getEndTime());
|
||||||
|
player.sendMessage("§bPrüfer: " + WarkingUser.get(checkedSchematic.getValidator()).getUserName());
|
||||||
|
player.sendMessage("§bGrund: " + checkedSchematic.getDeclineReason());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if(args[0].equalsIgnoreCase("info")) {
|
if(args[0].equalsIgnoreCase("info")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
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) {
|
|
||||||
|
|
||||||
player.sendMessage("§6Name: §7" + schematic.getSchemName());
|
|
||||||
|
|
||||||
if(schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) {
|
|
||||||
TextComponent typ = new TextComponent("§6Typ: §7" + schematic.getSchemType().name());
|
|
||||||
typ.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Typ ändern").create()));
|
|
||||||
typ.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem getschemchangetype " + schematic.getSchemName()));
|
|
||||||
player.spigot().sendMessage(typ);
|
|
||||||
} else
|
|
||||||
player.sendMessage("§6Typ: §7" + schematic.getSchemType().name());
|
|
||||||
|
|
||||||
if(schematic.getSchemType() == SchematicType.normal) {
|
|
||||||
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
|
||||||
for(int i = checkedSchematics.size() -1; i > 0; i--) {
|
|
||||||
if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) &&
|
|
||||||
checkedSchematics.get(i).getSchemOwner() == schematic.getSchemOwner()) {
|
|
||||||
player.sendMessage("§cStatus: §c" + checkedSchematics.get(i).getStartTime() + " : " + checkedSchematics.get(i).getDeclineReason());
|
|
||||||
TextComponent mehr = new TextComponent("§9mehr...");
|
|
||||||
mehr.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem getmoreinfo " + schematic.getSchemName()));
|
|
||||||
player.spigot().sendMessage(mehr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
|
||||||
player.sendMessage("§6Owner: §7" + WarkingUser.get(schematic.getSchemOwner()).getUserName());
|
|
||||||
} else {
|
|
||||||
|
|
||||||
List<String> schematicMembers = new ArrayList<>();
|
|
||||||
for(SchematicMember schematicMember : SchematicMember.getSchemMembers(schematic.getSchemName(), schematic.getSchemOwner())) {
|
|
||||||
schematicMembers.add(WarkingUser.get(schematicMember.getMember()).getUserName());
|
|
||||||
}
|
|
||||||
if(schematicMembers.size() <= 3) {
|
|
||||||
player.sendMessage("§6Member: §7" + schematicMembers.toString());
|
|
||||||
} else
|
|
||||||
player.sendMessage("§6Member: §7...");
|
|
||||||
}
|
|
||||||
|
|
||||||
TextComponent loadSchematic = new TextComponent("LADEN");
|
|
||||||
loadSchematic.setColor(ChatColor.DARK_GREEN);
|
|
||||||
loadSchematic.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + schematic.getSchemName()));
|
|
||||||
player.spigot().sendMessage(loadSchematic);
|
|
||||||
|
|
||||||
if(WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
|
||||||
TextComponent deleteSchematic = new TextComponent("LÖSCHEN");
|
|
||||||
deleteSchematic.setColor(ChatColor.RED);
|
|
||||||
deleteSchematic.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + schematic.getSchemName()));
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
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) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.sendMessage("§6Name: §7" + schematic.getSchemName());
|
||||||
|
|
||||||
|
if(schematic.getSchemOwner() == WarkingUser.get(player.getUniqueId()).getId()) {
|
||||||
|
TextComponent typ = new TextComponent("§6Typ: §7" + schematic.getSchemType().name());
|
||||||
|
typ.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Typ ändern").create()));
|
||||||
|
typ.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem getschemchangetype " + schematic.getSchemName()));
|
||||||
|
player.spigot().sendMessage(typ);
|
||||||
|
} else
|
||||||
|
player.sendMessage("§6Typ: §7" + schematic.getSchemType().name());
|
||||||
|
|
||||||
|
if(schematic.getSchemType() == SchematicType.normal) {
|
||||||
|
List<CheckedSchematic> checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId());
|
||||||
|
for(int i = checkedSchematics.size() -1; i > 0; i--) {
|
||||||
|
if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) &&
|
||||||
|
checkedSchematics.get(i).getSchemOwner() == schematic.getSchemOwner()) {
|
||||||
|
player.sendMessage("§cStatus: §c" + checkedSchematics.get(i).getStartTime() + " : " + checkedSchematics.get(i).getDeclineReason());
|
||||||
|
TextComponent mehr = new TextComponent("§9mehr...");
|
||||||
|
mehr.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem getmoreinfo " + schematic.getSchemName()));
|
||||||
|
player.spigot().sendMessage(mehr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||||
|
player.sendMessage("§6Owner: §7" + WarkingUser.get(schematic.getSchemOwner()).getUserName());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
List<String> schematicMembers = new ArrayList<>();
|
||||||
|
for(SchematicMember schematicMember : SchematicMember.getSchemMembers(schematic.getSchemName(), schematic.getSchemOwner())) {
|
||||||
|
schematicMembers.add(WarkingUser.get(schematicMember.getMember()).getUserName());
|
||||||
|
}
|
||||||
|
if(schematicMembers.size() <= 3) {
|
||||||
|
player.sendMessage("§6Member: §7" + schematicMembers.toString());
|
||||||
|
} else
|
||||||
|
player.sendMessage("§6Member: §7...");
|
||||||
|
}
|
||||||
|
|
||||||
|
TextComponent loadSchematic = new TextComponent("LADEN");
|
||||||
|
loadSchematic.setColor(ChatColor.DARK_GREEN);
|
||||||
|
loadSchematic.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + schematic.getSchemName()));
|
||||||
|
player.spigot().sendMessage(loadSchematic);
|
||||||
|
|
||||||
|
if(WarkingUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())) {
|
||||||
|
TextComponent deleteSchematic = new TextComponent("LÖSCHEN");
|
||||||
|
deleteSchematic.setColor(ChatColor.RED);
|
||||||
|
deleteSchematic.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + schematic.getSchemName()));
|
||||||
|
player.spigot().sendMessage(deleteSchematic);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("list")) {
|
if(args[0].equalsIgnoreCase("list")) {
|
||||||
@ -385,193 +381,191 @@ public class SchematicCommand implements CommandExecutor {
|
|||||||
|
|
||||||
if(args[0].equalsIgnoreCase("changetype")) {
|
if(args[0].equalsIgnoreCase("changetype")) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
if(schematic != null) {
|
if(schematic == null) {
|
||||||
Clipboard clipboard;
|
|
||||||
try {
|
|
||||||
clipboard = FaweAPI.load(new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/" + args[1] + ".schematic")).getClipboard();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cBeim Ausführen des Commands ist ein Fehler aufgetreten!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector origin = clipboard.getOrigin();
|
|
||||||
Vector dimensions = clipboard.getDimensions();
|
|
||||||
if(schematic.getSchemType() != SchematicType.normal) {
|
|
||||||
|
|
||||||
if(args[2].equalsIgnoreCase("normal")) {
|
|
||||||
schematic.setSchemType(SchematicType.normal);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6normal §7gesetzt!");
|
|
||||||
return false;
|
|
||||||
} else if(args[2].equalsIgnoreCase("airship") ||
|
|
||||||
args[2].equalsIgnoreCase("miniwargear") ||
|
|
||||||
args[2].equalsIgnoreCase("wargear") ||
|
|
||||||
args[2].equalsIgnoreCase("warship")) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Diese Schematic ist entweder schon freigegeben oder du versuchst eine bereits zum Prüfen gesendete Schematic erneut einzusenden!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if(args[2].equalsIgnoreCase("airship")) {
|
|
||||||
if(dimensions.getBlockX() <= Config.AirShipBreite && dimensions.getBlockY() <= Config.AirShipHöhe && dimensions.getBlockZ() <= Config.AirShipTiefe) {
|
|
||||||
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.AirShipForbiddenIds, true, true, "AirShip");
|
|
||||||
if(!checkresult.isCheck()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein AirShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
|
||||||
checkresult.remove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
schematic.setSchemType(SchematicType.Cairship);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6airship §7angefordert!");
|
|
||||||
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6AirShip§8]");
|
|
||||||
checkresult.remove();
|
|
||||||
} else
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein Airship überschreitet die Maximalmaße!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[2].equalsIgnoreCase("miniwargear")) {
|
|
||||||
if(dimensions.getBlockX() <= Config.MiniWarGearBreite && dimensions.getBlockY() <= Config.MiniWarGearHöhe && dimensions.getBlockZ() <= Config.MiniWarGearTiefe) {
|
|
||||||
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.MiniWarGearForbiddenIds, true, false, "MiniWarGear");
|
|
||||||
if(!checkresult.isCheck()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
|
||||||
checkresult.remove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
schematic.setSchemType(SchematicType.Cminiwargear);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6miniwargear §7angefordert!");
|
|
||||||
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6MiniWarGear§8]");
|
|
||||||
checkresult.remove();
|
|
||||||
} else
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear überschreitet die Maximalmaße!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[2].equalsIgnoreCase("wargear")) {
|
|
||||||
if(dimensions.getBlockX() <= Config.WarGearBreite && dimensions.getBlockY() <= Config.WarGearHöhe && dimensions.getBlockZ() <= Config.WarGearTiefe) {
|
|
||||||
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarGearForbiddenIds, true, false, "WarGear");
|
|
||||||
if(!checkresult.isCheck()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
|
||||||
checkresult.remove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
schematic.setSchemType(SchematicType.Cwargear);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6wargear §7angefordert!");
|
|
||||||
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarGear§8]");
|
|
||||||
checkresult.remove();
|
|
||||||
} else
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear überschreitet die Maximalmaße!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[2].equalsIgnoreCase("warship")) {
|
|
||||||
if(dimensions.getBlockX() <= Config.WarShipBreite && dimensions.getBlockY() <= Config.WarShipHöhe && dimensions.getBlockZ() <= Config.WarShipTiefe) {
|
|
||||||
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarShipForbiddenIds, true, true, "WarShip");
|
|
||||||
if(!checkresult.isCheck()) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
|
||||||
checkresult.remove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
schematic.setSchemType(SchematicType.Cwarship);
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6warship §7angefordert!");
|
|
||||||
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarShip§8]");
|
|
||||||
checkresult.remove();
|
|
||||||
} else
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip überschreitet die Maximalmaße!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.sendMessage("§8/schem changetype <Name> <airship/warship/miniwargear/wargear/normal>");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clipboard clipboard;
|
||||||
|
try {
|
||||||
|
clipboard = FaweAPI.load(new File(SchematicSystem.SCHEM_DIR + player.getUniqueId() + "/" + args[1] + ".schematic")).getClipboard();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cBeim Ausführen des Commands ist ein Fehler aufgetreten!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector origin = clipboard.getOrigin();
|
||||||
|
Vector dimensions = clipboard.getDimensions();
|
||||||
|
if(schematic.getSchemType() != SchematicType.normal) {
|
||||||
|
|
||||||
|
if(args[2].equalsIgnoreCase("normal")) {
|
||||||
|
schematic.setSchemType(SchematicType.normal);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6normal §7gesetzt!");
|
||||||
|
return false;
|
||||||
|
} else if(args[2].equalsIgnoreCase("airship") ||
|
||||||
|
args[2].equalsIgnoreCase("miniwargear") ||
|
||||||
|
args[2].equalsIgnoreCase("wargear") ||
|
||||||
|
args[2].equalsIgnoreCase("warship")) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Diese Schematic ist entweder schon freigegeben oder du versuchst eine bereits zum Prüfen gesendete Schematic erneut einzusenden!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(args[2].equalsIgnoreCase("airship")) {
|
||||||
|
if(dimensions.getBlockX() <= Config.AirShipBreite && dimensions.getBlockY() <= Config.AirShipHöhe && dimensions.getBlockZ() <= Config.AirShipTiefe) {
|
||||||
|
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.AirShipForbiddenIds, true, true, "AirShip");
|
||||||
|
if(!checkresult.isCheck()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein AirShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
||||||
|
checkresult.remove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
schematic.setSchemType(SchematicType.Cairship);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6airship §7angefordert!");
|
||||||
|
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6AirShip§8]");
|
||||||
|
checkresult.remove();
|
||||||
|
} else
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein Airship überschreitet die Maximalmaße!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[2].equalsIgnoreCase("miniwargear")) {
|
||||||
|
if(dimensions.getBlockX() <= Config.MiniWarGearBreite && dimensions.getBlockY() <= Config.MiniWarGearHöhe && dimensions.getBlockZ() <= Config.MiniWarGearTiefe) {
|
||||||
|
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.MiniWarGearForbiddenIds, true, false, "MiniWarGear");
|
||||||
|
if(!checkresult.isCheck()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
||||||
|
checkresult.remove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
schematic.setSchemType(SchematicType.Cminiwargear);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6miniwargear §7angefordert!");
|
||||||
|
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6MiniWarGear§8]");
|
||||||
|
checkresult.remove();
|
||||||
|
} else
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein MiniWarGear überschreitet die Maximalmaße!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[2].equalsIgnoreCase("wargear")) {
|
||||||
|
if(dimensions.getBlockX() <= Config.WarGearBreite && dimensions.getBlockY() <= Config.WarGearHöhe && dimensions.getBlockZ() <= Config.WarGearTiefe) {
|
||||||
|
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarGearForbiddenIds, true, false, "WarGear");
|
||||||
|
if(!checkresult.isCheck()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
||||||
|
checkresult.remove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
schematic.setSchemType(SchematicType.Cwargear);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6wargear §7angefordert!");
|
||||||
|
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarGear§8]");
|
||||||
|
checkresult.remove();
|
||||||
|
} else
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarGear überschreitet die Maximalmaße!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args[2].equalsIgnoreCase("warship")) {
|
||||||
|
if(dimensions.getBlockX() <= Config.WarShipBreite && dimensions.getBlockY() <= Config.WarShipHöhe && dimensions.getBlockZ() <= Config.WarShipTiefe) {
|
||||||
|
Checkresult checkresult = CheckUtils.checkSchematic(clipboard, Config.WarShipForbiddenIds, true, true, "WarShip");
|
||||||
|
if(!checkresult.isCheck()) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip ist nicht regelkonform! §0[§c" + checkresult.getReason() + ((checkresult.getBlockID() != -1) ? ": " + checkresult.getBlockID() : "") + "§0]");
|
||||||
|
checkresult.remove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
schematic.setSchemType(SchematicType.Cwarship);
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Schematic Type §6warship §7angefordert!");
|
||||||
|
CheckUtils.sendTeamMembersCSchematics(SchematicSystem.PREFIX + "§aDer Benutzer §6" + player.getName() + " §ahat eine Schematic eingesendet §8[§6WarShip§8]");
|
||||||
|
checkresult.remove();
|
||||||
|
} else
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDein WarShip überschreitet die Maximalmaße!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.sendMessage("§8/schem changetype <Name> <airship/warship/miniwargear/wargear/normal>");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("addmember")) {
|
if(args[0].equalsIgnoreCase("addmember")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
|
||||||
if(schematic != null) {
|
|
||||||
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(SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), WarkingUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID()) != null) {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist bereits auf diese Schematic geaddet!");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
SchematicMember schematicMember = new SchematicMember(schematic.getSchemName(), WarkingUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID());
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §6" + warkingUser.getUserName() + " §7hat nun Zugriff auf die Schematic §6" + schematic.getSchemName() + "§7.");
|
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(warkingUser.getUUID());
|
|
||||||
if(target != null)
|
|
||||||
target.sendMessage(SchematicSystem.PREFIX + "Du hast nun Zugriff auf die Schematic §6" + schematic.getSchemName() + " §7von §6" + WarkingUser.get(schematic.getSchemOwner()).getUserName() + "§7.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst dich nicht auf deine eigene Schematic adden!");
|
|
||||||
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!");
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
|
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(SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), WarkingUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID()) != null) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist bereits auf diese Schematic geaddet!");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
SchematicMember schematicMember = new SchematicMember(schematic.getSchemName(), WarkingUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID());
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §6" + warkingUser.getUserName() + " §7hat nun Zugriff auf die Schematic §6" + schematic.getSchemName() + "§7.");
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(warkingUser.getUUID());
|
||||||
|
if(target != null)
|
||||||
|
target.sendMessage(SchematicSystem.PREFIX + "Du hast nun Zugriff auf die Schematic §6" + schematic.getSchemName() + " §7von §6" + WarkingUser.get(schematic.getSchemOwner()).getUserName() + "§7.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst dich nicht auf deine eigene Schematic adden!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("delmember")) {
|
if(args[0].equalsIgnoreCase("delmember")) {
|
||||||
if(CheckUtils.isSchematicNameAllowed(args[1])) {
|
if(!CheckUtils.isSchematicNameAllowed(args[1])) {
|
||||||
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
||||||
if(schematic != null) {
|
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()) {
|
|
||||||
SchematicMember schematicMember = SchematicMember.getSchemMemberFromDB(schematic.getSchemName(), WarkingUser.get(schematic.getSchemOwner()).getUUID(), warkingUser.getUUID());
|
|
||||||
if(schematicMember != null) {
|
|
||||||
|
|
||||||
schematicMember.remove();
|
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §6" + warkingUser.getUserName() + " §7hat keinen Zugriff mehr auf die Schematic §6" + schematic.getSchemName() + "§7.");
|
if(schematic == null) {
|
||||||
|
player.sendMessage(SchematicSystem.PREFIX + "§cDiese Schematic existiert nicht!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(warkingUser.getUUID());
|
if(schematic.getSchemOwner() != WarkingUser.get(player.getUniqueId()).getId()) {
|
||||||
if(target != null)
|
player.sendMessage(SchematicSystem.PREFIX + "§cDafür musst du der Owner der Schematic sein!");
|
||||||
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;
|
||||||
return false;
|
} else {
|
||||||
} else {
|
WarkingUser warkingUser = WarkingUser.get(args[2]);
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler ist nicht auf die Schematic geaddet!");
|
if(warkingUser.getUUID() == null) {
|
||||||
return false;
|
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht!");
|
||||||
}
|
|
||||||
|
|
||||||
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen!");
|
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) {
|
||||||
|
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.");
|
||||||
|
|
||||||
|
Player target = Bukkit.getPlayer(warkingUser.getUUID());
|
||||||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren