Moving home config from ConfServer --> UConf
This commit is contained in:
parent
29e05fd54d
commit
3dc2691bea
@ -30,17 +30,7 @@ public class ConfServer extends SimpleConfig
|
||||
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
|
||||
public static boolean removePlayerDataWhenBanned = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// HOMES
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean homesEnabled = true;
|
||||
public static boolean homesMustBeInClaimedTerritory = true;
|
||||
public static boolean homesTeleportCommandEnabled = true;
|
||||
public static boolean homesTeleportAllowedFromEnemyTerritory = true;
|
||||
public static boolean homesTeleportAllowedFromDifferentWorld = true;
|
||||
public static double homesTeleportAllowedEnemyDistance = 32.0;
|
||||
public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// PVP
|
||||
|
@ -4,13 +4,13 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.FFlag;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
|
||||
@ -35,14 +35,16 @@ public class CmdFactionsHome extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UConf uconf = UConf.get(sender);
|
||||
|
||||
// TODO: Hide this command on help also.
|
||||
if ( ! ConfServer.homesEnabled)
|
||||
if ( ! uconf.homesEnabled)
|
||||
{
|
||||
fme.msg("<b>Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ConfServer.homesTeleportCommandEnabled)
|
||||
if ( ! uconf.homesTeleportCommandEnabled)
|
||||
{
|
||||
fme.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
|
||||
return;
|
||||
@ -55,13 +57,13 @@ public class CmdFactionsHome extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ConfServer.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory())
|
||||
if ( ! uconf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory())
|
||||
{
|
||||
fme.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ConfServer.homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(myFaction.getHome().getWorld()))
|
||||
if (!uconf.homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(myFaction.getHome().getWorld()))
|
||||
{
|
||||
fme.msg("<b>You cannot teleport to your faction home while in a different world.");
|
||||
return;
|
||||
@ -74,7 +76,7 @@ public class CmdFactionsHome extends FCommand
|
||||
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
|
||||
if
|
||||
(
|
||||
ConfServer.homesTeleportAllowedEnemyDistance > 0
|
||||
uconf.homesTeleportAllowedEnemyDistance > 0
|
||||
&&
|
||||
faction.getFlag(FFlag.PVP)
|
||||
&&
|
||||
@ -84,7 +86,7 @@ public class CmdFactionsHome extends FCommand
|
||||
(
|
||||
fme.isInOwnTerritory()
|
||||
&&
|
||||
! ConfServer.homesTeleportIgnoreEnemiesIfInOwnTerritory
|
||||
! uconf.homesTeleportIgnoreEnemiesIfInOwnTerritory
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -107,13 +109,13 @@ public class CmdFactionsHome extends FCommand
|
||||
double dx = Math.abs(x - l.getX());
|
||||
double dy = Math.abs(y - l.getY());
|
||||
double dz = Math.abs(z - l.getZ());
|
||||
double max = ConfServer.homesTeleportAllowedEnemyDistance;
|
||||
double max = uconf.homesTeleportAllowedEnemyDistance;
|
||||
|
||||
// box-shaped distance check
|
||||
if (dx > max || dy > max || dz > max)
|
||||
continue;
|
||||
|
||||
fme.msg("<b>You cannot teleport to your faction home while an enemy is within " + ConfServer.homesTeleportAllowedEnemyDistance + " blocks of you.");
|
||||
fme.msg("<b>You cannot teleport to your faction home while an enemy is within " + uconf.homesTeleportAllowedEnemyDistance + " blocks of you.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.UConf;
|
||||
import com.massivecraft.factions.event.FactionsEventHomeChange;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
|
||||
@ -26,19 +26,19 @@ public class CmdFactionsSethome extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
// TODO: Make a command REQ instead?
|
||||
if ( ! ConfServer.homesEnabled)
|
||||
{
|
||||
fme.msg("<b>Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Args
|
||||
Faction faction = this.arg(0, ARFaction.get(myFaction), myFaction);
|
||||
if (faction == null) return;
|
||||
|
||||
PS newHome = PS.valueOf(me.getLocation());
|
||||
|
||||
// Validate
|
||||
if ( ! UConf.get(faction).homesEnabled)
|
||||
{
|
||||
fme.msg("<b>Sorry, Faction homes are disabled on this server.");
|
||||
return;
|
||||
}
|
||||
|
||||
// FPerm
|
||||
if ( ! FPerm.SETHOME.has(sender, faction, true)) return;
|
||||
|
||||
|
@ -231,7 +231,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
public boolean isValidHome(PS ps)
|
||||
{
|
||||
if (ps == null) return true;
|
||||
if (!ConfServer.homesMustBeInClaimedTerritory) return true;
|
||||
if (!UConf.get(this).homesMustBeInClaimedTerritory) return true;
|
||||
if (BoardColls.get().getFactionAt(ps) == this) return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -60,6 +60,18 @@ public class UConf extends Entity<UConf>
|
||||
public double powerPerHour = 2.0;
|
||||
public double powerPerDeath = -2.0;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// HOMES
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean homesEnabled = true;
|
||||
public boolean homesMustBeInClaimedTerritory = true;
|
||||
public boolean homesTeleportCommandEnabled = true;
|
||||
public boolean homesTeleportAllowedFromEnemyTerritory = true;
|
||||
public boolean homesTeleportAllowedFromDifferentWorld = true;
|
||||
public double homesTeleportAllowedEnemyDistance = 32.0;
|
||||
public boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DENY COMMANDS
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user