This commit is contained in:
Aubri Seebauer committed 2023-04-12 22:03:24 -04:00
1 parent 12c2b70b4b
commit 6fa8fa70ed
1 file changed
+10 -17
@@ -428,6 +428,8 @@ public class AdminCommands implements CommandExecutor {
if (t.hasTownBlock(tb)) { if (t.hasTownBlock(tb)) {
t.setHomeBlock(tb.getTownBlock()); t.setHomeBlock(tb.getTownBlock());
t.setSpawn(new Location(p.getWorld(), Integer.parseInt(args[5]), Integer.parseInt(args[6]), Integer.parseInt(args[7]))); t.setSpawn(new Location(p.getWorld(), Integer.parseInt(args[5]), Integer.parseInt(args[6]), Integer.parseInt(args[7])));
r.setHomeBlockRaided(tb.getTownBlock());
r.setTownSpawnRaided(t.getSpawn());
p.sendMessage(Helper.Chatlabel() + "Set town spawn for raided town " + args[4] + " in war " + args[3] + " to " + p.getLocation().toString()); p.sendMessage(Helper.Chatlabel() + "Set town spawn for raided town " + args[4] + " in war " + args[3] + " to " + p.getLocation().toString());
Main.warLogger.log("Set town spawn for raided town " + args[4] + " in war " + args[3] + " to [" + args[5] + "," + args[6] + "," + args[7] + "]"); Main.warLogger.log("Set town spawn for raided town " + args[4] + " in war " + args[3] + " to [" + args[5] + "," + args[6] + "," + args[7] + "]");
return true; return true;
@@ -435,16 +437,12 @@ public class AdminCommands implements CommandExecutor {
p.sendMessage(Helper.color("c") + "Town does not contain town block at [" + args[5] + "," + args[7] + "]"); p.sendMessage(Helper.color("c") + "Town does not contain town block at [" + args[5] + "," + args[7] + "]");
return false; return false;
} }
r.setHomeBlockRaided(tb.getTownBlock());
r.setTownSpawnRaided(t.getSpawn());
} catch (NotRegisteredException e) { } catch (NotRegisteredException e) {
p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!"); p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!");
return false; return false;
throw new RuntimeException(e);
} catch (TownyException e) { } catch (TownyException e) {
p.sendMessage(Helper.color("c") + "Error!"); p.sendMessage(Helper.color("c") + "Error!");
return false; return false;
throw new RuntimeException(e);
} }
} else { } else {
p.sendMessage(Helper.color("c") + "Error! Wrong world!"); p.sendMessage(Helper.color("c") + "Error! Wrong world!");
@@ -458,6 +456,8 @@ public class AdminCommands implements CommandExecutor {
if (t.hasTownBlock(tb)) { if (t.hasTownBlock(tb)) {
t.setHomeBlock(tb.getTownBlock()); t.setHomeBlock(tb.getTownBlock());
t.setSpawn(p.getLocation()); t.setSpawn(p.getLocation());
r.setHomeBlockRaided(tb.getTownBlock());
r.setTownSpawnRaided(t.getSpawn());
p.sendMessage(Helper.Chatlabel() + "Set town spawn for raided town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString()); p.sendMessage(Helper.Chatlabel() + "Set town spawn for raided town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString());
Main.warLogger.log("Set town spawn for raided town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString()); Main.warLogger.log("Set town spawn for raided town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString());
return true; return true;
@@ -465,16 +465,12 @@ public class AdminCommands implements CommandExecutor {
p.sendMessage(Helper.color("c") + "Town does not contain town block at your location [" + (int) p.getLocation().getX() + "," + (int) p.getLocation().getZ() + "]"); p.sendMessage(Helper.color("c") + "Town does not contain town block at your location [" + (int) p.getLocation().getX() + "," + (int) p.getLocation().getZ() + "]");
return false; return false;
} }
r.setHomeBlockRaided(tb.getTownBlock());
r.setTownSpawnRaided(t.getSpawn());
} catch (NotRegisteredException e) { } catch (NotRegisteredException e) {
p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!"); p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!");
return false; return false;
throw new RuntimeException(e);
} catch (TownyException e) { } catch (TownyException e) {
p.sendMessage(Helper.color("c") + "Error!"); p.sendMessage(Helper.color("c") + "Error!");
return false; return false;
throw new RuntimeException(e);
} }
} else { } else {
return false; return false;
@@ -789,7 +785,7 @@ public class AdminCommands implements CommandExecutor {
return false; return false;
} }
} else if(args[2].equalsIgnoreCase("townspawn")) { } else if(args[2].equalsIgnoreCase("townspawn")) {
if(args.length >= 8) { if(args.length >= 5) {
for(Siege s: SiegeData.getSieges()) { for(Siege s: SiegeData.getSieges()) {
if (s.getWar().getName().equals(args[3]) && s.getTown().getName().equals(args[4])) { if (s.getWar().getName().equals(args[3]) && s.getTown().getName().equals(args[4])) {
if (args.length == 6 || args.length == 7){ if (args.length == 6 || args.length == 7){
@@ -804,6 +800,8 @@ public class AdminCommands implements CommandExecutor {
if (t.hasTownBlock(tb)) { if (t.hasTownBlock(tb)) {
t.setHomeBlock(tb.getTownBlock()); t.setHomeBlock(tb.getTownBlock());
t.setSpawn(new Location(p.getWorld(), Integer.parseInt(args[5]), Integer.parseInt(args[6]), Integer.parseInt(args[7]))); t.setSpawn(new Location(p.getWorld(), Integer.parseInt(args[5]), Integer.parseInt(args[6]), Integer.parseInt(args[7])));
s.setHomeBlock(tb.getTownBlock());
s.setTownSpawn(t.getSpawn());
p.sendMessage(Helper.Chatlabel() + "Set town spawn for sieged town " + args[4] + " in war " + args[3] + " to " + p.getLocation().toString()); p.sendMessage(Helper.Chatlabel() + "Set town spawn for sieged town " + args[4] + " in war " + args[3] + " to " + p.getLocation().toString());
Main.warLogger.log("Set town spawn for sieged town " + args[4] + " in war " + args[3] + " to [" + args[5] + "," + args[6] + "," + args[7] + "]"); Main.warLogger.log("Set town spawn for sieged town " + args[4] + " in war " + args[3] + " to [" + args[5] + "," + args[6] + "," + args[7] + "]");
return true; return true;
@@ -811,16 +809,12 @@ public class AdminCommands implements CommandExecutor {
p.sendMessage(Helper.color("c") + "Town does not contain town block at [" + args[5] + "," + args[7] + "]"); p.sendMessage(Helper.color("c") + "Town does not contain town block at [" + args[5] + "," + args[7] + "]");
return false; return false;
} }
s.setHomeBlock(tb.getTownBlock());
s.setTownSpawn(t.getSpawn());
} catch (NotRegisteredException e) { } catch (NotRegisteredException e) {
p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!"); p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!");
return false; return false;
throw new RuntimeException(e);
} catch (TownyException e) { } catch (TownyException e) {
p.sendMessage(Helper.color("c") + "Error!"); p.sendMessage(Helper.color("c") + "Error!");
return false; return false;
throw new RuntimeException(e);
} }
} else { } else {
p.sendMessage(Helper.color("c") + "Error! Wrong world!"); p.sendMessage(Helper.color("c") + "Error! Wrong world!");
@@ -834,6 +828,8 @@ public class AdminCommands implements CommandExecutor {
if (t.hasTownBlock(tb)) { if (t.hasTownBlock(tb)) {
t.setHomeBlock(tb.getTownBlock()); t.setHomeBlock(tb.getTownBlock());
t.setSpawn(p.getLocation()); t.setSpawn(p.getLocation());
s.setHomeBlock(tb.getTownBlock());
s.setTownSpawn(t.getSpawn());
p.sendMessage(Helper.Chatlabel() + "Set town spawn for sieged town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString()); p.sendMessage(Helper.Chatlabel() + "Set town spawn for sieged town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString());
Main.warLogger.log("Set town spawn for sieged town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString()); Main.warLogger.log("Set town spawn for sieged town " + args[5] + " in war " + args[4] + " to " + p.getLocation().toString());
return true; return true;
@@ -841,16 +837,12 @@ public class AdminCommands implements CommandExecutor {
p.sendMessage(Helper.color("c") + "Town does not contain town block at your location [" + (int) p.getLocation().getX() + "," + (int) p.getLocation().getZ() + "]"); p.sendMessage(Helper.color("c") + "Town does not contain town block at your location [" + (int) p.getLocation().getX() + "," + (int) p.getLocation().getZ() + "]");
return false; return false;
} }
s.setHomeBlock(tb.getTownBlock());
s.setTownSpawn(t.getSpawn());
} catch (NotRegisteredException e) { } catch (NotRegisteredException e) {
p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!"); p.sendMessage(Helper.color("c") + "Error! Townblock does not exist!");
return false; return false;
throw new RuntimeException(e);
} catch (TownyException e) { } catch (TownyException e) {
p.sendMessage(Helper.color("c") + "Error!"); p.sendMessage(Helper.color("c") + "Error!");
return false; return false;
throw new RuntimeException(e);
} }
} else { } else {
return false; return false;
@@ -1124,6 +1116,7 @@ public class AdminCommands implements CommandExecutor {
} else { } else {
return fail(p, args, "syntax"); return fail(p, args, "syntax");
} }
return fail(p, args, "syntax");
} }