Merge remote-tracking branch 'origin/clans-beta' into clans-beta

This commit is contained in:
Shaun Bennett 2015-11-26 02:46:56 -05:00
commit 75ff5bb3da
11 changed files with 27 additions and 15 deletions

View File

@ -13,7 +13,7 @@ public class AddCommand extends CommandBase<NpcManager>
{ {
public AddCommand(NpcManager plugin) public AddCommand(NpcManager plugin)
{ {
super(plugin, Rank.DEVELOPER, "add"); super(plugin, Rank.JNR_DEV, "add");
} }
@Override @Override

View File

@ -12,7 +12,7 @@ public class DeleteCommand extends CommandBase<NpcManager>
{ {
public DeleteCommand(NpcManager plugin) public DeleteCommand(NpcManager plugin)
{ {
super(plugin, Rank.DEVELOPER, "del"); super(plugin, Rank.JNR_DEV, "del");
} }
@Override @Override

View File

@ -10,7 +10,7 @@ public class NpcCommand extends MultiCommandBase<NpcManager>
{ {
public NpcCommand(NpcManager plugin) public NpcCommand(NpcManager plugin)
{ {
super(plugin, Rank.DEVELOPER, new Rank[] {Rank.JNR_DEV}, "npc"); super(plugin, Rank.JNR_DEV, "npc");
AddCommand(new AddCommand(plugin)); AddCommand(new AddCommand(plugin));
AddCommand(new DeleteCommand(plugin)); AddCommand(new DeleteCommand(plugin));

View File

@ -1,5 +1,7 @@
package mineplex.game.clans.core.repository; package mineplex.game.clans.core.repository;
import org.bukkit.Location;
import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken; import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken;
public class ClanTerritory public class ClanTerritory
@ -16,4 +18,14 @@ public class ClanTerritory
public boolean Safe; public boolean Safe;
public String Owner = ""; public String Owner = "";
public String Chunk = ""; public String Chunk = "";
public boolean isSafe(Location location)
{
if (Owner.equals("Spawn"))
{
return location.getY() > 190;
}
return Safe;
}
} }

View File

@ -742,6 +742,6 @@ public class ClansAdmin
Clans.getClanDataAccess().safe(claim, caller.getName()); Clans.getClanDataAccess().safe(claim, caller.getName());
//Inform //Inform
UtilPlayer.message(caller, F.main("Clans Admin", "Territory Safe Zone: " + F.tf(claim.Safe))); UtilPlayer.message(caller, F.main("Clans Admin", "Territory Safe Zone: " + F.tf(claim.isSafe(caller.getLocation()))));
} }
} }

View File

@ -246,7 +246,7 @@ public class ClansUtility
{ {
if (!Clans.getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) return false; if (!Clans.getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) return false;
return Clans.getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).Safe; return Clans.getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).isSafe(loc);
} }
public boolean isChunkHome(ClanInfo clan, Chunk chunk) public boolean isChunkHome(ClanInfo clan, Chunk chunk)
@ -439,15 +439,15 @@ public class ClansUtility
} }
// Player Territory // Player Territory
public ClanRelation relPT(Player pA, String tB) public ClanRelation relPT(Player player, String territory)
{ {
ClanTerritory claim = getClaim(tB); ClanTerritory claim = getClaim(territory);
if (claim != null && claim.Safe) if (claim != null && claim.isSafe(player.getLocation()))
{ {
return ClanRelation.SAFE; return ClanRelation.SAFE;
} }
return rel(getClanByPlayer(pA), getOwner(tB)); return rel(getClanByPlayer(player), getOwner(territory));
} }
// Clan Territory // Clan Territory

View File

@ -16,7 +16,7 @@ public class RegionsCommand extends CommandBase<ClansManager>
public RegionsCommand(ClansManager plugin) public RegionsCommand(ClansManager plugin)
{ {
super(plugin, Rank.ADMIN, "region-reset"); super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV},"region-reset");
_manager = plugin; _manager = plugin;
} }

View File

@ -155,7 +155,7 @@ public class ObserverManager extends MiniPlugin
{ {
ClanTerritory territory = _clansManager.getClanUtility().getClaim(player.getLocation()); ClanTerritory territory = _clansManager.getClanUtility().getClaim(player.getLocation());
if (territory == null || !territory.Safe) if (territory == null || !territory.isSafe(player.getLocation()))
{ {
if (notify) if (notify)
UtilPlayer.message(player, F.main("Observer", "You must be in a Safe Zone to use observer mode!")); UtilPlayer.message(player, F.main("Observer", "You must be in a Safe Zone to use observer mode!"));

View File

@ -66,9 +66,9 @@ public class ClansRegions extends MiniPlugin
Location worldCenter = new Location(_world, 0, 0, 0); Location worldCenter = new Location(_world, 0, 0, 0);
// Initialize Spawn faction and claims // Initialize Spawn faction and claims
claimArea("Spawn", SPAWN_RADIUS, 1, false, new Location[]{Spawn.getEastSpawn(), Spawn.getWestSpawn()}); // Claim unsafe area around claimArea("Spawn", SPAWN_RADIUS, 0, false, new Location[]{Spawn.getEastSpawn(), Spawn.getWestSpawn()});
claimArea("Spawn", SPAWN_RADIUS, 0, true, new Location[]{Spawn.getEastSpawn(), Spawn.getWestSpawn()}); // Claim the centre safe chunk
claimArea("Shops", SHOP_RADIUS, 2, false, new Location[]{Spawn.getNorthTownCenter(), Spawn.getSouthTownCenter()});
claimArea("Shops", SHOP_RADIUS, 0, true, new Location[]{Spawn.getNorthTownCenter(), Spawn.getSouthTownCenter()}); claimArea("Shops", SHOP_RADIUS, 0, true, new Location[]{Spawn.getNorthTownCenter(), Spawn.getSouthTownCenter()});
// Initialize Fields and Borderlands factions and claims // Initialize Fields and Borderlands factions and claims

View File

@ -94,7 +94,7 @@ public class Gameplay extends MiniPlugin
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void spawnDamage(CustomDamageEvent event) public void spawnDamage(CustomDamageEvent event)
{ {
if (_clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()) != null && _clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()).Safe) if (_clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()) != null && _clansManager.getClanUtility().getClaim(event.GetDamageeEntity().getLocation()).isSafe(event.GetDamageeEntity().getLocation()))
{ {
event.SetCancelled("Safe Zone"); event.SetCancelled("Safe Zone");
} }

View File

@ -27,7 +27,7 @@ public class MagneticMaul extends LegendaryItem
Location loc = wielder.getLocation(); Location loc = wielder.getLocation();
if (ClansManager.getInstance().getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk()))) if (ClansManager.getInstance().getClaimMap().containsKey(UtilWorld.chunkToStr(loc.getChunk())))
{ {
if (!ClansManager.getInstance().getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).Safe) if (!ClansManager.getInstance().getClaimMap().get(UtilWorld.chunkToStr(loc.getChunk())).isSafe(wielder.getLocation()))
{ {
return; return;
} }