mirror of
https://github.com/taoneill/war.git
synced 2024-11-13 05:54:31 +01:00
Closes gh-76. Stopping item drop near zone borders to prevent item duping exploit at lobby gates. Better zone name matching. Updated plugin.yml to War v1.2 (Bradley).
This commit is contained in:
parent
e3f7dd1989
commit
1cf30f18b8
@ -1002,7 +1002,7 @@ public class War extends JavaPlugin {
|
||||
} else {
|
||||
boolean warped = false;
|
||||
for(Warzone warzone : this.getWarzones()) {
|
||||
if(warzone.getName().toLowerCase().startsWith(arguments[0]) && warzone.getTeleport() != null){
|
||||
if(warzone.getName().toLowerCase().startsWith(arguments[0].toLowerCase()) && warzone.getTeleport() != null){
|
||||
Team playerTeam = getPlayerTeam(player.getName());
|
||||
if(playerTeam != null) {
|
||||
Warzone playerWarzone = getPlayerTeamWarzone(player.getName());
|
||||
@ -1233,7 +1233,7 @@ public class War extends JavaPlugin {
|
||||
Warzone currentZone = warzone(location);
|
||||
if(currentZone == null) {
|
||||
return false;
|
||||
} else if (warzoneName.equals(currentZone.getName())){
|
||||
} else if (warzoneName.toLowerCase().equals(currentZone.getName().toLowerCase())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1275,7 +1275,7 @@ public class War extends JavaPlugin {
|
||||
// the only way to find a zone that has only one corner
|
||||
public Warzone findWarzone(String warzoneName) {
|
||||
for(Warzone warzone : warzones) {
|
||||
if(warzone.getName().equals(warzoneName)) {
|
||||
if(warzone.getName().toLowerCase().equals(warzoneName.toLowerCase())) {
|
||||
return warzone;
|
||||
}
|
||||
}
|
||||
@ -1422,7 +1422,7 @@ public class War extends JavaPlugin {
|
||||
ZoneLobby currentLobby = lobby(location);
|
||||
if(currentLobby == null) {
|
||||
return false;
|
||||
} else if (warzoneName.equals(currentLobby.getZone().getName())){
|
||||
} else if (warzoneName.toLowerCase().equals(currentLobby.getZone().getName().toLowerCase())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -118,6 +118,12 @@ public class WarPlayerListener extends PlayerListener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(zone.isNearWall(player.getLocation()) && itemStack != null) {
|
||||
war.badMsg(player, "Can't drop items near the zone border!");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -220,6 +221,21 @@ public class Warzone {
|
||||
}
|
||||
|
||||
initZone();
|
||||
|
||||
// Set the zone chunks to all players
|
||||
World world = this.getWorld();
|
||||
if(world instanceof CraftWorld) {
|
||||
CraftWorld craftWorld = (CraftWorld)world;
|
||||
// team spawns
|
||||
for(Team team : teams) {
|
||||
if(team.getPlayers().size() > 0) {
|
||||
craftWorld.refreshChunk(team.getTeamSpawn().getBlockX(), team.getTeamSpawn().getBlockZ());
|
||||
craftWorld.refreshChunk(team.getSpawnVolume().getCornerOne().getX(), team.getSpawnVolume().getCornerOne().getZ());
|
||||
craftWorld.refreshChunk(team.getSpawnVolume().getCornerTwo().getX(), team.getSpawnVolume().getCornerTwo().getZ());
|
||||
}
|
||||
}
|
||||
// dont do all the zone chunks for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,10 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
||||
import bukkit.tommytony.war.War;
|
||||
|
||||
@ -242,6 +244,12 @@ public class ZoneLobby {
|
||||
} else {
|
||||
war.logWarn("Failed to initalize zone lobby for zone " + warzone.getName());
|
||||
}
|
||||
World world = warzone.getWorld();
|
||||
if(world instanceof CraftWorld && lobbyMiddleWallBlock != null) {
|
||||
((CraftWorld)world).refreshChunk(lobbyMiddleWallBlock.getX(), lobbyMiddleWallBlock.getZ());
|
||||
((CraftWorld)world).refreshChunk(volume.getCornerOne().getX(), volume.getCornerOne().getZ());
|
||||
((CraftWorld)world).refreshChunk(volume.getCornerTwo().getX(), volume.getCornerTwo().getZ());
|
||||
}
|
||||
}
|
||||
|
||||
private void setGatePositions(Block lobbyMiddleWallBlock) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: War
|
||||
version: 1.1 (Guderian)
|
||||
version: 1.2 (Bradley)
|
||||
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||
author: tommytony
|
||||
website: war.tommytony.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: War
|
||||
version: 1.1 (Guderian)
|
||||
version: 1.2 (Bradley)
|
||||
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||
author: tommytony
|
||||
website: war.tommytony.com
|
||||
|
Loading…
Reference in New Issue
Block a user