More reformatting

This commit is contained in:
drtshock
2014-07-01 14:52:40 -05:00
parent dc54f78cc1
commit 5066934a95
109 changed files with 1288 additions and 2883 deletions

View File

@@ -17,86 +17,55 @@ import java.util.List;
public class CmdHome extends FCommand {
public CmdHome() {
super();
this.aliases.add("home");
super(); this.aliases.add("home");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.HOME.node;
this.disableOnLock = false;
this.permission = Permission.HOME.node; this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = true; senderMustBeMember = true; senderMustBeModerator = false; senderMustBeAdmin = false;
}
@Override
public void perform() {
// TODO: Hide this command on help also.
if (!Conf.homesEnabled) {
fme.msg("<b>Sorry, Faction homes are disabled on this server.");
return;
fme.msg("<b>Sorry, Faction homes are disabled on this server."); return;
}
if (!Conf.homesTeleportCommandEnabled) {
fme.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
return;
fme.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server."); return;
}
if (!myFaction.hasHome()) {
fme.msg("<b>Your faction does not have a home. " + (fme.getRole().value < Role.MODERATOR.value ? "<i> Ask your leader to:" : "<i>You should:"));
fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
return;
fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate()); return;
}
if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
fme.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
return;
fme.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction."); return;
}
if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
fme.msg("<b>You cannot teleport to your faction home while in a different world.");
return;
fme.msg("<b>You cannot teleport to your faction home while in a different world."); return;
}
Faction faction = Board.getFactionAt(new FLocation(me.getLocation()));
Location loc = me.getLocation().clone();
Faction faction = Board.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
if
(
Conf.homesTeleportAllowedEnemyDistance > 0
&&
!faction.isSafeZone()
&&
(
!fme.isInOwnTerritory()
||
(
fme.isInOwnTerritory()
&&
!Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory
)
)
) {
World w = loc.getWorld();
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
if (Conf.homesTeleportAllowedEnemyDistance > 0 &&
!faction.isSafeZone() &&
(!fme.isInOwnTerritory() || (fme.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
World w = loc.getWorld(); double x = loc.getX(); double y = loc.getY(); double z = loc.getZ();
for (Player p : me.getServer().getOnlinePlayers()) {
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w) { continue; }
FPlayer fp = FPlayers.i.get(p);
if (fme.getRelationTo(fp) != Relation.ENEMY) { continue; }
FPlayer fp = FPlayers.i.get(p); if (fme.getRelationTo(fp) != Relation.ENEMY) { continue; }
Location l = p.getLocation();
double dx = Math.abs(x - l.getX());
double dy = Math.abs(y - l.getY());
double dz = Math.abs(z - l.getZ());
double max = Conf.homesTeleportAllowedEnemyDistance;
Location l = p.getLocation(); double dx = Math.abs(x - l.getX()); double dy = Math.abs(y - l.getY());
double dz = Math.abs(z - l.getZ()); double max = Conf.homesTeleportAllowedEnemyDistance;
// box-shaped distance check
if (dx > max || dy > max || dz > max) { continue; }
@@ -116,10 +85,8 @@ public class CmdHome extends FCommand {
// Create a smoke effect
if (Conf.homesTeleportCommandSmokeEffectEnabled) {
List<Location> smokeLocations = new ArrayList<Location>();
smokeLocations.add(loc);
smokeLocations.add(loc.add(0, 1, 0));
smokeLocations.add(myFaction.getHome());
List<Location> smokeLocations = new ArrayList<Location>(); smokeLocations.add(loc);
smokeLocations.add(loc.add(0, 1, 0)); smokeLocations.add(myFaction.getHome());
smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0));
SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
}