mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-02 06:28:52 +00:00
modify war unsurrender town/nation added
This commit is contained in:
1 parent
55b1f529d2
commit
0816fd17e4
2 files changed
+105
-2
No files matched your search
@@ -1296,7 +1296,7 @@ public class AdminCommands implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
w.addTown(t, args[5]);
|
||||
w.addTown(t, args[4]);
|
||||
}
|
||||
p.sendMessage(Helper.Chatlabel() + "Forcefully added nation " + args[6] + " war " + args[3] + " on side " + args[4]);
|
||||
Main.warLogger.log(Helper.Chatlabel() + "Forcefully added nation " + args[6] + " war " + args[3] + " on side " + args[4]);
|
||||
@@ -1313,7 +1313,61 @@ public class AdminCommands implements CommandExecutor {
|
||||
}
|
||||
p.sendMessage(Helper.color("&cError: War not found!"));
|
||||
} else {
|
||||
p.sendMessage(Helper.color("&cUsage: /alathrawaradmin modify war add [war] town/nation [town/nation] [force] "));
|
||||
p.sendMessage(Helper.color("&cUsage: /alathrawaradmin modify war add [war] [side] town/nation [town/nation] [force] "));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//TODO do
|
||||
else if (args[2].equalsIgnoreCase("unsurrender")) {
|
||||
if (args.length >= 7) {
|
||||
for (War w : WarData.getWars()) {
|
||||
if (w.getName().equals(args[3])) {
|
||||
if (args[4].equalsIgnoreCase("town")) {
|
||||
Town t = TownyAPI.getInstance().getTown(args[6]);
|
||||
if (t != null) {
|
||||
if(w.getSurrenderedTowns().contains(args[6])) {
|
||||
w.unSurrenderTown(args[6]);
|
||||
p.sendMessage(Helper.Chatlabel() + "Un-surrendered town " + args[6]);
|
||||
Main.warLogger.log(Helper.Chatlabel() + "Un-surrendered town " + args[6]);
|
||||
p.sendMessage(Helper.color("&cTo re-add, use: /alathrawaradmin modify war add, or have the town loader join."));
|
||||
return true;
|
||||
}
|
||||
p.sendMessage(Helper.Chatlabel() + "Town " + args[6] + " not already surrendered, ignoring.");
|
||||
Main.warLogger.log(Helper.Chatlabel() + "Town " + args[6] + " not already surrendered, ignoring.");
|
||||
return true;
|
||||
} else {
|
||||
p.sendMessage(Helper.color("&cError: Town not found!"));
|
||||
}
|
||||
return finalizeWar(w);
|
||||
} else if (args[4].equalsIgnoreCase("nation")) {
|
||||
Nation n = TownyAPI.getInstance().getNation(args[6]);
|
||||
if (n != null) {
|
||||
for(Town t : n.getTowns()) {
|
||||
if (w.getSurrenderedTowns().contains(t.getName())) {
|
||||
w.unSurrenderTown(t.getName());
|
||||
p.sendMessage(Helper.Chatlabel() + "Un-surrendered town " + t.getName());
|
||||
Main.warLogger.log(Helper.Chatlabel() + "Un-surrendered town " + t.getName());
|
||||
}
|
||||
}
|
||||
|
||||
p.sendMessage(Helper.Chatlabel() + "Un-surrendered nation " + args[6] + " in war " + args[3]);
|
||||
Main.warLogger.log(Helper.Chatlabel() + "Un-surrendered nation " + args[6] + " in war " + args[3]);
|
||||
p.sendMessage(Helper.color("&cTo re-add, use: /alathrawaradmin modify war add, or have the nation loader join."));
|
||||
return finalizeWar(w);
|
||||
} else {
|
||||
p.sendMessage(Helper.color("&cError: Nation not found!"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(Helper.color("&cUsage: /alathrawaradmin modify war unsurrender [war] town/nation [town/nation]"));
|
||||
p.sendMessage(Helper.color("&cTo re-add, use: /alathrawaradmin modify war add, or have the town/nation loader join."));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
p.sendMessage(Helper.color("&cError: War not found!"));
|
||||
} else {
|
||||
p.sendMessage(Helper.color("&cUsage: /alathrawaradmin modify war unsurrender [war] town/nation [town/nation]"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class AdminTabCompletion implements TabCompleter {
|
||||
"name",
|
||||
"add",
|
||||
"surrender",
|
||||
"unsurrender",
|
||||
"raidTimeWar",
|
||||
"raidTimeTown"
|
||||
});
|
||||
@@ -542,6 +543,8 @@ public class AdminTabCompletion implements TabCompleter {
|
||||
* -modify war add nation [war] [nation]
|
||||
* -modify war surrender town [war] [town] //adds town to surrender list
|
||||
* -modify war surrender nation [war] [town] //adds all towns to surrender list
|
||||
* -modify war unsurrender [war] town/nation [town/nation]
|
||||
* -modify war unsurrender [war] town/nation [town/nation]
|
||||
* -modify war raidTimeTown [add,set,reset] [war] [town] [amt] //set when last raid was
|
||||
*/
|
||||
case "score" -> {
|
||||
@@ -652,6 +655,52 @@ public class AdminTabCompletion implements TabCompleter {
|
||||
return NameUtil.filterByStart(CommandHelper.getWarNames(), args[3]);
|
||||
}
|
||||
}
|
||||
case "surrender" -> {
|
||||
if (args.length > 4) {
|
||||
if (args.length > 5) {
|
||||
if (args.length > 6) {
|
||||
if (args.length > 7) {
|
||||
return empty;
|
||||
} else {
|
||||
if (args[5].equalsIgnoreCase("town")) {
|
||||
return NameUtil.filterByStart(CommandHelper.getTownyTowns(), args[6]);
|
||||
} else if (args[5].equalsIgnoreCase("nation")) {
|
||||
return NameUtil.filterByStart(CommandHelper.getTownyNations(), args[6]);
|
||||
} else {
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return NameUtil.filterByStart(nationTown, args[5]);
|
||||
}
|
||||
} else {
|
||||
return NameUtil.filterByStart(CommandHelper.getWarSides(args[3]), args[4]);
|
||||
}
|
||||
} else {
|
||||
return NameUtil.filterByStart(CommandHelper.getWarNames(), args[3]);
|
||||
}
|
||||
}
|
||||
case "unsurrender" -> {
|
||||
if (args.length > 4) {
|
||||
if (args.length > 5) {
|
||||
if (args.length > 6) {
|
||||
return empty;
|
||||
} else {
|
||||
if (args[5].equalsIgnoreCase("town")) {
|
||||
return NameUtil.filterByStart(CommandHelper.getTownyTowns(), args[5]);
|
||||
} else if (args[5].equalsIgnoreCase("nation")) {
|
||||
return NameUtil.filterByStart(CommandHelper.getTownyNations(), args[5]);
|
||||
} else {
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return NameUtil.filterByStart(nationTown, args[4]);
|
||||
}
|
||||
} else {
|
||||
return NameUtil.filterByStart(CommandHelper.getWarNames(), args[3]);
|
||||
}
|
||||
}
|
||||
default -> {
|
||||
return empty;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user