Rename Board --> BoardOld

This commit is contained in:
Olof Larsson 2013-04-11 07:01:30 +02:00
parent 828c149cb0
commit 9d347715d5
18 changed files with 64 additions and 65 deletions

View File

@ -21,7 +21,7 @@ import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.util.AsciiCompass;
public class Board
public class BoardOld
{
private static transient File file = new File(Factions.get().getDataFolder(), "board.json");
private static transient HashMap<FLocation, TerritoryAccess> flocationIds = new HashMap<FLocation, TerritoryAccess>();

View File

@ -173,7 +173,7 @@ public enum FPerm
}
public boolean has(Object testSubject, FLocation floc, boolean informIfNot)
{
TerritoryAccess access = Board.getTerritoryAccessAt(floc);
TerritoryAccess access = BoardOld.getTerritoryAccessAt(floc);
if (this.isTerritoryPerm())
{
if (access.subjectHasAccess(testSubject)) return true;

View File

@ -299,7 +299,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
public Rel getRelationToLocation()
{
return Board.getFactionAt(new FLocation(this)).getRelationTo(this);
return BoardOld.getFactionAt(new FLocation(this)).getRelationTo(this);
}
@Override
@ -420,7 +420,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
//----------------------------------------------//
public boolean isInOwnTerritory()
{
return Board.getFactionAt(new FLocation(this)) == this.getFaction();
return BoardOld.getFactionAt(new FLocation(this)) == this.getFaction();
}
/*public boolean isInOthersTerritory()
@ -441,7 +441,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
public boolean isInEnemyTerritory()
{
return Board.getFactionAt(new FLocation(this)).getRelationTo(this) == Rel.ENEMY;
return BoardOld.getFactionAt(new FLocation(this)).getRelationTo(this) == Rel.ENEMY;
}
public void sendFactionHereMessage()
@ -450,7 +450,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
{
return;
}
Faction factionHere = Board.getFactionAt(this.getLastStoodAt());
Faction factionHere = BoardOld.getFactionAt(this.getLastStoodAt());
String msg = Txt.parse("<i>")+" ~ "+factionHere.getTag(this);
if (factionHere.getDescription().length() > 0)
{
@ -538,7 +538,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
String error = null;
FLocation flocation = new FLocation(location);
Faction myFaction = getFaction();
Faction currentFaction = Board.getFactionAt(flocation);
Faction currentFaction = BoardOld.getFactionAt(flocation);
int ownedLand = forFaction.getLandRounded();
if (ConfServer.worldGuardChecking && Worldguard.checkForRegionsInChunk(location))
@ -587,7 +587,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
ConfServer.claimsMustBeConnected
&& ! this.hasAdminMode()
&& myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0
&& !Board.isConnectedLocation(flocation, myFaction)
&& !BoardOld.isConnectedLocation(flocation, myFaction)
&& (!ConfServer.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal())
)
{
@ -603,7 +603,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
// TODO more messages WARN current faction most importantly
error = Txt.parse("%s<i> owns this land and is strong enough to keep it.", currentFaction.getTag(this));
}
else if ( ! Board.isBorderLocation(flocation))
else if ( ! BoardOld.isBorderLocation(flocation))
{
error = Txt.parse("<b>You must start claiming land at the border of the territory.");
}
@ -622,7 +622,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
// return value is false on failure, true on success
FLocation flocation = new FLocation(location);
Faction currentFaction = Board.getFactionAt(flocation);
Faction currentFaction = BoardOld.getFactionAt(flocation);
int ownedLand = forFaction.getLandRounded();
@ -637,7 +637,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
{
cost = Econ.calculateClaimCost(ownedLand, currentFaction.isNormal());
if (ConfServer.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.isConnectedLocation(flocation, forFaction))
if (ConfServer.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !BoardOld.isConnectedLocation(flocation, forFaction))
cost += ConfServer.econClaimUnconnectedFee;
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts && this.hasFaction())
@ -667,7 +667,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
fp.msg("<h>%s<i> claimed land for <h>%s<i> from <h>%s<i>.", this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
}
Board.setFactionAt(forFaction, flocation);
BoardOld.setFactionAt(forFaction, flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
if (ConfServer.logLandClaims)

View File

@ -74,7 +74,7 @@ public class Faction extends Entity implements EconomyParticipator
}
public void confirmValidHome()
{
if (!ConfServer.homesMustBeInClaimedTerritory || this.home == null || (this.home.getLocation() != null && Board.getFactionAt(new FLocation(this.home.getLocation())) == this))
if (!ConfServer.homesMustBeInClaimedTerritory || this.home == null || (this.home.getLocation() != null && BoardOld.getFactionAt(new FLocation(this.home.getLocation())) == this))
return;
msg("<b>Your faction home has been un-set since it is no longer in your territory.");
@ -349,12 +349,12 @@ public class Faction extends Entity implements EconomyParticipator
}
public int getLandRounded() {
return Board.getFactionCoordCount(this);
return BoardOld.getFactionCoordCount(this);
}
public int getLandRoundedInWorld(String worldName)
{
return Board.getFactionCoordCountInWorld(this, worldName);
return BoardOld.getFactionCoordCountInWorld(this, worldName);
}
public boolean hasLandInflation()
@ -548,7 +548,7 @@ public class Faction extends Entity implements EconomyParticipator
}
// Clean the board
Board.clean();
BoardOld.clean();
// Clean the fplayers
FPlayerColl.i.clean();

View File

@ -188,7 +188,7 @@ public class FactionColl extends EntityCollection<Faction>
if ( ! this.exists(id))
{
Factions.get().log(Level.WARNING, "Non existing factionId "+id+" requested! Issuing cleaning!");
Board.clean();
BoardOld.clean();
FPlayerColl.i.clean();
}

View File

@ -81,7 +81,7 @@ public class Factions extends MPlugin
// Load Conf from disk
FPlayerColl.i.loadFromDisc();
FactionColl.i.loadFromDisc();
Board.load();
BoardOld.load();
// Add Base Commands
this.cmdAutoHelp = new CmdFactionsAutoHelp();
@ -146,7 +146,7 @@ public class Factions extends MPlugin
// only save data if plugin actually completely loaded successfully
if (this.loadSuccessful)
{
Board.save();
BoardOld.save();
}
EssentialsFeatures.unhookChat();
if (AutoLeaveTask != null)
@ -157,8 +157,7 @@ public class Factions extends MPlugin
super.onDisable();
}
//
public void startAutoLeaveTask(boolean restartIfRunning)
{
@ -195,7 +194,7 @@ public class Factions extends MPlugin
@Override
public void postAutoSave()
{
Board.save();
BoardOld.save();
}
@Override

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FLocation;
@ -38,7 +38,7 @@ public class CmdFactionsAccess extends FCommand
type = (type == null) ? "" : type.toLowerCase();
FLocation loc = new FLocation(me.getLocation());
TerritoryAccess territory = Board.getTerritoryAccessAt(loc);
TerritoryAccess territory = BoardOld.getTerritoryAccessAt(loc);
Faction locFaction = territory.getHostFaction();
boolean accessAny = Perm.ACCESS_ANY.has(sender, false);

View File

@ -7,7 +7,7 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FLocation;
@ -75,7 +75,7 @@ public class CmdFactionsHome extends FCommand
return;
}
Faction faction = Board.getFactionAt(new FLocation(me.getLocation()));
Faction faction = BoardOld.getFactionAt(new FLocation(me.getLocation()));
Location loc = me.getLocation().clone();
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Perm;
@ -61,7 +61,7 @@ public class CmdFactionsMap extends FCommand
public void showMap()
{
sendMessage(Board.getMap(myFaction, new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
sendMessage(BoardOld.getMap(myFaction, new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
}
}

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Factions;
@ -36,7 +36,7 @@ public class CmdFactionsReload extends FCommand
if (file.startsWith("b"))
{
Board.load();
BoardOld.load();
fileName = "board.json";
}
else if (file.startsWith("f"))
@ -54,7 +54,7 @@ public class CmdFactionsReload extends FCommand
fileName = "all";
FPlayerColl.i.loadFromDisc();
FactionColl.i.loadFromDisc();
Board.load();
BoardOld.load();
}
else
{

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Perm;
@ -31,7 +31,7 @@ public class CmdFactionsSaveAll extends FCommand
{
FPlayerColl.i.saveToDisc();
FactionColl.i.saveToDisc();
Board.save();
BoardOld.save();
msg("<i>Factions saved to disk!");
}

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPerm;
@ -47,7 +47,7 @@ public class CmdFactionsSethome extends FCommand
&&
ConfServer.homesMustBeInClaimedTerritory
&&
Board.getFactionAt(new FLocation(me)) != faction
BoardOld.getFactionAt(new FLocation(me)) != faction
)
{
fme.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import org.bukkit.Bukkit;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.event.LandUnclaimEvent;
import com.massivecraft.factions.integration.Econ;
@ -36,7 +36,7 @@ public class CmdFactionsUnclaim extends FCommand
public void perform()
{
FLocation flocation = new FLocation(fme);
Faction otherFaction = Board.getFactionAt(flocation);
Faction otherFaction = BoardOld.getFactionAt(flocation);
if ( ! FPerm.TERRITORY.has(sender, otherFaction, true)) return;
@ -59,7 +59,7 @@ public class CmdFactionsUnclaim extends FCommand
}
}
Board.removeAt(flocation);
BoardOld.removeAt(flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import org.bukkit.Bukkit;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
@ -49,7 +49,7 @@ public class CmdFactionsUnclaimall extends FCommand
Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent);
// this event cannot be cancelled
Board.unclaimAll(myFaction.getId());
BoardOld.unclaimAll(myFaction.getId());
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
SpoutFeatures.updateTerritoryDisplayLoc(null);

View File

@ -8,7 +8,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPlayer;
@ -90,7 +90,7 @@ public class SpoutMainListener implements Listener
private void doLabels(FPlayer player, SpoutPlayer sPlayer, boolean notify)
{
FLocation here = player.getLastStoodAt();
Faction factionHere = Board.getFactionAt(here);
Faction factionHere = BoardOld.getFactionAt(here);
String tag = factionHere.getColorTo(player).toString() + factionHere.getTag();
// ----------------------
@ -177,7 +177,7 @@ public class SpoutMainListener implements Listener
}
String msg = "";
TerritoryAccess access = Board.getTerritoryAccessAt(here);
TerritoryAccess access = BoardOld.getTerritoryAccessAt(here);
if ( ! access.isDefault())
{

View File

@ -14,7 +14,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FLocation;
@ -31,7 +31,7 @@ public class FactionsBlockListener implements Listener
{
if (event.isCancelled()) return;
if (event.getSource().getTypeId() != 51) return; // Must be Fire
Faction faction = Board.getFactionAt(event.getBlock());
Faction faction = BoardOld.getFactionAt(event.getBlock());
if (faction.getFlag(FFlag.FIRESPREAD) == false)
{
event.setCancelled(true);
@ -42,7 +42,7 @@ public class FactionsBlockListener implements Listener
public void onBlockBurn(BlockBurnEvent event)
{
if (event.isCancelled()) return;
Faction faction = Board.getFactionAt(event.getBlock());
Faction faction = BoardOld.getFactionAt(event.getBlock());
if (faction.getFlag(FFlag.FIRESPREAD) == false)
{
event.setCancelled(true);
@ -63,7 +63,7 @@ public class FactionsBlockListener implements Listener
if (me.hasAdminMode()) return true;
FLocation loc = new FLocation(location);
Faction factionHere = Board.getFactionAt(loc);
Faction factionHere = BoardOld.getFactionAt(loc);
if ( ! FPerm.BUILD.has(me, location) && FPerm.PAINBUILD.has(me, location))
{
@ -117,13 +117,13 @@ public class FactionsBlockListener implements Listener
if (event.isCancelled()) return;
if ( ! ConfServer.pistonProtectionThroughDenyBuild) return;
Faction pistonFaction = Board.getFactionAt(new FLocation(event.getBlock()));
Faction pistonFaction = BoardOld.getFactionAt(new FLocation(event.getBlock()));
// target end-of-the-line empty (air) block which is being pushed into, including if piston itself would extend into air
Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1);
// members of faction might not have build rights in their own territory, but pistons should still work regardless; so, address that corner case
Faction targetFaction = Board.getFactionAt(new FLocation(targetBlock));
Faction targetFaction = BoardOld.getFactionAt(new FLocation(targetBlock));
if (targetFaction == pistonFaction) return;
// if potentially pushing into air/water/lava in another territory, we need to check it out
@ -150,10 +150,10 @@ public class FactionsBlockListener implements Listener
// if potentially retracted block is just air/water/lava, no worries
if (targetLoc.getBlock().isEmpty() || targetLoc.getBlock().isLiquid()) return;
Faction pistonFaction = Board.getFactionAt(new FLocation(event.getBlock()));
Faction pistonFaction = BoardOld.getFactionAt(new FLocation(event.getBlock()));
// members of faction might not have build rights in their own territory, but pistons should still work regardless; so, address that corner case
Faction targetFaction = Board.getFactionAt(new FLocation(targetLoc));
Faction targetFaction = BoardOld.getFactionAt(new FLocation(targetLoc));
if (targetFaction == pistonFaction) return;
if ( ! FPerm.BUILD.has(pistonFaction, targetLoc))

View File

@ -38,7 +38,7 @@ import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.FFlag;
@ -61,7 +61,7 @@ public class FactionsEntityListener implements Listener
Player player = (Player) entity;
FPlayer fplayer = FPlayerColl.i.get(player);
Faction faction = Board.getFactionAt(new FLocation(player.getLocation()));
Faction faction = BoardOld.getFactionAt(new FLocation(player.getLocation()));
PowerLossEvent powerLossEvent = new PowerLossEvent(faction,fplayer);
// Check for no power loss conditions
@ -129,7 +129,7 @@ public class FactionsEntityListener implements Listener
}
for (FLocation loc : explosionLocs)
{
Faction faction = Board.getFactionAt(loc);
Faction faction = BoardOld.getFactionAt(loc);
if (faction.getFlag(FFlag.EXPLOSIONS) == false)
{
// faction has explosions disabled
@ -231,7 +231,7 @@ public class FactionsEntityListener implements Listener
Location defenderLoc = defender.getPlayer().getLocation();
Faction defLocFaction = Board.getFactionAt(new FLocation(defenderLoc));
Faction defLocFaction = BoardOld.getFactionAt(new FLocation(defenderLoc));
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
if (damager instanceof Projectile)
@ -272,7 +272,7 @@ public class FactionsEntityListener implements Listener
return false;
}
Faction locFaction = Board.getFactionAt(new FLocation(attacker));
Faction locFaction = BoardOld.getFactionAt(new FLocation(attacker));
// so we know from above that the defender isn't in a safezone... what about the attacker, sneaky dog that he might be?
if (locFaction.getFlag(FFlag.PVP) == false)
@ -351,7 +351,7 @@ public class FactionsEntityListener implements Listener
if (event.getLocation() == null) return;
FLocation floc = new FLocation(event.getLocation());
Faction faction = Board.getFactionAt(floc);
Faction faction = BoardOld.getFactionAt(floc);
if (faction.getFlag(FFlag.MONSTERS)) return;
if ( ! Const.ENTITY_TYPES_MONSTERS.contains(event.getEntityType())) return;
@ -374,7 +374,7 @@ public class FactionsEntityListener implements Listener
if ( ! Const.ENTITY_TYPES_MONSTERS.contains(event.getEntity().getType())) return;
FLocation floc = new FLocation(target.getLocation());
Faction faction = Board.getFactionAt(floc);
Faction faction = BoardOld.getFactionAt(floc);
if (faction.getFlag(FFlag.MONSTERS)) return;
@ -388,7 +388,7 @@ public class FactionsEntityListener implements Listener
if (event.getCause() == RemoveCause.EXPLOSION)
{
Faction faction = Board.getFactionAt(new FLocation(event.getEntity().getLocation()));
Faction faction = BoardOld.getFactionAt(new FLocation(event.getEntity().getLocation()));
if (faction.getFlag(FFlag.EXPLOSIONS) == false)
{ // faction has explosions disabled
event.setCancelled(true);
@ -435,7 +435,7 @@ public class FactionsEntityListener implements Listener
if (!(entity instanceof Enderman) && !(entity instanceof Wither)) return;
FLocation floc = new FLocation(event.getBlock());
Faction faction = Board.getFactionAt(floc);
Faction faction = BoardOld.getFactionAt(floc);
if (entity instanceof Enderman)
{

View File

@ -24,7 +24,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.util.NumberConversions;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.BoardOld;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.FFlag;
@ -96,17 +96,17 @@ public class FactionsPlayerListener implements Listener
// Yes we did change coord (:
me.setLastStoodAt(to);
TerritoryAccess access = Board.getTerritoryAccessAt(to);
TerritoryAccess access = BoardOld.getTerritoryAccessAt(to);
// Did we change "host"(faction)?
boolean changedFaction = (Board.getFactionAt(from) != access.getHostFaction());
boolean changedFaction = (BoardOld.getFactionAt(from) != access.getHostFaction());
// let Spout handle most of this if it's available
boolean handledBySpout = changedFaction && SpoutFeatures.updateTerritoryDisplay(me);
if (me.isMapAutoUpdating())
{
me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
me.sendMessage(BoardOld.getMap(me.getFaction(), to, player.getLocation().getYaw()));
}
else if (changedFaction && ! handledBySpout)
{
@ -303,7 +303,7 @@ public class FactionsPlayerListener implements Listener
}
Rel rel = me.getRelationToLocation();
if (Board.getFactionAt(me.getLastStoodAt()).isNone()) return;
if (BoardOld.getFactionAt(me.getLastStoodAt()).isNone()) return;
if (rel == Rel.NEUTRAL && isCommandInList(fullCmd, ConfServer.territoryNeutralDenyCommands))
{