mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-03 06:28:51 +00:00
Command changes & greater tp restrictions
This commit is contained in:
1 parent
a0d44d19e9
commit
c658158cf5
6 files changed
+243
-63
No files matched your search
@@ -2,10 +2,8 @@ package me.ShermansWorld.AlathraWar.commands;
|
||||
|
||||
import com.palmergames.bukkit.towny.TownyAPI;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import com.palmergames.bukkit.towny.object.Town;
|
||||
import com.palmergames.bukkit.towny.object.TownyWorld;
|
||||
import com.palmergames.bukkit.towny.object.WorldCoord;
|
||||
import com.palmergames.bukkit.towny.exceptions.TownyException;
|
||||
import com.palmergames.bukkit.towny.object.*;
|
||||
import me.ShermansWorld.AlathraWar.*;
|
||||
import me.ShermansWorld.AlathraWar.data.RaidPhase;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -294,11 +292,17 @@ public class RaidCommands implements CommandExecutor
|
||||
if(raidFound) {
|
||||
//check if gather phase
|
||||
if(raid.getPhase() == RaidPhase.GATHER || raid.getPhase() == RaidPhase.START) {
|
||||
if(raid.getGatherTown().hasTownBlock(WorldCoord.parseWorldCoord(p))) {
|
||||
raid.addActiveRaider(p.getName());
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You have joined the raid on " + raid.getRaidedTown().getName() + "!");
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Leaving " + raid.getGatherTown().getName() + " will cause you to leave the raid party.");
|
||||
try {
|
||||
ArrayList<WorldCoord> cluster = Helper.getCluster(raid.getGatherTown().getHomeBlock().getWorldCoord());
|
||||
if(cluster.contains(WorldCoord.parseWorldCoord(p))) {
|
||||
raid.addActiveRaider(p.getName());
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You have joined the raid on " + raid.getRaidedTown().getName() + "!");
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "Leaving " + raid.getGatherTown().getName() + " will cause you to leave the raid party.");
|
||||
}
|
||||
} catch (TownyException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
} else {
|
||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot join the raid on " + raid.getRaidedTown().getName() + "! It has already started!");
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ public class RaidTabCompletion implements TabCompleter {
|
||||
completions.add("abandon");
|
||||
completions.add("list");
|
||||
completions.add("help");
|
||||
completions.add("join");
|
||||
completions.add("leave");
|
||||
return completions;
|
||||
} else if (args.length == 2) {
|
||||
if (args[0].equalsIgnoreCase("start")) {
|
||||
@@ -43,6 +45,20 @@ public class RaidTabCompletion implements TabCompleter {
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("join")) {
|
||||
if (!WarCommands.wars.isEmpty()) {
|
||||
for (War war : WarCommands.wars) {
|
||||
completions.add(war.getName());
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("leave")) {
|
||||
if (!WarCommands.wars.isEmpty()) {
|
||||
for (War war : WarCommands.wars) {
|
||||
completions.add(war.getName());
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
} else if (args.length == 3) {
|
||||
if (args[0].equalsIgnoreCase("start")) {
|
||||
@@ -52,8 +68,24 @@ public class RaidTabCompletion implements TabCompleter {
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("join")) {
|
||||
if (!TownyAPI.getInstance().getTowns().isEmpty()) {
|
||||
for (Town town : TownyAPI.getInstance().getTowns()) {
|
||||
completions.add(town.getName());
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("leave")) {
|
||||
if (!TownyAPI.getInstance().getTowns().isEmpty()) {
|
||||
for (Town town : TownyAPI.getInstance().getTowns()) {
|
||||
completions.add(town.getName());
|
||||
}
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user