mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-03 06:28:51 +00:00
force leave raid
This commit is contained in:
1 parent
2f867fca2c
commit
ffe9bd0c2e
2 files changed
+52
-30
No files matched your search
@@ -211,7 +211,7 @@ public class AdminCommands implements CommandExecutor {
|
|||||||
* -force join war [player] [war] [side]
|
* -force join war [player] [war] [side]
|
||||||
* -force join siege [player] [war] [town] (side)
|
* -force join siege [player] [war] [town] (side)
|
||||||
* -force join raid [player] [war] [town] (side) //TODO time until must be in gather?
|
* -force join raid [player] [war] [town] (side) //TODO time until must be in gather?
|
||||||
* -force leave raid [war] [player] (timeout) //kicks from raid party
|
* -force leave raid [war] [player] (timeout) //kicks from raid party
|
||||||
* -force surrender war [name] [town]
|
* -force surrender war [name] [town]
|
||||||
*
|
*
|
||||||
* @param p
|
* @param p
|
||||||
@@ -324,13 +324,15 @@ public class AdminCommands implements CommandExecutor {
|
|||||||
p.sendMessage(Helper.color("c") + "Siege not found!");
|
p.sendMessage(Helper.color("c") + "Siege not found!");
|
||||||
return false;
|
return false;
|
||||||
} else if(args[2].equalsIgnoreCase("war")) {
|
} else if(args[2].equalsIgnoreCase("war")) {
|
||||||
|
//TODO determine if needed
|
||||||
|
p.sendMessage(Helper.color("c") + "Unused! use /war delete");
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force end [raid/siege/war]");
|
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force end [raid/siege]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force end [raid/siege/war]");
|
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force end [raid/siege]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if(args[1].equalsIgnoreCase("join")) {
|
} else if(args[1].equalsIgnoreCase("join")) {
|
||||||
@@ -390,33 +392,40 @@ public class AdminCommands implements CommandExecutor {
|
|||||||
} else if(args[1].equalsIgnoreCase("leave")) {
|
} else if(args[1].equalsIgnoreCase("leave")) {
|
||||||
if(args.length >= 3) {
|
if(args.length >= 3) {
|
||||||
if(args[2].equalsIgnoreCase("raid")) {
|
if(args[2].equalsIgnoreCase("raid")) {
|
||||||
|
if (args.length >= 6) {
|
||||||
|
for (Raid r : RaidData.getRaids()) {
|
||||||
|
if (r.getWar().getName().equals(args[3]) && r.getRaidedTown().getName().equals(args[4])) {
|
||||||
|
if (Bukkit.getPlayer(args[5]) != null) {
|
||||||
|
String[] fixed = new String[] {
|
||||||
|
args[1],
|
||||||
|
args[3],
|
||||||
|
args[4],
|
||||||
|
args[5]
|
||||||
|
};
|
||||||
|
RaidCommands.leaveRaid(p, fixed, true);
|
||||||
|
p.sendMessage(Helper.Chatlabel() + "Forced player " + args[5] + " to leave raid on " + args[4] + " in war " + args[3]);
|
||||||
|
Main.warLogger.log("Forced player " + args[5] + " to leave raid on " + args[4] + " in war " + args[3]);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Helper.color("c") + "Player not found!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.sendMessage(Helper.color("c") + "Raid not found!");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force leave raid [war] [town] [player] (timeout)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else if(args[2].equalsIgnoreCase("siege")) {
|
} else if(args[2].equalsIgnoreCase("siege")) {
|
||||||
|
//TODO determine if needed
|
||||||
|
p.sendMessage(Helper.color("c") + "Unused!");
|
||||||
|
return false;
|
||||||
} else if(args[2].equalsIgnoreCase("war")) {
|
} else if(args[2].equalsIgnoreCase("war")) {
|
||||||
// if(args.length >= 6) {
|
//TODO determine if needed
|
||||||
// //fix args to match
|
p.sendMessage(Helper.color("c") + "Unused! use /war surrender");
|
||||||
// String[] adjusted = new String[] {
|
return false;
|
||||||
// args[1],
|
|
||||||
// args[4],
|
|
||||||
// args[5],
|
|
||||||
// args[3]
|
|
||||||
// };
|
|
||||||
// //find the player
|
|
||||||
// if(Bukkit.getPlayer(args[3]) != null) {
|
|
||||||
// p = Bukkit.getPlayer(args[3]);
|
|
||||||
// } else {
|
|
||||||
// p.sendMessage(Helper.color("c") + args[3] + " does not exist!");
|
|
||||||
// p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force leave war [player] [war] (timeout)");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// WarCommands.warJoin(p, adjusted, true);
|
|
||||||
// p.sendMessage(Helper.color("c") + "Forced " + args[3] + " to leave the war " + args[4] + " from side " + args[5]);
|
|
||||||
// Main.warLogger.log("Forced " + args[3] + " to leave the war " + args[4] + " from side " + args[5]);
|
|
||||||
// } else {
|
|
||||||
// p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force leave war [player] [war] (timeout)");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force leave [raid/siege/war]");
|
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin force leave [raid/siege/war]");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -318,13 +318,23 @@ public class RaidCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void leaveRaid(Player p, String[] args, boolean admin) {
|
protected static void leaveRaid(Player player, String[] args, boolean admin) {
|
||||||
//Get raid!
|
//Get raid!
|
||||||
|
Player p = player;
|
||||||
|
if (admin) {
|
||||||
|
p = Bukkit.getPlayer(args[3]);
|
||||||
|
if (p == null) {
|
||||||
|
player.sendMessage(String.valueOf(Helper.Chatlabel()) + "Error: player not found!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Raid raid = RaidData.getRaidOrNull(args[1] + "-" + args[2]);
|
Raid raid = RaidData.getRaidOrNull(args[1] + "-" + args[2]);
|
||||||
if (raid != null) {
|
if (raid != null) {
|
||||||
if (raid.getWar().getName().equalsIgnoreCase(args[1])) {
|
if (raid.getWar().getName().equalsIgnoreCase(args[1])) {
|
||||||
if (!raid.getWar().getSide1Players().contains(p.getName()) && !raid.getWar().getSide2Players().contains(p.getName())) {
|
if (!raid.getWar().getSide1Players().contains(p.getName()) && !raid.getWar().getSide2Players().contains(p.getName())) {
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You are not in this war! Type /war join [war] [side]");
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You are not in this war! Type /war join [war] [side]");
|
||||||
|
if (admin) player.sendMessage(String.valueOf(Helper.Chatlabel()) + "You are not in this war! Type /war join [war] [side]");
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if gather phase
|
//check if gather phase
|
||||||
@@ -335,9 +345,11 @@ public class RaidCommands implements CommandExecutor {
|
|||||||
if (cluster.contains(WorldCoord.parseWorldCoord(p))) {
|
if (cluster.contains(WorldCoord.parseWorldCoord(p))) {
|
||||||
raid.removeActiveRaider(p.getName());
|
raid.removeActiveRaider(p.getName());
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You have left the raid on " + raid.getRaidedTown().getName() + "!");
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You have left the raid on " + raid.getRaidedTown().getName() + "!");
|
||||||
|
if (admin) player.sendMessage(String.valueOf(Helper.Chatlabel()) + "You have left the raid on " + raid.getRaidedTown().getName() + "!");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot leave the raid on " + raid.getRaidedTown().getName() + "! It has already started!");
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot leave the raid on " + raid.getRaidedTown().getName() + "! It has already started!");
|
||||||
|
if (admin) player.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot leave the raid on " + raid.getRaidedTown().getName() + "! It has already started!");
|
||||||
}
|
}
|
||||||
} catch (TownyException e) {
|
} catch (TownyException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@@ -346,6 +358,7 @@ public class RaidCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "No raid is gathering in this town or this town does not exist!");
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "No raid is gathering in this town or this town does not exist!");
|
||||||
|
if (admin) player.sendMessage(String.valueOf(Helper.Chatlabel()) + "No raid is gathering in this town or this town does not exist!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user