13
0
Signed-off-by: yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-06-15 22:08:47 +02:00 committet von yaruma3341
Ursprung 3bc4620bbd
Commit 5c3890d438

Datei anzeigen

@ -80,6 +80,10 @@ public class SchematicCommand implements CommandExecutor {
if(args[0].equalsIgnoreCase("load")) {
if(CheckUtils.isSchematicNameAllowed(args[1])) {
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
if(schematic == null)
schematic = Schematic.getSchemFromDB(args[1], 0); //public schematic
if (schematic != null) {
try {
@ -236,9 +240,74 @@ public class SchematicCommand implements CommandExecutor {
}
}
if(args[0].equalsIgnoreCase("info")) {
if(args[0].equalsIgnoreCase("getschemchangetype")) {
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!");
return false;
}
}
if(args[0].equalsIgnoreCase("getmoreinfo")) {
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!");
return false;
}
}
return false;
case 3:
if(args[0].equalsIgnoreCase("info")) {
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());
@ -301,66 +370,6 @@ public class SchematicCommand implements CommandExecutor {
}
}
if(args[0].equalsIgnoreCase("getschemchangetype")) {
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!");
return false;
}
}
if(args[0].equalsIgnoreCase("getmoreinfo")) {
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!");
return false;
}
}
return false;
case 3:
if(args[0].equalsIgnoreCase("list")) {
if(args[1].equalsIgnoreCase("public")) {
try {
@ -374,35 +383,6 @@ public class SchematicCommand implements CommandExecutor {
return false;
}
if(args[0].equalsIgnoreCase("load")) {
if(!player.hasPermission("bau.team")) return false;
WarkingUser warkingUser = WarkingUser.get(args[2]);
if(warkingUser != null) {
if(CheckUtils.isSchematicNameAllowed(args[1])) {
Schematic schematic = Schematic.getSchemFromDB(args[1], warkingUser.getUUID());
if(schematic != null) {
try {
Actor actor = SchematicSystem.getWorldEditPlugin().wrapCommandSender(player);
SchematicSystem.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard((ClipboardHolder) FaweAPI.load(new File(SchematicSystem.SCHEM_DIR + warkingUser.getUUID().toString() + "/", args[1] + ".schematic")).getClipboard());
player.sendMessage(SchematicSystem.PREFIX + "Schematic §6" + args[1] + " §7von §6" + warkingUser.getUserName() + "§7geladen.");
} catch (IOException ex) {
ex.printStackTrace();
}
} 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;
}
} else {
player.sendMessage(SchematicSystem.PREFIX + "§cDieser Spieler existiert nicht!");
return false;
}
return false;
}
if(args[0].equalsIgnoreCase("changetype")) {
Schematic schematic = Schematic.getSchemFromDB(args[1], player.getUniqueId());
if(schematic != null) {
@ -604,11 +584,11 @@ public class SchematicCommand implements CommandExecutor {
player.sendMessage("§8/schem - §6Zeigt Informationen zum Plugin");
player.sendMessage("§8/schem help - §6Zeigt eine Liste mit Befehlen");
player.sendMessage("§8/schem list (public) - §6Listet deine (oder Public) Schematics auf");
player.sendMessage("§8/schem load <Name> [Besitzer] - §6Du lädst eine Schematic");
player.sendMessage("§8/schem load <Name> - §6Du lädst eine Schematic");
player.sendMessage("§8/schem save <Name> - §6Du speicherst dein Clipboard als Datei");
player.sendMessage("§8/schem changetype <Name> <airship/warship/miniwargear/wargear/normal> - §6Ändert den Typ deiner Schematic");
player.sendMessage("§8/schem info <Name> - §6Zeigt dir Informationen zu der Schematic");
player.sendMessage("§8/schem delete <Name> - §6Löscht eine Schematic");
player.sendMessage("§8/schem info <Name> <Besitzer> - §6Zeigt dir Informationen zu der Schematic");
player.sendMessage("§8/schem addmember <Schematic> <Spieler> - §6Fügt einen Spieler zu einer Schematic hinzu");
player.sendMessage("§8/schem delmember <Schematic> <Spieler> - §6Entfernt einen Spieler von einer Schematic");
@ -675,7 +655,7 @@ public class SchematicCommand implements CommandExecutor {
schematics.setBold(true);
schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Schematic verwalten...").create()));
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + schematic.getSchemName()));
schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + schematic.getSchemName() + " " + schematic.getSchemOwner()));
player.spigot().sendMessage(schematics);
}