Remove deprecated isNone usages in favor of isWilderness

This commit is contained in:
drtshock 2015-09-08 11:46:48 -05:00
parent 088c6e11b1
commit 4414b1589f
12 changed files with 29 additions and 29 deletions

View File

@ -58,7 +58,7 @@ public class CmdKick extends FCommand {
Faction toKickFaction = toKick.getFaction(); Faction toKickFaction = toKick.getFaction();
if (toKickFaction.isNone()) { if (toKickFaction.isWilderness()) {
sender.sendMessage(TL.COMMAND_KICK_NONE.toString()); sender.sendMessage(TL.COMMAND_KICK_NONE.toString());
return; return;
} }

View File

@ -104,7 +104,7 @@ public class CmdList extends FCommand {
lines.add(p.txt.parse(header)); lines.add(p.txt.parse(header));
for (Faction faction : factionList.subList(start, end)) { for (Faction faction : factionList.subList(start, end)) {
if (faction.isNone()) { if (faction.isWilderness()) {
lines.add(p.txt.parse(TagUtil.parsePlain(faction, p.getConfig().getString("list.factionless", defaults[1])))); lines.add(p.txt.parse(TagUtil.parsePlain(faction, p.getConfig().getString("list.factionless", defaults[1]))));
continue; continue;
} }

View File

@ -77,7 +77,7 @@ public class CmdStuck extends FCommand {
public boolean work() { public boolean work() {
FLocation chunk = currentFLocation(); FLocation chunk = currentFLocation();
Faction faction = board.getFactionAt(chunk); Faction faction = board.getFactionAt(chunk);
if (faction.isNone()) { if (faction.isWilderness()) {
int cx = FLocation.chunkToBlock((int) chunk.getX()); int cx = FLocation.chunkToBlock((int) chunk.getX());
int cz = FLocation.chunkToBlock((int) chunk.getZ()); int cz = FLocation.chunkToBlock((int) chunk.getZ());
int y = world.getHighestBlockYAt(cx, cz); int y = world.getHighestBlockYAt(cx, cz);

View File

@ -491,7 +491,7 @@ public class EngineDynmap {
if (faction == null) { if (faction == null) {
return null; return null;
} }
if (faction.isNone()) { if (faction.isWilderness()) {
return null; return null;
} }
String factionId = faction.getId(); String factionId = faction.getId();
@ -506,7 +506,7 @@ public class EngineDynmap {
if (faction == null) { if (faction == null) {
return null; return null;
} }
if (faction.isNone()) { if (faction.isWilderness()) {
return null; return null;
} }

View File

@ -137,7 +137,7 @@ public class FactionsBlockListener implements Listener {
return true; return true;
} }
if (otherFaction.isNone()) { if (otherFaction.isWilderness()) {
if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName())) { if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName())) {
return true; return true;
} }
@ -180,7 +180,7 @@ public class FactionsBlockListener implements Listener {
FLocation loc = new FLocation(location); FLocation loc = new FLocation(location);
Faction otherFaction = Board.getInstance().getFactionAt(loc); Faction otherFaction = Board.getInstance().getFactionAt(loc);
if (otherFaction.isNone()) { if (otherFaction.isWilderness()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) { if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true; return true;
} }

View File

@ -57,7 +57,7 @@ public class FactionsEntityListener implements Listener {
if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
powerLossEvent.setMessage(TL.PLAYER_POWER_LOSS_WARZONE.toString()); powerLossEvent.setMessage(TL.PLAYER_POWER_LOSS_WARZONE.toString());
} }
} else if (faction.isNone() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) { } else if (faction.isWilderness() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) {
powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WILDERNESS.toString()); powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WILDERNESS.toString());
powerLossEvent.setCancelled(true); powerLossEvent.setCancelled(true);
} else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { } else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
@ -150,7 +150,7 @@ public class FactionsEntityListener implements Listener {
boolean online = faction.hasPlayersOnline(); boolean online = faction.hasPlayersOnline();
//TODO: :( //TODO: :(
if (boomer instanceof Creeper && ((faction.isNone() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) || (faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockCreepers) || (faction.isWarZone() && Conf.warZoneBlockCreepers) ||
faction.isSafeZone())) { faction.isSafeZone())) {
@ -158,13 +158,13 @@ public class FactionsEntityListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} else if ( } else if (
// it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever // it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
(boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isNone() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || (boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) || (faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockFireballs) || (faction.isWarZone() && Conf.warZoneBlockFireballs) ||
faction.isSafeZone())) { faction.isSafeZone())) {
// ghast fireball which needs prevention // ghast fireball which needs prevention
event.setCancelled(true); event.setCancelled(true);
} else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && ((faction.isNone() && Conf.wildernessBlockTNT && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || } else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && ((faction.isWilderness() && Conf.wildernessBlockTNT && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline)) || (faction.isNormal() && (online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockTNT) || (faction.isWarZone() && Conf.warZoneBlockTNT) ||
(faction.isSafeZone() && Conf.safeZoneBlockTNT))) { (faction.isSafeZone() && Conf.safeZoneBlockTNT))) {
@ -349,12 +349,12 @@ public class FactionsEntityListener implements Listener {
Faction defendFaction = defender.getFaction(); Faction defendFaction = defender.getFaction();
Faction attackFaction = attacker.getFaction(); Faction attackFaction = attacker.getFaction();
if (attackFaction.isNone() && Conf.disablePVPForFactionlessPlayers) { if (attackFaction.isWilderness() && Conf.disablePVPForFactionlessPlayers) {
if (notify) { if (notify) {
attacker.msg(TL.PLAYER_PVP_REQUIREFACTION); attacker.msg(TL.PLAYER_PVP_REQUIREFACTION);
} }
return false; return false;
} else if (defendFaction.isNone()) { } else if (defendFaction.isWilderness()) {
if (defLocFaction == attackFaction && Conf.enablePVPAgainstFactionlessInAttackersLand) { if (defLocFaction == attackFaction && Conf.enablePVPAgainstFactionlessInAttackersLand) {
// Allow PVP vs. Factionless in attacker's faction territory // Allow PVP vs. Factionless in attacker's faction territory
return true; return true;
@ -471,7 +471,7 @@ public class FactionsEntityListener implements Listener {
boolean online = faction.hasPlayersOnline(); boolean online = faction.hasPlayersOnline();
if ((faction.isNone() && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()) && (Conf.wildernessBlockCreepers || Conf.wildernessBlockFireballs || Conf.wildernessBlockTNT)) || if ((faction.isWilderness() && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()) && (Conf.wildernessBlockCreepers || Conf.wildernessBlockFireballs || Conf.wildernessBlockTNT)) ||
(faction.isNormal() && (online ? (Conf.territoryBlockCreepers || Conf.territoryBlockFireballs || Conf.territoryBlockTNT) : (Conf.territoryBlockCreepersWhenOffline || Conf.territoryBlockFireballsWhenOffline || Conf.territoryBlockTNTWhenOffline))) || (faction.isNormal() && (online ? (Conf.territoryBlockCreepers || Conf.territoryBlockFireballs || Conf.territoryBlockTNT) : (Conf.territoryBlockCreepersWhenOffline || Conf.territoryBlockFireballsWhenOffline || Conf.territoryBlockTNTWhenOffline))) ||
(faction.isWarZone() && (Conf.warZoneBlockCreepers || Conf.warZoneBlockFireballs || Conf.warZoneBlockTNT)) || (faction.isWarZone() && (Conf.warZoneBlockCreepers || Conf.warZoneBlockFireballs || Conf.warZoneBlockTNT)) ||
faction.isSafeZone()) { faction.isSafeZone()) {
@ -519,7 +519,7 @@ public class FactionsEntityListener implements Listener {
} else if (entity instanceof Wither) { } else if (entity instanceof Wither) {
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc)); Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
// it's a bit crude just using fireball protection, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever // it's a bit crude just using fireball protection, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
if ((faction.isNone() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || if ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
(faction.isNormal() && (faction.hasPlayersOnline() ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) || (faction.isNormal() && (faction.hasPlayersOnline() ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockFireballs) || (faction.isWarZone() && Conf.warZoneBlockFireballs) ||
faction.isSafeZone()) { faction.isSafeZone()) {
@ -540,7 +540,7 @@ public class FactionsEntityListener implements Listener {
if (event.useTravelAgent() && agent.getCanCreatePortal() && agent.findPortal(event.getTo()) == null) { if (event.useTravelAgent() && agent.getCanCreatePortal() && agent.findPortal(event.getTo()) == null) {
FLocation loc = new FLocation(event.getTo()); FLocation loc = new FLocation(event.getTo());
Faction faction = Board.getInstance().getFactionAt(loc); Faction faction = Board.getInstance().getFactionAt(loc);
if (faction.isNone()) { if (faction.isWilderness()) {
return; // We don't care about wilderness. return; // We don't care about wilderness.
} else if (!faction.isNormal() && !event.getPlayer().isOp()) { } else if (!faction.isNormal() && !event.getPlayer().isOp()) {
// Don't let non ops make portals in safezone or warzone. // Don't let non ops make portals in safezone or warzone.
@ -572,7 +572,7 @@ public class FactionsEntityListener implements Listener {
FLocation fLoc = new FLocation(loc); FLocation fLoc = new FLocation(loc);
Faction claimFaction = Board.getInstance().getFactionAt(fLoc); Faction claimFaction = Board.getInstance().getFactionAt(fLoc);
if (claimFaction.isNone()) { if (claimFaction.isWilderness()) {
return Conf.wildernessDenyEndermanBlocks; return Conf.wildernessDenyEndermanBlocks;
} else if (claimFaction.isNormal()) { } else if (claimFaction.isNormal()) {
return claimFaction.hasPlayersOnline() ? Conf.territoryDenyEndermanBlocks : Conf.territoryDenyEndermanBlocksWhenOffline; return claimFaction.hasPlayersOnline() ? Conf.territoryDenyEndermanBlocks : Conf.territoryDenyEndermanBlocksWhenOffline;

View File

@ -78,7 +78,7 @@ public class FactionsPlayerListener implements Listener {
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
if (!myFaction.isNone()) { if (!myFaction.isWilderness()) {
for (FPlayer other : myFaction.getFPlayersWhereOnline(true)) { for (FPlayer other : myFaction.getFPlayersWhereOnline(true)) {
if (other != me && other.isMonitoringJoins()) { if (other != me && other.isMonitoringJoins()) {
other.msg(TL.FACTION_LOGIN, me.getName()); other.msg(TL.FACTION_LOGIN, me.getName());
@ -106,11 +106,11 @@ public class FactionsPlayerListener implements Listener {
} }
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
if (!myFaction.isNone()) { if (!myFaction.isWilderness()) {
myFaction.memberLoggedOff(); myFaction.memberLoggedOff();
} }
if (!myFaction.isNone()) { if (!myFaction.isWilderness()) {
for (FPlayer player : myFaction.getFPlayersWhereOnline(true)) { for (FPlayer player : myFaction.getFPlayersWhereOnline(true)) {
if (player != me && player.isMonitoringJoins()) { if (player != me && player.isMonitoringJoins()) {
player.msg(TL.FACTION_LOGOUT, me.getName()); player.msg(TL.FACTION_LOGOUT, me.getName());
@ -178,7 +178,7 @@ public class FactionsPlayerListener implements Listener {
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) { if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo)); me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
} }
} else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && !myFaction.isNone()) { } else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && !myFaction.isWilderness()) {
String ownersFrom = myFaction.getOwnerListString(from); String ownersFrom = myFaction.getOwnerListString(from);
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) { if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) {
if (!ownersTo.isEmpty()) { if (!ownersTo.isEmpty()) {
@ -305,7 +305,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
if (otherFaction.isNone()) { if (otherFaction.isWilderness()) {
if (!Conf.wildernessDenyUseage || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) { if (!Conf.wildernessDenyUseage || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) {
return true; // This is not faction territory. Use whatever you like here. return true; // This is not faction territory. Use whatever you like here.
} }

View File

@ -25,7 +25,7 @@ public class FTeamWrapper {
return; return;
} }
if (faction.isNone()) { if (faction.isWilderness()) {
return; return;
} }
@ -50,7 +50,7 @@ public class FTeamWrapper {
return; return;
} }
if (faction.isNone()) { if (faction.isWilderness()) {
return; return;
} }

View File

@ -263,7 +263,7 @@ public abstract class MemoryBoard extends Board {
FLocation flocationHere = topLeft.getRelative(dx, dz); FLocation flocationHere = topLeft.getRelative(dx, dz);
Faction factionHere = getFactionAt(flocationHere); Faction factionHere = getFactionAt(flocationHere);
Relation relation = faction.getRelationTo(factionHere); Relation relation = faction.getRelationTo(factionHere);
if (factionHere.isNone()) { if (factionHere.isWilderness()) {
row += ChatColor.GRAY + "-"; row += ChatColor.GRAY + "-";
} else if (factionHere.isSafeZone()) { } else if (factionHere.isSafeZone()) {
row += Conf.colorPeaceful + "+"; row += Conf.colorPeaceful + "+";

View File

@ -576,7 +576,7 @@ public abstract class MemoryFPlayer implements FPlayer {
* @return true if should show, otherwise false. * @return true if should show, otherwise false.
*/ */
public boolean showInfoBoard(Faction toShow) { public boolean showInfoBoard(Faction toShow) {
return showScoreboard && !toShow.isWarZone() && !toShow.isNone() && !toShow.isSafeZone() && P.p.getConfig().contains("scoreboard.finfo") && P.p.getConfig().getBoolean("scoreboard.finfo-enabled", false) && FScoreboard.get(this) != null; return showScoreboard && !toShow.isWarZone() && !toShow.isWilderness() && !toShow.isSafeZone() && P.p.getConfig().contains("scoreboard.finfo") && P.p.getConfig().getBoolean("scoreboard.finfo-enabled", false) && FScoreboard.get(this) != null;
} }
@Override @Override
@ -665,7 +665,7 @@ public abstract class MemoryFPlayer implements FPlayer {
} }
public boolean canClaimForFaction(Faction forFaction) { public boolean canClaimForFaction(Faction forFaction) {
return !forFaction.isNone() && (this.isAdminBypassing() || (forFaction == this.getFaction() && this.getRole().isAtLeast(Role.MODERATOR)) || (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) || (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer()))); return !forFaction.isWilderness() && (this.isAdminBypassing() || (forFaction == this.getFaction() && this.getRole().isAtLeast(Role.MODERATOR)) || (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer())) || (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())));
} }
public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure) { public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure) {

View File

@ -352,7 +352,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
// ------------------------------- // -------------------------------
public boolean isNormal() { public boolean isNormal() {
return !(this.isNone() || this.isSafeZone() || this.isWarZone()); return !(this.isWilderness() || this.isSafeZone() || this.isWarZone());
} }
public boolean isNone() { public boolean isNone() {

View File

@ -145,7 +145,7 @@ public enum TagReplacer {
case PLAYER_NAME: case PLAYER_NAME:
return fp.getName(); return fp.getName();
case FACTION: case FACTION:
return !fac.isNone() ? fac.getTag(fp) : TL.GENERIC_FACTIONLESS.toString(); return !fac.isWilderness() ? fac.getTag(fp) : TL.GENERIC_FACTIONLESS.toString();
case LAST_SEEN: case LAST_SEEN:
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX; String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized); return fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);