+ Added a after game warp to prevent spamming of signs. Fixes #21.

This commit is contained in:
RandomPanda30 2013-10-12 13:16:18 +01:00
parent 9c5eba53e5
commit de5e22e636
6 changed files with 23 additions and 12 deletions

View File

@ -31,6 +31,7 @@ public class Arena implements ConfigurationSerializable {
public LocationSerializable lobbyWarp; public LocationSerializable lobbyWarp;
public LocationSerializable hidersWarp; public LocationSerializable hidersWarp;
public LocationSerializable seekersWarp; public LocationSerializable seekersWarp;
public LocationSerializable spawnWarp;
public List<String> seekersWinCommands; public List<String> seekersWinCommands;
public List<String> hidersWinCommands; public List<String> hidersWinCommands;
public List<String> allowedCommands; public List<String> allowedCommands;
@ -50,11 +51,12 @@ public class Arena implements ConfigurationSerializable {
int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword,
ArrayList<ItemStack> disguiseBlocks, ArrayList<ItemStack> disguiseBlocks,
LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable lobbyWarp, LocationSerializable hidersWarp,
LocationSerializable seekersWarp, List<String> seekersWinCommands, LocationSerializable seekersWarp, LocationSerializable spawnWarp,
List<String> hidersWinCommands, List<String> allowedCommands, List<String> seekersWinCommands, List<String> hidersWinCommands,
int seekersTokenWin, int hidersTokenWin, int killTokens, List<String> allowedCommands, int seekersTokenWin,
List<Player> playersInArena, ArenaState gameState, int timer, int hidersTokenWin, int killTokens, List<Player> playersInArena,
List<Player> seekers, Scoreboard scoreboard) { ArenaState gameState, int timer, List<Player> seekers,
Scoreboard scoreboard) {
this.arenaName = arenaName; this.arenaName = arenaName;
this.pos1 = pos1; this.pos1 = pos1;
this.pos2 = pos2; this.pos2 = pos2;
@ -69,6 +71,7 @@ public class Arena implements ConfigurationSerializable {
this.lobbyWarp = lobbyWarp; this.lobbyWarp = lobbyWarp;
this.hidersWarp = hidersWarp; this.hidersWarp = hidersWarp;
this.seekersWarp = seekersWarp; this.seekersWarp = seekersWarp;
this.spawnWarp = spawnWarp;
this.seekersWinCommands = seekersWinCommands; this.seekersWinCommands = seekersWinCommands;
this.hidersWinCommands = hidersWinCommands; this.hidersWinCommands = hidersWinCommands;
this.allowedCommands = allowedCommands; this.allowedCommands = allowedCommands;
@ -117,6 +120,7 @@ public class Arena implements ConfigurationSerializable {
map.put("lobbyWarp", lobbyWarp); map.put("lobbyWarp", lobbyWarp);
map.put("hidersWarp", hidersWarp); map.put("hidersWarp", hidersWarp);
map.put("seekersWarp", seekersWarp); map.put("seekersWarp", seekersWarp);
map.put("spawnWarp", spawnWarp);
map.put("seekersWinCommands", seekersWinCommands); map.put("seekersWinCommands", seekersWinCommands);
map.put("hidersWinCommands", hidersWinCommands); map.put("hidersWinCommands", hidersWinCommands);
map.put("allowedCommands", allowedCommands); map.put("allowedCommands", allowedCommands);
@ -145,6 +149,7 @@ public class Arena implements ConfigurationSerializable {
(LocationSerializable) M.g(map, "lobbyWarp", loc), (LocationSerializable) M.g(map, "lobbyWarp", loc),
(LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc),
(LocationSerializable) M.g(map, "seekersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc),
(LocationSerializable) M.g(map, "spawnWarp", loc),
(ArrayList<String>) M.g(map, "seekersWinCommands", (ArrayList<String>) M.g(map, "seekersWinCommands",
new ArrayList<String>()), (ArrayList<String>) M.g(map, new ArrayList<String>()), (ArrayList<String>) M.g(map,
"hidersWinCommands", new ArrayList<String>()), "hidersWinCommands", new ArrayList<String>()),

View File

@ -96,10 +96,12 @@ public class ArenaHandler {
Bukkit.getWorld(player.getWorld().getName() Bukkit.getWorld(player.getWorld().getName()
.toString()), 0, 0, 0, 0, 0); .toString()), 0, 0, 0, 0, 0);
if (arena.lobbyWarp != null && arena.hidersWarp != null if (arena.lobbyWarp != null && arena.hidersWarp != null
&& arena.seekersWarp != null) { && arena.seekersWarp != null
&& arena.spawnWarp != null) {
if (!arena.lobbyWarp.equals(zero) if (!arena.lobbyWarp.equals(zero)
&& !arena.hidersWarp.equals(zero) && !arena.hidersWarp.equals(zero)
&& !arena.seekersWarp.equals(zero)) { && !arena.seekersWarp.equals(zero)
&& !arena.spawnWarp.equals(zero)) {
if (arena.gameState == ArenaState.WAITING if (arena.gameState == ArenaState.WAITING
|| arena.gameState == ArenaState.STARTING) { || arena.gameState == ArenaState.STARTING) {
if (arena.playersInArena.size() >= arena.maxPlayers) { if (arena.playersInArena.size() >= arena.maxPlayers) {
@ -349,7 +351,7 @@ public class ArenaHandler {
player.setHealth(pad.pHealth); player.setHealth(pad.pHealth);
player.setFoodLevel(pad.pFood); player.setFoodLevel(pad.pFood);
player.addPotionEffects(pad.pPotionEffects); player.addPotionEffects(pad.pPotionEffects);
player.teleport(pad.pLocation); player.teleport(arena.spawnWarp);
player.setGameMode(pad.pGameMode); player.setGameMode(pad.pGameMode);
player.setAllowFlight(pad.pFlying); player.setAllowFlight(pad.pFlying);
if (player.getAllowFlight()) { if (player.getAllowFlight()) {

View File

@ -210,7 +210,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
"sw", Permissions.setwarp, ConfigC.help_setwarp, "sw", Permissions.setwarp, ConfigC.help_setwarp,
(Boolean) W.config.get(ConfigC.commandEnabled_setwarp), (Boolean) W.config.get(ConfigC.commandEnabled_setwarp),
BlockHuntCMD, new CMDsetwarp(), BlockHuntCMD, new CMDsetwarp(),
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers> <arenaname>"); "/BlockHunt <setwarp|sw> <lobby|hiders|seekers|spawn> <arenaname>");
CMDremove = new CommandM("BlockHunt REMOVE", "BlockHunt", "remove", CMDremove = new CommandM("BlockHunt REMOVE", "BlockHunt", "remove",
"delete", Permissions.remove, ConfigC.help_remove, "delete", Permissions.remove, ConfigC.help_remove,
(Boolean) W.config.get(ConfigC.commandEnabled_remove), (Boolean) W.config.get(ConfigC.commandEnabled_remove),

View File

@ -31,7 +31,7 @@ public class CMDcreate extends DefaultCMD {
Arena arena = new Arena(args[1], W.pos1.get(player), Arena arena = new Arena(args[1], W.pos1.get(player),
W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30,
new ArrayList<ItemStack>(), null, null, null, new ArrayList<ItemStack>(), null, null, null,
new ArrayList<String>(), null, new ArrayList<String>(),
new ArrayList<String>(), new ArrayList<String>(),
new ArrayList<String>(), 10, 50, 8, new ArrayList<String>(), 10, 50, 8,
new ArrayList<Player>(), ArenaState.WAITING, 0, new ArrayList<Player>(), ArenaState.WAITING, 0,

View File

@ -51,6 +51,12 @@ public class CMDsetwarp extends DefaultCMD {
MessageM.sendFMessage(player, MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, "warp-" ConfigC.normal_setwarpWarpSet, "warp-"
+ warpname); + warpname);
} else if (warpname.equalsIgnoreCase("spawn")) {
arena.spawnWarp = loc;
save(arena);
MessageM.sendFMessage(player,
ConfigC.normal_setwarpWarpSet, "warp-"
+ warpname);
} else { } else {
MessageM.sendFMessage(player, MessageM.sendFMessage(player,
ConfigC.error_setwarpWarpNotFound, "warp-" ConfigC.error_setwarpWarpNotFound, "warp-"

View File

@ -8,7 +8,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
public class PlayerArenaData { public class PlayerArenaData {
public Location pLocation;
public GameMode pGameMode; public GameMode pGameMode;
public ItemStack[] pInventory; public ItemStack[] pInventory;
public ItemStack[] pArmor; public ItemStack[] pArmor;
@ -23,7 +22,6 @@ public class PlayerArenaData {
ItemStack[] pInventory, ItemStack[] pArmor, Float pEXP, ItemStack[] pInventory, ItemStack[] pArmor, Float pEXP,
Integer pEXPL, Double pHealth, Integer pFood, Integer pEXPL, Double pHealth, Integer pFood,
Collection<PotionEffect> pPotionEffects, boolean pFlying) { Collection<PotionEffect> pPotionEffects, boolean pFlying) {
this.pLocation = pLocation;
this.pGameMode = pGameMode; this.pGameMode = pGameMode;
this.pInventory = pInventory; this.pInventory = pInventory;
this.pArmor = pArmor; this.pArmor = pArmor;