Check System Added and Massive Reformat

This commit is contained in:
Driftay 2019-08-24 13:18:50 -04:00
parent 84f4e0f732
commit 72f76aeb71
199 changed files with 15584 additions and 15463 deletions

View File

@ -9,82 +9,82 @@ import java.util.Set;
public abstract class Board {
protected static Board instance = getBoardImpl();
protected static Board instance = getBoardImpl();
private static Board getBoardImpl() {
switch (Conf.backEnd) {
case JSON:
return new JSONBoard();
}
return null;
}
private static Board getBoardImpl() {
switch (Conf.backEnd) {
case JSON:
return new JSONBoard();
}
return null;
}
public static Board getInstance() {
return instance;
}
public static Board getInstance() {
return instance;
}
//----------------------------------------------//
// Get and Set
//----------------------------------------------//
public abstract String getIdAt(FLocation flocation);
//----------------------------------------------//
// Get and Set
//----------------------------------------------//
public abstract String getIdAt(FLocation flocation);
public abstract Faction getFactionAt(FLocation flocation);
public abstract Faction getFactionAt(FLocation flocation);
public abstract void setIdAt(String id, FLocation flocation);
public abstract void setIdAt(String id, FLocation flocation);
public abstract void setFactionAt(Faction faction, FLocation flocation);
public abstract void setFactionAt(Faction faction, FLocation flocation);
public abstract void removeAt(FLocation flocation);
public abstract void removeAt(FLocation flocation);
public abstract Set<FLocation> getAllClaims(String factionId);
public abstract Set<FLocation> getAllClaims(String factionId);
public abstract Set<FLocation> getAllClaims(Faction faction);
public abstract Set<FLocation> getAllClaims(Faction faction);
// not to be confused with claims, ownership referring to further member-specific ownership of a claim
public abstract void clearOwnershipAt(FLocation flocation);
// not to be confused with claims, ownership referring to further member-specific ownership of a claim
public abstract void clearOwnershipAt(FLocation flocation);
public abstract void unclaimAll(String factionId);
public abstract void unclaimAll(String factionId);
public abstract void unclaimAllInWorld(String factionId, World world);
public abstract void unclaimAllInWorld(String factionId, World world);
// Is this coord NOT completely surrounded by coords claimed by the same faction?
// Simpler: Is there any nearby coord with a faction other than the faction here?
public abstract boolean isBorderLocation(FLocation flocation);
// Is this coord NOT completely surrounded by coords claimed by the same faction?
// Simpler: Is there any nearby coord with a faction other than the faction here?
public abstract boolean isBorderLocation(FLocation flocation);
// Is this coord connected to any coord claimed by the specified faction?
public abstract boolean isConnectedLocation(FLocation flocation, Faction faction);
// Is this coord connected to any coord claimed by the specified faction?
public abstract boolean isConnectedLocation(FLocation flocation, Faction faction);
public abstract boolean hasFactionWithin(FLocation flocation, Faction faction, int radius);
public abstract boolean hasFactionWithin(FLocation flocation, Faction faction, int radius);
//----------------------------------------------//
// Cleaner. Remove orphaned foreign keys
//----------------------------------------------//
//----------------------------------------------//
// Cleaner. Remove orphaned foreign keys
//----------------------------------------------//
public abstract void clean();
public abstract void clean();
//----------------------------------------------//
// Coord count
//----------------------------------------------//
//----------------------------------------------//
// Coord count
//----------------------------------------------//
public abstract int getFactionCoordCount(String factionId);
public abstract int getFactionCoordCount(String factionId);
public abstract int getFactionCoordCount(Faction faction);
public abstract int getFactionCoordCount(Faction faction);
public abstract int getFactionCoordCountInWorld(Faction faction, String worldName);
public abstract int getFactionCoordCountInWorld(Faction faction, String worldName);
//----------------------------------------------//
// Map generation
//----------------------------------------------//
//----------------------------------------------//
// Map generation
//----------------------------------------------//
/*
* The map is relative to a coord and a faction north is in the direction of decreasing x east is in the direction
* of decreasing z
*/
public abstract List<FancyMessage> getMap(FPlayer fPlayer, FLocation flocation, double inDegrees);
/*
* The map is relative to a coord and a faction north is in the direction of decreasing x east is in the direction
* of decreasing z
*/
public abstract List<FancyMessage> getMap(FPlayer fPlayer, FLocation flocation, double inDegrees);
public abstract void forceSave();
public abstract void forceSave();
public abstract void forceSave(boolean sync);
public abstract void forceSave(boolean sync);
public abstract boolean load();
public abstract boolean load();
}

View File

@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableMap;
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
import com.massivecraft.factions.util.XMaterial;
import com.massivecraft.factions.zcore.fperms.DefaultPermissions;
import com.massivecraft.factions.zcore.fperms.Permissable;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -14,429 +13,431 @@ import java.util.*;
public class Conf {
// Region Style
public static final transient String DYNMAP_STYLE_LINE_COLOR = "#00FF00";
public static final transient double DYNMAP_STYLE_LINE_OPACITY = 0.8D;
public static final transient int DYNMAP_STYLE_LINE_WEIGHT = 3;
public static final transient String DYNMAP_STYLE_FILL_COLOR = "#00FF00";
public static final transient double DYNMAP_STYLE_FILL_OPACITY = 0.35D;
public static final transient String DYNMAP_STYLE_HOME_MARKER = "greenflag";
public static final transient boolean DYNMAP_STYLE_BOOST = false;
public static List<String> baseCommandAliases = new ArrayList<>();
public static boolean allowNoSlashCommand = true;
// Region Style
public static final transient String DYNMAP_STYLE_LINE_COLOR = "#00FF00";
public static final transient double DYNMAP_STYLE_LINE_OPACITY = 0.8D;
public static final transient int DYNMAP_STYLE_LINE_WEIGHT = 3;
public static final transient String DYNMAP_STYLE_FILL_COLOR = "#00FF00";
public static final transient double DYNMAP_STYLE_FILL_OPACITY = 0.35D;
public static final transient String DYNMAP_STYLE_HOME_MARKER = "greenflag";
public static final transient boolean DYNMAP_STYLE_BOOST = false;
public static List<String> baseCommandAliases = new ArrayList<>();
public static boolean allowNoSlashCommand = true;
// Colors
public static ChatColor colorMember = ChatColor.GREEN;
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
public static ChatColor colorTruce = ChatColor.DARK_PURPLE;
public static ChatColor colorNeutral = ChatColor.WHITE;
public static ChatColor colorEnemy = ChatColor.RED;
public static ChatColor colorPeaceful = ChatColor.GOLD;
public static ChatColor colorWilderness = ChatColor.GRAY;
public static ChatColor colorSafezone = ChatColor.GOLD;
public static ChatColor colorWar = ChatColor.DARK_RED;
// Power
public static double powerPlayerMax = 10.0;
public static double powerPlayerMin = -10.0;
public static double powerPlayerStarting = 0.0;
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
public static double powerPerDeath = 4.0; // A death makes you lose 4 power
public static boolean powerRegenOffline = false; // does player power regenerate even while they're offline?
public static double powerOfflineLossPerDay = 0.0; // players will lose this much power per day offline
public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less
public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts)
public static String prefixLeader = "***";
public static String prefixCoLeader = "**";
public static String prefixMod = "*";
public static String prefixRecruit = "-";
public static String prefixNormal = "+";
public static int factionTagLengthMin = 3;
public static int factionTagLengthMax = 10;
public static boolean factionTagForceUpperCase = false;
public static boolean newFactionsDefaultOpen = false;
// when faction membership hits this limit, players will no longer be able to join using /f join; default is 0, no limit
public static int factionMemberLimit = 0;
public static int factionAltMemberLimit = 0;
// what faction ID to start new players in when they first join the server; default is 0, "no faction"
public static String newPlayerStartingFactionID = "0";
public static boolean showMapFactionKey = true;
public static boolean showNeutralFactionsOnMap = true;
public static boolean showEnemyFactionsOnMap = true;
public static boolean showTrucesFactionsOnMap = true;
// Disallow joining/leaving/kicking while power is negative
public static boolean canLeaveWithNegativePower = true;
// Configuration for faction-only chat
public static boolean factionOnlyChat = true;
// Configuration on the Faction tag in chat messages.
public static boolean chatTagEnabled = true;
public static transient boolean chatTagHandledByAnotherPlugin = false;
public static boolean chatTagRelationColored = true;
public static String chatTagReplaceString = "[FACTION]";
public static String chatTagInsertAfterString = "";
public static String chatTagInsertBeforeString = "";
public static int chatTagInsertIndex = 0;
public static boolean chatTagPadBefore = false;
public static boolean chatTagPadAfter = true;
public static String chatTagFormat = "%s" + ChatColor.WHITE;
public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s";
public static String allianceChatFormat = ChatColor.LIGHT_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String modChatFormat = ChatColor.RED + "%s:" + ChatColor.WHITE + " %s";
public static int stealthFlyCheckRadius = 32;
public static int factionBufferSize = 20;
public static boolean removeHomesOnLeave = true;
public static boolean gracePeriod = false;
public static boolean noEnderpearlsInFly = false;
public static boolean broadcastDescriptionChanges = false;
public static boolean broadcastTagChanges = false;
public static double saveToFileEveryXMinutes = 30.0;
public static double autoLeaveAfterDaysOfInactivity = 10.0;
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
public static int autoLeaveRoutineMaxMillisecondsPerTick = 5; // 1 server tick is roughly 50ms, so default max 10% of a tick
public static boolean removePlayerDataWhenBanned = true;
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
public static boolean worldGuardChecking = false;
public static boolean worldGuardBuildPriority = false;
// server logging options
public static boolean logFactionCreate = true;
public static boolean logFactionDisband = true;
public static boolean logFactionJoin = true;
public static boolean logFactionKick = true;
public static boolean logFactionLeave = true;
public static boolean logLandClaims = true;
public static boolean logLandUnclaims = true;
public static boolean logMoneyTransactions = true;
public static boolean logPlayerCommands = true;
// prevent some potential exploits
public static boolean handleExploitObsidianGenerators = true;
public static boolean handleExploitEnderPearlClipping = true;
public static boolean handleExploitInteractionSpam = true;
public static boolean handleExploitTNTWaterlog = false;
public static boolean handleExploitLiquidFlow = false;
public static boolean homesEnabled = true;
public static boolean homesMustBeInClaimedTerritory = true;
public static boolean homesTeleportToOnDeath = true;
public static boolean homesRespawnFromNoPowerLossWorlds = true;
public static boolean homesTeleportCommandEnabled = true;
public static boolean homesTeleportCommandEssentialsIntegration = true;
public static boolean homesTeleportCommandSmokeEffectEnabled = true;
public static float homesTeleportCommandSmokeEffectThickness = 3f;
public static boolean homesTeleportAllowedFromEnemyTerritory = true;
public static boolean homesTeleportAllowedFromDifferentWorld = true;
public static double homesTeleportAllowedEnemyDistance = 32.0;
public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
public static boolean disablePVPBetweenNeutralFactions = false;
public static boolean disablePVPForFactionlessPlayers = false;
public static boolean enablePVPAgainstFactionlessInAttackersLand = false;
public static int noPVPDamageToOthersForXSecondsAfterLogin = 3;
public static boolean peacefulTerritoryDisablePVP = true;
public static boolean peacefulTerritoryDisableMonsters = false;
public static boolean peacefulTerritoryDisableBoom = false;
public static boolean peacefulMembersDisablePowerLoss = true;
public static boolean permanentFactionsDisableLeaderPromotion = false;
public static boolean claimsMustBeConnected = false;
public static boolean claimsCanBeUnconnectedIfOwnedByOtherFaction = true;
public static int claimsRequireMinFactionMembers = 1;
public static int claimedLandsMax = 0;
public static int lineClaimLimit = 5;
// if someone is doing a radius claim and the process fails to claim land this many times in a row, it will exit
public static int radiusClaimFailureLimit = 9;
public static double considerFactionsReallyOfflineAfterXMinutes = 0.0;
public static int actionDeniedPainAmount = 1;
// commands which will be prevented if the player is a member of a permanent faction
public static Set<String> permanentFactionMemberDenyCommands = new LinkedHashSet<>();
// commands which will be prevented when in claimed territory of another faction
public static Set<String> territoryNeutralDenyCommands = new LinkedHashSet<>();
public static Set<String> territoryEnemyDenyCommands = new LinkedHashSet<>();
public static Set<String> territoryAllyDenyCommands = new LinkedHashSet<>();
public static Set<String> warzoneDenyCommands = new LinkedHashSet<>();
public static Set<String> wildernessDenyCommands = new LinkedHashSet<>();
public static boolean territoryDenyBuild = true;
public static boolean territoryDenyBuildWhenOffline = true;
public static boolean territoryPainBuild = false;
public static boolean territoryPainBuildWhenOffline = false;
public static boolean territoryDenyUseage = true;
public static boolean territoryEnemyDenyBuild = true;
public static boolean territoryEnemyDenyBuildWhenOffline = true;
public static boolean territoryEnemyPainBuild = false;
public static boolean territoryEnemyPainBuildWhenOffline = false;
public static boolean territoryEnemyDenyUseage = true;
public static boolean territoryAllyDenyBuild = true;
public static boolean territoryAllyDenyBuildWhenOffline = true;
public static boolean territoryAllyPainBuild = false;
public static boolean territoryAllyPainBuildWhenOffline = false;
public static boolean territoryAllyDenyUseage = true;
public static boolean territoryTruceDenyBuild = true;
public static boolean territoryTruceDenyBuildWhenOffline = true;
public static boolean territoryTrucePainBuild = false;
public static boolean territoryTrucePainBuildWhenOffline = false;
public static boolean territoryTruceDenyUseage = true;
public static boolean territoryBlockCreepers = false;
public static boolean territoryBlockCreepersWhenOffline = false;
public static boolean territoryBlockFireballs = false;
public static boolean territoryBlockFireballsWhenOffline = false;
public static boolean territoryBlockTNT = false;
public static boolean territoryBlockTNTWhenOffline = false;
public static boolean territoryDenyEndermanBlocks = true;
public static boolean territoryDenyEndermanBlocksWhenOffline = true;
public static boolean safeZoneDenyBuild = true;
public static boolean safeZoneDenyUseage = true;
public static boolean safeZoneBlockTNT = true;
public static boolean safeZonePreventAllDamageToPlayers = false;
public static boolean safeZoneDenyEndermanBlocks = true;
public static boolean warZoneDenyBuild = true;
public static boolean warZoneDenyUseage = true;
public static boolean warZoneBlockCreepers = false;
public static boolean warZoneBlockFireballs = false;
public static boolean warZoneBlockTNT = true;
public static boolean warZonePowerLoss = true;
public static boolean warZoneFriendlyFire = false;
public static boolean warZoneDenyEndermanBlocks = true;
public static boolean wildernessDenyBuild = false;
public static boolean wildernessDenyUseage = false;
public static boolean wildernessBlockCreepers = false;
public static boolean wildernessBlockFireballs = false;
public static boolean wildernessBlockTNT = false;
public static boolean wildernessPowerLoss = true;
public static boolean wildernessDenyEndermanBlocks = false;
// for claimed areas where further faction-member ownership can be defined
public static boolean ownedAreasEnabled = true;
public static int ownedAreasLimitPerFaction = 0;
public static boolean ownedAreasModeratorsCanSet = false;
public static boolean ownedAreaModeratorsBypass = true;
public static boolean ownedAreaDenyBuild = true;
public static boolean ownedAreaPainBuild = false;
public static boolean ownedMessageOnBorder = true;
public static boolean ownedMessageInsideTerritory = true;
public static boolean ownedMessageByChunk = false;
public static boolean pistonProtectionThroughDenyBuild = true;
public static Set<Material> territoryProtectedMaterials = EnumSet.noneOf(Material.class);
public static Set<Material> territoryDenyUseageMaterials = EnumSet.noneOf(Material.class);
public static Set<Material> territoryProtectedMaterialsWhenOffline = EnumSet.noneOf(Material.class);
public static Set<Material> territoryDenyUseageMaterialsWhenOffline = EnumSet.noneOf(Material.class);
public static transient Set<EntityType> safeZoneNerfedCreatureTypes = EnumSet.noneOf(EntityType.class);
/// <summary>
/// This defines a set of materials which should always be allowed to use, regardless of factions permissions.
/// Useful for HCF features.
/// </summary>
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
// Colors
public static ChatColor colorMember = ChatColor.GREEN;
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
public static ChatColor colorTruce = ChatColor.DARK_PURPLE;
public static ChatColor colorNeutral = ChatColor.WHITE;
public static ChatColor colorEnemy = ChatColor.RED;
public static ChatColor colorPeaceful = ChatColor.GOLD;
public static ChatColor colorWilderness = ChatColor.GRAY;
public static ChatColor colorSafezone = ChatColor.GOLD;
public static ChatColor colorWar = ChatColor.DARK_RED;
// Power
public static double powerPlayerMax = 10.0;
public static double powerPlayerMin = -10.0;
public static double powerPlayerStarting = 0.0;
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
public static double powerPerDeath = 4.0; // A death makes you lose 4 power
public static boolean powerRegenOffline = false; // does player power regenerate even while they're offline?
public static double powerOfflineLossPerDay = 0.0; // players will lose this much power per day offline
public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less
public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts)
public static String prefixLeader = "***";
public static String prefixCoLeader = "**";
public static String prefixMod = "*";
public static String prefixRecruit = "-";
public static String prefixNormal = "+";
public static int factionTagLengthMin = 3;
public static int factionTagLengthMax = 10;
public static boolean factionTagForceUpperCase = false;
public static boolean newFactionsDefaultOpen = false;
// when faction membership hits this limit, players will no longer be able to join using /f join; default is 0, no limit
public static int factionMemberLimit = 0;
public static int factionAltMemberLimit = 0;
// what faction ID to start new players in when they first join the server; default is 0, "no faction"
public static String newPlayerStartingFactionID = "0";
public static boolean showMapFactionKey = true;
public static boolean showNeutralFactionsOnMap = true;
public static boolean showEnemyFactionsOnMap = true;
public static boolean showTrucesFactionsOnMap = true;
// Disallow joining/leaving/kicking while power is negative
public static boolean canLeaveWithNegativePower = true;
// Configuration for faction-only chat
public static boolean factionOnlyChat = true;
// Configuration on the Faction tag in chat messages.
public static boolean chatTagEnabled = true;
public static transient boolean chatTagHandledByAnotherPlugin = false;
public static boolean chatTagRelationColored = true;
public static String chatTagReplaceString = "[FACTION]";
public static String chatTagInsertAfterString = "";
public static String chatTagInsertBeforeString = "";
public static int chatTagInsertIndex = 0;
public static boolean chatTagPadBefore = false;
public static boolean chatTagPadAfter = true;
public static String chatTagFormat = "%s" + ChatColor.WHITE;
public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s";
public static String allianceChatFormat = ChatColor.LIGHT_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String modChatFormat = ChatColor.RED + "%s:" + ChatColor.WHITE + " %s";
public static int stealthFlyCheckRadius = 32;
public static int factionBufferSize = 20;
public static boolean removeHomesOnLeave = true;
public static boolean useCheckSystem = true;
public static boolean gracePeriod = false;
public static boolean noEnderpearlsInFly = false;
public static boolean broadcastDescriptionChanges = false;
public static boolean broadcastTagChanges = false;
public static double saveToFileEveryXMinutes = 30.0;
public static double autoLeaveAfterDaysOfInactivity = 10.0;
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
public static int autoLeaveRoutineMaxMillisecondsPerTick = 5; // 1 server tick is roughly 50ms, so default max 10% of a tick
public static boolean removePlayerDataWhenBanned = true;
public static boolean autoLeaveDeleteFPlayerData = true; // Let them just remove player from Faction.
public static boolean worldGuardChecking = false;
public static boolean worldGuardBuildPriority = false;
// server logging options
public static boolean logFactionCreate = true;
public static boolean logFactionDisband = true;
public static boolean logFactionJoin = true;
public static boolean logFactionKick = true;
public static boolean logFactionLeave = true;
public static boolean logLandClaims = true;
public static boolean logLandUnclaims = true;
public static boolean logMoneyTransactions = true;
public static boolean logPlayerCommands = true;
// prevent some potential exploits
public static boolean handleExploitObsidianGenerators = true;
public static boolean handleExploitEnderPearlClipping = true;
public static boolean handleExploitInteractionSpam = true;
public static boolean handleExploitTNTWaterlog = false;
public static boolean handleExploitLiquidFlow = false;
public static boolean homesEnabled = true;
public static boolean homesMustBeInClaimedTerritory = true;
public static boolean homesTeleportToOnDeath = true;
public static boolean homesRespawnFromNoPowerLossWorlds = true;
public static boolean homesTeleportCommandEnabled = true;
public static boolean homesTeleportCommandEssentialsIntegration = true;
public static boolean homesTeleportCommandSmokeEffectEnabled = true;
public static float homesTeleportCommandSmokeEffectThickness = 3f;
public static boolean homesTeleportAllowedFromEnemyTerritory = true;
public static boolean homesTeleportAllowedFromDifferentWorld = true;
public static double homesTeleportAllowedEnemyDistance = 32.0;
public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
public static boolean disablePVPBetweenNeutralFactions = false;
public static boolean disablePVPForFactionlessPlayers = false;
public static boolean enablePVPAgainstFactionlessInAttackersLand = false;
public static int noPVPDamageToOthersForXSecondsAfterLogin = 3;
public static boolean peacefulTerritoryDisablePVP = true;
public static boolean peacefulTerritoryDisableMonsters = false;
public static boolean peacefulTerritoryDisableBoom = false;
public static boolean peacefulMembersDisablePowerLoss = true;
public static boolean permanentFactionsDisableLeaderPromotion = false;
public static boolean claimsMustBeConnected = false;
public static boolean claimsCanBeUnconnectedIfOwnedByOtherFaction = true;
public static int claimsRequireMinFactionMembers = 1;
public static int claimedLandsMax = 0;
public static int lineClaimLimit = 5;
// if someone is doing a radius claim and the process fails to claim land this many times in a row, it will exit
public static int radiusClaimFailureLimit = 9;
public static double considerFactionsReallyOfflineAfterXMinutes = 0.0;
public static int actionDeniedPainAmount = 1;
// commands which will be prevented if the player is a member of a permanent faction
public static Set<String> permanentFactionMemberDenyCommands = new LinkedHashSet<>();
// commands which will be prevented when in claimed territory of another faction
public static Set<String> territoryNeutralDenyCommands = new LinkedHashSet<>();
public static Set<String> territoryEnemyDenyCommands = new LinkedHashSet<>();
public static Set<String> territoryAllyDenyCommands = new LinkedHashSet<>();
public static Set<String> warzoneDenyCommands = new LinkedHashSet<>();
public static Set<String> wildernessDenyCommands = new LinkedHashSet<>();
public static boolean territoryDenyBuild = true;
public static boolean territoryDenyBuildWhenOffline = true;
public static boolean territoryPainBuild = false;
public static boolean territoryPainBuildWhenOffline = false;
public static boolean territoryDenyUseage = true;
public static boolean territoryEnemyDenyBuild = true;
public static boolean territoryEnemyDenyBuildWhenOffline = true;
public static boolean territoryEnemyPainBuild = false;
public static boolean territoryEnemyPainBuildWhenOffline = false;
public static boolean territoryEnemyDenyUseage = true;
public static boolean territoryAllyDenyBuild = true;
public static boolean territoryAllyDenyBuildWhenOffline = true;
public static boolean territoryAllyPainBuild = false;
public static boolean territoryAllyPainBuildWhenOffline = false;
public static boolean territoryAllyDenyUseage = true;
public static boolean territoryTruceDenyBuild = true;
public static boolean territoryTruceDenyBuildWhenOffline = true;
public static boolean territoryTrucePainBuild = false;
public static boolean territoryTrucePainBuildWhenOffline = false;
public static boolean territoryTruceDenyUseage = true;
public static boolean territoryBlockCreepers = false;
public static boolean territoryBlockCreepersWhenOffline = false;
public static boolean territoryBlockFireballs = false;
public static boolean territoryBlockFireballsWhenOffline = false;
public static boolean territoryBlockTNT = false;
public static boolean territoryBlockTNTWhenOffline = false;
public static boolean territoryDenyEndermanBlocks = true;
public static boolean territoryDenyEndermanBlocksWhenOffline = true;
public static boolean safeZoneDenyBuild = true;
public static boolean safeZoneDenyUseage = true;
public static boolean safeZoneBlockTNT = true;
public static boolean safeZonePreventAllDamageToPlayers = false;
public static boolean safeZoneDenyEndermanBlocks = true;
public static boolean warZoneDenyBuild = true;
public static boolean warZoneDenyUseage = true;
public static boolean warZoneBlockCreepers = false;
public static boolean warZoneBlockFireballs = false;
public static boolean warZoneBlockTNT = true;
public static boolean warZonePowerLoss = true;
public static boolean warZoneFriendlyFire = false;
public static boolean warZoneDenyEndermanBlocks = true;
public static boolean wildernessDenyBuild = false;
public static boolean wildernessDenyUseage = false;
public static boolean wildernessBlockCreepers = false;
public static boolean wildernessBlockFireballs = false;
public static boolean wildernessBlockTNT = false;
public static boolean wildernessPowerLoss = true;
public static boolean wildernessDenyEndermanBlocks = false;
// for claimed areas where further faction-member ownership can be defined
public static boolean ownedAreasEnabled = true;
public static int ownedAreasLimitPerFaction = 0;
public static boolean ownedAreasModeratorsCanSet = false;
public static boolean ownedAreaModeratorsBypass = true;
public static boolean ownedAreaDenyBuild = true;
public static boolean ownedAreaPainBuild = false;
public static boolean ownedMessageOnBorder = true;
public static boolean ownedMessageInsideTerritory = true;
public static boolean ownedMessageByChunk = false;
public static boolean pistonProtectionThroughDenyBuild = true;
public static Set<Material> territoryProtectedMaterials = EnumSet.noneOf(Material.class);
public static Set<Material> territoryDenyUseageMaterials = EnumSet.noneOf(Material.class);
public static Set<Material> territoryProtectedMaterialsWhenOffline = EnumSet.noneOf(Material.class);
public static Set<Material> territoryDenyUseageMaterialsWhenOffline = EnumSet.noneOf(Material.class);
public static transient Set<EntityType> safeZoneNerfedCreatureTypes = EnumSet.noneOf(EntityType.class);
/// <summary>
/// This defines a set of materials which should always be allowed to use, regardless of factions permissions.
/// Useful for HCF features.
/// </summary>
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
// Economy settings
public static boolean econEnabled = false;
public static String econUniverseAccount = "";
public static double econCostClaimWilderness = 30.0;
public static double econCostClaimFromFactionBonus = 30.0;
public static double econOverclaimRewardMultiplier = 0.0;
public static double econClaimAdditionalMultiplier = 0.5;
public static double econClaimRefundMultiplier = 0.7;
public static double econClaimUnconnectedFee = 0.0;
public static double econCostCreate = 100.0;
public static double econCostOwner = 15.0;
public static double econCostSethome = 30.0;
public static double econCostJoin = 0.0;
public static double econCostLeave = 0.0;
public static double econCostKick = 0.0;
public static double econCostInvite = 0.0;
public static double econCostHome = 0.0;
public static double econCostTag = 0.0;
public static double econCostDesc = 0.0;
public static double econCostTitle = 0.0;
public static double econCostList = 0.0;
public static double econCostMap = 0.0;
public static double econCostPower = 0.0;
public static double econCostShow = 0.0;
public static double econFactionStartingBalance = 0.0;
public static double econDenyWithdrawWhenMinutesAgeLessThan = 2880; // 2 days
public static String dateFormat = "HH:mm dd/MM/yyyy";
// Economy settings
public static boolean econEnabled = false;
public static String econUniverseAccount = "";
public static double econCostClaimWilderness = 30.0;
public static double econCostClaimFromFactionBonus = 30.0;
public static double econOverclaimRewardMultiplier = 0.0;
public static double econClaimAdditionalMultiplier = 0.5;
public static double econClaimRefundMultiplier = 0.7;
public static double econClaimUnconnectedFee = 0.0;
public static double econCostCreate = 100.0;
public static double econCostOwner = 15.0;
public static double econCostSethome = 30.0;
public static double econCostJoin = 0.0;
public static double econCostLeave = 0.0;
public static double econCostKick = 0.0;
public static double econCostInvite = 0.0;
public static double econCostHome = 0.0;
public static double econCostTag = 0.0;
public static double econCostDesc = 0.0;
public static double econCostTitle = 0.0;
public static double econCostList = 0.0;
public static double econCostMap = 0.0;
public static double econCostPower = 0.0;
public static double econCostShow = 0.0;
public static double econFactionStartingBalance = 0.0;
public static double econDenyWithdrawWhenMinutesAgeLessThan = 2880; // 2 days
public static String dateFormat = "HH:mm dd/MM/yyyy";
// -------------------------------------------- //
// INTEGRATION: DYNMAP
// -------------------------------------------- //
public static double econCostStuck = 0.0;
public static double econCostOpen = 0.0;
public static double econCostAlly = 0.0;
public static double econCostTruce = 0.0;
public static double econCostEnemy = 0.0;
public static double econCostNeutral = 0.0;
public static double econCostNoBoom = 0.0;
// Should the dynmap intagration be used?
public static boolean dynmapUse = false;
// Name of the Factions layer
public static String dynmapLayerName = "Factions";
// Should the layer be visible per default
public static boolean dynmapLayerVisible = true;
// Ordering priority in layer menu (low goes before high - default is 0)
public static int dynmapLayerPriority = 2;
// (optional) set minimum zoom level before layer is visible (0 = default, always visible)
public static int dynmapLayerMinimumZoom = 0;
// Format for popup - substitute values for macros
public static String dynmapDescription =
"<div class=\"infowindow\">\n"
+ "<span style=\"font-weight: bold; font-size: 150%;\">%name%</span><br>\n"
+ "<span style=\"font-style: italic; font-size: 110%;\">%description%</span><br>"
+ "<br>\n"
+ "<span style=\"font-weight: bold;\">Leader:</span> %players.leader%<br>\n"
+ "<span style=\"font-weight: bold;\">Admins:</span> %players.admins.count%<br>\n"
+ "<span style=\"font-weight: bold;\">Moderators:</span> %players.moderators.count%<br>\n"
+ "<span style=\"font-weight: bold;\">Members:</span> %players.normals.count%<br>\n"
+ "<span style=\"font-weight: bold;\">TOTAL:</span> %players.count%<br>\n"
+ "</br>\n"
+ "<span style=\"font-weight: bold;\">Bank:</span> %money%<br>\n"
+ "<br>\n"
+ "</div>";
// Enable the %money% macro. Only do this if you know your economy manager is thread-safe.
public static boolean dynmapDescriptionMoney = false;
// Allow players in faction to see one another on Dynmap (only relevant if Dynmap has 'player-info-protected' enabled)
public static boolean dynmapVisibilityByFaction = true;
// Optional setting to limit which regions to show.
// If empty all regions are shown.
// Specify Faction either by name or UUID.
// To show all regions on a given world, add 'world:<worldname>' to the list.
public static Set<String> dynmapVisibleFactions = new HashSet<>();
// Optional setting to hide specific Factions.
// Specify Faction either by name or UUID.
// To hide all regions on a given world, add 'world:<worldname>' to the list.
public static Set<String> dynmapHiddenFactions = new HashSet<>();
public static DynmapStyle dynmapDefaultStyle = new DynmapStyle()
.setStrokeColor(DYNMAP_STYLE_LINE_COLOR)
.setLineOpacity(DYNMAP_STYLE_LINE_OPACITY)
.setLineWeight(DYNMAP_STYLE_LINE_WEIGHT)
.setFillColor(DYNMAP_STYLE_FILL_COLOR)
.setFillOpacity(DYNMAP_STYLE_FILL_OPACITY)
.setHomeMarker(DYNMAP_STYLE_HOME_MARKER)
.setBoost(DYNMAP_STYLE_BOOST);
// -------------------------------------------- //
// INTEGRATION: DYNMAP
// -------------------------------------------- //
public static double econCostStuck = 0.0;
public static double econCostOpen = 0.0;
public static double econCostAlly = 0.0;
public static double econCostTruce = 0.0;
public static double econCostEnemy = 0.0;
public static double econCostNeutral = 0.0;
public static double econCostNoBoom = 0.0;
// Should the dynmap intagration be used?
public static boolean dynmapUse = false;
// Name of the Factions layer
public static String dynmapLayerName = "Factions";
// Should the layer be visible per default
public static boolean dynmapLayerVisible = true;
// Ordering priority in layer menu (low goes before high - default is 0)
public static int dynmapLayerPriority = 2;
// (optional) set minimum zoom level before layer is visible (0 = default, always visible)
public static int dynmapLayerMinimumZoom = 0;
// Format for popup - substitute values for macros
public static String dynmapDescription =
"<div class=\"infowindow\">\n"
+ "<span style=\"font-weight: bold; font-size: 150%;\">%name%</span><br>\n"
+ "<span style=\"font-style: italic; font-size: 110%;\">%description%</span><br>"
+ "<br>\n"
+ "<span style=\"font-weight: bold;\">Leader:</span> %players.leader%<br>\n"
+ "<span style=\"font-weight: bold;\">Admins:</span> %players.admins.count%<br>\n"
+ "<span style=\"font-weight: bold;\">Moderators:</span> %players.moderators.count%<br>\n"
+ "<span style=\"font-weight: bold;\">Members:</span> %players.normals.count%<br>\n"
+ "<span style=\"font-weight: bold;\">TOTAL:</span> %players.count%<br>\n"
+ "</br>\n"
+ "<span style=\"font-weight: bold;\">Bank:</span> %money%<br>\n"
+ "<br>\n"
+ "</div>";
// Enable the %money% macro. Only do this if you know your economy manager is thread-safe.
public static boolean dynmapDescriptionMoney = false;
// Allow players in faction to see one another on Dynmap (only relevant if Dynmap has 'player-info-protected' enabled)
public static boolean dynmapVisibilityByFaction = true;
// Optional setting to limit which regions to show.
// If empty all regions are shown.
// Specify Faction either by name or UUID.
// To show all regions on a given world, add 'world:<worldname>' to the list.
public static Set<String> dynmapVisibleFactions = new HashSet<>();
// Optional setting to hide specific Factions.
// Specify Faction either by name or UUID.
// To hide all regions on a given world, add 'world:<worldname>' to the list.
public static Set<String> dynmapHiddenFactions = new HashSet<>();
public static DynmapStyle dynmapDefaultStyle = new DynmapStyle()
.setStrokeColor(DYNMAP_STYLE_LINE_COLOR)
.setLineOpacity(DYNMAP_STYLE_LINE_OPACITY)
.setLineWeight(DYNMAP_STYLE_LINE_WEIGHT)
.setFillColor(DYNMAP_STYLE_FILL_COLOR)
.setFillOpacity(DYNMAP_STYLE_FILL_OPACITY)
.setHomeMarker(DYNMAP_STYLE_HOME_MARKER)
.setBoost(DYNMAP_STYLE_BOOST);
// Optional per Faction style overrides. Any defined replace those in dynmapDefaultStyle.
// Specify Faction either by name or UUID.
public static Map<String, DynmapStyle> dynmapFactionStyles = ImmutableMap.of(
"SafeZone", new DynmapStyle().setStrokeColor("#FF00FF").setFillColor("#FF00FF").setBoost(false),
"WarZone", new DynmapStyle().setStrokeColor("#FF0000").setFillColor("#FF0000").setBoost(false)
);
// Optional per Faction style overrides. Any defined replace those in dynmapDefaultStyle.
// Specify Faction either by name or UUID.
public static Map<String, DynmapStyle> dynmapFactionStyles = ImmutableMap.of(
"SafeZone", new DynmapStyle().setStrokeColor("#FF00FF").setFillColor("#FF00FF").setBoost(false),
"WarZone", new DynmapStyle().setStrokeColor("#FF0000").setFillColor("#FF0000").setBoost(false)
);
//Faction banks, to pay for land claiming and other costs instead of individuals paying for them
public static boolean bankEnabled = true;
public static boolean bankMembersCanWithdraw = false; //Have to be at least moderator to withdraw or pay money to another faction
public static boolean bankFactionPaysCosts = true; //The faction pays for faction command costs, such as sethome
public static boolean bankFactionPaysLandCosts = true; //The faction pays for land claiming costs.
//Faction banks, to pay for land claiming and other costs instead of individuals paying for them
public static boolean bankEnabled = true;
public static boolean bankMembersCanWithdraw = false; //Have to be at least moderator to withdraw or pay money to another faction
public static boolean bankFactionPaysCosts = true; //The faction pays for faction command costs, such as sethome
public static boolean bankFactionPaysLandCosts = true; //The faction pays for land claiming costs.
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
public static Set<String> playersWhoBypassAllProtection = new LinkedHashSet<>();
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
public static Set<String> playersWhoBypassAllProtection = new LinkedHashSet<>();
public static boolean useWorldConfigurationsAsWhitelist = false;
public static Set<String> worldsNoClaiming = new LinkedHashSet<>();
public static Set<String> worldsNoPowerLoss = new LinkedHashSet<>();
public static Set<String> worldsIgnorePvP = new LinkedHashSet<>();
public static Set<String> worldsNoWildernessProtection = new LinkedHashSet<>();
public static boolean useWorldConfigurationsAsWhitelist = false;
public static Set<String> worldsNoClaiming = new LinkedHashSet<>();
public static Set<String> worldsNoPowerLoss = new LinkedHashSet<>();
public static Set<String> worldsIgnorePvP = new LinkedHashSet<>();
public static Set<String> worldsNoWildernessProtection = new LinkedHashSet<>();
// faction-<factionId>
public static int defaultMaxVaults = 0;
public static boolean disableFlightOnFactionClaimChange = true;
// faction-<factionId>
public static int defaultMaxVaults = 0;
public static boolean disableFlightOnFactionClaimChange = true;
public static Backend backEnd = Backend.JSON;
public static Backend backEnd = Backend.JSON;
// Taller and wider for "bigger f map"
public static int mapHeight = 17;
public static int mapWidth = 49;
public static transient char[] mapKeyChrs = "\\/#$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz?".toCharArray();
// Taller and wider for "bigger f map"
public static int mapHeight = 17;
public static int mapWidth = 49;
public static transient char[] mapKeyChrs = "\\/#$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz?".toCharArray();
//Cooldown for /f logout in seconds
//Cooldown for /f logout in seconds
public static long logoutCooldown = 30;
// Custom Ranks - Oof I forgot I was doing this _SvenjaReissaus_
//public static boolean enableCustomRanks = false; // We will disable it by default to avoid any migration error
//public static int maxCustomRanks = 2; // Setting this to -1 will allow unlimited custom ranks
// -------------------------------------------- //
// Persistance
// ----------------------------------------- //
//public static boolean enableCustomRanks = false; // We will disable it by default to avoid any migration error
//public static int maxCustomRanks = 2; // Setting this to -1 will allow unlimited custom ranks
// -------------------------------------------- //
// Persistance
// ----------------------------------------- //
// Default Faction Permission Settings.
public static boolean useLockedPermissions = false;
public static boolean useCustomDefaultPermissions = true;
public static boolean usePermissionHints = false;
public static HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
public static HashSet<PermissableAction> lockedPermissions = new HashSet<>();
// Default Faction Permission Settings.
public static boolean useLockedPermissions = false;
public static boolean useCustomDefaultPermissions = true;
public static boolean usePermissionHints = false;
public static HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
public static HashSet<PermissableAction> lockedPermissions = new HashSet<>();
private static transient Conf i = new Conf();
private static transient Conf i = new Conf();
static {
lockedPermissions.add(PermissableAction.CHEST);
}
static {
baseCommandAliases.add("f");
static {
lockedPermissions.add(PermissableAction.CHEST);
}
territoryEnemyDenyCommands.add("home");
territoryEnemyDenyCommands.add("sethome");
territoryEnemyDenyCommands.add("spawn");
territoryEnemyDenyCommands.add("tpahere");
territoryEnemyDenyCommands.add("tpaccept");
territoryEnemyDenyCommands.add("tpa");
static {
baseCommandAliases.add("f");
/// TODO: Consider removing this in a future release, as permissions works just fine now
territoryProtectedMaterials.add(Material.BEACON);
territoryEnemyDenyCommands.add("home");
territoryEnemyDenyCommands.add("sethome");
territoryEnemyDenyCommands.add("spawn");
territoryEnemyDenyCommands.add("tpahere");
territoryEnemyDenyCommands.add("tpaccept");
territoryEnemyDenyCommands.add("tpa");
// Config is not loading if value is empty ???
territoryBypassProtectedMaterials.add(Material.COOKIE);
/// TODO: Consider removing this in a future release, as permissions works just fine now
territoryProtectedMaterials.add(Material.BEACON);
territoryDenyUseageMaterials.add(XMaterial.FIRE_CHARGE.parseMaterial());
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
territoryDenyUseageMaterials.add(Material.BUCKET);
territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
territoryDenyUseageMaterials.add(Material.LAVA_BUCKET);
if (!P.p.mc17) {
territoryDenyUseageMaterials.add(Material.ARMOR_STAND);
}
// Config is not loading if value is empty ???
territoryBypassProtectedMaterials.add(Material.COOKIE);
territoryDenyUseageMaterials.add(XMaterial.FIRE_CHARGE.parseMaterial());
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
territoryDenyUseageMaterials.add(Material.BUCKET);
territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
territoryDenyUseageMaterials.add(Material.LAVA_BUCKET);
if (!P.p.mc17) {
territoryDenyUseageMaterials.add(Material.ARMOR_STAND);
}
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
territoryProtectedMaterialsWhenOffline.add(Material.BEACON);
territoryDenyUseageMaterialsWhenOffline.add(XMaterial.FIRE_CHARGE.parseMaterial());
territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);
territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET);
if (!P.p.mc17) {
territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND);
}
safeZoneNerfedCreatureTypes.add(EntityType.BLAZE);
safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER);
safeZoneNerfedCreatureTypes.add(EntityType.CREEPER);
safeZoneNerfedCreatureTypes.add(EntityType.ENDER_DRAGON);
safeZoneNerfedCreatureTypes.add(EntityType.ENDERMAN);
safeZoneNerfedCreatureTypes.add(EntityType.GHAST);
safeZoneNerfedCreatureTypes.add(EntityType.MAGMA_CUBE);
safeZoneNerfedCreatureTypes.add(EntityType.PIG_ZOMBIE);
safeZoneNerfedCreatureTypes.add(EntityType.SILVERFISH);
safeZoneNerfedCreatureTypes.add(EntityType.SKELETON);
safeZoneNerfedCreatureTypes.add(EntityType.SPIDER);
safeZoneNerfedCreatureTypes.add(EntityType.SLIME);
safeZoneNerfedCreatureTypes.add(EntityType.WITCH);
safeZoneNerfedCreatureTypes.add(EntityType.WITHER);
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
territoryDenyUseageMaterialsWhenOffline.add(XMaterial.FIRE_CHARGE.parseMaterial());
territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);
territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET);
if (!P.p.mc17) {
territoryDenyUseageMaterialsWhenOffline.add(Material.ARMOR_STAND);
}
safeZoneNerfedCreatureTypes.add(EntityType.BLAZE);
safeZoneNerfedCreatureTypes.add(EntityType.CAVE_SPIDER);
safeZoneNerfedCreatureTypes.add(EntityType.CREEPER);
safeZoneNerfedCreatureTypes.add(EntityType.ENDER_DRAGON);
safeZoneNerfedCreatureTypes.add(EntityType.ENDERMAN);
safeZoneNerfedCreatureTypes.add(EntityType.GHAST);
safeZoneNerfedCreatureTypes.add(EntityType.MAGMA_CUBE);
safeZoneNerfedCreatureTypes.add(EntityType.PIG_ZOMBIE);
safeZoneNerfedCreatureTypes.add(EntityType.SILVERFISH);
safeZoneNerfedCreatureTypes.add(EntityType.SKELETON);
safeZoneNerfedCreatureTypes.add(EntityType.SPIDER);
safeZoneNerfedCreatureTypes.add(EntityType.SLIME);
safeZoneNerfedCreatureTypes.add(EntityType.WITCH);
safeZoneNerfedCreatureTypes.add(EntityType.WITHER);
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
// Is this called lazy load?
defaultFactionPermissions.put("LEADER", new DefaultPermissions(true));
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false));
defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
}
// Is this called lazy load?
defaultFactionPermissions.put("LEADER", new DefaultPermissions(true));
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false));
defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
}
public static void load() {
P.p.persist.loadOrSaveDefault(i, Conf.class, "conf");
}
public static void load() {
P.p.persist.loadOrSaveDefault(i, Conf.class, "conf");
}
public static void save() {
P.p.persist.save(i);
}
public static void save() {
P.p.persist.save(i);
}
public enum Backend {
JSON,
//MYSQL, TODO add MySQL storage
;
}
public enum Backend {
JSON,
//MYSQL, TODO add MySQL storage
;
}
}

View File

@ -12,246 +12,247 @@ import java.util.Objects;
import java.util.Set;
public class FLocation implements Serializable {
private static final long serialVersionUID = -8292915234027387983L;
private static final boolean worldBorderSupport;
private static final long serialVersionUID = -8292915234027387983L;
private static final boolean worldBorderSupport;
static {
boolean worldBorderClassPresent = false;
try {
Class.forName("org.bukkit.WorldBorder");
worldBorderClassPresent = true;
} catch (ClassNotFoundException ignored) {
}
static {
boolean worldBorderClassPresent = false;
try {
Class.forName("org.bukkit.WorldBorder");
worldBorderClassPresent = true;
} catch (ClassNotFoundException ignored) {
}
worldBorderSupport = worldBorderClassPresent;
}
worldBorderSupport = worldBorderClassPresent;
}
private String worldName = "world";
private int x = 0;
private int z = 0;
private String worldName = "world";
private int x = 0;
private int z = 0;
//----------------------------------------------//
// Constructors
//----------------------------------------------//
//----------------------------------------------//
// Constructors
//----------------------------------------------//
public FLocation() {
public FLocation() {
}
}
public FLocation(String worldName, int x, int z) {
this.worldName = worldName;
this.x = x;
this.z = z;
}
public FLocation(String worldName, int x, int z) {
this.worldName = worldName;
this.x = x;
this.z = z;
}
public FLocation(Location location) {
this(location.getWorld().getName(), blockToChunk(location.getBlockX()), blockToChunk(location.getBlockZ()));
}
public FLocation(Location location) {
this(location.getWorld().getName(), blockToChunk(location.getBlockX()), blockToChunk(location.getBlockZ()));
}
public FLocation(Player player) {
this(player.getLocation());
}
public FLocation(Player player) {
this(player.getLocation());
}
public FLocation(FPlayer fplayer) {
this(fplayer.getPlayer());
}
public FLocation(FPlayer fplayer) {
this(fplayer.getPlayer());
}
public FLocation(Block block) {
this(block.getLocation());
}
public FLocation(Block block) {
this(block.getLocation());
}
//----------------------------------------------//
// Getters and Setters
//----------------------------------------------//
//----------------------------------------------//
// Getters and Setters
//----------------------------------------------//
public static FLocation fromString(String string) {
int index = string.indexOf(",");
int start = 1;
String worldName = string.substring(start, index);
start = index + 1;
index = string.indexOf(",", start);
int x = Integer.valueOf(string.substring(start, index));
int y = Integer.valueOf(string.substring(index + 1, string.length() - 1));
return new FLocation(worldName, x, y);
}
public static FLocation fromString(String string) {
int index = string.indexOf(",");
int start = 1;
String worldName = string.substring(start, index);
start = index + 1;
index = string.indexOf(",", start);
int x = Integer.valueOf(string.substring(start, index));
int y = Integer.valueOf(string.substring(index + 1, string.length() - 1));
return new FLocation(worldName, x, y);
}
// bit-shifting is used because it's much faster than standard division and multiplication
public static int blockToChunk(int blockVal) { // 1 chunk is 16x16 blocks
return blockVal >> 4; // ">> 4" == "/ 16"
}
public static int blockToRegion(int blockVal) { // 1 region is 512x512 blocks
return blockVal >> 9; // ">> 9" == "/ 512"
}
// bit-shifting is used because it's much faster than standard division and multiplication
public static int blockToChunk(int blockVal) { // 1 chunk is 16x16 blocks
return blockVal >> 4; // ">> 4" == "/ 16"
}
public static int chunkToRegion(int chunkVal) { // 1 region is 32x32 chunks
return chunkVal >> 5; // ">> 5" == "/ 32"
}
public static int blockToRegion(int blockVal) { // 1 region is 512x512 blocks
return blockVal >> 9; // ">> 9" == "/ 512"
}
public static int chunkToBlock(int chunkVal) {
return chunkVal << 4; // "<< 4" == "* 16"
}
public static int chunkToRegion(int chunkVal) { // 1 region is 32x32 chunks
return chunkVal >> 5; // ">> 5" == "/ 32"
}
public static int regionToBlock(int regionVal) {
return regionVal << 9; // "<< 9" == "* 512"
}
public static int chunkToBlock(int chunkVal) {
return chunkVal << 4; // "<< 4" == "* 16"
}
public static int regionToChunk(int regionVal) {
return regionVal << 5; // "<< 5" == "* 32"
}
public static int regionToBlock(int regionVal) {
return regionVal << 9; // "<< 9" == "* 512"
}
public static HashSet<FLocation> getArea(FLocation from, FLocation to) {
HashSet<FLocation> ret = new HashSet<>();
public static int regionToChunk(int regionVal) {
return regionVal << 5; // "<< 5" == "* 32"
}
for (long x : MiscUtil.range(from.getX(), to.getX())) {
for (long z : MiscUtil.range(from.getZ(), to.getZ())) {
ret.add(new FLocation(from.getWorldName(), (int) x, (int) z));
}
}
public static HashSet<FLocation> getArea(FLocation from, FLocation to) {
HashSet<FLocation> ret = new HashSet<>();
return ret;
}
for (long x : MiscUtil.range(from.getX(), to.getX())) {
for (long z : MiscUtil.range(from.getZ(), to.getZ())) {
ret.add(new FLocation(from.getWorldName(), (int) x, (int) z));
}
}
public Chunk getChunk() {
return Bukkit.getWorld(worldName).getChunkAt(x, z);
}
return ret;
}
public String getWorldName() {
return worldName;
}
public Chunk getChunk() {
return Bukkit.getWorld(worldName).getChunkAt(x, z);
}
public void setWorldName(String worldName) {
this.worldName = worldName;
}
public String getWorldName() {
return worldName;
}
//----------------------------------------------//
// Block/Chunk/Region Value Transformation
//----------------------------------------------//
public void setWorldName(String worldName) {
this.worldName = worldName;
}
public World getWorld() {
return Bukkit.getWorld(worldName);
}
//----------------------------------------------//
// Block/Chunk/Region Value Transformation
//----------------------------------------------//
public long getX() {
return x;
}
public World getWorld() {
return Bukkit.getWorld(worldName);
}
public void setX(int x) {
this.x = x;
}
public long getX() {
return x;
}
public long getZ() {
return z;
}
public void setX(int x) {
this.x = x;
}
public void setZ(int z) {
this.z = z;
}
public long getZ() {
return z;
}
public String getCoordString() {
return "" + x + "," + z;
}
public void setZ(int z) {
this.z = z;
}
//----------------------------------------------//
// Misc Geometry
//----------------------------------------------//
public String getCoordString() {
return "" + x + "," + z;
}
@Override
public String toString() {
return "[" + this.getWorldName() + "," + this.getCoordString() + "]";
}
//----------------------------------------------//
// Misc Geometry
//----------------------------------------------//
public FLocation getRelative(int dx, int dz) {
return new FLocation(this.worldName, this.x + dx, this.z + dz);
}
@Override
public String toString() {
return "[" + this.getWorldName() + "," + this.getCoordString() + "]";
}
public double getDistanceTo(FLocation that) {
double dx = that.x - this.x;
double dz = that.z - this.z;
return Math.sqrt(dx * dx + dz * dz);
}
public FLocation getRelative(int dx, int dz) {
return new FLocation(this.worldName, this.x + dx, this.z + dz);
}
public double getDistanceSquaredTo(FLocation that) {
double dx = that.x - this.x;
double dz = that.z - this.z;
return dx * dx + dz * dz;
}
public double getDistanceTo(FLocation that) {
double dx = that.x - this.x;
double dz = that.z - this.z;
return Math.sqrt(dx * dx + dz * dz);
}
public boolean isInChunk(Location loc) {
if (loc == null) {
return false;
}
Chunk chunk = loc.getChunk();
return loc.getWorld().getName().equalsIgnoreCase(getWorldName()) && chunk.getX() == x && chunk.getZ() == z;
}
public double getDistanceSquaredTo(FLocation that) {
double dx = that.x - this.x;
double dz = that.z - this.z;
return dx * dx + dz * dz;
}
/**
* Checks if the chunk represented by this FLocation is outside the world border
*
* @param buffer the number of chunks from the border that will be treated as "outside"
* @return whether this location is outside of the border
*/
public boolean isOutsideWorldBorder(int buffer) {
if (!worldBorderSupport) {
return false;
}
public boolean isInChunk(Location loc) {
if (loc == null) {
return false;
}
Chunk chunk = loc.getChunk();
return loc.getWorld().getName().equalsIgnoreCase(getWorldName()) && chunk.getX() == x && chunk.getZ() == z;
}
WorldBorder border = getWorld().getWorldBorder();
Chunk chunk = border.getCenter().getChunk();
/**
* Checks if the chunk represented by this FLocation is outside the world border
*
* @param buffer the number of chunks from the border that will be treated as "outside"
* @return whether this location is outside of the border
*/
public boolean isOutsideWorldBorder(int buffer) {
if (!worldBorderSupport) {
return false;
}
int lim = FLocation.chunkToRegion((int) border.getSize()) - buffer;
int diffX = chunk.getX() - x;
int diffZ = chunk.getZ() - z;
return diffX > lim || diffZ > lim || -diffX > lim - 1 || -diffZ > lim - 1;
}
WorldBorder border = getWorld().getWorldBorder();
Chunk chunk = border.getCenter().getChunk();
//----------------------------------------------//
// Some Geometry
//----------------------------------------------//
public Set<FLocation> getCircle(double radius) {
double radiusSquared = radius * radius;
int lim = FLocation.chunkToRegion((int) border.getSize()) - buffer;
int diffX = chunk.getX() - x;
int diffZ = chunk.getZ() - z;
return diffX > lim || diffZ > lim || -diffX > lim - 1 || -diffZ > lim - 1;
}
Set<FLocation> ret = new LinkedHashSet<>();
if (radius <= 0) {
return ret;
}
//----------------------------------------------//
// Some Geometry
//----------------------------------------------//
public Set<FLocation> getCircle(double radius) {
double radiusSquared = radius * radius;
int xfrom = (int) Math.floor(this.x - radius);
int xto = (int) Math.ceil(this.x + radius);
int zfrom = (int) Math.floor(this.z - radius);
int zto = (int) Math.ceil(this.z + radius);
Set<FLocation> ret = new LinkedHashSet<>();
if (radius <= 0) {
return ret;
}
for (int x = xfrom; x <= xto; x++) {
for (int z = zfrom; z <= zto; z++) {
FLocation potential = new FLocation(this.worldName, x, z);
if (this.getDistanceSquaredTo(potential) <= radiusSquared) {
ret.add(potential);
}
}
}
int xfrom = (int) Math.floor(this.x - radius);
int xto = (int) Math.ceil(this.x + radius);
int zfrom = (int) Math.floor(this.z - radius);
int zto = (int) Math.ceil(this.z + radius);
return ret;
}
for (int x = xfrom; x <= xto; x++) {
for (int z = zfrom; z <= zto; z++) {
FLocation potential = new FLocation(this.worldName, x, z);
if (this.getDistanceSquaredTo(potential) <= radiusSquared) {
ret.add(potential);
}
}
}
//----------------------------------------------//
// Comparison
//----------------------------------------------//
return ret;
}
@Override
public int hashCode() {
// should be fast, with good range and few hash collisions: (x * 512) + z + worldName.hashCode
return (this.x << 9) + this.z + (this.worldName != null ? this.worldName.hashCode() : 0);
}
//----------------------------------------------//
// Comparison
//----------------------------------------------//
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof FLocation)) {
return false;
}
@Override
public int hashCode() {
// should be fast, with good range and few hash collisions: (x * 512) + z + worldName.hashCode
return (this.x << 9) + this.z + (this.worldName != null ? this.worldName.hashCode() : 0);
}
FLocation that = (FLocation) obj;
return this.x == that.x && this.z == that.z && (Objects.equals(this.worldName, that.worldName));
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof FLocation)) {
return false;
}
FLocation that = (FLocation) obj;
return this.x == that.x && this.z == that.z && (Objects.equals(this.worldName, that.worldName));
}
}

View File

@ -26,368 +26,368 @@ import java.util.List;
public interface FPlayer extends EconomyParticipator {
void setNotificationsEnabled(boolean notifications);
void setNotificationsEnabled(boolean notifications);
boolean hasNotificationsEnabled();
boolean hasNotificationsEnabled();
void setAlt(boolean alt);
boolean isAlt();
boolean isAlt();
void setAlt(boolean alt);
/**
* Used to know if stealth is toggled on or off
*
* @return if stealth mode is on or not.
*/
boolean isStealthEnabled();
/**
* Used to know if stealth is toggled on or off
*
* @return if stealth mode is on or not.
*/
boolean isStealthEnabled();
/**
* Toggles the stealth of the FPlayer depending on the parameter
*
* @param stealthToggle - toggles stealth
*/
void setStealth(boolean stealthToggle);
/**
* Toggles the stealth of the FPlayer depending on the parameter
*
* @param stealthToggle - toggles stealth
*/
void setStealth(boolean stealthToggle);
/**
* Sets the kills and deaths of a player.
*/
void login();
/**
* Sets the kills and deaths of a player.
*/
void login();
/**
* Caches the kills and deaths of a player.
*/
void logout();
/**
* Caches the kills and deaths of a player.
*/
void logout();
/**
* gets the faction of a FPlayer.
*
* @return Faction of the FPlayer.
*/
Faction getFaction();
/**
* gets the faction of a FPlayer.
*
* @return Faction of the FPlayer.
*/
Faction getFaction();
/**
* Sets the faction of the FPlayer
*
* @param faction faction to set.
*/
void setFaction(Faction faction, boolean alt);
/**
* Sets the faction of the FPlayer
*
* @param faction faction to set.
*/
void setFaction(Faction faction, boolean alt);
/**
* Gets the faction ID of the player.
*
* @return FactionsID string
*/
String getFactionId();
/**
* Gets the faction ID of the player.
*
* @return FactionsID string
*/
String getFactionId();
/**
* Check if a player has a faction
*
* @return boolean
*/
boolean hasFaction();
/**
* Check if a player has a faction
*
* @return boolean
*/
boolean hasFaction();
/**
* Gets autoleave status
*
* @return boolean of the autoleave
*/
boolean willAutoLeave();
/**
* Gets autoleave status
*
* @return boolean of the autoleave
*/
boolean willAutoLeave();
void setAutoLeave(boolean autoLeave);
void setAutoLeave(boolean autoLeave);
long getLastFrostwalkerMessage();
long getLastFrostwalkerMessage();
void setLastFrostwalkerMessage();
void setLastFrostwalkerMessage();
void setMonitorJoins(boolean monitor);
void setMonitorJoins(boolean monitor);
boolean isMonitoringJoins();
boolean isMonitoringJoins();
Role getRole();
Role getRole();
void setRole(Role role);
void setRole(Role role);
boolean shouldTakeFallDamage();
boolean shouldTakeFallDamage();
void setTakeFallDamage(boolean fallDamage);
void setTakeFallDamage(boolean fallDamage);
double getPowerBoost();
double getPowerBoost();
void setPowerBoost(double powerBoost);
void setPowerBoost(double powerBoost);
Faction getAutoClaimFor();
Faction getAutoClaimFor();
void setAutoClaimFor(Faction faction);
void setAutoClaimFor(Faction faction);
boolean isAutoSafeClaimEnabled();
boolean isAutoSafeClaimEnabled();
void setIsAutoSafeClaimEnabled(boolean enabled);
void setIsAutoSafeClaimEnabled(boolean enabled);
boolean isAutoWarClaimEnabled();
boolean isAutoWarClaimEnabled();
void setIsAutoWarClaimEnabled(boolean enabled);
void setIsAutoWarClaimEnabled(boolean enabled);
boolean isAdminBypassing();
boolean isAdminBypassing();
boolean isVanished();
boolean isVanished();
void setIsAdminBypassing(boolean val);
void setIsAdminBypassing(boolean val);
ChatMode getChatMode();
ChatMode getChatMode();
void setChatMode(ChatMode chatMode);
void setChatMode(ChatMode chatMode);
boolean isIgnoreAllianceChat();
boolean isIgnoreAllianceChat();
void setIgnoreAllianceChat(boolean ignore);
void setIgnoreAllianceChat(boolean ignore);
boolean isSpyingChat();
boolean isSpyingChat();
void setSpyingChat(boolean chatSpying);
void setSpyingChat(boolean chatSpying);
boolean showScoreboard();
boolean showScoreboard();
void setShowScoreboard(boolean show);
void setShowScoreboard(boolean show);
// FIELD: account
String getAccountId();
// FIELD: account
String getAccountId();
void resetFactionData(boolean doSpoutUpdate);
void resetFactionData(boolean doSpoutUpdate);
void resetFactionData();
void resetFactionData();
long getLastLoginTime();
long getLastLoginTime();
void setLastLoginTime(long lastLoginTime);
void setLastLoginTime(long lastLoginTime);
boolean isMapAutoUpdating();
boolean isMapAutoUpdating();
void setMapAutoUpdating(boolean mapAutoUpdating);
void setMapAutoUpdating(boolean mapAutoUpdating);
boolean hasLoginPvpDisabled();
boolean hasLoginPvpDisabled();
FLocation getLastStoodAt();
FLocation getLastStoodAt();
void setLastStoodAt(FLocation flocation);
void setLastStoodAt(FLocation flocation);
String getTitle();
String getTitle();
void setTitle(CommandSender sender, String title);
void setTitle(CommandSender sender, String title);
String getName();
String getName();
String getTag();
String getTag();
// Base concatenations:
// Base concatenations:
String getNameAndSomething(String something);
String getNameAndSomething(String something);
String getNameAndTitle();
String getNameAndTitle();
String getNameAndTag();
String getNameAndTag();
// Colored concatenations:
// These are used in information messages
// Colored concatenations:
// These are used in information messages
String getNameAndTitle(Faction faction);
String getNameAndTitle(Faction faction);
String getNameAndTitle(FPlayer fplayer);
String getNameAndTitle(FPlayer fplayer);
// Chat Tag:
// These are injected into the format of global chat messages.
// Chat Tag:
// These are injected into the format of global chat messages.
String getChatTag();
String getChatTag();
// Colored Chat Tag
String getChatTag(Faction faction);
// Colored Chat Tag
String getChatTag(Faction faction);
String getChatTag(FPlayer fplayer);
String getChatTag(FPlayer fplayer);
int getKills();
int getKills();
int getDeaths();
int getDeaths();
void takeMoney(int amt);
void takeMoney(int amt);
boolean hasMoney(int amt);
boolean hasMoney(int amt);
//inspect Stuff
//inspect Stuff
boolean isInspectMode();
boolean isInspectMode();
void setInspectMode(boolean status);
void setInspectMode(boolean status);
// Fly Checks
// Fly Checks
Boolean canflyinWilderness();
Boolean canflyinWilderness();
Boolean canflyinWarzone();
Boolean canflyinWarzone();
Boolean canflyinSafezone();
Boolean canflyinSafezone();
Boolean canflyinEnemy();
Boolean canflyinEnemy();
Boolean canflyinAlly();
Boolean canflyinAlly();
Boolean canflyinTruce();
Boolean canflyinTruce();
Boolean canflyinNeutral();
Boolean canflyinNeutral();
// -------------------------------
// Relation and relation colors
// -------------------------------
// -------------------------------
// Relation and relation colors
// -------------------------------
@Override
String describeTo(RelationParticipator that, boolean ucfirst);
@Override
String describeTo(RelationParticipator that, boolean ucfirst);
@Override
String describeTo(RelationParticipator that);
@Override
String describeTo(RelationParticipator that);
@Override
Relation getRelationTo(RelationParticipator rp);
@Override
Relation getRelationTo(RelationParticipator rp);
@Override
Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
@Override
Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
Relation getRelationToLocation();
Relation getRelationToLocation();
@Override
ChatColor getColorTo(RelationParticipator rp);
@Override
ChatColor getColorTo(RelationParticipator rp);
String getRolePrefix();
String getRolePrefix();
//----------------------------------------------//
// Health
//----------------------------------------------//
void heal(int amnt);
//----------------------------------------------//
// Health
//----------------------------------------------//
void heal(int amnt);
//----------------------------------------------//
// Power
//----------------------------------------------//
double getPower();
//----------------------------------------------//
// Power
//----------------------------------------------//
double getPower();
void alterPower(double delta);
void alterPower(double delta);
double getPowerMax();
double getPowerMax();
double getPowerMin();
double getPowerMin();
int getPowerRounded();
int getPowerRounded();
int getPowerMaxRounded();
int getPowerMaxRounded();
int getPowerMinRounded();
int getPowerMinRounded();
void updatePower();
void updatePower();
void losePowerFromBeingOffline();
void losePowerFromBeingOffline();
void onDeath();
void onDeath();
//----------------------------------------------//
// Territory
//----------------------------------------------//
boolean isInOwnTerritory();
//----------------------------------------------//
// Territory
//----------------------------------------------//
boolean isInOwnTerritory();
boolean isInOthersTerritory();
boolean isInOthersTerritory();
boolean isInAllyTerritory();
boolean isInAllyTerritory();
boolean isInNeutralTerritory();
boolean isInNeutralTerritory();
boolean isInEnemyTerritory();
boolean isInEnemyTerritory();
void sendFactionHereMessage(Faction from);
void sendFactionHereMessage(Faction from);
// -------------------------------
// Actions
// -------------------------------
// -------------------------------
// Actions
// -------------------------------
void leave(boolean makePay);
void leave(boolean makePay);
boolean canClaimForFaction(Faction forFaction);
boolean canClaimForFaction(Faction forFaction);
boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure);
boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure);
boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure);
boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure);
boolean isInVault();
boolean isInVault();
void setInVault(boolean status);
void setInVault(boolean status);
void msg(String str, Object... args);
void msg(String str, Object... args);
String getId();
String getId();
void setId(String id);
void setId(String id);
Player getPlayer();
Player getPlayer();
boolean isOnline();
boolean isOnline();
void sendMessage(String message);
void sendMessage(String message);
void sendMessage(List<String> messages);
void sendMessage(List<String> messages);
void sendFancyMessage(FancyMessage message);
void sendFancyMessage(FancyMessage message);
void sendFancyMessage(List<FancyMessage> message);
void sendFancyMessage(List<FancyMessage> message);
int getMapHeight();
int getMapHeight();
void setMapHeight(int height);
void setMapHeight(int height);
boolean isOnlineAndVisibleTo(Player me);
boolean isOnlineAndVisibleTo(Player me);
void remove();
void remove();
boolean isOffline();
boolean isOffline();
boolean isFlying();
boolean isFlying();
void setFlying(boolean fly);
void setFlying(boolean fly);
void setFFlying(boolean fly, boolean damage);
void setFFlying(boolean fly, boolean damage);
boolean canFlyAtLocation();
boolean canFlyAtLocation();
boolean canFlyAtLocation(FLocation location);
boolean canFlyAtLocation(FLocation location);
boolean isEnteringPassword();
boolean isEnteringPassword();
void setEnteringPassword(boolean toggle, String warp);
void setEnteringPassword(boolean toggle, String warp);
String getEnteringWarp();
String getEnteringWarp();
boolean checkIfNearbyEnemies();
boolean checkIfNearbyEnemies();
int getCooldown(String cmd);
int getCooldown(String cmd);
void setCooldown(String cmd, long cooldown);
void setCooldown(String cmd, long cooldown);
boolean isCooldownEnded(String cmd);
boolean isCooldownEnded(String cmd);
// -------------------------------
// Warmups
// -------------------------------
// -------------------------------
// Warmups
// -------------------------------
boolean isWarmingUp();
boolean isWarmingUp();
WarmUpUtil.Warmup getWarmupType();
WarmUpUtil.Warmup getWarmupType();
void addWarmup(WarmUpUtil.Warmup warmup, int taskId);
void addWarmup(WarmUpUtil.Warmup warmup, int taskId);
void stopWarmup();
void stopWarmup();
void clearWarmup();
void clearWarmup();
}

View File

@ -7,34 +7,34 @@ import org.bukkit.entity.Player;
import java.util.Collection;
public abstract class FPlayers {
protected static FPlayers instance = getFPlayersImpl();
protected static FPlayers instance = getFPlayersImpl();
public static FPlayers getInstance() {
return instance;
}
public static FPlayers getInstance() {
return instance;
}
private static FPlayers getFPlayersImpl() {
if (Conf.backEnd == Conf.Backend.JSON) {
return new JSONFPlayers();
}
return null;
}
private static FPlayers getFPlayersImpl() {
if (Conf.backEnd == Conf.Backend.JSON) {
return new JSONFPlayers();
}
return null;
}
public abstract void clean();
public abstract void clean();
public abstract Collection<FPlayer> getOnlinePlayers();
public abstract Collection<FPlayer> getOnlinePlayers();
public abstract FPlayer getByPlayer(Player player);
public abstract FPlayer getByPlayer(Player player);
public abstract Collection<FPlayer> getAllFPlayers();
public abstract Collection<FPlayer> getAllFPlayers();
public abstract void forceSave();
public abstract void forceSave();
public abstract void forceSave(boolean sync);
public abstract void forceSave(boolean sync);
public abstract FPlayer getByOfflinePlayer(OfflinePlayer player);
public abstract FPlayer getByOfflinePlayer(OfflinePlayer player);
public abstract FPlayer getById(String string);
public abstract FPlayer getById(String string);
public abstract void load();
public abstract void load();
}

View File

@ -23,350 +23,358 @@ import java.util.concurrent.ConcurrentHashMap;
public interface Faction extends EconomyParticipator {
boolean altInvited(FPlayer fplayer);
long getCheckNotifier();
Map<String, Mission> getMissions();
void setCheckNotifier(long minutes);
void deinviteAlt(FPlayer alt);
void sendCheckNotify();
void deinviteAllAlts();
boolean altInvited(FPlayer fplayer);
void altInvite(FPlayer fplayer);
Map<String, Mission> getMissions();
boolean addAltPlayer(FPlayer fplayer);
void deinviteAlt(FPlayer alt);
boolean removeAltPlayer(FPlayer fplayer);
void deinviteAllAlts();
Set<FPlayer> getAltPlayers();
void altInvite(FPlayer fplayer);
HashMap<String, List<String>> getAnnouncements();
boolean addAltPlayer(FPlayer fplayer);
ConcurrentHashMap<String, LazyLocation> getWarps();
boolean removeAltPlayer(FPlayer fplayer);
LazyLocation getWarp(String name);
Set<FPlayer> getAltPlayers();
void setWarp(String name, LazyLocation loc);
HashMap<String, List<String>> getAnnouncements();
boolean isWarp(String name);
ConcurrentHashMap<String, LazyLocation> getWarps();
boolean hasWarpPassword(String warp);
LazyLocation getWarp(String name);
boolean isWarpPassword(String warp, String password);
void setWarp(String name, LazyLocation loc);
void setWarpPassword(String warp, String password);
boolean isWarp(String name);
boolean removeWarp(String name);
boolean hasWarpPassword(String warp);
void clearWarps();
boolean isWarpPassword(String warp, String password);
int getMaxVaults();
void setWarpPassword(String warp, String password);
void setMaxVaults(int value);
boolean removeWarp(String name);
void addAnnouncement(FPlayer fPlayer, String msg);
void clearWarps();
void sendUnreadAnnouncements(FPlayer fPlayer);
int getMaxVaults();
void removeAnnouncements(FPlayer fPlayer);
void setMaxVaults(int value);
Set<String> getInvites();
void addAnnouncement(FPlayer fPlayer, String msg);
String getFocused();
void sendUnreadAnnouncements(FPlayer fPlayer);
void setFocused(String setFocused);
void removeAnnouncements(FPlayer fPlayer);
String getId();
Set<String> getInvites();
void setId(String id);
String getFocused();
void invite(FPlayer fplayer);
void setFocused(String setFocused);
void deinvite(FPlayer fplayer);
String getId();
void setUpgrade(UpgradeType upgrade, int level);
void setId(String id);
int getUpgrade(UpgradeType upgrade);
void invite(FPlayer fplayer);
boolean isInvited(FPlayer fplayer);
void deinvite(FPlayer fplayer);
void ban(FPlayer target, FPlayer banner);
void setUpgrade(UpgradeType upgrade, int level);
int getPoints();
int getUpgrade(UpgradeType upgrade);
void setPoints(int points);
boolean isInvited(FPlayer fplayer);
int getStrikes();
void ban(FPlayer target, FPlayer banner);
void setStrikes(int strikes);
int getPoints();
void unban(FPlayer player);
void setPoints(int points);
boolean isBanned(FPlayer player);
int getStrikes();
Set<BanInfo> getBannedPlayers();
void setStrikes(int strikes);
HashMap<Integer, String> getRulesMap();
void unban(FPlayer player);
void addRule(String rule);
boolean isBanned(FPlayer player);
void removeRule(int index);
Set<BanInfo> getBannedPlayers();
void clearRules();
HashMap<Integer, String> getRulesMap();
Location getCheckpoint();
void addRule(String rule);
void setCheckpoint(Location location);
void removeRule(int index);
void addTnt(int amt);
void clearRules();
void takeTnt(int amt);
Location getCheckpoint();
Location getVault();
void setCheckpoint(Location location);
void setVault(Location vaultLocation);
void addTnt(int amt);
Inventory getChestInventory();
void takeTnt(int amt);
void setChestSize(int chestSize);
Location getVault();
void setBannerPattern(ItemStack banner);
void setVault(Location vaultLocation);
ItemStack getBanner();
Inventory getChestInventory();
int getTnt();
void setChestSize(int chestSize);
String getRule(int index);
void setBannerPattern(ItemStack banner);
boolean getOpen();
ItemStack getBanner();
void setOpen(boolean isOpen);
int getTnt();
boolean isPeaceful();
String getRule(int index);
void setPeaceful(boolean isPeaceful);
boolean getOpen();
boolean getPeacefulExplosionsEnabled();
void setOpen(boolean isOpen);
void setPeacefulExplosionsEnabled(boolean val);
boolean isPeaceful();
boolean noExplosionsInTerritory();
void setPeaceful(boolean isPeaceful);
boolean isPermanent();
boolean getPeacefulExplosionsEnabled();
void setPermanent(boolean isPermanent);
void setPeacefulExplosionsEnabled(boolean val);
String getTag();
boolean noExplosionsInTerritory();
void setTag(String str);
boolean isPermanent();
String getTag(String prefix);
void setPermanent(boolean isPermanent);
String getTag(Faction otherFaction);
String getTag();
String getTag(FPlayer otherFplayer);
void setTag(String str);
String getComparisonTag();
String getTag(String prefix);
String getDescription();
String getTag(Faction otherFaction);
void setDescription(String value);
String getTag(FPlayer otherFplayer);
boolean hasHome();
String getComparisonTag();
Location getHome();
String getDescription();
void setHome(Location home);
void setDescription(String value);
long getFoundedDate();
boolean hasHome();
void setFoundedDate(long newDate);
Location getHome();
void confirmValidHome();
void setHome(Location home);
String getAccountId();
long getFoundedDate();
Integer getPermanentPower();
void setFoundedDate(long newDate);
void setPermanentPower(Integer permanentPower);
void confirmValidHome();
boolean hasPermanentPower();
String getAccountId();
double getPowerBoost();
Integer getPermanentPower();
void setPowerBoost(double powerBoost);
void setPermanentPower(Integer permanentPower);
boolean noPvPInTerritory();
boolean hasPermanentPower();
boolean noMonstersInTerritory();
double getPowerBoost();
boolean isNormal();
boolean isSystemFaction();
@Deprecated
boolean isNone();
void setPowerBoost(double powerBoost);
boolean isWilderness();
boolean noPvPInTerritory();
boolean isSafeZone();
boolean noMonstersInTerritory();
boolean isWarZone();
boolean isNormal();
boolean isPlayerFreeType();
boolean isSystemFaction();
boolean isPowerFrozen();
@Deprecated
boolean isNone();
void setLastDeath(long time);
boolean isWilderness();
int getKills();
boolean isSafeZone();
int getDeaths();
boolean isWarZone();
Access getAccess(Permissable permissable, PermissableAction permissableAction);
boolean isPlayerFreeType();
Access getAccess(FPlayer player, PermissableAction permissableAction);
boolean isPowerFrozen();
boolean setPermission(Permissable permissable, PermissableAction permissableAction, Access access);
void setLastDeath(long time);
void resetPerms();
int getKills();
void setDefaultPerms();
int getDeaths();
void disband(Player disbander);
Access getAccess(Permissable permissable, PermissableAction permissableAction);
void disband(Player disbander, PlayerDisbandReason reason);
Access getAccess(FPlayer player, PermissableAction permissableAction);
// -------------------------------
// Relation and relation colors
// -------------------------------
boolean setPermission(Permissable permissable, PermissableAction permissableAction, Access access);
Map<Permissable, Map<PermissableAction, Access>> getPermissions();
void resetPerms();
@Override
String describeTo(RelationParticipator that, boolean ucfirst);
void setDefaultPerms();
@Override
String describeTo(RelationParticipator that);
void disband(Player disbander);
@Override
Relation getRelationTo(RelationParticipator rp);
void disband(Player disbander, PlayerDisbandReason reason);
@Override
Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
// -------------------------------
// Relation and relation colors
// -------------------------------
@Override
ChatColor getColorTo(RelationParticipator rp);
Map<Permissable, Map<PermissableAction, Access>> getPermissions();
Relation getRelationWish(Faction otherFaction);
@Override
String describeTo(RelationParticipator that, boolean ucfirst);
void setRelationWish(Faction otherFaction, Relation relation);
@Override
String describeTo(RelationParticipator that);
int getRelationCount(Relation relation);
@Override
Relation getRelationTo(RelationParticipator rp);
// ----------------------------------------------//
// Power
// ----------------------------------------------//
double getPower();
@Override
Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
double getPowerMax();
@Override
ChatColor getColorTo(RelationParticipator rp);
int getPowerRounded();
Relation getRelationWish(Faction otherFaction);
int getPowerMaxRounded();
void setRelationWish(Faction otherFaction, Relation relation);
int getLandRounded();
int getRelationCount(Relation relation);
int getLandRoundedInWorld(String worldName);
// ----------------------------------------------//
// Power
// ----------------------------------------------//
double getPower();
// -------------------------------
// FPlayers
// -------------------------------
double getPowerMax();
boolean hasLandInflation();
int getPowerRounded();
// maintain the reference list of FPlayers in this faction
void refreshFPlayers();
int getPowerMaxRounded();
boolean addFPlayer(FPlayer fplayer);
int getLandRounded();
boolean removeFPlayer(FPlayer fplayer);
int getLandRoundedInWorld(String worldName);
int getSize();
// -------------------------------
// FPlayers
// -------------------------------
Set<FPlayer> getFPlayers();
boolean hasLandInflation();
Set<FPlayer> getFPlayersWhereOnline(boolean online);
// maintain the reference list of FPlayers in this faction
void refreshFPlayers();
Set<FPlayer> getFPlayersWhereOnline(boolean online, FPlayer viewer);
boolean addFPlayer(FPlayer fplayer);
FPlayer getFPlayerAdmin();
boolean removeFPlayer(FPlayer fplayer);
FPlayer getFPlayerLeader();
int getSize();
ArrayList<FPlayer> getFPlayersWhereRole(Role role);
Set<FPlayer> getFPlayers();
ArrayList<Player> getOnlinePlayers();
Set<FPlayer> getFPlayersWhereOnline(boolean online);
// slightly faster check than getOnlinePlayers() if you just want to see if
// there are any players online
boolean hasPlayersOnline();
Set<FPlayer> getFPlayersWhereOnline(boolean online, FPlayer viewer);
void memberLoggedOff();
FPlayer getFPlayerAdmin();
// used when current leader is about to be removed from the faction;
// promotes new leader, or disbands faction if no other members left
void promoteNewLeader();
FPlayer getFPlayerLeader();
void promoteNewLeader(boolean autoLeave);
ArrayList<FPlayer> getFPlayersWhereRole(Role role);
Role getDefaultRole();
ArrayList<Player> getOnlinePlayers();
void setDefaultRole(Role role);
// slightly faster check than getOnlinePlayers() if you just want to see if
// there are any players online
boolean hasPlayersOnline();
// ----------------------------------------------//
// Messages
// ----------------------------------------------//
void msg(String message, Object... args);
void memberLoggedOff();
void sendMessage(String message);
// used when current leader is about to be removed from the faction;
// promotes new leader, or disbands faction if no other members left
void promoteNewLeader();
// ----------------------------------------------//
// Ownership of specific claims
// ----------------------------------------------//
void promoteNewLeader(boolean autoLeave);
void sendMessage(List<String> messages);
Role getDefaultRole();
Map<FLocation, Set<String>> getClaimOwnership();
void setDefaultRole(Role role);
void clearAllClaimOwnership();
// ----------------------------------------------//
// Messages
// ----------------------------------------------//
void msg(String message, Object... args);
void clearClaimOwnership(FLocation loc);
void sendMessage(String message);
void clearClaimOwnership(FPlayer player);
// ----------------------------------------------//
// Ownership of specific claims
// ----------------------------------------------//
int getCountOfClaimsWithOwners();
void sendMessage(List<String> messages);
boolean doesLocationHaveOwnersSet(FLocation loc);
Map<FLocation, Set<String>> getClaimOwnership();
boolean isPlayerInOwnerList(FPlayer player, FLocation loc);
void clearAllClaimOwnership();
void setPlayerAsOwner(FPlayer player, FLocation loc);
void clearClaimOwnership(FLocation loc);
void removePlayerAsOwner(FPlayer player, FLocation loc);
void clearClaimOwnership(FPlayer player);
Set<String> getOwnerList(FLocation loc);
int getCountOfClaimsWithOwners();
String getOwnerListString(FLocation loc);
boolean doesLocationHaveOwnersSet(FLocation loc);
boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc);
boolean isPlayerInOwnerList(FPlayer player, FLocation loc);
// ----------------------------------------------//
// Persistance and entity management
// ----------------------------------------------//
void remove();
void setPlayerAsOwner(FPlayer player, FLocation loc);
Set<FLocation> getAllClaims();
void removePlayerAsOwner(FPlayer player, FLocation loc);
String getPaypal();
Set<String> getOwnerList(FLocation loc);
void paypalSet(String paypal);
String getOwnerListString(FLocation loc);
boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc);
// ----------------------------------------------//
// Persistance and entity management
// ----------------------------------------------//
void remove();
Set<FLocation> getAllClaims();
String getPaypal();
void paypalSet(String paypal);
}

View File

@ -6,50 +6,50 @@ import java.util.ArrayList;
import java.util.Set;
public abstract class Factions {
protected static Factions instance = getFactionsImpl();
protected static Factions instance = getFactionsImpl();
public static Factions getInstance() {
return instance;
}
public static Factions getInstance() {
return instance;
}
private static Factions getFactionsImpl() {
switch (Conf.backEnd) {
case JSON:
return new JSONFactions();
}
return null;
}
private static Factions getFactionsImpl() {
switch (Conf.backEnd) {
case JSON:
return new JSONFactions();
}
return null;
}
public abstract Faction getFactionById(String id);
public abstract Faction getFactionById(String id);
public abstract Faction getByTag(String str);
public abstract Faction getByTag(String str);
public abstract Faction getBestTagMatch(String start);
public abstract Faction getBestTagMatch(String start);
public abstract boolean isTagTaken(String str);
public abstract boolean isTagTaken(String str);
public abstract boolean isValidFactionId(String id);
public abstract boolean isValidFactionId(String id);
public abstract Faction createFaction();
public abstract Faction createFaction();
public abstract void removeFaction(String id);
public abstract void removeFaction(String id);
public abstract Set<String> getFactionTags();
public abstract Set<String> getFactionTags();
public abstract ArrayList<Faction> getAllFactions();
public abstract ArrayList<Faction> getAllFactions();
@Deprecated
public abstract Faction getNone();
@Deprecated
public abstract Faction getNone();
public abstract Faction getWilderness();
public abstract Faction getWilderness();
public abstract Faction getSafeZone();
public abstract Faction getSafeZone();
public abstract Faction getWarZone();
public abstract Faction getWarZone();
public abstract void forceSave();
public abstract void forceSave();
public abstract void forceSave(boolean sync);
public abstract void forceSave(boolean sync);
public abstract void load();
public abstract void load();
}

File diff suppressed because it is too large Load Diff

View File

@ -8,46 +8,46 @@ import org.bukkit.event.player.PlayerTeleportEvent;
public class CmdAHome extends FCommand {
public CmdAHome() {
super();
this.aliases.add("ahome");
public CmdAHome() {
super();
this.aliases.add("ahome");
this.requiredArgs.add("player name");
this.requiredArgs.add("player name");
this.permission = Permission.AHOME.node;
this.disableOnLock = false;
this.disableOnSpam = false;
this.permission = Permission.AHOME.node;
this.disableOnLock = false;
this.disableOnSpam = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer target = argAsBestFPlayerMatch(0);
if (target == null) {
msg(TL.GENERIC_NOPLAYERMATCH, argAsString(0));
return;
}
@Override
public void perform() {
FPlayer target = argAsBestFPlayerMatch(0);
if (target == null) {
msg(TL.GENERIC_NOPLAYERMATCH, argAsString(0));
return;
}
if (target.isOnline()) {
Faction faction = target.getFaction();
if (faction.hasHome()) {
target.getPlayer().teleport(faction.getHome(), PlayerTeleportEvent.TeleportCause.PLUGIN);
msg(TL.COMMAND_AHOME_SUCCESS, target.getName());
target.msg(TL.COMMAND_AHOME_TARGET);
} else {
msg(TL.COMMAND_AHOME_NOHOME, target.getName());
}
} else {
msg(TL.COMMAND_AHOME_OFFLINE, target.getName());
}
}
if (target.isOnline()) {
Faction faction = target.getFaction();
if (faction.hasHome()) {
target.getPlayer().teleport(faction.getHome(), PlayerTeleportEvent.TeleportCause.PLUGIN);
msg(TL.COMMAND_AHOME_SUCCESS, target.getName());
target.msg(TL.COMMAND_AHOME_TARGET);
} else {
msg(TL.COMMAND_AHOME_NOHOME, target.getName());
}
} else {
msg(TL.COMMAND_AHOME_OFFLINE, target.getName());
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_AHOME_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_AHOME_DESCRIPTION;
}
}

View File

@ -12,95 +12,95 @@ import org.bukkit.ChatColor;
public class CmdAdmin extends FCommand {
public CmdAdmin() {
super();
this.aliases.add("admin");
this.aliases.add("setadmin");
this.aliases.add("leader");
this.aliases.add("setleader");
public CmdAdmin() {
super();
this.aliases.add("admin");
this.aliases.add("setadmin");
this.aliases.add("leader");
this.aliases.add("setleader");
this.requiredArgs.add("player name");
this.requiredArgs.add("player name");
this.permission = Permission.ADMIN.node;
this.disableOnLock = true;
this.disableOnSpam = true;
this.permission = Permission.ADMIN.node;
this.disableOnLock = true;
this.disableOnSpam = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer fyou = this.argAsBestFPlayerMatch(0);
if (fyou == null || fyou.getFaction().isWarZone() || fyou.getFaction().isWilderness() || fyou.getFaction().isSafeZone()) {
return;
}
@Override
public void perform() {
FPlayer fyou = this.argAsBestFPlayerMatch(0);
if (fyou == null || fyou.getFaction().isWarZone() || fyou.getFaction().isWilderness() || fyou.getFaction().isSafeZone()) {
return;
}
boolean permAny = Permission.ADMIN_ANY.has(sender, false);
Faction targetFaction = fyou.getFaction();
boolean permAny = Permission.ADMIN_ANY.has(sender, false);
Faction targetFaction = fyou.getFaction();
if(fyou.isAlt()){
msg(ChatColor.RED + "You can not promote alt accounts.");
return;
}
if (fyou.isAlt()) {
msg(ChatColor.RED + "You can not promote alt accounts.");
return;
}
if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true));
return;
}
if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true));
return;
}
if (fme != null && fme.getRole() != Role.LEADER && !permAny) {
msg(TL.COMMAND_ADMIN_NOTADMIN);
return;
}
if (fme != null && fme.getRole() != Role.LEADER && !permAny) {
msg(TL.COMMAND_ADMIN_NOTADMIN);
return;
}
if (fyou == fme && !permAny) {
msg(TL.COMMAND_ADMIN_TARGETSELF);
return;
}
if (fyou == fme && !permAny) {
msg(TL.COMMAND_ADMIN_TARGETSELF);
return;
}
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
if (fyou.getFaction() != targetFaction) {
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
}
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
if (fyou.getFaction() != targetFaction) {
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
}
FPlayer admin = targetFaction.getFPlayerAdmin();
FPlayer admin = targetFaction.getFPlayerAdmin();
if (fyou == admin && fyou.getFaction().getSize() == 1) {
msg(TL.COMMAND_ADMIN_NOMEMBERS);
return;
}
if (fyou == admin && fyou.getFaction().getSize() == 1) {
msg(TL.COMMAND_ADMIN_NOMEMBERS);
return;
}
// if target player is currently admin, demote and replace him
if (fyou == admin) {
targetFaction.promoteNewLeader();
msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true));
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true));
return;
}
// if target player is currently admin, demote and replace him
if (fyou == admin) {
targetFaction.promoteNewLeader();
msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true));
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true));
return;
}
// promote target player, and demote existing admin if one exists
if (admin != null) {
admin.setRole(Role.COLEADER);
}
fyou.setRole(Role.LEADER);
msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true));
// promote target player, and demote existing admin if one exists
if (admin != null) {
admin.setRole(Role.COLEADER);
}
fyou.setRole(Role.LEADER);
msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true));
// Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
}
}
// Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
}
}
public TL getUsageTranslation() {
return TL.COMMAND_ADMIN_DESCRIPTION;
}
public TL getUsageTranslation() {
return TL.COMMAND_ADMIN_DESCRIPTION;
}
}

View File

@ -9,42 +9,42 @@ import org.bukkit.entity.Player;
public class CmdAnnounce extends FCommand {
public CmdAnnounce() {
super();
this.aliases.add("ann");
this.aliases.add("announce");
public CmdAnnounce() {
super();
this.aliases.add("ann");
this.aliases.add("announce");
this.requiredArgs.add("message");
this.errorOnToManyArgs = false;
this.requiredArgs.add("message");
this.errorOnToManyArgs = false;
this.permission = Permission.ANNOUNCE.node;
this.disableOnLock = false;
this.disableOnSpam = false;
this.permission = Permission.ANNOUNCE.node;
this.disableOnLock = false;
this.disableOnSpam = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
}
@Override
public void perform() {
String prefix = ChatColor.GREEN + myFaction.getTag() + ChatColor.YELLOW + " [" + ChatColor.GRAY + me.getName() + ChatColor.YELLOW + "] " + ChatColor.RESET;
String message = StringUtils.join(args, " ");
@Override
public void perform() {
String prefix = ChatColor.GREEN + myFaction.getTag() + ChatColor.YELLOW + " [" + ChatColor.GRAY + me.getName() + ChatColor.YELLOW + "] " + ChatColor.RESET;
String message = StringUtils.join(args, " ");
for (Player player : myFaction.getOnlinePlayers()) {
player.sendMessage(prefix + message);
}
for (Player player : myFaction.getOnlinePlayers()) {
player.sendMessage(prefix + message);
}
// Add for offline players.
for (FPlayer fp : myFaction.getFPlayersWhereOnline(false)) {
myFaction.addAnnouncement(fp, prefix + message);
}
}
// Add for offline players.
for (FPlayer fp : myFaction.getFPlayersWhereOnline(false)) {
myFaction.addAnnouncement(fp, prefix + message);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_ANNOUNCE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_ANNOUNCE_DESCRIPTION;
}
}

View File

@ -9,38 +9,38 @@ import java.util.ArrayList;
public class CmdAutoHelp extends MCommand<P> {
public CmdAutoHelp() {
super(P.p);
this.aliases.add("?");
this.aliases.add("h");
this.aliases.add("help");
public CmdAutoHelp() {
super(P.p);
this.aliases.add("?");
this.aliases.add("h");
this.aliases.add("help");
this.setHelpShort("");
this.setHelpShort("");
this.optionalArgs.put("page", "1");
}
this.optionalArgs.put("page", "1");
}
@Override
public void perform() {
@Override
public void perform() {
if (this.commandChain.size() == 0) {
return;
}
MCommand<?> pcmd = this.commandChain.get(this.commandChain.size() - 1);
if (this.commandChain.size() == 0) {
return;
}
MCommand<?> pcmd = this.commandChain.get(this.commandChain.size() - 1);
ArrayList<String> lines = new ArrayList<>(pcmd.helpLong);
ArrayList<String> lines = new ArrayList<>(pcmd.helpLong);
for (MCommand<?> scmd : pcmd.subCommands) {
if (scmd.visibility == CommandVisibility.VISIBLE || (scmd.visibility == CommandVisibility.SECRET && scmd.validSenderPermissions(sender, false))) {
lines.add(scmd.getUseageTemplate(this.commandChain, true));
}
}
for (MCommand<?> scmd : pcmd.subCommands) {
if (scmd.visibility == CommandVisibility.VISIBLE || (scmd.visibility == CommandVisibility.SECRET && scmd.validSenderPermissions(sender, false))) {
lines.add(scmd.getUseageTemplate(this.commandChain, true));
}
}
sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), TL.COMMAND_AUTOHELP_HELPFOR.toString() + pcmd.aliases.get(0) + "\""));
}
sendMessage(p.txt.getPage(lines, this.argAsInt(0, 1), TL.COMMAND_AUTOHELP_HELPFOR.toString() + pcmd.aliases.get(0) + "\""));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_HELP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_HELP_DESCRIPTION;
}
}

View File

@ -15,88 +15,88 @@ import java.util.logging.Level;
public class CmdBan extends FCommand {
public CmdBan() {
super();
this.aliases.add("ban");
public CmdBan() {
super();
this.aliases.add("ban");
this.requiredArgs.add("target");
this.requiredArgs.add("target");
this.permission = Permission.BAN.node;
this.disableOnLock = true;
this.disableOnSpam = false;
this.permission = Permission.BAN.node;
this.disableOnLock = true;
this.disableOnSpam = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
@Override
public void perform() {
// Adds bypass to admins and clean permission check
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban");
return;
}
}
// Adds bypass to admins and clean permission check
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban");
return;
}
}
// Good on permission checks. Now lets just ban the player.
FPlayer target = argAsFPlayer(0);
if (target == null) {
return; // the above method sends a message if fails to find someone.
}
// Good on permission checks. Now lets just ban the player.
FPlayer target = argAsFPlayer(0);
if (target == null) {
return; // the above method sends a message if fails to find someone.
}
if (fme == target) {
// You may not ban yourself
fme.msg(TL.COMMAND_BAN_SELF);
return;
} else if (target.getFaction() == myFaction && target.getRole().value >= fme.getRole().value) {
// You may not ban someone that has same or higher faction rank
fme.msg(TL.COMMAND_BAN_INSUFFICIENTRANK, target.getName());
return;
}
if (fme == target) {
// You may not ban yourself
fme.msg(TL.COMMAND_BAN_SELF);
return;
} else if (target.getFaction() == myFaction && target.getRole().value >= fme.getRole().value) {
// You may not ban someone that has same or higher faction rank
fme.msg(TL.COMMAND_BAN_INSUFFICIENTRANK, target.getName());
return;
}
for (BanInfo banInfo : myFaction.getBannedPlayers()) {
if (banInfo.getBanned().equals(target.getId())) {
msg(TL.COMMAND_BAN_ALREADYBANNED);
return;
}
}
for (BanInfo banInfo : myFaction.getBannedPlayers()) {
if (banInfo.getBanned().equals(target.getId())) {
msg(TL.COMMAND_BAN_ALREADYBANNED);
return;
}
}
// Ban the user.
myFaction.ban(target, fme);
myFaction.deinvite(target); // can't hurt
// Ban the user.
myFaction.ban(target, fme);
myFaction.deinvite(target); // can't hurt
// If in same Faction, lets make sure to kick them and throw an event.
if (target.getFaction() == myFaction) {
// If in same Faction, lets make sure to kick them and throw an event.
if (target.getFaction() == myFaction) {
FPlayerLeaveEvent event = new FPlayerLeaveEvent(target, myFaction, FPlayerLeaveEvent.PlayerLeaveReason.BANNED);
Bukkit.getServer().getPluginManager().callEvent(event);
FPlayerLeaveEvent event = new FPlayerLeaveEvent(target, myFaction, FPlayerLeaveEvent.PlayerLeaveReason.BANNED);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
// if someone cancels a ban, we'll get people complaining here. So lets log it.
P.p.log(Level.WARNING, "Attempted to ban {0} but someone cancelled the kick event. This isn't good.", target.getName());
return;
}
if (event.isCancelled()) {
// if someone cancels a ban, we'll get people complaining here. So lets log it.
P.p.log(Level.WARNING, "Attempted to ban {0} but someone cancelled the kick event. This isn't good.", target.getName());
return;
}
// Didn't get cancelled so remove them and reset their invite.
myFaction.removeFPlayer(target);
target.resetFactionData();
}
// Didn't get cancelled so remove them and reset their invite.
myFaction.removeFPlayer(target);
target.resetFactionData();
}
// Lets inform the people!
target.msg(TL.COMMAND_BAN_TARGET, myFaction.getTag(target.getFaction()));
myFaction.msg(TL.COMMAND_BAN_BANNED, fme.getName(), target.getName());
}
// Lets inform the people!
target.msg(TL.COMMAND_BAN_TARGET, myFaction.getTag(target.getFaction()));
myFaction.msg(TL.COMMAND_BAN_BANNED, fme.getName(), target.getName());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BAN_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BAN_DESCRIPTION;
}
}

View File

@ -13,61 +13,61 @@ import java.util.List;
public class CmdBanlist extends FCommand {
public CmdBanlist() {
super();
this.aliases.add("banlist");
this.aliases.add("bans");
this.aliases.add("banl");
public CmdBanlist() {
super();
this.aliases.add("banlist");
this.aliases.add("bans");
this.aliases.add("banl");
this.optionalArgs.put("faction", "faction");
this.optionalArgs.put("faction", "faction");
this.permission = Permission.BAN.node;
this.disableOnLock = true;
this.disableOnSpam = false;
this.permission = Permission.BAN.node;
this.disableOnLock = true;
this.disableOnSpam = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction target = myFaction;
if (!args.isEmpty()) {
target = argAsFaction(0);
}
@Override
public void perform() {
Faction target = myFaction;
if (!args.isEmpty()) {
target = argAsFaction(0);
}
if (target == Factions.getInstance().getWilderness()) {
sender.sendMessage(TL.COMMAND_BANLIST_NOFACTION.toString());
return;
}
if (target == Factions.getInstance().getWilderness()) {
sender.sendMessage(TL.COMMAND_BANLIST_NOFACTION.toString());
return;
}
if (target == null) {
sender.sendMessage(TL.COMMAND_BANLIST_INVALID.format(argAsString(0)));
return;
}
if (target == null) {
sender.sendMessage(TL.COMMAND_BANLIST_INVALID.format(argAsString(0)));
return;
}
List<String> lines = new ArrayList<>();
lines.add(TL.COMMAND_BANLIST_HEADER.format(target.getBannedPlayers().size(), target.getTag(myFaction)));
int i = 1;
List<String> lines = new ArrayList<>();
lines.add(TL.COMMAND_BANLIST_HEADER.format(target.getBannedPlayers().size(), target.getTag(myFaction)));
int i = 1;
for (BanInfo info : target.getBannedPlayers()) {
FPlayer banned = FPlayers.getInstance().getById(info.getBanned());
FPlayer banner = FPlayers.getInstance().getById(info.getBanner());
String timestamp = TL.sdf.format(info.getTime());
for (BanInfo info : target.getBannedPlayers()) {
FPlayer banned = FPlayers.getInstance().getById(info.getBanned());
FPlayer banner = FPlayers.getInstance().getById(info.getBanner());
String timestamp = TL.sdf.format(info.getTime());
lines.add(TL.COMMAND_BANLIST_ENTRY.format(i, banned.getName(), banner.getName(), timestamp));
i++;
}
lines.add(TL.COMMAND_BANLIST_ENTRY.format(i, banned.getName(), banner.getName(), timestamp));
i++;
}
for (String s : lines) {
fme.sendMessage(s);
}
}
for (String s : lines) {
fme.sendMessage(s);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BANLIST_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BANLIST_DESCRIPTION;
}
}

View File

@ -6,47 +6,47 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdBoom extends FCommand {
public CmdBoom() {
super();
this.aliases.add("noboom");
this.aliases.add("explosions");
this.aliases.add("toggleexplosions");
public CmdBoom() {
super();
this.aliases.add("noboom");
this.aliases.add("explosions");
this.aliases.add("toggleexplosions");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.NO_BOOM.node;
this.disableOnLock = true;
this.permission = Permission.NO_BOOM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!myFaction.isPeaceful()) {
fme.msg(TL.COMMAND_BOOM_PEACEFULONLY);
return;
}
@Override
public void perform() {
if (!myFaction.isPeaceful()) {
fme.msg(TL.COMMAND_BOOM_PEACEFULONLY);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostNoBoom, TL.COMMAND_BOOM_TOTOGGLE, TL.COMMAND_BOOM_FORTOGGLE)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostNoBoom, TL.COMMAND_BOOM_TOTOGGLE, TL.COMMAND_BOOM_FORTOGGLE)) {
return;
}
myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, !myFaction.getPeacefulExplosionsEnabled()));
myFaction.setPeacefulExplosionsEnabled(this.argAsBool(0, !myFaction.getPeacefulExplosionsEnabled()));
String enabled = myFaction.noExplosionsInTerritory() ? TL.GENERIC_DISABLED.toString() : TL.GENERIC_ENABLED.toString();
String enabled = myFaction.noExplosionsInTerritory() ? TL.GENERIC_DISABLED.toString() : TL.GENERIC_ENABLED.toString();
// Inform
myFaction.msg(TL.COMMAND_BOOM_ENABLED, fme.describeTo(myFaction), enabled);
}
// Inform
myFaction.msg(TL.COMMAND_BOOM_ENABLED, fme.describeTo(myFaction), enabled);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BOOM_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BOOM_DESCRIPTION;
}
}

View File

@ -6,39 +6,39 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdBypass extends FCommand {
public CmdBypass() {
super();
this.aliases.add("bypass");
public CmdBypass() {
super();
this.aliases.add("bypass");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.BYPASS.node;
this.disableOnLock = false;
this.permission = Permission.BYPASS.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
fme.setIsAdminBypassing(this.argAsBool(0, !fme.isAdminBypassing()));
@Override
public void perform() {
fme.setIsAdminBypassing(this.argAsBool(0, !fme.isAdminBypassing()));
// TODO: Move this to a transient field in the model??
if (fme.isAdminBypassing()) {
fme.msg(TL.COMMAND_BYPASS_ENABLE.toString());
P.p.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString());
} else {
fme.msg(TL.COMMAND_BYPASS_DISABLE.toString());
P.p.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString());
}
}
// TODO: Move this to a transient field in the model??
if (fme.isAdminBypassing()) {
fme.msg(TL.COMMAND_BYPASS_ENABLE.toString());
P.p.log(fme.getName() + TL.COMMAND_BYPASS_ENABLELOG.toString());
} else {
fme.msg(TL.COMMAND_BYPASS_DISABLE.toString());
P.p.log(fme.getName() + TL.COMMAND_BYPASS_DISABLELOG.toString());
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BYPASS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_BYPASS_DESCRIPTION;
}
}

View File

@ -8,80 +8,80 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdChat extends FCommand {
public CmdChat() {
super();
this.aliases.add("c");
this.aliases.add("chat");
public CmdChat() {
super();
this.aliases.add("c");
this.aliases.add("chat");
//this.requiredArgs.add("");
this.optionalArgs.put("mode", "next");
//this.requiredArgs.add("");
this.optionalArgs.put("mode", "next");
this.permission = Permission.CHAT.node;
this.disableOnLock = false;
this.permission = Permission.CHAT.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!Conf.factionOnlyChat) {
msg(TL.COMMAND_CHAT_DISABLED.toString());
return;
}
@Override
public void perform() {
if (!Conf.factionOnlyChat) {
msg(TL.COMMAND_CHAT_DISABLED.toString());
return;
}
String modeString = this.argAsString(0);
ChatMode modeTarget = fme.getChatMode().getNext();
String modeString = this.argAsString(0);
ChatMode modeTarget = fme.getChatMode().getNext();
if (modeString != null) {
modeString = modeString.toLowerCase();
// Only allow Mods and higher rank to switch to this channel.
if (modeString.startsWith("m")) {
if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
msg(TL.COMMAND_CHAT_MOD_ONLY);
return;
} else modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC;
} else if (modeString.startsWith("a")) {
modeTarget = ChatMode.ALLIANCE;
} else if (modeString.startsWith("f")) {
modeTarget = ChatMode.FACTION;
} else if (modeString.startsWith("t")) {
modeTarget = ChatMode.TRUCE;
} else {
msg(TL.COMMAND_CHAT_INVALIDMODE);
return;
}
}
if (modeString != null) {
modeString = modeString.toLowerCase();
// Only allow Mods and higher rank to switch to this channel.
if (modeString.startsWith("m")) {
if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
msg(TL.COMMAND_CHAT_MOD_ONLY);
return;
} else modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC;
} else if (modeString.startsWith("a")) {
modeTarget = ChatMode.ALLIANCE;
} else if (modeString.startsWith("f")) {
modeTarget = ChatMode.FACTION;
} else if (modeString.startsWith("t")) {
modeTarget = ChatMode.TRUCE;
} else {
msg(TL.COMMAND_CHAT_INVALIDMODE);
return;
}
}
fme.setChatMode(modeTarget);
fme.setChatMode(modeTarget);
switch (fme.getChatMode()) {
case MOD:
msg(TL.COMMAND_CHAT_MODE_MOD);
break;
case PUBLIC:
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
break;
case ALLIANCE:
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
break;
case TRUCE:
msg(TL.COMMAND_CHAT_MODE_TRUCE);
break;
default:
msg(TL.COMMAND_CHAT_MODE_FACTION);
break;
}
}
switch (fme.getChatMode()) {
case MOD:
msg(TL.COMMAND_CHAT_MODE_MOD);
break;
case PUBLIC:
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
break;
case ALLIANCE:
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
break;
case TRUCE:
msg(TL.COMMAND_CHAT_MODE_TRUCE);
break;
default:
msg(TL.COMMAND_CHAT_MODE_FACTION);
break;
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHAT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHAT_DESCRIPTION;
}
}

View File

@ -6,37 +6,37 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdChatSpy extends FCommand {
public CmdChatSpy() {
super();
this.aliases.add("chatspy");
public CmdChatSpy() {
super();
this.aliases.add("chatspy");
this.optionalArgs.put("on/off", "flip");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.CHATSPY.node;
this.disableOnLock = false;
this.permission = Permission.CHATSPY.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat()));
@Override
public void perform() {
fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat()));
if (fme.isSpyingChat()) {
fme.msg(TL.COMMAND_CHATSPY_ENABLE);
P.p.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString());
} else {
fme.msg(TL.COMMAND_CHATSPY_DISABLE);
P.p.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString());
}
}
if (fme.isSpyingChat()) {
fme.msg(TL.COMMAND_CHATSPY_ENABLE);
P.p.log(fme.getName() + TL.COMMAND_CHATSPY_ENABLELOG.toString());
} else {
fme.msg(TL.COMMAND_CHATSPY_DISABLE);
P.p.log(fme.getName() + TL.COMMAND_CHATSPY_DISABLELOG.toString());
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHATSPY_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHATSPY_DESCRIPTION;
}
}

View File

@ -0,0 +1,56 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
public class CmdCheck extends FCommand {
public CmdCheck() {
this.aliases.add("check");
this.requiredArgs.add("minutes");
this.permission = Permission.CHECK.node;
this.disableOnLock = true;
this.disableOnSpam = false;
this.senderMustBePlayer = true;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
this.senderMustBeColeader = false;
this.senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!Conf.useCheckSystem) {
msg(TL.GENERIC_DISABLED);
return;
}
Access access = myFaction.getAccess(fme, PermissableAction.CHECK);
if ((access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.LEADER))) && !fme.isAdminBypassing()) {
fme.msg(TL.GENERIC_NOPERMISSION, "check");
return;
}
int minutes = this.argAsInt(0);
if (minutes <= 0) {
msg(TL.COMMAND_CHECK_INVALID_NUMBER);
} else {
myFaction.setCheckNotifier(minutes);
msg(TL.COMMAND_CHECK_SUCCESSFUL.format(minutes));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHECK_DESCRIPTION;
}
}

View File

@ -6,61 +6,61 @@ import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.util.TL;
public class CmdCheckpoint extends FCommand {
public CmdCheckpoint() {
super();
this.aliases.add("checkp");
this.aliases.add("checkpoint");
this.aliases.add("cpoint");
public CmdCheckpoint() {
super();
this.aliases.add("checkp");
this.aliases.add("checkpoint");
this.aliases.add("cpoint");
this.optionalArgs.put("set", "");
this.optionalArgs.put("set", "");
this.permission = Permission.CHECKPOINT.node;
this.disableOnLock = false;
this.permission = Permission.CHECKPOINT.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("checkpoints.Enabled")) {
fme.msg(TL.COMMAND_CHECKPOINT_DISABLED);
return;
}
if (args.size() == 1) {
FLocation myLocation = new FLocation(fme.getPlayer().getLocation());
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == fme.getFaction()) {
fme.getFaction().setCheckpoint(fme.getPlayer().getLocation());
fme.msg(TL.COMMAND_CHECKPOINT_SET);
return;
} else {
fme.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
return;
}
}
if (fme.getFaction().getCheckpoint() == null) {
fme.msg(TL.COMMAND_CHECKPOINT_NOT_SET);
return;
}
FLocation checkLocation = new FLocation(fme.getFaction().getCheckpoint());
Faction checkfaction = Board.getInstance().getFactionAt(checkLocation);
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("checkpoints.Enabled")) {
fme.msg(TL.COMMAND_CHECKPOINT_DISABLED);
return;
}
if (args.size() == 1) {
FLocation myLocation = new FLocation(fme.getPlayer().getLocation());
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == fme.getFaction()) {
fme.getFaction().setCheckpoint(fme.getPlayer().getLocation());
fme.msg(TL.COMMAND_CHECKPOINT_SET);
return;
} else {
fme.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
return;
}
}
if (fme.getFaction().getCheckpoint() == null) {
fme.msg(TL.COMMAND_CHECKPOINT_NOT_SET);
return;
}
FLocation checkLocation = new FLocation(fme.getFaction().getCheckpoint());
Faction checkfaction = Board.getInstance().getFactionAt(checkLocation);
if (checkfaction.getId().equals(Factions.getInstance().getWilderness().getId()) || checkfaction.getId().equals(fme.getFaction().getId())) {
fme.msg(TL.COMMAND_CHECKPOINT_GO);
this.doWarmUp(WarmUpUtil.Warmup.CHECKPOINT, TL.WARMUPS_NOTIFY_TELEPORT, "Checkpoint", () -> fme.getPlayer().teleport(fme.getFaction().getCheckpoint()), this.p.getConfig().getLong("warmups.f-checkpoint", 0));
} else {
fme.msg(TL.COMMAND_CHECKPOINT_CLAIMED);
}
if (checkfaction.getId().equals(Factions.getInstance().getWilderness().getId()) || checkfaction.getId().equals(fme.getFaction().getId())) {
fme.msg(TL.COMMAND_CHECKPOINT_GO);
this.doWarmUp(WarmUpUtil.Warmup.CHECKPOINT, TL.WARMUPS_NOTIFY_TELEPORT, "Checkpoint", () -> fme.getPlayer().teleport(fme.getFaction().getCheckpoint()), this.p.getConfig().getLong("warmups.f-checkpoint", 0));
} else {
fme.msg(TL.COMMAND_CHECKPOINT_CLAIMED);
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
}
}

View File

@ -10,87 +10,87 @@ import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor;
public class CmdColeader extends FCommand {
public CmdColeader() {
super();
this.aliases.add("co");
this.aliases.add("setcoleader");
this.aliases.add("coleader");
this.aliases.add("setco");
public CmdColeader() {
super();
this.aliases.add("co");
this.aliases.add("setcoleader");
this.aliases.add("coleader");
this.aliases.add("setco");
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.permission = Permission.COLEADER.node;
this.disableOnLock = true;
this.permission = Permission.COLEADER.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = true;
}
senderMustBePlayer = false;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = true;
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_COLEADER_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " coleader " + s);
}
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " coleader " + s);
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_COLEADER_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " coleader " + s);
}
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " coleader " + s);
}
sendFancyMessage(msg);
return;
}
sendFancyMessage(msg);
return;
}
boolean permAny = Permission.COLEADER_ANY.has(sender, false);
Faction targetFaction = you.getFaction();
boolean permAny = Permission.COLEADER_ANY.has(sender, false);
Faction targetFaction = you.getFaction();
if(you.isAlt()){
msg(ChatColor.RED + "You can not promote alt accounts.");
return;
}
if (you.isAlt()) {
msg(ChatColor.RED + "You can not promote alt accounts.");
return;
}
if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
return;
}
if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
return;
}
if (fme != null && fme.getRole() != Role.LEADER && !permAny) {
msg(TL.COMMAND_COLEADER_NOTADMIN);
return;
}
if (fme != null && fme.getRole() != Role.LEADER && !permAny) {
msg(TL.COMMAND_COLEADER_NOTADMIN);
return;
}
if (you == fme && !permAny) {
msg(TL.COMMAND_COLEADER_SELF);
return;
}
if (you == fme && !permAny) {
msg(TL.COMMAND_COLEADER_SELF);
return;
}
if (you.getRole() == Role.LEADER) {
msg(TL.COMMAND_COLEADER_TARGETISADMIN);
return;
}
if (you.getRole() == Role.LEADER) {
msg(TL.COMMAND_COLEADER_TARGETISADMIN);
return;
}
if (you.getRole() == Role.COLEADER) {
// Revoke
you.setRole(Role.MODERATOR);
targetFaction.msg(TL.COMMAND_COLEADER_REVOKED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_COLEADER_REVOKES, you.describeTo(fme, true));
} else {
// Give
you.setRole(Role.COLEADER);
targetFaction.msg(TL.COMMAND_COLEADER_PROMOTED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_COLEADER_PROMOTES, you.describeTo(fme, true));
}
}
if (you.getRole() == Role.COLEADER) {
// Revoke
you.setRole(Role.MODERATOR);
targetFaction.msg(TL.COMMAND_COLEADER_REVOKED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_COLEADER_REVOKES, you.describeTo(fme, true));
} else {
// Give
you.setRole(Role.COLEADER);
targetFaction.msg(TL.COMMAND_COLEADER_PROMOTED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_COLEADER_PROMOTES, you.describeTo(fme, true));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_COLEADER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_COLEADER_DESCRIPTION;
}
}

View File

@ -16,234 +16,234 @@ import java.util.Set;
public class CmdConfig extends FCommand {
private static HashMap<String, String> properFieldNames = new HashMap<>();
private static HashMap<String, String> properFieldNames = new HashMap<>();
public CmdConfig() {
super();
this.aliases.add("config");
public CmdConfig() {
super();
this.aliases.add("config");
this.requiredArgs.add("setting");
this.requiredArgs.add("value");
this.errorOnToManyArgs = false;
this.requiredArgs.add("setting");
this.requiredArgs.add("value");
this.errorOnToManyArgs = false;
this.permission = Permission.CONFIG.node;
this.disableOnLock = true;
this.permission = Permission.CONFIG.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// store a lookup map of lowercase field names paired with proper capitalization field names
// that way, if the person using this command messes up the capitalization, we can fix that
if (properFieldNames.isEmpty()) {
Field[] fields = Conf.class.getDeclaredFields();
for (Field field : fields) {
properFieldNames.put(field.getName().toLowerCase(), field.getName());
}
}
@Override
public void perform() {
// store a lookup map of lowercase field names paired with proper capitalization field names
// that way, if the person using this command messes up the capitalization, we can fix that
if (properFieldNames.isEmpty()) {
Field[] fields = Conf.class.getDeclaredFields();
for (Field field : fields) {
properFieldNames.put(field.getName().toLowerCase(), field.getName());
}
}
String field = this.argAsString(0).toLowerCase();
if (field.startsWith("\"") && field.endsWith("\"")) {
field = field.substring(1, field.length() - 1);
}
String fieldName = properFieldNames.get(field);
String field = this.argAsString(0).toLowerCase();
if (field.startsWith("\"") && field.endsWith("\"")) {
field = field.substring(1, field.length() - 1);
}
String fieldName = properFieldNames.get(field);
if (fieldName == null || fieldName.isEmpty()) {
msg(TL.COMMAND_CONFIG_NOEXIST, field);
return;
}
if (fieldName == null || fieldName.isEmpty()) {
msg(TL.COMMAND_CONFIG_NOEXIST, field);
return;
}
String success;
String success;
StringBuilder value = new StringBuilder(args.get(1));
for (int i = 2; i < args.size(); i++) {
value.append(' ').append(args.get(i));
}
StringBuilder value = new StringBuilder(args.get(1));
for (int i = 2; i < args.size(); i++) {
value.append(' ').append(args.get(i));
}
try {
Field target = Conf.class.getField(fieldName);
try {
Field target = Conf.class.getField(fieldName);
// boolean
if (target.getType() == boolean.class) {
boolean targetValue = this.strAsBool(value.toString());
target.setBoolean(null, targetValue);
// boolean
if (target.getType() == boolean.class) {
boolean targetValue = this.strAsBool(value.toString());
target.setBoolean(null, targetValue);
if (targetValue) {
success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_TRUE.toString();
} else {
success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_FALSE.toString();
}
}
if (targetValue) {
success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_TRUE.toString();
} else {
success = "\"" + fieldName + TL.COMMAND_CONFIG_SET_FALSE.toString();
}
}
// int
else if (target.getType() == int.class) {
try {
int intVal = Integer.parseInt(value.toString());
target.setInt(null, intVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + intVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_INTREQUIRED.format(fieldName));
return;
}
}
// int
else if (target.getType() == int.class) {
try {
int intVal = Integer.parseInt(value.toString());
target.setInt(null, intVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + intVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_INTREQUIRED.format(fieldName));
return;
}
}
// long
else if (target.getType() == long.class) {
try {
long longVal = Long.parseLong(value.toString());
target.setLong(null, longVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + longVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_LONGREQUIRED.format(fieldName));
return;
}
}
// long
else if (target.getType() == long.class) {
try {
long longVal = Long.parseLong(value.toString());
target.setLong(null, longVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + longVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_LONGREQUIRED.format(fieldName));
return;
}
}
// double
else if (target.getType() == double.class) {
try {
double doubleVal = Double.parseDouble(value.toString());
target.setDouble(null, doubleVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + doubleVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_DOUBLEREQUIRED.format(fieldName));
return;
}
}
// double
else if (target.getType() == double.class) {
try {
double doubleVal = Double.parseDouble(value.toString());
target.setDouble(null, doubleVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + doubleVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_DOUBLEREQUIRED.format(fieldName));
return;
}
}
// float
else if (target.getType() == float.class) {
try {
float floatVal = Float.parseFloat(value.toString());
target.setFloat(null, floatVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + floatVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_FLOATREQUIRED.format(fieldName));
return;
}
}
// float
else if (target.getType() == float.class) {
try {
float floatVal = Float.parseFloat(value.toString());
target.setFloat(null, floatVal);
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + floatVal + ".";
} catch (NumberFormatException ex) {
sendMessage(TL.COMMAND_CONFIG_FLOATREQUIRED.format(fieldName));
return;
}
}
// String
else if (target.getType() == String.class) {
target.set(null, value.toString());
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + value + "\".";
}
// String
else if (target.getType() == String.class) {
target.set(null, value.toString());
success = "\"" + fieldName + TL.COMMAND_CONFIG_OPTIONSET.toString() + value + "\".";
}
// ChatColor
else if (target.getType() == ChatColor.class) {
ChatColor newColor = null;
try {
newColor = ChatColor.valueOf(value.toString().toUpperCase());
} catch (IllegalArgumentException ex) {
// ChatColor
else if (target.getType() == ChatColor.class) {
ChatColor newColor = null;
try {
newColor = ChatColor.valueOf(value.toString().toUpperCase());
} catch (IllegalArgumentException ex) {
}
if (newColor == null) {
sendMessage(TL.COMMAND_CONFIG_INVALID_COLOUR.format(fieldName, value.toString().toUpperCase()));
return;
}
target.set(null, newColor);
success = "\"" + fieldName + TL.COMMAND_CONFIG_COLOURSET.toString() + value.toString().toUpperCase() + "\".";
}
}
if (newColor == null) {
sendMessage(TL.COMMAND_CONFIG_INVALID_COLOUR.format(fieldName, value.toString().toUpperCase()));
return;
}
target.set(null, newColor);
success = "\"" + fieldName + TL.COMMAND_CONFIG_COLOURSET.toString() + value.toString().toUpperCase() + "\".";
}
// Set<?> or other parameterized collection
else if (target.getGenericType() instanceof ParameterizedType) {
ParameterizedType targSet = (ParameterizedType) target.getGenericType();
Type innerType = targSet.getActualTypeArguments()[0];
// Set<?> or other parameterized collection
else if (target.getGenericType() instanceof ParameterizedType) {
ParameterizedType targSet = (ParameterizedType) target.getGenericType();
Type innerType = targSet.getActualTypeArguments()[0];
// not a Set, somehow, and that should be the only collection we're using in Conf.java
if (targSet.getRawType() != Set.class) {
sendMessage(TL.COMMAND_CONFIG_INVALID_COLLECTION.format(fieldName));
return;
}
// not a Set, somehow, and that should be the only collection we're using in Conf.java
if (targSet.getRawType() != Set.class) {
sendMessage(TL.COMMAND_CONFIG_INVALID_COLLECTION.format(fieldName));
return;
}
// Set<Material>
else if (innerType == Material.class) {
Material newMat = null;
try {
newMat = Material.valueOf(value.toString().toUpperCase());
} catch (IllegalArgumentException ex) {
// Set<Material>
else if (innerType == Material.class) {
Material newMat = null;
try {
newMat = Material.valueOf(value.toString().toUpperCase());
} catch (IllegalArgumentException ex) {
}
if (newMat == null) {
sendMessage(TL.COMMAND_CONFIG_INVALID_MATERIAL.format(fieldName, value.toString().toUpperCase()));
return;
}
}
if (newMat == null) {
sendMessage(TL.COMMAND_CONFIG_INVALID_MATERIAL.format(fieldName, value.toString().toUpperCase()));
return;
}
@SuppressWarnings("unchecked") Set<Material> matSet = (Set<Material>) target.get(null);
@SuppressWarnings("unchecked") Set<Material> matSet = (Set<Material>) target.get(null);
// Material already present, so remove it
if (matSet.contains(newMat)) {
matSet.remove(newMat);
target.set(null, matSet);
success = TL.COMMAND_CONFIG_MATERIAL_REMOVED.format(fieldName, value.toString().toUpperCase());
}
// Material not present yet, add it
else {
matSet.add(newMat);
target.set(null, matSet);
success = TL.COMMAND_CONFIG_MATERIAL_ADDED.format(fieldName, value.toString().toUpperCase());
}
}
// Material already present, so remove it
if (matSet.contains(newMat)) {
matSet.remove(newMat);
target.set(null, matSet);
success = TL.COMMAND_CONFIG_MATERIAL_REMOVED.format(fieldName, value.toString().toUpperCase());
}
// Material not present yet, add it
else {
matSet.add(newMat);
target.set(null, matSet);
success = TL.COMMAND_CONFIG_MATERIAL_ADDED.format(fieldName, value.toString().toUpperCase());
}
}
// Set<String>
else if (innerType == String.class) {
@SuppressWarnings("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
// Set<String>
else if (innerType == String.class) {
@SuppressWarnings("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
// String already present, so remove it
if (stringSet.contains(value.toString())) {
stringSet.remove(value.toString());
target.set(null, stringSet);
success = TL.COMMAND_CONFIG_SET_REMOVED.format(fieldName, value.toString());
}
// String not present yet, add it
else {
stringSet.add(value.toString());
target.set(null, stringSet);
success = TL.COMMAND_CONFIG_SET_ADDED.format(fieldName, value.toString());
}
}
// String already present, so remove it
if (stringSet.contains(value.toString())) {
stringSet.remove(value.toString());
target.set(null, stringSet);
success = TL.COMMAND_CONFIG_SET_REMOVED.format(fieldName, value.toString());
}
// String not present yet, add it
else {
stringSet.add(value.toString());
target.set(null, stringSet);
success = TL.COMMAND_CONFIG_SET_ADDED.format(fieldName, value.toString());
}
}
// Set of unknown type
else {
sendMessage(TL.COMMAND_CONFIG_INVALID_TYPESET.format(fieldName));
return;
}
}
// Set of unknown type
else {
sendMessage(TL.COMMAND_CONFIG_INVALID_TYPESET.format(fieldName));
return;
}
}
// unknown type
else {
sendMessage(TL.COMMAND_CONFIG_ERROR_TYPE.format(fieldName, target.getClass().getName()));
return;
}
} catch (NoSuchFieldException ex) {
sendMessage(TL.COMMAND_CONFIG_ERROR_MATCHING.format(fieldName));
return;
} catch (IllegalAccessException ex) {
sendMessage(TL.COMMAND_CONFIG_ERROR_SETTING.format(fieldName, value.toString()));
return;
}
// unknown type
else {
sendMessage(TL.COMMAND_CONFIG_ERROR_TYPE.format(fieldName, target.getClass().getName()));
return;
}
} catch (NoSuchFieldException ex) {
sendMessage(TL.COMMAND_CONFIG_ERROR_MATCHING.format(fieldName));
return;
} catch (IllegalAccessException ex) {
sendMessage(TL.COMMAND_CONFIG_ERROR_SETTING.format(fieldName, value.toString()));
return;
}
if (!success.isEmpty()) {
if (sender instanceof Player) {
sendMessage(success);
P.p.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender));
} else // using P.p.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log
{
P.p.log(success);
}
}
// save change to disk
Conf.save();
}
if (!success.isEmpty()) {
if (sender instanceof Player) {
sendMessage(success);
P.p.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender));
} else // using P.p.log() instead of sendMessage if run from server console so that "[Factions v#.#.#]" is prepended in server log
{
P.p.log(success);
}
}
// save change to disk
Conf.save();
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CONFIG_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CONFIG_DESCRIPTION;
}
}

View File

@ -9,36 +9,36 @@ import org.bukkit.command.ConsoleCommandSender;
public class CmdConvert extends FCommand {
public CmdConvert() {
this.aliases.add("convert");
public CmdConvert() {
this.aliases.add("convert");
this.permission = Permission.CONVERT.node;
this.permission = Permission.CONVERT.node;
this.requiredArgs.add("[MYSQL|JSON]");
}
this.requiredArgs.add("[MYSQL|JSON]");
}
@Override
public void perform() {
if (!(this.sender instanceof ConsoleCommandSender)) {
this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString());
}
Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase());
if (nb == Conf.backEnd) {
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString());
return;
}
if (nb == Backend.JSON) {
FactionsJSON.convertTo();
} else {
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
return;
}
Conf.backEnd = nb;
}
@Override
public void perform() {
if (!(this.sender instanceof ConsoleCommandSender)) {
this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString());
}
Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase());
if (nb == Conf.backEnd) {
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_RUNNING.toString());
return;
}
if (nb == Backend.JSON) {
FactionsJSON.convertTo();
} else {
this.sender.sendMessage(TL.COMMAND_CONVERT_BACKEND_INVALID.toString());
return;
}
Conf.backEnd = nb;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CONVERT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CONVERT_DESCRIPTION;
}
}

View File

@ -7,36 +7,36 @@ import org.bukkit.Location;
public class CmdCoords extends FCommand {
public CmdCoords() {
super();
this.aliases.add("coords");
this.aliases.add("coord");
public CmdCoords() {
super();
this.aliases.add("coords");
this.aliases.add("coord");
this.permission = Permission.COORD.node;
this.disableOnLock = true;
this.permission = Permission.COORD.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Location location = fme.getPlayer().getLocation();
String message = TL.COMMAND_COORDS_MESSAGE.toString().replace("{player}", fme.getPlayer().getDisplayName()).replace("{x}", (int) location.getX() + "")
.replace("{y}", (int) location.getY() + "").replace("{z}", (int) location.getZ() + "").replace("{world}", location.getWorld().getName());
for (FPlayer fPlayer : fme.getFaction().getFPlayers()) {
fPlayer.sendMessage(message);
}
}
@Override
public void perform() {
Location location = fme.getPlayer().getLocation();
String message = TL.COMMAND_COORDS_MESSAGE.toString().replace("{player}", fme.getPlayer().getDisplayName()).replace("{x}", (int) location.getX() + "")
.replace("{y}", (int) location.getY() + "").replace("{z}", (int) location.getZ() + "").replace("{world}", location.getWorld().getName());
for (FPlayer fPlayer : fme.getFaction().getFPlayers()) {
fPlayer.sendMessage(message);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_COORDS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_COORDS_DESCRIPTION;
}
}

View File

@ -15,117 +15,116 @@ import java.util.ArrayList;
public class CmdCreate extends FCommand {
public CmdCreate() {
super();
this.aliases.add("create");
public CmdCreate() {
super();
this.aliases.add("create");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.CREATE.node;
this.disableOnLock = true;
this.disableOnSpam = true;
this.permission = Permission.CREATE.node;
this.disableOnLock = true;
this.disableOnSpam = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
String tag = this.argAsString(0);
@Override
public void perform() {
String tag = this.argAsString(0);
if (fme.hasFaction()) {
msg(TL.COMMAND_CREATE_MUSTLEAVE);
return;
}
if (fme.hasFaction()) {
msg(TL.COMMAND_CREATE_MUSTLEAVE);
return;
}
if (!fme.isCooldownEnded("create")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("create"));
return;
}
if (!fme.isCooldownEnded("create")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("create"));
return;
}
if (Factions.getInstance().isTagTaken(tag)) {
msg(TL.COMMAND_CREATE_INUSE);
return;
}
if (Factions.getInstance().isTagTaken(tag)) {
msg(TL.COMMAND_CREATE_INUSE);
return;
}
ArrayList<String> tagValidationErrors = MiscUtil.validateTag(tag);
if (tagValidationErrors.size() > 0) {
sendMessage(tagValidationErrors);
return;
}
ArrayList<String> tagValidationErrors = MiscUtil.validateTag(tag);
if (tagValidationErrors.size() > 0) {
sendMessage(tagValidationErrors);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) {
return;
}
// trigger the faction creation event (cancellable)
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag);
Bukkit.getServer().getPluginManager().callEvent(createEvent);
if (createEvent.isCancelled()) {
return;
}
// trigger the faction creation event (cancellable)
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag);
Bukkit.getServer().getPluginManager().callEvent(createEvent);
if (createEvent.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
return;
}
Faction faction = Factions.getInstance().createFaction();
Faction faction = Factions.getInstance().createFaction();
// TODO: Why would this even happen??? Auto increment clash??
if (faction == null) {
msg(TL.COMMAND_CREATE_ERROR);
return;
}
// TODO: Why would this even happen??? Auto increment clash??
if (faction == null) {
msg(TL.COMMAND_CREATE_ERROR);
return;
}
// finish setting up the Faction
faction.setTag(tag);
// finish setting up the Faction
faction.setTag(tag);
// trigger the faction join event for the creator
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
// join event cannot be cancelled or you'll have an empty faction
// trigger the faction join event for the creator
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
// join event cannot be cancelled or you'll have an empty faction
// finish setting up the FPlayer
fme.setFaction(faction, false);
// We should consider adding the role just AFTER joining the faction.
// That way we don't have to mess up deleting more stuff.
// And prevent the user from being returned to NORMAL after deleting his old faction.
fme.setRole(Role.LEADER);
if (P.p.getConfig().getBoolean("faction-creation-broadcast", true)) {
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
}
}
msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate());
// finish setting up the FPlayer
fme.setFaction(faction, false);
// We should consider adding the role just AFTER joining the faction.
// That way we don't have to mess up deleting more stuff.
// And prevent the user from being returned to NORMAL after deleting his old faction.
fme.setRole(Role.LEADER);
if (P.p.getConfig().getBoolean("faction-creation-broadcast", true)) {
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
}
}
msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate());
if (Conf.econEnabled)
Econ.setBalance(faction.getAccountId(), Conf.econFactionStartingBalance);
if (Conf.econEnabled)
Econ.setBalance(faction.getAccountId(), Conf.econFactionStartingBalance);
if (Conf.logFactionCreate)
P.p.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag);
if (Conf.logFactionCreate)
P.p.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag);
if (P.p.getConfig().getBoolean("fpaypal.Enabled"))
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
if (P.p.getConfig().getBoolean("fpaypal.Enabled"))
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
if (Conf.useCustomDefaultPermissions) faction.setDefaultPerms();
if (Conf.usePermissionHints) fme.msg(TL.COMMAND_HINT_PERMISSION);
if (Conf.useCustomDefaultPermissions) faction.setDefaultPerms();
if (Conf.usePermissionHints) fme.msg(TL.COMMAND_HINT_PERMISSION);
fme.setCooldown("create", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-create") * 1000));
fme.setCooldown("create", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-create") * 1000));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CREATE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CREATE_DESCRIPTION;
}
}

View File

@ -13,62 +13,62 @@ import org.bukkit.ChatColor;
public class CmdDeinvite extends FCommand {
public CmdDeinvite() {
super();
this.aliases.add("deinvite");
this.aliases.add("deinv");
public CmdDeinvite() {
super();
this.aliases.add("deinvite");
this.aliases.add("deinv");
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.permission = Permission.DEINVITE.node;
this.disableOnLock = true;
this.permission = Permission.DEINVITE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}
}
if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) {
FPlayer fp = FPlayers.getInstance().getById(id);
String name = fp != null ? fp.getName() : id;
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
}
sendFancyMessage(msg);
return;
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}
}
if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) {
FPlayer fp = FPlayers.getInstance().getById(id);
String name = fp != null ? fp.getName() : id;
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
}
sendFancyMessage(msg);
return;
}
if (you.getFaction() == myFaction) {
msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), myFaction.getTag());
msg(TL.COMMAND_DEINVITE_MIGHTWANT, p.cmdBase.cmdKick.getUseageTemplate(false));
return;
}
if (you.getFaction() == myFaction) {
msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), myFaction.getTag());
msg(TL.COMMAND_DEINVITE_MIGHTWANT, p.cmdBase.cmdKick.getUseageTemplate(false));
return;
}
myFaction.deinvite(you);
myFaction.deinvite(you);
you.msg(TL.COMMAND_DEINVITE_REVOKED, fme.describeTo(you), myFaction.describeTo(you));
you.msg(TL.COMMAND_DEINVITE_REVOKED, fme.describeTo(you), myFaction.describeTo(you));
myFaction.msg(TL.COMMAND_DEINVITE_REVOKES, fme.describeTo(myFaction), you.describeTo(myFaction));
}
myFaction.msg(TL.COMMAND_DEINVITE_REVOKES, fme.describeTo(myFaction), you.describeTo(myFaction));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DEINVITE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DEINVITE_DESCRIPTION;
}
}

View File

@ -7,39 +7,39 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdDelFWarp extends FCommand {
public CmdDelFWarp() {
super();
this.aliases.add("delwarp");
this.aliases.add("dw");
this.aliases.add("deletewarp");
this.requiredArgs.add("warp name");
this.senderMustBeMember = true;
this.senderMustBeModerator = true;
this.senderMustBePlayer = true;
this.permission = Permission.SETWARP.node;
public CmdDelFWarp() {
super();
this.aliases.add("delwarp");
this.aliases.add("dw");
this.aliases.add("deletewarp");
this.requiredArgs.add("warp name");
this.senderMustBeMember = true;
this.senderMustBeModerator = true;
this.senderMustBePlayer = true;
this.permission = Permission.SETWARP.node;
}
}
@Override
public void perform() {
String warp = argAsString(0);
if (myFaction.isWarp(warp)) {
if (!transact(fme)) {
return;
}
myFaction.removeWarp(warp);
fme.msg(TL.COMMAND_DELFWARP_DELETED, warp);
} else {
fme.msg(TL.COMMAND_DELFWARP_INVALID, warp);
}
}
@Override
public void perform() {
String warp = argAsString(0);
if (myFaction.isWarp(warp)) {
if (!transact(fme)) {
return;
}
myFaction.removeWarp(warp);
fme.msg(TL.COMMAND_DELFWARP_DELETED, warp);
} else {
fme.msg(TL.COMMAND_DELFWARP_INVALID, warp);
}
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString());
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DELFWARP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DELFWARP_DESCRIPTION;
}
}

View File

@ -9,53 +9,53 @@ import com.massivecraft.factions.zcore.util.TextUtil;
public class CmdDescription extends FCommand {
public CmdDescription() {
super();
this.aliases.add("desc");
this.aliases.add("description");
public CmdDescription() {
super();
this.aliases.add("desc");
this.aliases.add("description");
this.requiredArgs.add("desc");
this.errorOnToManyArgs = false;
//this.optionalArgs
this.requiredArgs.add("desc");
this.errorOnToManyArgs = false;
//this.optionalArgs
this.permission = Permission.DESCRIPTION.node;
this.disableOnLock = true;
this.permission = Permission.DESCRIPTION.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
return;
}
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
return;
}
// since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
// And replace all the % because it messes with string formatting and this is easy way around that.
myFaction.setDescription(TextUtil.implode(args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2"));
// since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
// And replace all the % because it messes with string formatting and this is easy way around that.
myFaction.setDescription(TextUtil.implode(args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2"));
if (!Conf.broadcastDescriptionChanges) {
fme.msg(TL.COMMAND_DESCRIPTION_CHANGED, myFaction.describeTo(fme));
fme.sendMessage(myFaction.getDescription());
return;
}
if (!Conf.broadcastDescriptionChanges) {
fme.msg(TL.COMMAND_DESCRIPTION_CHANGED, myFaction.describeTo(fme));
fme.sendMessage(myFaction.getDescription());
return;
}
// Broadcast the description to everyone
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, myFaction.describeTo(fplayer));
fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
}
}
// Broadcast the description to everyone
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, myFaction.describeTo(fplayer));
fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DESCRIPTION_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DESCRIPTION_DESCRIPTION;
}
}

View File

@ -16,101 +16,101 @@ import java.util.HashMap;
public class CmdDisband extends FCommand {
private static HashMap<String, String> disbandMap = new HashMap<>();
private static HashMap<String, String> disbandMap = new HashMap<>();
public CmdDisband() {
super();
this.aliases.add("disband");
public CmdDisband() {
super();
this.aliases.add("disband");
//this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours");
//this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours");
this.permission = Permission.DISBAND.node;
this.disableOnLock = true;
this.disableOnSpam = true;
this.permission = Permission.DISBAND.node;
this.disableOnLock = true;
this.disableOnSpam = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
// The faction, default to your own.. but null if console sender.
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction);
if (faction == null) {
return;
}
@Override
public void perform() {
// The faction, default to your own.. but null if console sender.
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction);
if (faction == null) {
return;
}
if (!fme.isCooldownEnded("disband")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("disband"));
return;
}
if (!fme.isCooldownEnded("disband")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("disband"));
return;
}
boolean isMyFaction = fme != null && faction == myFaction;
boolean isMyFaction = fme != null && faction == myFaction;
if (isMyFaction) {
if (!assertMinRole(Role.LEADER)) {
return;
}
} else {
if (!Permission.DISBAND_ANY.has(sender, true)) {
return;
}
}
if (isMyFaction) {
if (!assertMinRole(Role.LEADER)) {
return;
}
} else {
if (!Permission.DISBAND_ANY.has(sender, true)) {
return;
}
}
if (fme != null && !fme.isAdminBypassing()) {
Access access = faction.getAccess(fme, PermissableAction.DISBAND);
if (fme.getRole() != Role.LEADER && faction.getFPlayerLeader() != fme && access != Access.ALLOW) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband " + faction.getTag());
return;
}
}
if (fme != null && !fme.isAdminBypassing()) {
Access access = faction.getAccess(fme, PermissableAction.DISBAND);
if (fme.getRole() != Role.LEADER && faction.getFPlayerLeader() != fme && access != Access.ALLOW) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband " + faction.getTag());
return;
}
}
if (!faction.isNormal()) {
msg(TL.COMMAND_DISBAND_IMMUTABLE.toString());
return;
}
if (faction.isPermanent()) {
msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString());
return;
}
if (!faction.isNormal()) {
msg(TL.COMMAND_DISBAND_IMMUTABLE.toString());
return;
}
if (faction.isPermanent()) {
msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString());
return;
}
// check for tnt before disbanding.
// check for tnt before disbanding.
if ((fme!= null && !disbandMap.containsKey(me.getUniqueId().toString())) && faction.getTnt() > 0) {
msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
disbandMap.put(me.getUniqueId().toString(), faction.getId());
Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> disbandMap.remove(me.getUniqueId().toString()), 200L);
} else if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) {
if (P.p.getConfig().getBoolean("faction-disband-broadcast", true)) {
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower);
UtilFly.checkFly(this.fme, Board.getInstance().getFactionAt(new FLocation(follower)));
if (follower.getFaction() == faction) {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
fme.setCooldown("disband", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-disband") * 1000));
} else {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
}
}
faction.disband(me, PlayerDisbandReason.COMMAND);
} else {
faction.disband(me, PlayerDisbandReason.COMMAND);
me.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
}
}
}
if ((fme != null && !disbandMap.containsKey(me.getUniqueId().toString())) && faction.getTnt() > 0) {
msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
disbandMap.put(me.getUniqueId().toString(), faction.getId());
Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> disbandMap.remove(me.getUniqueId().toString()), 200L);
} else if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) {
if (P.p.getConfig().getBoolean("faction-disband-broadcast", true)) {
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower);
UtilFly.checkFly(this.fme, Board.getInstance().getFactionAt(new FLocation(follower)));
if (follower.getFaction() == faction) {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
fme.setCooldown("disband", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-disband") * 1000));
} else {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
}
}
faction.disband(me, PlayerDisbandReason.COMMAND);
} else {
faction.disband(me, PlayerDisbandReason.COMMAND);
me.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DISBAND_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_DISBAND_DESCRIPTION;
}
}

View File

@ -9,6 +9,8 @@ import java.util.UUID;
public class CmdFGlobal extends FCommand {
public static List<UUID> toggled = new ArrayList<>();
public CmdFGlobal() {
super();
@ -26,18 +28,16 @@ public class CmdFGlobal extends FCommand {
senderMustBeAdmin = false;
}
public static List<UUID> toggled = new ArrayList<>();
@Override
public void perform() {
Player p = (Player)sender;
Player p = (Player) sender;
// /f global
if (toggled.contains(p.getUniqueId())){
if (toggled.contains(p.getUniqueId())) {
toggled.remove(p.getUniqueId());
}else{
} else {
toggled.add(p.getUniqueId());
}

View File

@ -16,68 +16,70 @@ import java.util.UUID;
public class CmdFWarp extends FCommand {
public CmdFWarp() {
super();
this.aliases.add("warp");
this.aliases.add("warps");
this.optionalArgs.put("warpname", "warpname");
this.optionalArgs.put("password", "password");
public CmdFWarp() {
super();
this.aliases.add("warp");
this.aliases.add("warps");
this.optionalArgs.put("warpname", "warpname");
this.optionalArgs.put("password", "password");
this.permission = Permission.WARP.node;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
}
this.permission = Permission.WARP.node;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
}
@Override
public void perform() {
//TODO: check if in combat.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.WARP);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps");
return;
}
}
@Override
public void perform() {
//TODO: check if in combat.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.WARP);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps");
return;
}
}
if (args.size() == 0) {
new FactionWarpsFrame(fme.getFaction()).buildGUI(fme);
} else if (args.size() > 2) {
fme.msg(TL.COMMAND_FWARP_COMMANDFORMAT);
} else {
final String warpName = argAsString(0);
final String passwordAttempt = argAsString(1);
if (args.size() == 0) {
new FactionWarpsFrame(fme.getFaction()).buildGUI(fme);
} else if (args.size() > 2) {
fme.msg(TL.COMMAND_FWARP_COMMANDFORMAT);
} else {
final String warpName = argAsString(0);
final String passwordAttempt = argAsString(1);
if (myFaction.isWarp(argAsString(0))) {
if (myFaction.isWarp(argAsString(0))) {
// Check if requires password and if so, check if valid. CASE SENSITIVE
if (myFaction.hasWarpPassword(warpName) && !myFaction.isWarpPassword(warpName, passwordAttempt)) {
fme.msg(TL.COMMAND_FWARP_INVALID_PASSWORD);
return;
}
// Check if requires password and if so, check if valid. CASE SENSITIVE
if (myFaction.hasWarpPassword(warpName) && !myFaction.isWarpPassword(warpName, passwordAttempt)) {
fme.msg(TL.COMMAND_FWARP_INVALID_PASSWORD);
return;
}
// Check transaction AFTER password check.
if (!transact(fme)) return;
final FPlayer fPlayer = fme;
final UUID uuid = fme.getPlayer().getUniqueId();
this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, () -> {
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
player.teleport(fPlayer.getFaction().getWarp(warpName).getLocation());
fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
}
}, this.p.getConfig().getLong("warmups.f-warp", 0));
} else { fme.msg(TL.COMMAND_FWARP_INVALID_WARP, warpName); }
}
}
// Check transaction AFTER password check.
if (!transact(fme)) return;
final FPlayer fPlayer = fme;
final UUID uuid = fme.getPlayer().getUniqueId();
this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, () -> {
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
player.teleport(fPlayer.getFaction().getWarp(warpName).getLocation());
fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
}
}, this.p.getConfig().getLong("warmups.f-warp", 0));
} else {
fme.msg(TL.COMMAND_FWARP_INVALID_WARP, warpName);
}
}
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.warp", 5), TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.warp", 5), TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_FWARP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_FWARP_DESCRIPTION;
}
}

View File

@ -21,216 +21,215 @@ import java.util.concurrent.ConcurrentHashMap;
public class CmdFly extends FCommand {
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
public static int id = -1;
public static int flyid = -1;
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
public static int id = -1;
public static int flyid = -1;
public CmdFly() {
super();
this.aliases.add("fly");
public CmdFly() {
super();
this.aliases.add("fly");
this.optionalArgs.put("on/off", "flip");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.FLY.node;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
}
this.permission = Permission.FLY.node;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
}
public static void startParticles() {
// Just a secondary check.
if (!P.p.getConfig().getBoolean("ffly.Particles.Enabled")) {
return;
}
public static void startParticles() {
// Just a secondary check.
if (!P.p.getConfig().getBoolean("ffly.Particles.Enabled")) {
return;
}
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> {
for (String name : flyMap.keySet()) {
Player player = Bukkit.getPlayer(name);
if (player == null) {
continue;
}
if (!player.isFlying()) {
continue;
}
if (!P.p.mc17) {
if (player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
}
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> {
for (String name : flyMap.keySet()) {
Player player = Bukkit.getPlayer(name);
if (player == null) {
continue;
}
if (!player.isFlying()) {
continue;
}
if (!P.p.mc17) {
if (player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
}
if (FPlayers.getInstance().getByPlayer(player).isVanished()) {
// Actually, vanished players (such as admins) should not display particles to prevent others from knowing their vanished assistance for moderation.
// But we can keep it as a config.
if (P.p.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) {
return;
}
continue;
}
if (P.p.useNonPacketParticles) {
// 1.9+ based servers will use the built in particleAPI instead of packet based.
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
// So setting the amount to 0 spawns 1 in the precise location
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
} else {
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
}
if (FPlayers.getInstance().getByPlayer(player).isVanished()) {
// Actually, vanished players (such as admins) should not display particles to prevent others from knowing their vanished assistance for moderation.
// But we can keep it as a config.
if (P.p.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) {
return;
}
continue;
}
if (P.p.useNonPacketParticles) {
// 1.9+ based servers will use the built in particleAPI instead of packet based.
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
// So setting the amount to 0 spawns 1 in the precise location
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
} else {
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
}
}
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(id);
id = -1;
}
}, 10L, 3L);
}
}
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(id);
id = -1;
}
}, 10L, 3L);
}
public static void startFlyCheck() {
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { //threw the exception for now, until I recode fly :( Cringe.
checkTaskState();
if (flyMap.keySet().size() != 0) {
for (String name : flyMap.keySet()) {
if (name == null) {
continue;
}
Player player = Bukkit.getPlayer(name);
if (player == null
|| !player.isFlying()
|| player.getGameMode() == GameMode.CREATIVE
|| !P.p.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
Faction myFaction = fPlayer.getFaction();
if (myFaction.isWilderness()) {
fPlayer.setFlying(false);
flyMap.remove(name);
continue;
}
if (fPlayer.checkIfNearbyEnemies()) {
continue;
}
FLocation myFloc = new FLocation(player.getLocation());
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
if (!checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
fPlayer.setFlying(false);
flyMap.remove(name);
}
}
public static void startFlyCheck() {
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> { //threw the exception for now, until I recode fly :( Cringe.
checkTaskState();
if (flyMap.keySet().size() != 0) {
for (String name : flyMap.keySet()) {
if (name == null) {
continue;
}
Player player = Bukkit.getPlayer(name);
if (player == null
|| !player.isFlying()
|| player.getGameMode() == GameMode.CREATIVE
|| !P.p.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
Faction myFaction = fPlayer.getFaction();
if (myFaction.isWilderness()) {
fPlayer.setFlying(false);
flyMap.remove(name);
continue;
}
if (fPlayer.checkIfNearbyEnemies()) {
continue;
}
FLocation myFloc = new FLocation(player.getLocation());
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
if (!checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
fPlayer.setFlying(false);
flyMap.remove(name);
}
}
}
}
}
}
}, 20L, 20L);
}
}, 20L, 20L);
}
private static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) {
if (toFac != fme.getFaction()) {
if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness() || !me.hasPermission("factions.fly.safezone") && toFac.isSafeZone() || !me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
Access access = toFac.getAccess(fme, PermissableAction.FLY);
if ((!(me.hasPermission("factions.fly.enemy") || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
if (!(me.hasPermission("factions.fly.ally") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
if (!(me.hasPermission("factions.fly.truce") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
private static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) {
if (toFac != fme.getFaction()) {
if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness() || !me.hasPermission("factions.fly.safezone") && toFac.isSafeZone() || !me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
Access access = toFac.getAccess(fme, PermissableAction.FLY);
if ((!(me.hasPermission("factions.fly.enemy") || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
if (!(me.hasPermission("factions.fly.ally") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
if (!(me.hasPermission("factions.fly.truce") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
if (!(me.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac)) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
return me.hasPermission("factions.fly") && access != Access.DENY;
}
return true;
}
if (!(me.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac)) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
return false;
}
return me.hasPermission("factions.fly") && access != Access.DENY;
}
return true;
}
public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
}
public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
}
public static void checkTaskState() {
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(flyid);
flyid = -1;
}
}
public static void checkTaskState() {
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(flyid);
flyid = -1;
}
}
public boolean isInFlightChecker(Player player) {
return flyMap.containsKey(player.getName());
}
public static void disableFlight(final FPlayer fme) {
fme.setFlying(false);
flyMap.remove(fme.getPlayer().getName());
}
@Override
public void perform() {
// Disabled by default.
if (!P.p.getConfig().getBoolean("enable-faction-flight", false)) {
fme.msg(TL.COMMAND_FLY_DISABLED);
return;
}
public boolean isInFlightChecker(Player player) {
return flyMap.containsKey(player.getName());
}
FLocation myfloc = new FLocation(me.getLocation());
Faction toFac = Board.getInstance().getFactionAt(myfloc);
if (!checkBypassPerms(fme, me, toFac)) return;
List<Entity> entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D);
@Override
public void perform() {
// Disabled by default.
if (!P.p.getConfig().getBoolean("enable-faction-flight", false)) {
fme.msg(TL.COMMAND_FLY_DISABLED);
return;
}
for (int i = 0; i <= entities.size() - 1; ++i) {
if (entities.get(i) instanceof Player) {
Player eplayer = (Player) entities.get(i);
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
if (efplayer.getRelationTo(this.fme) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
this.fme.msg(TL.COMMAND_FLY_CHECK_ENEMY);
return;
}
}
}
FLocation myfloc = new FLocation(me.getLocation());
Faction toFac = Board.getInstance().getFactionAt(myfloc);
if (!checkBypassPerms(fme, me, toFac)) return;
List<Entity> entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D);
for (int i = 0; i <= entities.size() - 1; ++i) {
if (entities.get(i) instanceof Player) {
Player eplayer = (Player) entities.get(i);
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
if (efplayer.getRelationTo(this.fme) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
this.fme.msg(TL.COMMAND_FLY_CHECK_ENEMY);
return;
}
}
}
if (args.size() == 0) {
toggleFlight(fme.isFlying(), me);
} else if (args.size() == 1) {
toggleFlight(argAsBool(0), me);
}
}
if (args.size() == 0) {
toggleFlight(fme.isFlying(), me);
} else if (args.size() == 1) {
toggleFlight(argAsBool(0), me);
}
}
private void toggleFlight(final boolean toggle, final Player player) {
if (toggle) {
fme.setFlying(false);
flyMap.remove(player.getName());
return;
}
private void toggleFlight(final boolean toggle, final Player player) {
if (toggle) {
fme.setFlying(false);
flyMap.remove(player.getName());
return;
}
if (fme.canFlyAtLocation())
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
fme.setFlying(true);
flyMap.put(player.getName(), true);
if (id == -1) {
if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) {
startParticles();
}
}
if (flyid == -1) {
startFlyCheck();
}
}, this.p.getConfig().getLong("warmups.f-fly", 0));
}
if (fme.canFlyAtLocation())
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
fme.setFlying(true);
flyMap.put(player.getName(), true);
if (id == -1) {
if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) {
startParticles();
}
}
if (flyid == -1) {
startFlyCheck();
}
}, this.p.getConfig().getLong("warmups.f-fly", 0));
}
public static void disableFlight(final FPlayer fme) {
fme.setFlying(false);
flyMap.remove(fme.getPlayer().getName());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_FLY_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_FLY_DESCRIPTION;
}
}

View File

@ -7,48 +7,48 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdFocus
extends FCommand {
public CmdFocus() {
aliases.add("focus");
extends FCommand {
public CmdFocus() {
aliases.add("focus");
requiredArgs.add("player");
requiredArgs.add("player");
permission = Permission.FOCUS.node;
permission = Permission.FOCUS.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
public void perform() {
if (!P.p.getConfig().getBoolean("ffocus.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
FPlayer target = argAsFPlayer(0);
if (target == null) {
return;
}
if (target.getFaction().getId().equalsIgnoreCase(myFaction.getId())) {
fme.msg(TL.COMMAND_FOCUS_SAMEFACTION);
return;
}
if ((myFaction.getFocused() != null) && (myFaction.getFocused().equalsIgnoreCase(target.getName()))) {
myFaction.setFocused(null);
myFaction.msg(TL.COMMAND_FOCUS_NO_LONGER, target.getName());
FTeamWrapper.updatePrefixes(target.getFaction());
return;
}
myFaction.msg(TL.COMMAND_FOCUS_FOCUSING, target.getName());
myFaction.setFocused(target.getName());
FTeamWrapper.updatePrefixes(target.getFaction());
}
public void perform() {
if (!P.p.getConfig().getBoolean("ffocus.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
FPlayer target = argAsFPlayer(0);
if (target == null) {
return;
}
if (target.getFaction().getId().equalsIgnoreCase(myFaction.getId())) {
fme.msg(TL.COMMAND_FOCUS_SAMEFACTION);
return;
}
if ((myFaction.getFocused() != null) && (myFaction.getFocused().equalsIgnoreCase(target.getName()))) {
myFaction.setFocused(null);
myFaction.msg(TL.COMMAND_FOCUS_NO_LONGER, target.getName());
FTeamWrapper.updatePrefixes(target.getFaction());
return;
}
myFaction.msg(TL.COMMAND_FOCUS_FOCUSING, target.getName());
myFaction.setFocused(target.getName());
FTeamWrapper.updatePrefixes(target.getFaction());
}
public TL getUsageTranslation() {
return TL.COMMAND_FOCUS_DESCRIPTION;
}
public TL getUsageTranslation() {
return TL.COMMAND_FOCUS_DESCRIPTION;
}
}

View File

@ -9,70 +9,70 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class CmdGetVault extends FCommand {
public CmdGetVault() {
super();
public CmdGetVault() {
super();
this.aliases.add("getvault");
this.aliases.add("getvault");
this.permission = Permission.GETVAULT.node;
this.disableOnLock = true;
this.permission = Permission.GETVAULT.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fvault.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
Location vaultLocation = fme.getFaction().getVault();
ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore")));
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fvault.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
Location vaultLocation = fme.getFaction().getVault();
ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore")));
//check if vault is set
if (vaultLocation != null) {
fme.msg(TL.COMMAND_GETVAULT_ALREADYSET);
return;
}
//check if vault is set
if (vaultLocation != null) {
fme.msg(TL.COMMAND_GETVAULT_ALREADYSET);
return;
}
//has enough money?
int amount = P.p.getConfig().getInt("fvault.Price");
if (!fme.hasMoney(amount)) {
return;
}
//has enough money?
int amount = P.p.getConfig().getInt("fvault.Price");
if (!fme.hasMoney(amount)) {
return;
}
//success :)
fme.takeMoney(amount);
me.getInventory().addItem(vault);
fme.msg(TL.COMMAND_GETVAULT_RECEIVE);
//success :)
fme.takeMoney(amount);
me.getInventory().addItem(vault);
fme.msg(TL.COMMAND_GETVAULT_RECEIVE);
}
}
public boolean inventoryContains(Inventory inventory, ItemStack item) {
int count = 0;
ItemStack[] items = inventory.getContents();
for (int i = 0; i < items.length; i++) {
if (items[i] != null && items[i].getType() == item.getType() && items[i].getDurability() == item.getDurability()) {
count += items[i].getAmount();
}
if (count >= item.getAmount()) {
return true;
}
}
return false;
}
public boolean inventoryContains(Inventory inventory, ItemStack item) {
int count = 0;
ItemStack[] items = inventory.getContents();
for (int i = 0; i < items.length; i++) {
if (items[i] != null && items[i].getType() == item.getType() && items[i].getDurability() == item.getDurability()) {
count += items[i].getAmount();
}
if (count >= item.getAmount()) {
return true;
}
}
return false;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_GETVAULT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_GETVAULT_DESCRIPTION;
}
}

View File

@ -13,207 +13,207 @@ import java.util.List;
public class CmdHelp extends FCommand {
public ArrayList<ArrayList<String>> helpPages;
public ArrayList<ArrayList<String>> helpPages;
public CmdHelp() {
super();
this.aliases.add("help");
this.aliases.add("h");
this.aliases.add("?");
public CmdHelp() {
super();
this.aliases.add("help");
this.aliases.add("h");
this.aliases.add("?");
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
this.permission = Permission.HELP.node;
this.disableOnLock = false;
this.permission = Permission.HELP.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
//----------------------------------------------//
// Build the help pages
//----------------------------------------------//
//----------------------------------------------//
// Build the help pages
//----------------------------------------------//
@Override
public void perform() {
if (P.p.getConfig().getBoolean("use-old-help", true)) {
if (helpPages == null) {
updateHelp();
}
@Override
public void perform() {
if (P.p.getConfig().getBoolean("use-old-help", true)) {
if (helpPages == null) {
updateHelp();
}
int page = this.argAsInt(0, 1);
sendMessage(p.txt.titleize("Factions Help (" + page + "/" + helpPages.size() + ")"));
int page = this.argAsInt(0, 1);
sendMessage(p.txt.titleize("Factions Help (" + page + "/" + helpPages.size() + ")"));
page -= 1;
page -= 1;
if (page < 0 || page >= helpPages.size()) {
msg(TL.COMMAND_HELP_404.format(String.valueOf(page)));
return;
}
sendMessage(helpPages.get(page));
return;
}
ConfigurationSection help = P.p.getConfig().getConfigurationSection("help");
if (help == null) {
help = P.p.getConfig().createSection("help"); // create new help section
List<String> error = new ArrayList<>();
error.add("&cUpdate help messages in config.yml!");
error.add("&cSet use-old-help for legacy help messages");
help.set("'1'", error); // add default error messages
}
String pageArg = this.argAsString(0, "1");
List<String> page = help.getStringList(pageArg);
if (page == null || page.isEmpty()) {
msg(TL.COMMAND_HELP_404.format(pageArg));
return;
}
for (String helpLine : page) {
sendMessage(P.p.txt.parse(helpLine));
}
}
if (page < 0 || page >= helpPages.size()) {
msg(TL.COMMAND_HELP_404.format(String.valueOf(page)));
return;
}
sendMessage(helpPages.get(page));
return;
}
ConfigurationSection help = P.p.getConfig().getConfigurationSection("help");
if (help == null) {
help = P.p.getConfig().createSection("help"); // create new help section
List<String> error = new ArrayList<>();
error.add("&cUpdate help messages in config.yml!");
error.add("&cSet use-old-help for legacy help messages");
help.set("'1'", error); // add default error messages
}
String pageArg = this.argAsString(0, "1");
List<String> page = help.getStringList(pageArg);
if (page == null || page.isEmpty()) {
msg(TL.COMMAND_HELP_404.format(pageArg));
return;
}
for (String helpLine : page) {
sendMessage(P.p.txt.parse(helpLine));
}
}
public void updateHelp() {
helpPages = new ArrayList<>();
ArrayList<String> pageLines;
public void updateHelp() {
helpPages = new ArrayList<>();
ArrayList<String> pageLines;
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdHelp.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdList.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdShow.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPower.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdJoin.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdToggleAllianceChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdHome.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_NEXTCREATE.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdHelp.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdList.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdShow.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPower.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdJoin.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdToggleAllianceChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdHome.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_NEXTCREATE.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdCreate.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdDescription.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdTag.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_INVITATIONS.toString()));
pageLines.add(p.cmdBase.cmdOpen.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdInvite.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdDeinvite.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_HOME.toString()));
pageLines.add(p.cmdBase.cmdSethome.getUseageTemplate(true));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdCreate.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdDescription.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdTag.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_INVITATIONS.toString()));
pageLines.add(p.cmdBase.cmdOpen.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdInvite.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdDeinvite.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_HOME.toString()));
pageLines.add(p.cmdBase.cmdSethome.getUseageTemplate(true));
helpPages.add(pageLines);
if (Econ.isSetup() && Conf.econEnabled && Conf.bankEnabled) {
pageLines = new ArrayList<>();
pageLines.add("");
pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_3.toString()));
pageLines.add("");
pageLines.add(p.cmdBase.cmdMoney.getUseageTemplate(true));
pageLines.add("");
pageLines.add("");
pageLines.add("");
helpPages.add(pageLines);
}
if (Econ.isSetup() && Conf.econEnabled && Conf.bankEnabled) {
pageLines = new ArrayList<>();
pageLines.add("");
pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_BANK_3.toString()));
pageLines.add("");
pageLines.add(p.cmdBase.cmdMoney.getUseageTemplate(true));
pageLines.add("");
pageLines.add("");
pageLines.add("");
helpPages.add(pageLines);
}
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdClaim.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdAutoClaim.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdUnclaim.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdUnclaimall.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdKick.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdMod.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdAdmin.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdTitle.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSB.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSeeChunk.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdStatus.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PLAYERTITLES.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdClaim.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdAutoClaim.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdUnclaim.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdUnclaimall.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdKick.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdMod.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdAdmin.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdTitle.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSB.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSeeChunk.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdStatus.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PLAYERTITLES.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdMap.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdBoom.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdOwner.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdOwnerList.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_3.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdMap.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdBoom.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdOwner.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdOwnerList.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_OWNERSHIP_3.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdDisband.getUseageTemplate(true));
pageLines.add("");
pageLines.add(p.cmdBase.cmdRelationAlly.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdRelationNeutral.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdRelationEnemy.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_3.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_4.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.cmdBase.cmdDisband.getUseageTemplate(true));
pageLines.add("");
pageLines.add(p.cmdBase.cmdRelationAlly.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdRelationNeutral.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdRelationEnemy.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_3.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_4.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_5.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_6.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_7.toString()));
pageLines.add(TL.COMMAND_HELP_RELATIONS_8.toString());
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_9.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_10.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_11.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_12.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_13.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_5.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_6.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_7.toString()));
pageLines.add(TL.COMMAND_HELP_RELATIONS_8.toString());
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_9.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_10.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_11.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_12.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_RELATIONS_13.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_3.toString()));
pageLines.add(TL.COMMAND_HELP_PERMISSIONS_4.toString());
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_5.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_6.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_7.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_8.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_9.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_3.toString()));
pageLines.add(TL.COMMAND_HELP_PERMISSIONS_4.toString());
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_5.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_6.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_7.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_8.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_PERMISSIONS_9.toString()));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(TL.COMMAND_HELP_MOAR_1.toString());
pageLines.add(p.cmdBase.cmdBypass.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_3.toString()));
pageLines.add(p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdWarunclaimall.getUseageTemplate(true));
//TODO:TL
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
pageLines.add(p.cmdBase.cmdPeaceful.getUseageTemplate(true));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(TL.COMMAND_HELP_MOAR_1.toString());
pageLines.add(p.cmdBase.cmdBypass.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_1.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_2.toString()));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_ADMIN_3.toString()));
pageLines.add(p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdWarunclaimall.getUseageTemplate(true));
//TODO:TL
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
pageLines.add(p.cmdBase.cmdPeaceful.getUseageTemplate(true));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_MOAR_2.toString()));
pageLines.add(p.cmdBase.cmdChatSpy.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPermanent.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPermanentPower.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPowerBoost.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdConfig.getUseageTemplate(true));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_MOAR_2.toString()));
pageLines.add(p.cmdBase.cmdChatSpy.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPermanent.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPermanentPower.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdPowerBoost.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdConfig.getUseageTemplate(true));
helpPages.add(pageLines);
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_MOAR_3.toString()));
pageLines.add(p.cmdBase.cmdLock.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdReload.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSaveAll.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdVersion.getUseageTemplate(true));
helpPages.add(pageLines);
}
pageLines = new ArrayList<>();
pageLines.add(p.txt.parse(TL.COMMAND_HELP_MOAR_3.toString()));
pageLines.add(p.cmdBase.cmdLock.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdReload.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdSaveAll.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdVersion.getUseageTemplate(true));
helpPages.add(pageLines);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_HELP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_HELP_DESCRIPTION;
}
}

View File

@ -1,7 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.*;
import com.massivecraft.factions.integration.Essentials;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
@ -10,7 +9,6 @@ import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.SmokeUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -21,165 +19,160 @@ import java.util.List;
public class CmdHome extends FCommand {
public CmdHome() {
super();
this.aliases.add("home");
public CmdHome() {
super();
this.aliases.add("home");
this.optionalArgs.put("faction", "yours");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.optionalArgs.put("faction", "yours");
//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 = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// TODO: Hide this command on help also.
@Override
public void perform() {
// TODO: Hide this command on help also.
if (!Conf.homesEnabled) {
fme.msg(TL.COMMAND_HOME_DISABLED);
return;
}
if (!Conf.homesEnabled) {
fme.msg(TL.COMMAND_HOME_DISABLED);
return;
}
if (!Conf.homesTeleportCommandEnabled) {
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
return;
}
if (!Conf.homesTeleportCommandEnabled) {
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
return;
}
Faction factionArg;
Faction factionArg;
if (args.isEmpty())
factionArg = myFaction;
else
factionArg = argAsFaction(0);
if (args.isEmpty())
factionArg = myFaction;
else
factionArg = argAsFaction(0);
if (factionArg.isSystemFaction()) {
fme.msg(TL.GENERIC_NOPERMISSION, "teleport to system faction home");
return;
}
if (factionArg.isSystemFaction()) {
fme.msg(TL.GENERIC_NOPERMISSION, "teleport to system faction home");
return;
}
myFaction = factionArg;
myFaction = factionArg;
if(myFaction.isWilderness())
return;
if (myFaction.isWilderness())
return;
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
}
if (!myFaction.hasHome()) {
fme.msg(TL.COMMAND_HOME_NOHOME.toString() + (fme.getRole().value < Role.MODERATOR.value ? TL.GENERIC_ASKYOURLEADER.toString() : TL.GENERIC_YOUSHOULD.toString()));
fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
return;
}
if (!myFaction.hasHome()) {
fme.msg(TL.COMMAND_HOME_NOHOME.toString() + (fme.getRole().value < Role.MODERATOR.value ? TL.GENERIC_ASKYOURLEADER.toString() : TL.GENERIC_YOUSHOULD.toString()));
fme.sendMessage(p.cmdBase.cmdSethome.getUseageTemplate());
return;
}
if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
fme.msg(TL.COMMAND_HOME_INENEMY);
return;
}
if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
fme.msg(TL.COMMAND_HOME_WRONGWORLD);
return;
}
if (!fme.isAdminBypassing()) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
}
Faction faction = Board.getInstance().getFactionAt(new FLocation(me.getLocation()));
final 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() || !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.getInstance().getByPlayer(p);
if (fme.getRelationTo(fp) != Relation.ENEMY || fp.isVanished()) {
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;
// box-shaped distance check
if (dx > max || dy > max || dz > max) {
continue;
}
fme.msg(TL.COMMAND_HOME_ENEMYNEAR, String.valueOf(Conf.homesTeleportAllowedEnemyDistance));
return;
}
}
if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
fme.msg(TL.COMMAND_HOME_INENEMY);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostHome, TL.COMMAND_HOME_TOTELEPORT.toString(), TL.COMMAND_HOME_FORTELEPORT.toString())) {
return;
}
if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
fme.msg(TL.COMMAND_HOME_WRONGWORLD);
return;
}
if (!fme.isAdminBypassing()) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
}
Faction faction = Board.getInstance().getFactionAt(new FLocation(me.getLocation()));
final 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() || !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.getInstance().getByPlayer(p);
if (fme.getRelationTo(fp) != Relation.ENEMY || fp.isVanished()) {
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;
// box-shaped distance check
if (dx > max || dy > max || dz > max) {
continue;
}
fme.msg(TL.COMMAND_HOME_ENEMYNEAR, String.valueOf(Conf.homesTeleportAllowedEnemyDistance));
return;
}
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostHome, TL.COMMAND_HOME_TOTELEPORT.toString(), TL.COMMAND_HOME_FORTELEPORT.toString())) {
return;
}
// TODO: Need to document this better confusing everyone, removed for now.
// TODO: Need to document this better confusing everyone, removed for now.
// // if Essentials teleport handling is enabled and available, pass the teleport off to it (for delay and cooldown)
// if (Essentials.handleTeleport(me, myFaction.getHome())) {
// return;
// }
this.doWarmUp(WarmUpUtil.Warmup.HOME, TL.WARMUPS_NOTIFY_TELEPORT, "Home", () -> {
// Create a smoke effect
if (Conf.homesTeleportCommandSmokeEffectEnabled) {
List<Location> smokeLocations = new ArrayList<>();
smokeLocations.add(loc);
smokeLocations.add(loc.add(0, 1, 0));
smokeLocations.add(CmdHome.this.myFaction.getHome());
smokeLocations.add(CmdHome.this.myFaction.getHome().clone().add(0, 1, 0));
SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
}
this.doWarmUp(WarmUpUtil.Warmup.HOME, TL.WARMUPS_NOTIFY_TELEPORT, "Home", () -> {
// Create a smoke effect
if (Conf.homesTeleportCommandSmokeEffectEnabled) {
List<Location> smokeLocations = new ArrayList<>();
smokeLocations.add(loc);
smokeLocations.add(loc.add(0, 1, 0));
smokeLocations.add(CmdHome.this.myFaction.getHome());
smokeLocations.add(CmdHome.this.myFaction.getHome().clone().add(0, 1, 0));
SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
}
CmdHome.this.me.teleport(CmdHome.this.myFaction.getHome());
}, this.p.getConfig().getLong("warmups.f-home", 0));
}
CmdHome.this.me.teleport(CmdHome.this.myFaction.getHome());
}, this.p.getConfig().getLong("warmups.f-home", 0));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_HOME_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_HOME_DESCRIPTION;
}
}

View File

@ -4,37 +4,37 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdInspect extends FCommand {
public CmdInspect() {
super();
this.aliases.add("inspect");
this.aliases.add("ins");
public CmdInspect() {
super();
this.aliases.add("inspect");
this.aliases.add("ins");
this.permission = Permission.INSPECT.node;
this.disableOnLock = true;
this.permission = Permission.INSPECT.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (fme.isInspectMode()) {
fme.setInspectMode(false);
msg(TL.COMMAND_INSPECT_DISABLED_MSG);
} else {
fme.setInspectMode(true);
msg(TL.COMMAND_INSPECT_ENABLED);
}
@Override
public void perform() {
if (fme.isInspectMode()) {
fme.setInspectMode(false);
msg(TL.COMMAND_INSPECT_DISABLED_MSG);
} else {
fme.setInspectMode(true);
msg(TL.COMMAND_INSPECT_ENABLED);
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_INSPECT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_INSPECT_DESCRIPTION;
}
}

View File

@ -12,83 +12,83 @@ import org.bukkit.ChatColor;
public class CmdInvite extends FCommand {
public CmdInvite() {
super();
this.aliases.add("invite");
this.aliases.add("inv");
public CmdInvite() {
super();
this.aliases.add("invite");
this.aliases.add("inv");
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.INVITE.node;
this.disableOnLock = true;
this.permission = Permission.INVITE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer target = this.argAsBestFPlayerMatch(0);
if (target == null) {
return;
}
@Override
public void perform() {
FPlayer target = this.argAsBestFPlayerMatch(0);
if (target == null) {
return;
}
if (target.getFaction() == myFaction) {
msg(TL.COMMAND_INVITE_ALREADYMEMBER, target.getName(), myFaction.getTag());
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdKick.getUseageTemplate(false));
return;
}
if (target.getFaction() == myFaction) {
msg(TL.COMMAND_INVITE_ALREADYMEMBER, target.getName(), myFaction.getTag());
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdKick.getUseageTemplate(false));
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) {
return;
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}
}
if (myFaction.isInvited(target)) {
fme.msg(TL.COMMAND_INVITE_ALREADYINVITED, target.getName());
return;
}
if (myFaction.isBanned(target)) {
fme.msg(TL.COMMAND_INVITE_BANNED, target.getName());
return;
}
if (myFaction.isInvited(target)) {
fme.msg(TL.COMMAND_INVITE_ALREADYINVITED, target.getName());
return;
}
if (myFaction.isBanned(target)) {
fme.msg(TL.COMMAND_INVITE_BANNED, target.getName());
return;
}
myFaction.invite(target);
// Send the invitation to the target player when online, otherwise just ignore
if (target.isOnline()) {
// Tooltips, colors, and commands only apply to the string immediately before it.
FancyMessage message = new FancyMessage(fme.describeTo(target, true))
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
.color(ChatColor.YELLOW)
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(myFaction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
myFaction.invite(target);
// Send the invitation to the target player when online, otherwise just ignore
if (target.isOnline()) {
// Tooltips, colors, and commands only apply to the string immediately before it.
FancyMessage message = new FancyMessage(fme.describeTo(target, true))
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
.color(ChatColor.YELLOW)
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(myFaction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
message.send(target.getPlayer());
}
message.send(target.getPlayer());
}
myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), target.describeTo(myFaction));
}
myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), target.describeTo(myFaction));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_INVITE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_INVITE_DESCRIPTION;
}
}

View File

@ -9,150 +9,149 @@ import org.bukkit.Bukkit;
public class CmdJoin extends FCommand {
public CmdJoin() {
super();
this.aliases.add("join");
public CmdJoin() {
super();
this.aliases.add("join");
this.requiredArgs.add("faction name");
this.optionalArgs.put("player", "you");
this.requiredArgs.add("faction name");
this.optionalArgs.put("player", "you");
this.permission = Permission.JOIN.node;
this.disableOnLock = true;
this.permission = Permission.JOIN.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction faction = this.argAsFaction(0);
if (faction == null) {
return;
}
@Override
public void perform() {
Faction faction = this.argAsFaction(0);
if (faction == null) {
return;
}
FPlayer fplayer = this.argAsBestFPlayerMatch(1, fme, false);
boolean samePlayer = fplayer == fme;
FPlayer fplayer = this.argAsBestFPlayerMatch(1, fme, false);
boolean samePlayer = fplayer == fme;
if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) {
msg(TL.COMMAND_JOIN_CANNOTFORCE);
return;
}
if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) {
msg(TL.COMMAND_JOIN_CANNOTFORCE);
return;
}
if (!faction.isNormal()) {
msg(TL.COMMAND_JOIN_SYSTEMFACTION);
return;
}
if (!faction.isNormal()) {
msg(TL.COMMAND_JOIN_SYSTEMFACTION);
return;
}
if (faction == fplayer.getFaction()) {
//TODO:TL
msg(TL.COMMAND_JOIN_ALREADYMEMBER, fplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
return;
}
if (faction == fplayer.getFaction()) {
//TODO:TL
msg(TL.COMMAND_JOIN_ALREADYMEMBER, fplayer.describeTo(fme, true), (samePlayer ? "are" : "is"), faction.getTag(fme));
return;
}
if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), Conf.factionMemberLimit, fplayer.describeTo(fme, false));
return;
}
if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), Conf.factionMemberLimit, fplayer.describeTo(fme, false));
return;
}
if (fplayer.hasFaction()) {
//TODO:TL
msg(TL.COMMAND_JOIN_INOTHERFACTION, fplayer.describeTo(fme, true), (samePlayer ? "your" : "their"));
return;
}
if (fplayer.hasFaction()) {
//TODO:TL
msg(TL.COMMAND_JOIN_INOTHERFACTION, fplayer.describeTo(fme, true), (samePlayer ? "your" : "their"));
return;
}
if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) {
msg(TL.COMMAND_JOIN_NEGATIVEPOWER, fplayer.describeTo(fme, true));
return;
}
if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) {
msg(TL.COMMAND_JOIN_NEGATIVEPOWER, fplayer.describeTo(fme, true));
return;
}
if (!(faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) {
msg(TL.COMMAND_JOIN_REQUIRESINVITATION);
if (samePlayer) {
faction.msg(TL.COMMAND_JOIN_ATTEMPTEDJOIN, fplayer.describeTo(faction, true));
}
return;
}
int level = faction.getUpgrade(UpgradeType.MEMBERS);
if (!(faction.getOpen() || faction.isInvited(fplayer) || fme.isAdminBypassing() || Permission.JOIN_ANY.has(sender, false))) {
msg(TL.COMMAND_JOIN_REQUIRESINVITATION);
if (samePlayer) {
faction.msg(TL.COMMAND_JOIN_ATTEMPTEDJOIN, fplayer.describeTo(faction, true));
}
return;
}
int level = faction.getUpgrade(UpgradeType.MEMBERS);
int limit = 0;
int limit = 0;
if (level == 0) {
limit = Conf.factionMemberLimit;
} else {
limit = P.p.getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + level);
}
if (level == 0) {
limit = Conf.factionMemberLimit;
} else {
limit = P.p.getConfig().getInt("fupgrades.MainMenu.Members.Members-Limit.level-" + level);
}
if (limit > 0 && faction.getFPlayers().size() >= limit && !faction.altInvited(fme)) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), limit, fplayer.describeTo(fme, false));
return;
}
if (limit > 0 && faction.getFPlayers().size() >= limit && !faction.altInvited(fme)) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), limit, fplayer.describeTo(fme, false));
return;
}
int altLimit = Conf.factionAltMemberLimit;
int altLimit = Conf.factionAltMemberLimit;
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(fme)) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), altLimit, fplayer.describeTo(fme, false));
return;
}
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(fme)) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), altLimit, fplayer.describeTo(fme, false));
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) {
return;
}
// Check for ban
if (!fme.isAdminBypassing() && faction.isBanned(fme)) {
fme.msg(TL.COMMAND_JOIN_BANNED, faction.getTag(fme));
return;
}
// Check for ban
if (!fme.isAdminBypassing() && faction.isBanned(fme)) {
fme.msg(TL.COMMAND_JOIN_BANNED, faction.getTag(fme));
return;
}
// trigger the join event (cancellable)
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), faction, FPlayerJoinEvent.PlayerJoinReason.COMMAND);
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
if (joinEvent.isCancelled()) {
return;
}
// trigger the join event (cancellable)
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), faction, FPlayerJoinEvent.PlayerJoinReason.COMMAND);
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
if (joinEvent.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (samePlayer && !payForCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString(), TL.COMMAND_JOIN_FORJOIN.toString())) {
return;
}
// then make 'em pay (if applicable)
if (samePlayer && !payForCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString(), TL.COMMAND_JOIN_FORJOIN.toString())) {
return;
}
fme.msg(TL.COMMAND_JOIN_SUCCESS, fplayer.describeTo(fme, true), faction.getTag(fme));
fme.msg(TL.COMMAND_JOIN_SUCCESS, fplayer.describeTo(fme, true), faction.getTag(fme));
if (!samePlayer) {
fplayer.msg(TL.COMMAND_JOIN_MOVED, fme.describeTo(fplayer, true), faction.getTag(fplayer));
}
if (!samePlayer) {
fplayer.msg(TL.COMMAND_JOIN_MOVED, fme.describeTo(fplayer, true), faction.getTag(fplayer));
}
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
fplayer.resetFactionData();
fplayer.resetFactionData();
if (faction.altInvited(fplayer)) {
fplayer.setAlt(true);
fplayer.setFaction(faction, true);
} else {
fplayer.setFaction(faction, false);
}
if(faction.altInvited(fplayer)){
fplayer.setAlt(true);
fplayer.setFaction(faction, true);
} else {
fplayer.setFaction(faction, false);
}
faction.deinvite(fplayer);
fplayer.setRole(faction.getDefaultRole());
if (Conf.logFactionJoin) {
if (samePlayer) {
P.p.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
} else {
P.p.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), fme.getName(), fplayer.getName(), faction.getTag());
}
}
}
faction.deinvite(fplayer);
fplayer.setRole(faction.getDefaultRole());
if (Conf.logFactionJoin) {
if (samePlayer) {
P.p.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
} else {
P.p.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), fme.getName(), fplayer.getName(), faction.getTag());
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_JOIN_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_JOIN_DESCRIPTION;
}
}

View File

@ -16,131 +16,131 @@ import org.bukkit.ChatColor;
public class CmdKick extends FCommand {
public CmdKick() {
super();
this.aliases.add("kick");
public CmdKick() {
super();
this.aliases.add("kick");
this.optionalArgs.put("player name", "player name");
//this.optionalArgs.put("", "");
this.optionalArgs.put("player name", "player name");
//this.optionalArgs.put("", "");
this.permission = Permission.KICK.node;
this.disableOnLock = false;
this.permission = Permission.KICK.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer toKick = this.argIsSet(0) ? this.argAsBestFPlayerMatch(0) : null;
if (toKick == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_KICK_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
if (fme.getRole().isAtLeast(Role.COLEADER)) {
// For both coleader and admin, add mods.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
if (fme.getRole() == Role.LEADER) {
// Only add coleader to this for the leader.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.COLEADER)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.RED).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
}
}
@Override
public void perform() {
FPlayer toKick = this.argIsSet(0) ? this.argAsBestFPlayerMatch(0) : null;
if (toKick == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_KICK_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
if (fme.getRole().isAtLeast(Role.COLEADER)) {
// For both coleader and admin, add mods.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
if (fme.getRole() == Role.LEADER) {
// Only add coleader to this for the leader.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.COLEADER)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.RED).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
}
}
sendFancyMessage(msg);
return;
}
sendFancyMessage(msg);
return;
}
if (fme == toKick) {
msg(TL.COMMAND_KICK_SELF);
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdLeave.getUseageTemplate(false));
return;
}
if (fme == toKick) {
msg(TL.COMMAND_KICK_SELF);
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdLeave.getUseageTemplate(false));
return;
}
if(toKick.isAlt()){
msg(P.p.color("&cToo few arguments, &eUse like this:"));
msg(P.p.color("&b/f alts,alt kick &3<player name>"));
return;
}
if (toKick.isAlt()) {
msg(P.p.color("&cToo few arguments, &eUse like this:"));
msg(P.p.color("&b/f alts,alt kick &3<player name>"));
return;
}
Faction toKickFaction = toKick.getFaction();
Faction toKickFaction = toKick.getFaction();
if (toKickFaction.isWilderness()) {
sender.sendMessage(TL.COMMAND_KICK_NONE.toString());
return;
}
if (toKickFaction.isWilderness()) {
sender.sendMessage(TL.COMMAND_KICK_NONE.toString());
return;
}
// This permission check has been cleaned to be more understandable and logical
// Unless is admin,
// - Check for the kick permission.
// - Make sure the player is in the faction.
// - Make sure the kicked player has lower rank than the kicker.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
return;
}
if (toKickFaction != myFaction) {
msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme));
return;
}
if (toKick.getRole().value >= fme.getRole().value) {
msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
return;
}
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
msg(TL.COMMAND_KICK_NEGATIVEPOWER);
return;
}
}
// This permission check has been cleaned to be more understandable and logical
// Unless is admin,
// - Check for the kick permission.
// - Make sure the player is in the faction.
// - Make sure the kicked player has lower rank than the kicker.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
return;
}
if (toKickFaction != myFaction) {
msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme));
return;
}
if (toKick.getRole().value >= fme.getRole().value) {
msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
return;
}
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
msg(TL.COMMAND_KICK_NEGATIVEPOWER);
return;
}
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
return;
}
// trigger the leave event (cancellable) [reason:kicked]
FPlayerLeaveEvent event = new FPlayerLeaveEvent(toKick, toKick.getFaction(), FPlayerLeaveEvent.PlayerLeaveReason.KICKED);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// trigger the leave event (cancellable) [reason:kicked]
FPlayerLeaveEvent event = new FPlayerLeaveEvent(toKick, toKick.getFaction(), FPlayerLeaveEvent.PlayerLeaveReason.KICKED);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
return;
}
toKickFaction.msg(TL.COMMAND_KICK_FACTION, fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
toKickFaction.msg(TL.COMMAND_KICK_FACTION, fme.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
toKick.msg(TL.COMMAND_KICK_KICKED, fme.describeTo(toKick, true), toKickFaction.describeTo(toKick));
if (toKickFaction != myFaction) {
fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme));
}
if (Conf.logFactionKick) {
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
}
if (toKick.getRole() == Role.LEADER) {
toKickFaction.promoteNewLeader();
}
toKickFaction.deinvite(toKick);
toKick.resetFactionData();
}
toKick.msg(TL.COMMAND_KICK_KICKED, fme.describeTo(toKick, true), toKickFaction.describeTo(toKick));
if (toKickFaction != myFaction) {
fme.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(fme), toKickFaction.describeTo(fme));
}
if (Conf.logFactionKick) {
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
}
if (toKick.getRole() == Role.LEADER) {
toKickFaction.promoteNewLeader();
}
toKickFaction.deinvite(toKick);
toKick.resetFactionData();
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_KICK_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_KICK_DESCRIPTION;
}
}

View File

@ -4,32 +4,32 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdKillHolograms extends FCommand {
public CmdKillHolograms() {
super();
public CmdKillHolograms() {
super();
this.aliases.add("killholos");
this.aliases.add("killholos");
this.requiredArgs.add("radius");
this.requiredArgs.add("radius");
this.permission = Permission.KILLHOLOS.node;
this.disableOnLock = true;
this.permission = Permission.KILLHOLOS.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
me.sendMessage("Killing Invisible Armor Stands..");
me.chat("/minecraft:kill @e[type=ArmorStand,r=" + argAsInt(0) + "]");
@Override
public void perform() {
me.sendMessage("Killing Invisible Armor Stands..");
me.chat("/minecraft:kill @e[type=ArmorStand,r=" + argAsInt(0) + "]");
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_KILLHOLOGRAMS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_KILLHOLOGRAMS_DESCRIPTION;
}
}

View File

@ -5,32 +5,32 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdLeave extends FCommand {
public CmdLeave() {
super();
this.aliases.add("leave");
public CmdLeave() {
super();
this.aliases.add("leave");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.LEAVE.node;
this.disableOnLock = true;
this.permission = Permission.LEAVE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
fme.leave(true);
}
@Override
public void perform() {
fme.leave(true);
}
@Override
public TL getUsageTranslation() {
return TL.LEAVE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.LEAVE_DESCRIPTION;
}
}

View File

@ -8,113 +8,115 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TagUtil;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CmdList extends FCommand {
private String[] defaults = new String[3];
private String[] defaults = new String[3];
public CmdList() {
super();
this.aliases.add("list");
this.aliases.add("ls");
public CmdList() {
super();
this.aliases.add("list");
this.aliases.add("ls");
// default values in case user has old config
defaults[0] = "&e&m----------&r&e[ &2Faction List &9{pagenumber}&e/&9{pagecount} &e]&m----------";
defaults[1] = "<i>Factionless<i> {factionless} online";
defaults[2] = "<a>{faction} <i>{online} / {members} online, <a>Land / Power / Maxpower: <i>{chunks}/{power}/{maxPower}";
// default values in case user has old config
defaults[0] = "&e&m----------&r&e[ &2Faction List &9{pagenumber}&e/&9{pagecount} &e]&m----------";
defaults[1] = "<i>Factionless<i> {factionless} online";
defaults[2] = "<a>{faction} <i>{online} / {members} online, <a>Land / Power / Maxpower: <i>{chunks}/{power}/{maxPower}";
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
//this.requiredArgs.add("");
this.optionalArgs.put("page", "1");
this.permission = Permission.LIST.node;
this.disableOnLock = false;
this.permission = Permission.LIST.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
return;
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
return;
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
factionList.remove(Factions.getInstance().getWilderness());
factionList.remove(Factions.getInstance().getSafeZone());
factionList.remove(Factions.getInstance().getWarZone());
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
factionList.remove(Factions.getInstance().getWilderness());
factionList.remove(Factions.getInstance().getSafeZone());
factionList.remove(Factions.getInstance().getWarZone());
// remove exempt factions
if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
List<String> exemptFactions = P.p.getConfig().getStringList("show-exempt");
// remove exempt factions
if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
List<String> exemptFactions = P.p.getConfig().getStringList("show-exempt");
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
}
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
}
// Sort by total followers first
Collections.sort(factionList, (f1, f2) -> {
int f1Size = f1.getFPlayers().size();
int f2Size = f2.getFPlayers().size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
// Sort by total followers first
Collections.sort(factionList, (f1, f2) -> {
int f1Size = f1.getFPlayers().size();
int f2Size = f2.getFPlayers().size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
// Then sort by how many members are online now
factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayersWhereOnline(true).size();
int f2Size = f2.getFPlayersWhereOnline(true).size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
// Then sort by how many members are online now
factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayersWhereOnline(true).size();
int f2Size = f2.getFPlayersWhereOnline(true).size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
ArrayList<String> lines = new ArrayList<>();
ArrayList<String> lines = new ArrayList<>();
factionList.add(0, Factions.getInstance().getWilderness());
factionList.add(0, Factions.getInstance().getWilderness());
final int pageheight = 9;
int pagenumber = this.argAsInt(0, 1);
int pagecount = (factionList.size() / pageheight) + 1;
if (pagenumber > pagecount) {
pagenumber = pagecount;
} else if (pagenumber < 1) {
pagenumber = 1;
}
int start = (pagenumber - 1) * pageheight;
int end = start + pageheight;
if (end > factionList.size()) {
end = factionList.size();
}
final int pageheight = 9;
int pagenumber = this.argAsInt(0, 1);
int pagecount = (factionList.size() / pageheight) + 1;
if (pagenumber > pagecount) {
pagenumber = pagecount;
} else if (pagenumber < 1) {
pagenumber = 1;
}
int start = (pagenumber - 1) * pageheight;
int end = start + pageheight;
if (end > factionList.size()) {
end = factionList.size();
}
String header = p.getConfig().getString("list.header", defaults[0]);
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
lines.add(p.txt.parse(header));
String header = p.getConfig().getString("list.header", defaults[0]);
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
lines.add(p.txt.parse(header));
for (Faction faction : factionList.subList(start, end)) {
if (faction.isWilderness()) {
lines.add(p.txt.parse(TagUtil.parsePlain(faction, p.getConfig().getString("list.factionless", defaults[1]))));
continue;
}
lines.add(p.txt.parse(TagUtil.parsePlain(faction, fme, p.getConfig().getString("list.entry", defaults[2]))));
}
sendMessage(lines);
}
for (Faction faction : factionList.subList(start, end)) {
if (faction.isWilderness()) {
lines.add(p.txt.parse(TagUtil.parsePlain(faction, p.getConfig().getString("list.factionless", defaults[1]))));
continue;
}
lines.add(p.txt.parse(TagUtil.parsePlain(faction, fme, p.getConfig().getString("list.entry", defaults[2]))));
}
sendMessage(lines);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LIST_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LIST_DESCRIPTION;
}
}

View File

@ -5,40 +5,40 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdLock extends FCommand {
// TODO: This solution needs refactoring.
// TODO: This solution needs refactoring.
/*
factions.lock:
description: use the /f lock [on/off] command to temporarily lock the data files from being overwritten
default: op
*/
public CmdLock() {
super();
this.aliases.add("lock");
public CmdLock() {
super();
this.aliases.add("lock");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.LOCK.node;
this.disableOnLock = false;
this.permission = Permission.LOCK.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
p.setLocked(this.argAsBool(0, !p.getLocked()));
msg(p.getLocked() ? TL.COMMAND_LOCK_LOCKED : TL.COMMAND_LOCK_UNLOCKED);
}
@Override
public void perform() {
p.setLocked(this.argAsBool(0, !p.getLocked()));
msg(p.getLocked() ? TL.COMMAND_LOCK_LOCKED : TL.COMMAND_LOCK_UNLOCKED);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LOCK_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LOCK_DESCRIPTION;
}
}

View File

@ -5,27 +5,27 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdLogins extends FCommand {
public CmdLogins() {
super();
this.aliases.add("login");
this.aliases.add("logins");
this.aliases.add("logout");
this.aliases.add("logouts");
this.senderMustBePlayer = true;
public CmdLogins() {
super();
this.aliases.add("login");
this.aliases.add("logins");
this.aliases.add("logout");
this.aliases.add("logouts");
this.senderMustBePlayer = true;
this.senderMustBeMember = true;
this.permission = Permission.MONITOR_LOGINS.node;
}
this.senderMustBeMember = true;
this.permission = Permission.MONITOR_LOGINS.node;
}
@Override
public void perform() {
boolean monitor = fme.isMonitoringJoins();
fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor));
fme.setMonitorJoins(!monitor);
}
@Override
public void perform() {
boolean monitor = fme.isMonitoringJoins();
fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor));
fme.setMonitorJoins(!monitor);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LOGINS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LOGINS_DESCRIPTION;
}
}

View File

@ -6,38 +6,38 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdLowPower extends FCommand {
public CmdLowPower() {
super();
this.aliases.add("lowpower");
public CmdLowPower() {
super();
this.aliases.add("lowpower");
this.disableOnLock = false;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
double maxPower = Conf.powerPlayerMax;
String format = TL.COMMAND_LOWPOWER_FORMAT.toString();
msg(TL.COMMAND_LOWPOWER_HEADER.toString().replace("{maxpower}", (int) maxPower + ""));
for (FPlayer fPlayer : fme.getFaction().getFPlayers()) {
if (fPlayer.getPower() < maxPower) {
sendMessage(format.replace("{player}", fPlayer.getName()).replace("{player_power}", (int) fPlayer.getPower() + "").replace("{maxpower}", (int) maxPower + ""));
}
}
}
@Override
public void perform() {
double maxPower = Conf.powerPlayerMax;
String format = TL.COMMAND_LOWPOWER_FORMAT.toString();
msg(TL.COMMAND_LOWPOWER_HEADER.toString().replace("{maxpower}", (int) maxPower + ""));
for (FPlayer fPlayer : fme.getFaction().getFPlayers()) {
if (fPlayer.getPower() < maxPower) {
sendMessage(format.replace("{player}", fPlayer.getName()).replace("{player_power}", (int) fPlayer.getPower() + "").replace("{maxpower}", (int) maxPower + ""));
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LOWPOWER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_LOWPOWER_DESCRIPTION;
}
}

View File

@ -9,62 +9,62 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdMap extends FCommand {
public CmdMap() {
super();
this.aliases.add("map");
public CmdMap() {
super();
this.aliases.add("map");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once");
this.permission = Permission.MAP.node;
this.disableOnLock = false;
this.permission = Permission.MAP.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (this.argIsSet(0)) {
if (this.argAsBool(0, !fme.isMapAutoUpdating())) {
// Turn on
@Override
public void perform() {
if (this.argIsSet(0)) {
if (this.argAsBool(0, !fme.isMapAutoUpdating())) {
// Turn on
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) {
return;
}
fme.setMapAutoUpdating(true);
msg(TL.COMMAND_MAP_UPDATE_ENABLED);
fme.setMapAutoUpdating(true);
msg(TL.COMMAND_MAP_UPDATE_ENABLED);
// And show the map once
showMap();
} else {
// Turn off
fme.setMapAutoUpdating(false);
msg(TL.COMMAND_MAP_UPDATE_DISABLED);
}
} else {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) {
return;
}
// And show the map once
showMap();
} else {
// Turn off
fme.setMapAutoUpdating(false);
msg(TL.COMMAND_MAP_UPDATE_DISABLED);
}
} else {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) {
return;
}
showMap();
}
}
showMap();
}
}
public void showMap() {
sendFancyMessage(Board.getInstance().getMap(fme, new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
}
public void showMap() {
sendFancyMessage(Board.getInstance().getMap(fme, new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MAP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MAP_DESCRIPTION;
}
}

View File

@ -5,36 +5,36 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdMapHeight extends FCommand {
public CmdMapHeight() {
super();
public CmdMapHeight() {
super();
this.aliases.add("mapheight");
this.aliases.add("mh");
this.aliases.add("mapheight");
this.aliases.add("mh");
this.optionalArgs.put("height", "height");
this.optionalArgs.put("height", "height");
this.permission = Permission.MAPHEIGHT.node;
this.permission = Permission.MAPHEIGHT.node;
this.senderMustBePlayer = true;
}
this.senderMustBePlayer = true;
}
@Override
public void perform() {
if (args.size() == 0) {
fme.sendMessage(TL.COMMAND_MAPHEIGHT_CURRENT.format(fme.getMapHeight()));
return;
}
@Override
public void perform() {
if (args.size() == 0) {
fme.sendMessage(TL.COMMAND_MAPHEIGHT_CURRENT.format(fme.getMapHeight()));
return;
}
int height = argAsInt(0);
int height = argAsInt(0);
fme.setMapHeight(height);
fme.sendMessage(TL.COMMAND_MAPHEIGHT_SET.format(fme.getMapHeight()));
}
fme.setMapHeight(height);
fme.sendMessage(TL.COMMAND_MAPHEIGHT_SET.format(fme.getMapHeight()));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MAPHEIGHT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MAPHEIGHT_DESCRIPTION;
}
}

View File

@ -11,85 +11,85 @@ import org.bukkit.ChatColor;
public class CmdMod extends FCommand {
public CmdMod() {
super();
this.aliases.add("mod");
this.aliases.add("setmod");
this.aliases.add("officer");
this.aliases.add("setofficer");
public CmdMod() {
super();
this.aliases.add("mod");
this.aliases.add("setmod");
this.aliases.add("officer");
this.aliases.add("setofficer");
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.permission = Permission.MOD.node;
this.disableOnLock = true;
this.permission = Permission.MOD.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
}
sendFancyMessage(msg);
return;
}
sendFancyMessage(msg);
return;
}
boolean permAny = Permission.MOD_ANY.has(sender, false);
Faction targetFaction = you.getFaction();
boolean permAny = Permission.MOD_ANY.has(sender, false);
Faction targetFaction = you.getFaction();
if(you.isAlt()){
msg(ChatColor.RED + "You can not promote alt accounts.");
return;
}
if (you.isAlt()) {
msg(ChatColor.RED + "You can not promote alt accounts.");
return;
}
if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
return;
}
if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
return;
}
if (fme != null && fme.getRole() != Role.LEADER && !permAny) {
msg(TL.COMMAND_MOD_NOTADMIN);
return;
}
if (fme != null && fme.getRole() != Role.LEADER && !permAny) {
msg(TL.COMMAND_MOD_NOTADMIN);
return;
}
if (you == fme && !permAny) {
msg(TL.COMMAND_MOD_SELF);
return;
}
if (you == fme && !permAny) {
msg(TL.COMMAND_MOD_SELF);
return;
}
if (you.getRole() == Role.LEADER) {
msg(TL.COMMAND_MOD_TARGETISADMIN);
return;
}
if (you.getRole() == Role.LEADER) {
msg(TL.COMMAND_MOD_TARGETISADMIN);
return;
}
if (you.getRole() == Role.MODERATOR) {
// Revoke
you.setRole(Role.NORMAL);
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_MOD_REVOKES, you.describeTo(fme, true));
} else {
// Give
you.setRole(Role.MODERATOR);
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(fme, true));
}
}
if (you.getRole() == Role.MODERATOR) {
// Revoke
you.setRole(Role.NORMAL);
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_MOD_REVOKES, you.describeTo(fme, true));
} else {
// Give
you.setRole(Role.MODERATOR);
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(fme, true));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MOD_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MOD_DESCRIPTION;
}
}

View File

@ -6,45 +6,45 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdModifyPower extends FCommand {
public CmdModifyPower() {
super();
public CmdModifyPower() {
super();
this.aliases.add("pm");
this.aliases.add("mp");
this.aliases.add("modifypower");
this.aliases.add("modpower");
this.aliases.add("pm");
this.aliases.add("mp");
this.aliases.add("modifypower");
this.aliases.add("modpower");
this.requiredArgs.add("name");
this.requiredArgs.add("power");
this.requiredArgs.add("name");
this.requiredArgs.add("power");
this.permission = Permission.MODIFY_POWER.node; // admin only perm.
this.permission = Permission.MODIFY_POWER.node; // admin only perm.
// Let's not require anything and let console modify this as well.
this.senderMustBeAdmin = false;
this.senderMustBePlayer = false;
this.senderMustBeMember = false;
senderMustBeColeader = false;
this.senderMustBeModerator = false;
}
// Let's not require anything and let console modify this as well.
this.senderMustBeAdmin = false;
this.senderMustBePlayer = false;
this.senderMustBeMember = false;
senderMustBeColeader = false;
this.senderMustBeModerator = false;
}
@Override
public void perform() {
// /f modify <name> #
FPlayer player = argAsBestFPlayerMatch(0);
Double number = argAsDouble(1); // returns null if not a Double.
@Override
public void perform() {
// /f modify <name> #
FPlayer player = argAsBestFPlayerMatch(0);
Double number = argAsDouble(1); // returns null if not a Double.
if (player == null || number == null) {
sender.sendMessage(getHelpShort());
return;
}
if (player == null || number == null) {
sender.sendMessage(getHelpShort());
return;
}
player.alterPower(number);
int newPower = player.getPowerRounded(); // int so we don't have super long doubles.
msg(TL.COMMAND_MODIFYPOWER_ADDED, number, player.getName(), newPower);
}
player.alterPower(number);
int newPower = player.getPowerRounded(); // int so we don't have super long doubles.
msg(TL.COMMAND_MODIFYPOWER_ADDED, number, player.getName(), newPower);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MODIFYPOWER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MODIFYPOWER_DESCRIPTION;
}
}

View File

@ -8,47 +8,47 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public class CmdNear extends FCommand {
public CmdNear() {
super();
public CmdNear() {
super();
this.aliases.add("near");
this.aliases.add("nearby");
this.aliases.add("near");
this.aliases.add("nearby");
this.disableOnLock = true;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fnear.Enabled")) {
fme.msg(TL.COMMAND_NEAR_DISABLED_MSG);
return;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fnear.Enabled")) {
fme.msg(TL.COMMAND_NEAR_DISABLED_MSG);
return;
}
double range = P.p.getConfig().getInt("fnear.Radius");
String format = TL.COMMAND_NEAR_FORMAT.toString();
fme.msg(TL.COMMAND_NEAR_USE_MSG);
for (Entity e : me.getNearbyEntities(range, 255, range)) {
if (e instanceof Player) {
Player player = (((Player) e).getPlayer());
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
if (fme.getFaction() == fplayer.getFaction()) {
double distance = me.getLocation().distance(player.getLocation());
fme.sendMessage(format.replace("{playername}", player.getDisplayName()).replace("{distance}", (int) distance + ""));
}
}
double range = P.p.getConfig().getInt("fnear.Radius");
String format = TL.COMMAND_NEAR_FORMAT.toString();
fme.msg(TL.COMMAND_NEAR_USE_MSG);
for (Entity e : me.getNearbyEntities(range, 255, range)) {
if (e instanceof Player) {
Player player = (((Player) e).getPlayer());
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
if (fme.getFaction() == fplayer.getFaction()) {
double distance = me.getLocation().distance(player.getLocation());
fme.sendMessage(format.replace("{playername}", player.getDisplayName()).replace("{distance}", (int) distance + ""));
}
}
}
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_NEAR_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_NEAR_DESCRIPTION;
}
}

View File

@ -9,55 +9,55 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdOpen extends FCommand {
public CmdOpen() {
super();
this.aliases.add("open");
public CmdOpen() {
super();
this.aliases.add("open");
//this.requiredArgs.add("");
this.optionalArgs.put("yes/no", "flip");
//this.requiredArgs.add("");
this.optionalArgs.put("yes/no", "flip");
this.permission = Permission.OPEN.node;
this.disableOnLock = false;
this.disableOnSpam = true;
this.permission = Permission.OPEN.node;
this.disableOnLock = false;
this.disableOnSpam = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
return;
}
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
return;
}
if (!fme.isCooldownEnded("open")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("open"));
return;
}
if (!fme.isCooldownEnded("open")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("open"));
return;
}
myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen()));
myFaction.setOpen(this.argAsBool(0, !myFaction.getOpen()));
String open = myFaction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
String open = myFaction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
// Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg(TL.COMMAND_OPEN_CHANGES, fme.getName(), open);
continue;
}
fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open);
}
fme.setCooldown("open", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-open") * 1000));
}
// Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg(TL.COMMAND_OPEN_CHANGES, fme.getName(), open);
continue;
}
fplayer.msg(TL.COMMAND_OPEN_CHANGED, myFaction.getTag(fplayer.getFaction()), open);
}
fme.setCooldown("open", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-open") * 1000));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OPEN_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OPEN_DESCRIPTION;
}
}

View File

@ -8,100 +8,100 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdOwner extends FCommand {
public CmdOwner() {
super();
this.aliases.add("owner");
public CmdOwner() {
super();
this.aliases.add("owner");
//this.requiredArgs.add("");
this.optionalArgs.put("player name", "you");
//this.requiredArgs.add("");
this.optionalArgs.put("player name", "you");
this.permission = Permission.OWNER.node;
this.disableOnLock = true;
this.permission = Permission.OWNER.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
// TODO: Fix colors!
// TODO: Fix colors!
@Override
public void perform() {
boolean hasBypass = fme.isAdminBypassing();
@Override
public void perform() {
boolean hasBypass = fme.isAdminBypassing();
if (!hasBypass && !assertHasFaction()) {
return;
}
if (!hasBypass && !assertHasFaction()) {
return;
}
if (!Conf.ownedAreasEnabled) {
fme.msg(TL.COMMAND_OWNER_DISABLED);
return;
}
if (!Conf.ownedAreasEnabled) {
fme.msg(TL.COMMAND_OWNER_DISABLED);
return;
}
if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
fme.msg(TL.COMMAND_OWNER_LIMIT, Conf.ownedAreasLimitPerFaction);
return;
}
if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
fme.msg(TL.COMMAND_OWNER_LIMIT, Conf.ownedAreasLimitPerFaction);
return;
}
if (!hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.LEADER)) {
return;
}
if (!hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.LEADER)) {
return;
}
FLocation flocation = new FLocation(fme);
FLocation flocation = new FLocation(fme);
Faction factionHere = Board.getInstance().getFactionAt(flocation);
if (factionHere != myFaction) {
if (!factionHere.isNormal()) {
fme.msg(TL.COMMAND_OWNER_NOTCLAIMED);
return;
}
Faction factionHere = Board.getInstance().getFactionAt(flocation);
if (factionHere != myFaction) {
if (!factionHere.isNormal()) {
fme.msg(TL.COMMAND_OWNER_NOTCLAIMED);
return;
}
if (!hasBypass) {
fme.msg(TL.COMMAND_OWNER_WRONGFACTION);
return;
}
}
if (!hasBypass) {
fme.msg(TL.COMMAND_OWNER_WRONGFACTION);
return;
}
}
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) {
return;
}
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) {
return;
}
String playerName = target.getName();
String playerName = target.getName();
if (target.getFaction() != myFaction) {
fme.msg(TL.COMMAND_OWNER_NOTMEMBER, playerName);
return;
}
if (target.getFaction() != myFaction) {
fme.msg(TL.COMMAND_OWNER_NOTMEMBER, playerName);
return;
}
// if no player name was passed, and this claim does already have owners set, clear them
if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) {
myFaction.clearClaimOwnership(flocation);
fme.msg(TL.COMMAND_OWNER_CLEARED);
return;
}
// if no player name was passed, and this claim does already have owners set, clear them
if (args.isEmpty() && myFaction.doesLocationHaveOwnersSet(flocation)) {
myFaction.clearClaimOwnership(flocation);
fme.msg(TL.COMMAND_OWNER_CLEARED);
return;
}
if (myFaction.isPlayerInOwnerList(target, flocation)) {
myFaction.removePlayerAsOwner(target, flocation);
fme.msg(TL.COMMAND_OWNER_REMOVED, playerName);
return;
}
if (myFaction.isPlayerInOwnerList(target, flocation)) {
myFaction.removePlayerAsOwner(target, flocation);
fme.msg(TL.COMMAND_OWNER_REMOVED, playerName);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostOwner, TL.COMMAND_OWNER_TOSET, TL.COMMAND_OWNER_FORSET)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostOwner, TL.COMMAND_OWNER_TOSET, TL.COMMAND_OWNER_FORSET)) {
return;
}
myFaction.setPlayerAsOwner(target, flocation);
myFaction.setPlayerAsOwner(target, flocation);
fme.msg(TL.COMMAND_OWNER_ADDED, playerName);
}
fme.msg(TL.COMMAND_OWNER_ADDED, playerName);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OWNER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OWNER_DESCRIPTION;
}
}

View File

@ -9,64 +9,64 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdOwnerList extends FCommand {
public CmdOwnerList() {
super();
this.aliases.add("ownerlist");
public CmdOwnerList() {
super();
this.aliases.add("ownerlist");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.OWNERLIST.node;
this.disableOnLock = false;
this.permission = Permission.OWNERLIST.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
boolean hasBypass = fme.isAdminBypassing();
@Override
public void perform() {
boolean hasBypass = fme.isAdminBypassing();
if (!hasBypass && !assertHasFaction()) {
return;
}
if (!hasBypass && !assertHasFaction()) {
return;
}
if (!Conf.ownedAreasEnabled) {
fme.msg(TL.COMMAND_OWNERLIST_DISABLED);
return;
}
if (!Conf.ownedAreasEnabled) {
fme.msg(TL.COMMAND_OWNERLIST_DISABLED);
return;
}
FLocation flocation = new FLocation(fme);
FLocation flocation = new FLocation(fme);
if (Board.getInstance().getFactionAt(flocation) != myFaction) {
if (!hasBypass) {
fme.msg(TL.COMMAND_OWNERLIST_WRONGFACTION);
return;
}
//TODO: This code won't ever be called.
myFaction = Board.getInstance().getFactionAt(flocation);
if (!myFaction.isNormal()) {
fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED);
return;
}
}
if (Board.getInstance().getFactionAt(flocation) != myFaction) {
if (!hasBypass) {
fme.msg(TL.COMMAND_OWNERLIST_WRONGFACTION);
return;
}
//TODO: This code won't ever be called.
myFaction = Board.getInstance().getFactionAt(flocation);
if (!myFaction.isNormal()) {
fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED);
return;
}
}
String owners = myFaction.getOwnerListString(flocation);
String owners = myFaction.getOwnerListString(flocation);
if (owners == null || owners.isEmpty()) {
fme.msg(TL.COMMAND_OWNERLIST_NONE);
return;
}
if (owners == null || owners.isEmpty()) {
fme.msg(TL.COMMAND_OWNERLIST_NONE);
return;
}
fme.msg(TL.COMMAND_OWNERLIST_OWNERS, owners);
}
fme.msg(TL.COMMAND_OWNERLIST_OWNERS, owners);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OWNERLIST_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_OWNERLIST_DESCRIPTION;
}
}

View File

@ -6,58 +6,59 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdPaypalSee extends FCommand {
public CmdPaypalSee() {
aliases.add("seepaypal");
aliases.add("paypal");
public CmdPaypalSee() {
aliases.add("seepaypal");
aliases.add("paypal");
optionalArgs.put("faction", "yours");
optionalArgs.put("faction", "yours");
permission = Permission.PAYPAL.node;
permission = Permission.PAYPAL.node;
disableOnLock = false;
disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = true;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
}
if (args.size() == 0) {
if (myFaction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPAL_NOTSET);
} else {
msg(TL.PAYPALSEE_PLAYER_PAYPAL, myFaction.getPaypal());
}
} else if (args.size() == 1) {
if (fme.isAdminBypassing()) {
Faction faction = argAsFaction(0);
if (faction != null) {
if (faction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET, faction.getTag());
} else {
msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
}
}
} else {
msg(TL.GENERIC_NOPERMISSION, "see another factions paypal.");
}
} else {
msg(P.p.cmdBase.cmdPaypalSee.getUseageTemplate());
}
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PAYPALSEE_DESCRIPTION;
}
if (args.size() == 0) {
if (myFaction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPAL_NOTSET);
} else {
msg(TL.PAYPALSEE_PLAYER_PAYPAL, myFaction.getPaypal());
}
} else if (args.size() == 1) {
if (fme.isAdminBypassing()) {
Faction faction = argAsFaction(0);
if (faction != null) {
if (faction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET, faction.getTag());
} else {
msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
}
}
} else {
msg(TL.GENERIC_NOPERMISSION, "see another factions paypal.");
}
} else {
msg(P.p.cmdBase.cmdPaypalSee.getUseageTemplate());
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PAYPALSEE_DESCRIPTION;
}
}

View File

@ -8,55 +8,55 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdPeaceful extends FCommand {
public CmdPeaceful() {
super();
this.aliases.add("peaceful");
public CmdPeaceful() {
super();
this.aliases.add("peaceful");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.SET_PEACEFUL.node;
this.disableOnLock = true;
this.permission = Permission.SET_PEACEFUL.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
Faction faction = this.argAsFaction(0);
if (faction == null) {
return;
}
@Override
public void perform() {
Faction faction = this.argAsFaction(0);
if (faction == null) {
return;
}
String change;
if (faction.isPeaceful()) {
change = TL.COMMAND_PEACEFUL_REVOKE.toString();
faction.setPeaceful(false);
} else {
change = TL.COMMAND_PEACEFUL_GRANT.toString();
faction.setPeaceful(true);
}
String change;
if (faction.isPeaceful()) {
change = TL.COMMAND_PEACEFUL_REVOKE.toString();
faction.setPeaceful(false);
} else {
change = TL.COMMAND_PEACEFUL_GRANT.toString();
faction.setPeaceful(true);
}
// Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
if (fplayer.getFaction() == faction) {
fplayer.msg(TL.COMMAND_PEACEFUL_YOURS, blame, change);
} else {
fplayer.msg(TL.COMMAND_PEACEFUL_OTHER, blame, change, faction.getTag(fplayer));
}
}
// Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
if (fplayer.getFaction() == faction) {
fplayer.msg(TL.COMMAND_PEACEFUL_YOURS, blame, change);
} else {
fplayer.msg(TL.COMMAND_PEACEFUL_OTHER, blame, change, faction.getTag(fplayer));
}
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PEACEFUL_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PEACEFUL_DESCRIPTION;
}
}

View File

@ -16,104 +16,104 @@ import java.util.Set;
public class CmdPerm extends FCommand {
public CmdPerm() {
super();
this.aliases.add("perm");
this.aliases.add("perms");
this.aliases.add("permission");
this.aliases.add("permissions");
public CmdPerm() {
super();
this.aliases.add("perm");
this.aliases.add("perms");
this.aliases.add("permission");
this.aliases.add("permissions");
this.optionalArgs.put("relation", "relation");
this.optionalArgs.put("action", "action");
this.optionalArgs.put("access", "access");
this.optionalArgs.put("relation", "relation");
this.optionalArgs.put("action", "action");
this.optionalArgs.put("access", "access");
this.disableOnLock = true;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = true;
}
}
@Override
public void perform() {
if (args.size() == 0) {
new PermissableRelationFrame(fme.getFaction()).buildGUI(fme);
return;
} else if (args.size() == 1 && getPermissable(argAsString(0)) != null) {
new PermissableActionFrame(fme.getFaction()).buildGUI(fme, getPermissable(argAsString(0)));
return;
}
@Override
public void perform() {
if (args.size() == 0) {
new PermissableRelationFrame(fme.getFaction()).buildGUI(fme);
return;
} else if (args.size() == 1 && getPermissable(argAsString(0)) != null) {
new PermissableActionFrame(fme.getFaction()).buildGUI(fme, getPermissable(argAsString(0)));
return;
}
// If not opening GUI, then setting the permission manually.
if (args.size() != 3) {
fme.msg(TL.COMMAND_PERM_DESCRIPTION);
return;
}
// If not opening GUI, then setting the permission manually.
if (args.size() != 3) {
fme.msg(TL.COMMAND_PERM_DESCRIPTION);
return;
}
Set<Permissable> permissables = new HashSet<>();
Set<PermissableAction> permissableActions = new HashSet<>();
Set<Permissable> permissables = new HashSet<>();
Set<PermissableAction> permissableActions = new HashSet<>();
boolean allRelations = argAsString(0).equalsIgnoreCase("all");
boolean allActions = argAsString(1).equalsIgnoreCase("all");
boolean allRelations = argAsString(0).equalsIgnoreCase("all");
boolean allActions = argAsString(1).equalsIgnoreCase("all");
if (allRelations) {
permissables.addAll(myFaction.getPermissions().keySet());
} else {
Permissable permissable = getPermissable(argAsString(0));
if (allRelations) {
permissables.addAll(myFaction.getPermissions().keySet());
} else {
Permissable permissable = getPermissable(argAsString(0));
if (permissable == null) {
fme.msg(TL.COMMAND_PERM_INVALID_RELATION);
return;
}
if (permissable == null) {
fme.msg(TL.COMMAND_PERM_INVALID_RELATION);
return;
}
permissables.add(permissable);
}
permissables.add(permissable);
}
if (allActions) {
permissableActions.addAll(Arrays.asList(PermissableAction.values()));
} else {
PermissableAction permissableAction = PermissableAction.fromString(argAsString(1));
if (permissableAction == null) {
fme.msg(TL.COMMAND_PERM_INVALID_ACTION);
return;
}
if (allActions) {
permissableActions.addAll(Arrays.asList(PermissableAction.values()));
} else {
PermissableAction permissableAction = PermissableAction.fromString(argAsString(1));
if (permissableAction == null) {
fme.msg(TL.COMMAND_PERM_INVALID_ACTION);
return;
}
permissableActions.add(permissableAction);
}
permissableActions.add(permissableAction);
}
Access access = Access.fromString(argAsString(2));
Access access = Access.fromString(argAsString(2));
if (access == null) {
fme.msg(TL.COMMAND_PERM_INVALID_ACCESS);
return;
}
if (access == null) {
fme.msg(TL.COMMAND_PERM_INVALID_ACCESS);
return;
}
for (Permissable permissable : permissables) {
for (PermissableAction permissableAction : permissableActions) {
fme.getFaction().setPermission(permissable, permissableAction, access);
}
}
fme.msg(TL.COMMAND_PERM_SET, argAsString(1), access.name(), argAsString(0));
P.p.log(String.format(TL.COMMAND_PERM_SET.toString(), argAsString(1), access.name(), argAsString(0)) + " for faction " + fme.getTag());
}
for (Permissable permissable : permissables) {
for (PermissableAction permissableAction : permissableActions) {
fme.getFaction().setPermission(permissable, permissableAction, access);
}
}
fme.msg(TL.COMMAND_PERM_SET, argAsString(1), access.name(), argAsString(0));
P.p.log(String.format(TL.COMMAND_PERM_SET.toString(), argAsString(1), access.name(), argAsString(0)) + " for faction " + fme.getTag());
}
private Permissable getPermissable(String name) {
if (Role.fromString(name.toUpperCase()) != null) {
return Role.fromString(name.toUpperCase());
} else if (Relation.fromString(name.toUpperCase()) != null) {
return Relation.fromString(name.toUpperCase());
} else {
return null;
}
}
private Permissable getPermissable(String name) {
if (Role.fromString(name.toUpperCase()) != null) {
return Role.fromString(name.toUpperCase());
} else if (Relation.fromString(name.toUpperCase()) != null) {
return Relation.fromString(name.toUpperCase());
} else {
return null;
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PERM_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PERM_DESCRIPTION;
}
}

View File

@ -10,54 +10,54 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdPermanent extends FCommand {
public CmdPermanent() {
super();
this.aliases.add("permanent");
public CmdPermanent() {
super();
this.aliases.add("permanent");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.SET_PERMANENT.node;
this.disableOnLock = true;
this.permission = Permission.SET_PERMANENT.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction faction = this.argAsFaction(0);
if (faction == null) {
return;
}
@Override
public void perform() {
Faction faction = this.argAsFaction(0);
if (faction == null) {
return;
}
String change;
if (faction.isPermanent()) {
change = TL.COMMAND_PERMANENT_REVOKE.toString();
faction.setPermanent(false);
} else {
change = TL.COMMAND_PERMANENT_GRANT.toString();
faction.setPermanent(true);
}
String change;
if (faction.isPermanent()) {
change = TL.COMMAND_PERMANENT_REVOKE.toString();
faction.setPermanent(false);
} else {
change = TL.COMMAND_PERMANENT_GRANT.toString();
faction.setPermanent(true);
}
P.p.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\".");
P.p.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\".");
// Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
if (fplayer.getFaction() == faction) {
fplayer.msg(TL.COMMAND_PERMANENT_YOURS, blame, change);
} else {
fplayer.msg(TL.COMMAND_PERMANENT_OTHER, blame, change, faction.getTag(fplayer));
}
}
}
// Inform all players
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
if (fplayer.getFaction() == faction) {
fplayer.msg(TL.COMMAND_PERMANENT_YOURS, blame, change);
} else {
fplayer.msg(TL.COMMAND_PERMANENT_OTHER, blame, change, faction.getTag(fplayer));
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PERMANENT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PERMANENT_DESCRIPTION;
}
}

View File

@ -6,54 +6,54 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdPermanentPower extends FCommand {
public CmdPermanentPower() {
super();
this.aliases.add("permanentpower");
public CmdPermanentPower() {
super();
this.aliases.add("permanentpower");
this.requiredArgs.add("faction");
this.requiredArgs.add("power");
this.requiredArgs.add("faction");
this.requiredArgs.add("power");
this.permission = Permission.SET_PERMANENTPOWER.node;
this.disableOnLock = true;
this.permission = Permission.SET_PERMANENTPOWER.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction targetFaction = this.argAsFaction(0);
if (targetFaction == null) {
return;
}
@Override
public void perform() {
Faction targetFaction = this.argAsFaction(0);
if (targetFaction == null) {
return;
}
Integer targetPower = this.argAsInt(1);
Integer targetPower = this.argAsInt(1);
targetFaction.setPermanentPower(targetPower);
targetFaction.setPermanentPower(targetPower);
String change = TL.COMMAND_PERMANENTPOWER_REVOKE.toString();
if (targetFaction.hasPermanentPower()) {
change = TL.COMMAND_PERMANENTPOWER_GRANT.toString();
}
String change = TL.COMMAND_PERMANENTPOWER_REVOKE.toString();
if (targetFaction.hasPermanentPower()) {
change = TL.COMMAND_PERMANENTPOWER_GRANT.toString();
}
// Inform sender
msg(TL.COMMAND_PERMANENTPOWER_SUCCESS, change, targetFaction.describeTo(fme));
// Inform sender
msg(TL.COMMAND_PERMANENTPOWER_SUCCESS, change, targetFaction.describeTo(fme));
// Inform all other players
for (FPlayer fplayer : targetFaction.getFPlayersWhereOnline(true)) {
if (fplayer == fme) {
continue;
}
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
fplayer.msg(TL.COMMAND_PERMANENTPOWER_FACTION, blame, change);
}
}
// Inform all other players
for (FPlayer fplayer : targetFaction.getFPlayersWhereOnline(true)) {
if (fplayer == fme) {
continue;
}
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
fplayer.msg(TL.COMMAND_PERMANENTPOWER_FACTION, blame, change);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PERMANENTPOWER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_PERMANENTPOWER_DESCRIPTION;
}
}

View File

@ -7,50 +7,50 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdPower extends FCommand {
public CmdPower() {
super();
this.aliases.add("power");
this.aliases.add("pow");
public CmdPower() {
super();
this.aliases.add("power");
this.aliases.add("pow");
//this.requiredArgs.add("faction tag");
this.optionalArgs.put("player name", "you");
//this.requiredArgs.add("faction tag");
this.optionalArgs.put("player name", "you");
this.permission = Permission.POWER.node;
this.disableOnLock = false;
this.permission = Permission.POWER.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) {
return;
}
@Override
public void perform() {
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) {
return;
}
if (target != fme && !Permission.POWER_ANY.has(sender, true)) {
return;
}
if (target != fme && !Permission.POWER_ANY.has(sender, true)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) {
return;
}
double powerBoost = target.getPowerBoost();
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_POWER_BONUS.toString() : TL.COMMAND_POWER_PENALTY.toString()) + powerBoost + ")";
msg(TL.COMMAND_POWER_POWER, target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost);
}
double powerBoost = target.getPowerBoost();
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_POWER_BONUS.toString() : TL.COMMAND_POWER_PENALTY.toString()) + powerBoost + ")";
msg(TL.COMMAND_POWER_POWER, target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_POWER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_POWER_DESCRIPTION;
}
}

View File

@ -8,81 +8,81 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdPowerBoost extends FCommand {
public CmdPowerBoost() {
super();
this.aliases.add("powerboost");
public CmdPowerBoost() {
super();
this.aliases.add("powerboost");
this.requiredArgs.add("plugin|f|player|faction");
this.requiredArgs.add("name");
this.requiredArgs.add("# or reset");
this.requiredArgs.add("plugin|f|player|faction");
this.requiredArgs.add("name");
this.requiredArgs.add("# or reset");
this.permission = Permission.POWERBOOST.node;
this.disableOnLock = true;
this.permission = Permission.POWERBOOST.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
String type = this.argAsString(0).toLowerCase();
boolean doPlayer = true;
if (type.equals("f") || type.equals("faction")) {
doPlayer = false;
} else if (!type.equals("plugin") && !type.equals("player")) {
msg(TL.COMMAND_POWERBOOST_HELP_1);
msg(TL.COMMAND_POWERBOOST_HELP_2);
return;
}
@Override
public void perform() {
String type = this.argAsString(0).toLowerCase();
boolean doPlayer = true;
if (type.equals("f") || type.equals("faction")) {
doPlayer = false;
} else if (!type.equals("plugin") && !type.equals("player")) {
msg(TL.COMMAND_POWERBOOST_HELP_1);
msg(TL.COMMAND_POWERBOOST_HELP_2);
return;
}
Double targetPower = this.argAsDouble(2);
if (targetPower == null) {
if (this.argAsString(2).equalsIgnoreCase("reset")) {
targetPower = 0D;
} else {
msg(TL.COMMAND_POWERBOOST_INVALIDNUM);
return;
}
}
Double targetPower = this.argAsDouble(2);
if (targetPower == null) {
if (this.argAsString(2).equalsIgnoreCase("reset")) {
targetPower = 0D;
} else {
msg(TL.COMMAND_POWERBOOST_INVALIDNUM);
return;
}
}
String target;
String target;
if (doPlayer) {
FPlayer targetPlayer = this.argAsBestFPlayerMatch(1);
if (targetPlayer == null) {
return;
}
if (doPlayer) {
FPlayer targetPlayer = this.argAsBestFPlayerMatch(1);
if (targetPlayer == null) {
return;
}
if (targetPower != 0) {
targetPower += targetPlayer.getPowerBoost();
}
targetPlayer.setPowerBoost(targetPower);
target = TL.COMMAND_POWERBOOST_PLAYER.format(targetPlayer.getName());
} else {
Faction targetFaction = this.argAsFaction(1);
if (targetFaction == null) {
return;
}
if (targetPower != 0) {
targetPower += targetPlayer.getPowerBoost();
}
targetPlayer.setPowerBoost(targetPower);
target = TL.COMMAND_POWERBOOST_PLAYER.format(targetPlayer.getName());
} else {
Faction targetFaction = this.argAsFaction(1);
if (targetFaction == null) {
return;
}
if (targetPower != 0) {
targetPower += targetFaction.getPowerBoost();
}
targetFaction.setPowerBoost(targetPower);
target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag());
}
if (targetPower != 0) {
targetPower += targetFaction.getPowerBoost();
}
targetFaction.setPowerBoost(targetPower);
target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag());
}
int roundedPower = (int) Math.round(targetPower);
msg(TL.COMMAND_POWERBOOST_BOOST, target, roundedPower);
if (!senderIsConsole) {
P.p.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower);
}
}
int roundedPower = (int) Math.round(targetPower);
msg(TL.COMMAND_POWERBOOST_BOOST, target, roundedPower);
if (!senderIsConsole) {
P.p.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_POWERBOOST_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_POWERBOOST_DESCRIPTION;
}
}

View File

@ -7,39 +7,39 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdReload extends FCommand {
public CmdReload() {
super();
this.aliases.add("reload");
public CmdReload() {
super();
this.aliases.add("reload");
this.permission = Permission.RELOAD.node;
this.disableOnLock = false;
this.permission = Permission.RELOAD.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
long timeInitStart = System.currentTimeMillis();
Conf.load();
Conf.save();
P.p.reloadConfig();
P.p.loadLang();
@Override
public void perform() {
long timeInitStart = System.currentTimeMillis();
Conf.load();
Conf.save();
P.p.reloadConfig();
P.p.loadLang();
if (P.p.getConfig().getBoolean("enable-faction-flight")) {
P.p.factionsFlight = true;
}
long timeReload = (System.currentTimeMillis() - timeInitStart);
if (P.p.getConfig().getBoolean("enable-faction-flight")) {
P.p.factionsFlight = true;
}
long timeReload = (System.currentTimeMillis() - timeInitStart);
msg(TL.COMMAND_RELOAD_TIME, timeReload);
}
msg(TL.COMMAND_RELOAD_TIME, timeReload);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RELOAD_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RELOAD_DESCRIPTION;
}
}

View File

@ -8,84 +8,84 @@ import java.util.HashMap;
import java.util.List;
public class CmdRules extends FCommand {
public CmdRules() {
super();
aliases.add("r");
aliases.add("rule");
aliases.add("rules");
public CmdRules() {
super();
aliases.add("r");
aliases.add("rule");
aliases.add("rules");
this.optionalArgs.put("add/remove/set/clear", "");
this.errorOnToManyArgs = false;
this.optionalArgs.put("add/remove/set/clear", "");
this.errorOnToManyArgs = false;
permission = Permission.RULES.node;
permission = Permission.RULES.node;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = true;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("frules.Enabled")) {
fme.msg(TL.COMMAND_RULES_DISABLED_MSG);
return;
}
if (this.args.size() == 0) {
HashMap<Integer, String> rules = fme.getFaction().getRulesMap();
if (rules.size() == 0) {
List<String> ruleList = P.p.getConfig().getStringList("frules.default-rules");
fme.sendMessage(P.p.colorList(ruleList));
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("frules.Enabled")) {
fme.msg(TL.COMMAND_RULES_DISABLED_MSG);
return;
}
if (this.args.size() == 0) {
HashMap<Integer, String> rules = fme.getFaction().getRulesMap();
if (rules.size() == 0) {
List<String> ruleList = P.p.getConfig().getStringList("frules.default-rules");
fme.sendMessage(P.p.colorList(ruleList));
} else {
for (int i = 0; i <= rules.size() - 1; i++) {
fme.sendMessage(P.p.color(rules.get(i)));
}
}
} else {
for (int i = 0; i <= rules.size() - 1; i++) {
fme.sendMessage(P.p.color(rules.get(i)));
}
}
}
if (this.args.size() == 1) {
if (args.get(0).equalsIgnoreCase("add")) {
fme.msg(TL.COMMAND_RULES_ADD_INVALIDARGS);
}
if (args.get(0).equalsIgnoreCase("set")) {
fme.msg(TL.COMMAND_RULES_SET_INVALIDARGS);
}
if (args.get(0).equalsIgnoreCase("remove")) {
fme.msg(TL.COMMAND_RULES_REMOVE_INVALIDARGS);
}
if (args.get(0).equalsIgnoreCase("clear")) {
fme.getFaction().clearRules();
fme.msg(TL.COMMAND_RULES_CLEAR_SUCCESS);
}
}
if (this.args.size() == 1) {
if (args.get(0).equalsIgnoreCase("add")) {
fme.msg(TL.COMMAND_RULES_ADD_INVALIDARGS);
}
if (args.get(0).equalsIgnoreCase("set")) {
fme.msg(TL.COMMAND_RULES_SET_INVALIDARGS);
}
if (args.get(0).equalsIgnoreCase("remove")) {
fme.msg(TL.COMMAND_RULES_REMOVE_INVALIDARGS);
}
if (args.get(0).equalsIgnoreCase("clear")) {
fme.getFaction().clearRules();
fme.msg(TL.COMMAND_RULES_CLEAR_SUCCESS);
}
}
if (this.args.size() >= 2) {
if (args.get(0).equalsIgnoreCase("add")) {
String message = "";
StringBuilder string = new StringBuilder(message);
for (int i = 1; i <= args.size() - 1; i++) {
string.append(" ").append(args.get(i));
}
fme.getFaction().addRule(string.toString());
fme.msg(TL.COMMAND_RULES_ADD_SUCCESS);
}
}
if (this.args.size() >= 2) {
if (args.get(0).equalsIgnoreCase("add")) {
String message = "";
StringBuilder string = new StringBuilder(message);
for (int i = 1; i <= args.size() - 1; i++) {
string.append(" ").append(args.get(i));
}
fme.getFaction().addRule(string.toString());
fme.msg(TL.COMMAND_RULES_ADD_SUCCESS);
}
if (this.args.size() == 2) {
if (args.get(0).equalsIgnoreCase("remove")) {
int index = argAsInt(1);
fme.getFaction().removeRule(index - 1);
fme.msg(TL.COMMAND_RULES_REMOVE_SUCCESS);
}
}
if (this.args.size() == 2) {
if (args.get(0).equalsIgnoreCase("remove")) {
int index = argAsInt(1);
fme.getFaction().removeRule(index - 1);
fme.msg(TL.COMMAND_RULES_REMOVE_SUCCESS);
}
}
}
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RULES_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_RULES_DESCRIPTION;
}
}

View File

@ -6,28 +6,28 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdSB extends FCommand {
public CmdSB() {
this.aliases.add("sb");
this.aliases.add("scoreboard");
this.permission = Permission.SCOREBOARD.node;
this.senderMustBePlayer = true;
}
public CmdSB() {
this.aliases.add("sb");
this.aliases.add("scoreboard");
this.permission = Permission.SCOREBOARD.node;
this.senderMustBePlayer = true;
}
@Override
public void perform() {
boolean toggleTo = !fme.showScoreboard();
FScoreboard board = FScoreboard.get(fme);
if (board == null) {
me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString());
} else {
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggleTo)));
board.setSidebarVisibility(toggleTo);
}
fme.setShowScoreboard(toggleTo);
}
@Override
public void perform() {
boolean toggleTo = !fme.showScoreboard();
FScoreboard board = FScoreboard.get(fme);
if (board == null) {
me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString());
} else {
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggleTo)));
board.setSidebarVisibility(toggleTo);
}
fme.setShowScoreboard(toggleTo);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SCOREBOARD_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SCOREBOARD_DESCRIPTION;
}
}

View File

@ -9,36 +9,36 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdSaveAll extends FCommand {
public CmdSaveAll() {
super();
this.aliases.add("saveall");
this.aliases.add("save");
public CmdSaveAll() {
super();
this.aliases.add("saveall");
this.aliases.add("save");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.SAVE.node;
this.disableOnLock = false;
this.permission = Permission.SAVE.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayers.getInstance().forceSave(false);
Factions.getInstance().forceSave(false);
Board.getInstance().forceSave(false);
Conf.save();
msg(TL.COMMAND_SAVEALL_SUCCESS);
}
@Override
public void perform() {
FPlayers.getInstance().forceSave(false);
Factions.getInstance().forceSave(false);
Board.getInstance().forceSave(false);
Conf.save();
msg(TL.COMMAND_SAVEALL_SUCCESS);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SAVEALL_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SAVEALL_DESCRIPTION;
}
}

View File

@ -15,131 +15,131 @@ import java.util.HashMap;
public class CmdSeeChunk extends FCommand {
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
Long interval;
private boolean useParticles;
private ParticleEffect effect;
private int taskID = -1;
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
Long interval;
private boolean useParticles;
private ParticleEffect effect;
private int taskID = -1;
//I remade it cause of people getting mad that I had the same seechunk as drtshock
//I remade it cause of people getting mad that I had the same seechunk as drtshock
public CmdSeeChunk() {
super();
aliases.add("seechunk");
aliases.add("sc");
public CmdSeeChunk() {
super();
aliases.add("seechunk");
aliases.add("sc");
permission = Permission.SEECHUNK.node;
permission = Permission.SEECHUNK.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.useParticles = p.getConfig().getBoolean("see-chunk.particles", true);
interval = P.p.getConfig().getLong("see-chunk.interval", 10L);
if (effect == null) {
effect = ParticleEffect.REDSTONE;
}
this.useParticles = p.getConfig().getBoolean("see-chunk.particles", true);
interval = P.p.getConfig().getLong("see-chunk.interval", 10L);
if (effect == null) {
effect = ParticleEffect.REDSTONE;
}
}
}
@Override
public void perform() {
if (seeChunkMap.containsKey(me.getName())) {
seeChunkMap.remove(me.getName());
msg(TL.COMMAND_SEECHUNK_DISABLED);
} else {
seeChunkMap.put(me.getName(), true);
msg(TL.COMMAND_SEECHUNK_ENABLED);
manageTask();
}
}
@Override
public void perform() {
if (seeChunkMap.containsKey(me.getName())) {
seeChunkMap.remove(me.getName());
msg(TL.COMMAND_SEECHUNK_DISABLED);
} else {
seeChunkMap.put(me.getName(), true);
msg(TL.COMMAND_SEECHUNK_ENABLED);
manageTask();
}
}
private void manageTask() {
if (taskID != -1) {
if (seeChunkMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(taskID);
taskID = -1;
}
} else {
startTask();
}
}
private void manageTask() {
if (taskID != -1) {
if (seeChunkMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(taskID);
taskID = -1;
}
} else {
startTask();
}
}
private void startTask() {
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> {
for (Object nameObject : seeChunkMap.keySet()) {
String name = nameObject + "";
Player player = Bukkit.getPlayer(name);
showBorders(player);
}
manageTask();
}, 0, interval);
}
private void startTask() {
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, () -> {
for (Object nameObject : seeChunkMap.keySet()) {
String name = nameObject + "";
Player player = Bukkit.getPlayer(name);
showBorders(player);
}
manageTask();
}, 0, interval);
}
private void showBorders(Player me) {
World world = me.getWorld();
FLocation flocation = new FLocation(me);
int chunkX = (int) flocation.getX();
int chunkZ = (int) flocation.getZ();
private void showBorders(Player me) {
World world = me.getWorld();
FLocation flocation = new FLocation(me);
int chunkX = (int) flocation.getX();
int chunkZ = (int) flocation.getZ();
int blockX;
int blockZ;
int blockX;
int blockZ;
blockX = chunkX * 16;
blockZ = chunkZ * 16;
showPillar(me, world, blockX, blockZ);
blockX = chunkX * 16;
blockZ = chunkZ * 16;
showPillar(me, world, blockX, blockZ);
blockX = chunkX * 16 + 15;
blockZ = chunkZ * 16;
showPillar(me, world, blockX, blockZ);
blockX = chunkX * 16 + 15;
blockZ = chunkZ * 16;
showPillar(me, world, blockX, blockZ);
blockX = chunkX * 16;
blockZ = chunkZ * 16 + 15;
showPillar(me, world, blockX, blockZ);
blockX = chunkX * 16;
blockZ = chunkZ * 16 + 15;
showPillar(me, world, blockX, blockZ);
blockX = chunkX * 16 + 15;
blockZ = chunkZ * 16 + 15;
showPillar(me, world, blockX, blockZ);
}
blockX = chunkX * 16 + 15;
blockZ = chunkZ * 16 + 15;
showPillar(me, world, blockX, blockZ);
}
private void showPillar(Player player, World world, int blockX, int blockZ) {
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
if (loc.getBlock().getType() != Material.AIR) {
continue;
}
if (useParticles) {
if (P.p.useNonPacketParticles) {
// Dust options only exists in the 1.13 API, so we use an
// alternative method to achieve this in lower versions.
if (P.p.mc113) {
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
} else {
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1);
}
private void showPillar(Player player, World world, int blockX, int blockZ) {
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
if (loc.getBlock().getType() != Material.AIR) {
continue;
}
if (useParticles) {
if (P.p.useNonPacketParticles) {
// Dust options only exists in the 1.13 API, so we use an
// alternative method to achieve this in lower versions.
if (P.p.mc113) {
player.spawnParticle(Particle.REDSTONE, loc, 0, new Particle.DustOptions(Color.RED, 1));
} else {
player.getWorld().spawnParticle(Particle.REDSTONE, loc, 0, 255, 0, 0, 1);
}
} else {
this.effect.display(0, 0, 0, 0, 1, loc, player);
}
} else {
this.effect.display(0, 0, 0, 0, 1, loc, player);
}
} else {
Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial();
VisualizeUtil.addLocation(player, loc, type);
}
}
}
} else {
Material type = blockY % 5 == 0 ? XMaterial.REDSTONE_LAMP.parseMaterial() : XMaterial.BLACK_STAINED_GLASS.parseMaterial();
VisualizeUtil.addLocation(player, loc, type);
}
}
}
@Override
public TL getUsageTranslation() {
return TL.GENERIC_PLACEHOLDER;
}
@Override
public TL getUsageTranslation() {
return TL.GENERIC_PLACEHOLDER;
}
}

View File

@ -5,35 +5,35 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdSetBanner extends FCommand {
public CmdSetBanner() {
super();
aliases.add("setbanner");
public CmdSetBanner() {
super();
aliases.add("setbanner");
permission = Permission.BANNER.node;
permission = Permission.BANNER.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = true;
}
}
public void perform() {
if (!me.getItemInHand().getType().toString().contains("BANNER")) {
fme.msg(TL.COMMAND_SETBANNER_NOTBANNER);
return;
}
public void perform() {
if (!me.getItemInHand().getType().toString().contains("BANNER")) {
fme.msg(TL.COMMAND_SETBANNER_NOTBANNER);
return;
}
fme.getFaction().setBannerPattern(me.getItemInHand());
fme.msg(TL.COMMAND_SETBANNER_SUCCESS);
fme.getFaction().setBannerPattern(me.getItemInHand());
fme.msg(TL.COMMAND_SETBANNER_SUCCESS);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETBANNER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETBANNER_DESCRIPTION;
}
}

View File

@ -6,43 +6,43 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdSetDefaultRole extends FCommand {
public CmdSetDefaultRole() {
super();
public CmdSetDefaultRole() {
super();
this.aliases.add("defaultrole");
this.aliases.add("defaultrank");
this.aliases.add("default");
this.aliases.add("def");
this.requiredArgs.add("role");
this.aliases.add("defaultrole");
this.aliases.add("defaultrank");
this.aliases.add("default");
this.aliases.add("def");
this.requiredArgs.add("role");
this.senderMustBeAdmin = true;
this.senderMustBePlayer = true;
senderMustBeColeader = false;
this.senderMustBeAdmin = true;
this.senderMustBePlayer = true;
senderMustBeColeader = false;
this.permission = Permission.DEFAULTRANK.node;
}
this.permission = Permission.DEFAULTRANK.node;
}
@Override
public void perform() {
Role target = Role.fromString(argAsString(0).toUpperCase());
if (target == null) {
msg(TL.COMMAND_SETDEFAULTROLE_INVALIDROLE, argAsString(0));
return;
}
@Override
public void perform() {
Role target = Role.fromString(argAsString(0).toUpperCase());
if (target == null) {
msg(TL.COMMAND_SETDEFAULTROLE_INVALIDROLE, argAsString(0));
return;
}
if (target == Role.LEADER) {
msg(TL.COMMAND_SETDEFAULTROLE_NOTTHATROLE, argAsString(0));
return;
}
if (target == Role.LEADER) {
msg(TL.COMMAND_SETDEFAULTROLE_NOTTHATROLE, argAsString(0));
return;
}
myFaction.setDefaultRole(target);
msg(TL.COMMAND_SETDEFAULTROLE_SUCCESS, target.nicename);
}
myFaction.setDefaultRole(target);
msg(TL.COMMAND_SETDEFAULTROLE_SUCCESS, target.nicename);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETDEFAULTROLE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETDEFAULTROLE_DESCRIPTION;
}
}

View File

@ -12,72 +12,72 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdSetFWarp extends FCommand {
public CmdSetFWarp() {
super();
public CmdSetFWarp() {
super();
this.aliases.add("setwarp");
this.aliases.add("sw");
this.aliases.add("setwarp");
this.aliases.add("sw");
this.requiredArgs.add("warp name");
this.optionalArgs.put("password", "password");
this.requiredArgs.add("warp name");
this.optionalArgs.put("password", "password");
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
this.senderMustBePlayer = true;
this.senderMustBePlayer = true;
this.permission = Permission.SETWARP.node;
}
this.permission = Permission.SETWARP.node;
}
@Override
public void perform() {
if (!(fme.getRelationToLocation() == Relation.MEMBER)) {
fme.msg(TL.COMMAND_SETFWARP_NOTCLAIMED);
return;
}
@Override
public void perform() {
if (!(fme.getRelationToLocation() == Relation.MEMBER)) {
fme.msg(TL.COMMAND_SETFWARP_NOTCLAIMED);
return;
}
// This statement allows us to check if they've specifically denied it, or default to
// the old setting of allowing moderators to set warps.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
return;
}
}
// This statement allows us to check if they've specifically denied it, or default to
// the old setting of allowing moderators to set warps.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
return;
}
}
String warp = argAsString(0);
String warp = argAsString(0);
// Checks if warp with same name already exists and ignores maxWarp check if it does.
boolean warpExists = myFaction.isWarp(warp);
// Checks if warp with same name already exists and ignores maxWarp check if it does.
boolean warpExists = myFaction.isWarp(warp);
int maxWarps = P.p.getConfig().getInt("max-warps", 5);
boolean tooManyWarps = maxWarps <= myFaction.getWarps().size();
if (tooManyWarps && !warpExists) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
return;
}
int maxWarps = P.p.getConfig().getInt("max-warps", 5);
boolean tooManyWarps = maxWarps <= myFaction.getWarps().size();
if (tooManyWarps && !warpExists) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);
return;
}
if (!transact(fme)) {
return;
}
if (!transact(fme)) {
return;
}
String password = argAsString(1);
String password = argAsString(1);
LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation());
myFaction.setWarp(warp, loc);
if (password != null) {
myFaction.setWarpPassword(warp, password);
}
fme.msg(TL.COMMAND_SETFWARP_SET, warp, password != null ? password : "");
}
LazyLocation loc = new LazyLocation(fme.getPlayer().getLocation());
myFaction.setWarp(warp, loc);
if (password != null) {
myFaction.setWarpPassword(warp, password);
}
fme.msg(TL.COMMAND_SETFWARP_SET, warp, password != null ? password : "");
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString());
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.setwarp", 5), TL.COMMAND_SETFWARP_TOSET.toString(), TL.COMMAND_SETFWARP_FORSET.toString());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETFWARP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETFWARP_DESCRIPTION;
}
}

View File

@ -7,44 +7,44 @@ import org.bukkit.ChatColor;
public class CmdSetMaxVaults extends FCommand {
public CmdSetMaxVaults() {
this.aliases.add("setmaxvaults");
this.aliases.add("smv");
public CmdSetMaxVaults() {
this.aliases.add("setmaxvaults");
this.aliases.add("smv");
this.requiredArgs.add("faction");
this.requiredArgs.add("number");
this.requiredArgs.add("faction");
this.requiredArgs.add("number");
this.permission = Permission.SETMAXVAULTS.node;
this.disableOnLock = false;
this.permission = Permission.SETMAXVAULTS.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
Faction targetFaction = argAsFaction(0);
int value = argAsInt(1, -1);
if (value < 0) {
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
return;
}
@Override
public void perform() {
Faction targetFaction = argAsFaction(0);
int value = argAsInt(1, -1);
if (value < 0) {
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
return;
}
if (targetFaction == null) {
sender.sendMessage(ChatColor.RED + "Couldn't find Faction: " + ChatColor.YELLOW + argAsString(0));
return;
}
if (targetFaction == null) {
sender.sendMessage(ChatColor.RED + "Couldn't find Faction: " + ChatColor.YELLOW + argAsString(0));
return;
}
targetFaction.setMaxVaults(value);
sender.sendMessage(TL.COMMAND_SETMAXVAULTS_SUCCESS.format(targetFaction.getTag(), value));
}
targetFaction.setMaxVaults(value);
sender.sendMessage(TL.COMMAND_SETMAXVAULTS_SUCCESS.format(targetFaction.getTag(), value));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETMAXVAULTS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETMAXVAULTS_DESCRIPTION;
}
}

View File

@ -12,68 +12,68 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdSethome extends FCommand {
public CmdSethome() {
this.aliases.add("sethome");
public CmdSethome() {
this.aliases.add("sethome");
//this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "mine");
//this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "mine");
this.permission = Permission.SETHOME.node;
this.disableOnLock = true;
this.permission = Permission.SETHOME.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
if (!Conf.homesEnabled) {
fme.msg(TL.COMMAND_SETHOME_DISABLED);
return;
}
@Override
public void perform() {
if (!Conf.homesEnabled) {
fme.msg(TL.COMMAND_SETHOME_DISABLED);
return;
}
Faction faction = this.argAsFaction(0, myFaction);
if (faction == null) {
return;
}
Faction faction = this.argAsFaction(0, myFaction);
if (faction == null) {
return;
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETHOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER && !Permission.SETHOME_ANY.has(sender, true)) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home");
return;
}
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETHOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER && !Permission.SETHOME_ANY.has(sender, true)) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home");
return;
}
}
// Can the player set the faction home HERE?
if (!Permission.BYPASS.has(me) &&
Conf.homesMustBeInClaimedTerritory &&
Board.getInstance().getFactionAt(new FLocation(me)) != faction) {
fme.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
return;
}
// Can the player set the faction home HERE?
if (!Permission.BYPASS.has(me) &&
Conf.homesMustBeInClaimedTerritory &&
Board.getInstance().getFactionAt(new FLocation(me)) != faction) {
fme.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
return;
}
faction.setHome(me.getLocation());
faction.setHome(me.getLocation());
faction.msg(TL.COMMAND_SETHOME_SET, fme.describeTo(myFaction, true));
faction.sendMessage(p.cmdBase.cmdHome.getUseageTemplate());
if (faction != myFaction) {
fme.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(fme));
}
}
faction.msg(TL.COMMAND_SETHOME_SET, fme.describeTo(myFaction, true));
faction.sendMessage(p.cmdBase.cmdHome.getUseageTemplate());
if (faction != myFaction) {
fme.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(fme));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETHOME_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETHOME_DESCRIPTION;
}
}

View File

@ -14,108 +14,108 @@ import java.util.List;
public class CmdShow extends FCommand {
List<String> defaults = new ArrayList<>();
List<String> defaults = new ArrayList<>();
public CmdShow() {
this.aliases.add("show");
this.aliases.add("who");
this.aliases.add("f");
public CmdShow() {
this.aliases.add("show");
this.aliases.add("who");
this.aliases.add("f");
// add defaults to /f show in case config doesnt have it
defaults.add("{header}");
defaults.add("<a>Description: <i>{description}");
defaults.add("<a>Joining: <i>{joining} {peaceful}");
defaults.add("<a>Land / Power / Maxpower: <i> {chunks} / {power} / {maxPower}");
defaults.add("<a>Faction Strikes: {strikes}");
defaults.add("<a>Founded: <i>{create-date}");
defaults.add("<a>This faction is permanent, remaining even with no members.");
defaults.add("<a>Land value: <i>{land-value} {land-refund}");
defaults.add("<a>Balance: <i>{faction-balance}");
defaults.add("<a>Allies(<i>{allies}<a>/<i>{max-allies}<a>): {allies-list}");
defaults.add("<a>Online: (<i>{online}<a>/<i>{members}<a>): {online-list}");
defaults.add("<a>Offline: (<i>{offline}<a>/<i>{members}<a>): {offline-list}");
defaults.add("<a>Alt List: <i>{alts}");
// add defaults to /f show in case config doesnt have it
defaults.add("{header}");
defaults.add("<a>Description: <i>{description}");
defaults.add("<a>Joining: <i>{joining} {peaceful}");
defaults.add("<a>Land / Power / Maxpower: <i> {chunks} / {power} / {maxPower}");
defaults.add("<a>Faction Strikes: {strikes}");
defaults.add("<a>Founded: <i>{create-date}");
defaults.add("<a>This faction is permanent, remaining even with no members.");
defaults.add("<a>Land value: <i>{land-value} {land-refund}");
defaults.add("<a>Balance: <i>{faction-balance}");
defaults.add("<a>Allies(<i>{allies}<a>/<i>{max-allies}<a>): {allies-list}");
defaults.add("<a>Online: (<i>{online}<a>/<i>{members}<a>): {online-list}");
defaults.add("<a>Offline: (<i>{offline}<a>/<i>{members}<a>): {offline-list}");
defaults.add("<a>Alt List: <i>{alts}");
// this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours");
// this.requiredArgs.add("");
this.optionalArgs.put("faction tag", "yours");
this.permission = Permission.SHOW.node;
this.disableOnLock = false;
this.permission = Permission.SHOW.node;
this.disableOnLock = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction faction = myFaction;
if (this.argIsSet(0))
faction = this.argAsFaction(0);
@Override
public void perform() {
Faction faction = myFaction;
if (this.argIsSet(0))
faction = this.argAsFaction(0);
if (faction == null)
return;
if (faction == null)
return;
if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")
&& P.p.getConfig().getStringList("show-exempt").contains(faction.getTag())) {
msg(TL.COMMAND_SHOW_EXEMPT);
return;
}
if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")
&& P.p.getConfig().getStringList("show-exempt").contains(faction.getTag())) {
msg(TL.COMMAND_SHOW_EXEMPT);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) {
return;
}
List<String> show = P.p.getConfig().getStringList("show");
if (show == null || show.isEmpty())
show = defaults;
List<String> show = P.p.getConfig().getStringList("show");
if (show == null || show.isEmpty())
show = defaults;
if (!faction.isNormal()) {
String tag = faction.getTag(fme);
// send header and that's all
String header = show.get(0);
if (TagReplacer.HEADER.contains(header)) {
msg(p.txt.titleize(tag));
} else {
msg(p.txt.parse(TagReplacer.FACTION.replace(header, tag)));
}
return; // we only show header for non-normal factions
}
if (!faction.isNormal()) {
String tag = faction.getTag(fme);
// send header and that's all
String header = show.get(0);
if (TagReplacer.HEADER.contains(header)) {
msg(p.txt.titleize(tag));
} else {
msg(p.txt.parse(TagReplacer.FACTION.replace(header, tag)));
}
return; // we only show header for non-normal factions
}
for (String raw : show) {
String parsed = TagUtil.parsePlain(faction, fme, raw); // use relations
if (parsed == null) {
continue; // Due to minimal f show.
}
for (String raw : show) {
String parsed = TagUtil.parsePlain(faction, fme, raw); // use relations
if (parsed == null) {
continue; // Due to minimal f show.
}
if (fme != null) {
parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed);
}
if (fme != null) {
parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed);
}
if (TagUtil.hasFancy(parsed)) {
List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed);
if (fancy != null)
sendFancyMessage(fancy);
if (TagUtil.hasFancy(parsed)) {
List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed);
if (fancy != null)
sendFancyMessage(fancy);
continue;
}
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
if (parsed.contains("{ig}")) {
// replaces all variables with no home TL
parsed = parsed.substring(0, parsed.indexOf("{ig}")) + TL.COMMAND_SHOW_NOHOME.toString();
}
if (parsed.contains("%")) {
parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it.
}
msg(p.txt.parse(parsed));
}
}
}
continue;
}
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
if (parsed.contains("{ig}")) {
// replaces all variables with no home TL
parsed = parsed.substring(0, parsed.indexOf("{ig}")) + TL.COMMAND_SHOW_NOHOME.toString();
}
if (parsed.contains("%")) {
parsed = parsed.replaceAll("%", ""); // Just in case it got in there before we disallowed it.
}
msg(p.txt.parse(parsed));
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SHOW_COMMANDDESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SHOW_COMMANDDESCRIPTION;
}
}

View File

@ -8,49 +8,49 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdShowClaims extends FCommand {
public CmdShowClaims() {
public CmdShowClaims() {
this.aliases.add("showclaims");
this.aliases.add("showclaim");
this.aliases.add("showclaims");
this.aliases.add("showclaim");
permission = Permission.SHOWCLAIMS.node;
permission = Permission.SHOWCLAIMS.node;
this.senderMustBePlayer = true;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
}
this.senderMustBePlayer = true;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
}
@Override
public void perform() {
sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}", fme.getFaction().describeTo(fme)));
ListMultimap<String, String> chunkMap = ArrayListMultimap.create();
String format = TL.COMMAND_SHOWCLAIMS_CHUNKSFORMAT.toString();
for (FLocation fLocation : fme.getFaction().getAllClaims()) {
chunkMap.put(fLocation.getWorldName(), format.replace("{x}", fLocation.getX() + "").replace("{z}", fLocation.getZ() + ""));
}
for (String world : chunkMap.keySet()) {
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
// made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
sendMessage(message.replace("{chunks}", ""));
StringBuilder chunks = new StringBuilder();
for (String chunkString : chunkMap.get(world)) {
chunks.append(chunkString).append(", ");
if (chunks.toString().length() >= 2000) {
sendMessage(chunks.toString());
chunks.setLength(0);
}
}
if (chunks.length() != 0) sendMessage(chunks.toString());
sendMessage("");
}
@Override
public void perform() {
sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}", fme.getFaction().describeTo(fme)));
ListMultimap<String, String> chunkMap = ArrayListMultimap.create();
String format = TL.COMMAND_SHOWCLAIMS_CHUNKSFORMAT.toString();
for (FLocation fLocation : fme.getFaction().getAllClaims()) {
chunkMap.put(fLocation.getWorldName(), format.replace("{x}", fLocation.getX() + "").replace("{z}", fLocation.getZ() + ""));
}
for (String world : chunkMap.keySet()) {
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
// made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
sendMessage(message.replace("{chunks}", ""));
StringBuilder chunks = new StringBuilder();
for (String chunkString : chunkMap.get(world)) {
chunks.append(chunkString).append(", ");
if (chunks.toString().length() >= 2000) {
sendMessage(chunks.toString());
chunks.setLength(0);
}
}
if (chunks.length() != 0) sendMessage(chunks.toString());
sendMessage("");
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SHOWCLAIMS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SHOWCLAIMS_DESCRIPTION;
}
}

View File

@ -10,32 +10,32 @@ import org.bukkit.ChatColor;
public class CmdShowInvites extends FCommand {
public CmdShowInvites() {
super();
aliases.add("showinvites");
permission = Permission.SHOW_INVITES.node;
public CmdShowInvites() {
super();
aliases.add("showinvites");
permission = Permission.SHOW_INVITES.node;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBePlayer = true;
senderMustBeMember = true;
}
}
@Override
public void perform() {
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) {
FPlayer fp = FPlayers.getInstance().getById(id);
String name = fp != null ? fp.getName() : id;
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
}
@Override
public void perform() {
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) {
FPlayer fp = FPlayers.getInstance().getById(id);
String name = fp != null ? fp.getName() : id;
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
}
sendFancyMessage(msg);
}
sendFancyMessage(msg);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SHOWINVITES_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SHOWINVITES_DESCRIPTION;
}
}

View File

@ -1,12 +1,11 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSpam extends FCommand {
public CmdSpam(){
public CmdSpam() {
this.aliases.add("spam");
this.optionalArgs.put("on/off", "flip");

View File

@ -10,35 +10,35 @@ import java.util.ArrayList;
public class CmdStatus extends FCommand {
public CmdStatus() {
super();
this.aliases.add("status");
this.aliases.add("s");
public CmdStatus() {
super();
this.aliases.add("status");
this.aliases.add("s");
this.permission = Permission.STATUS.node;
this.permission = Permission.STATUS.node;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
ArrayList<String> ret = new ArrayList<>();
for (FPlayer fp : myFaction.getFPlayers()) {
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET;
ret.add(String.format(TL.COMMAND_STATUS_FORMAT.toString(), ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, power, last).trim());
}
fme.sendMessage(ret);
}
@Override
public void perform() {
ArrayList<String> ret = new ArrayList<>();
for (FPlayer fp : myFaction.getFPlayers()) {
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET;
ret.add(String.format(TL.COMMAND_STATUS_FORMAT.toString(), ChatColor.GOLD + fp.getRole().getPrefix() + fp.getName() + ChatColor.RESET, power, last).trim());
}
fme.sendMessage(ret);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_STATUS_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_STATUS_DESCRIPTION;
}
}

View File

@ -5,35 +5,34 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdStealth extends FCommand {
public CmdStealth() {
this.aliases.add("ninja");
this.aliases.add("stealth");
this.permission = Permission.STEALTH.node;
public CmdStealth() {
this.aliases.add("ninja");
this.aliases.add("stealth");
this.permission = Permission.STEALTH.node;
this.disableOnLock = true;
this.disableOnLock = true;
this.senderMustBePlayer = true;
this.senderMustBeMember = false;
this.senderMustBeModerator = false;
this.senderMustBeColeader = false;
this.senderMustBeAdmin = false;
this.senderMustBePlayer = true;
this.senderMustBeMember = false;
this.senderMustBeModerator = false;
this.senderMustBeColeader = false;
this.senderMustBeAdmin = false;
}
}
public void perform() {
public void perform() {
Faction faction = fme.getFaction();
if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) {
fme.setStealth(!fme.isStealthEnabled());
fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
} else {
fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER);
}
}
Faction faction = fme.getFaction();
if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) {
fme.setStealth(!fme.isStealthEnabled());
fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
} else {
fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER);
}
}
public TL getUsageTranslation() {
return TL.COMMAND_STEALTH_DESCRIPTION;
}
public TL getUsageTranslation() {
return TL.COMMAND_STEALTH_DESCRIPTION;
}
}

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.*;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.zcore.util.TL;
public class CmdStrike extends FCommand {

View File

@ -14,98 +14,98 @@ import org.bukkit.scheduler.BukkitRunnable;
public class CmdStuck extends FCommand {
public CmdStuck() {
super();
public CmdStuck() {
super();
this.aliases.add("stuck");
this.aliases.add("halp!"); // halp!c:
this.aliases.add("stuck");
this.aliases.add("halp!"); // halp!c:
this.permission = Permission.STUCK.node;
this.disableOnLock = true;
this.permission = Permission.STUCK.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
final Player player = fme.getPlayer();
final Location sentAt = player.getLocation();
final FLocation chunk = fme.getLastStoodAt();
final long delay = P.p.getConfig().getLong("hcf.stuck.delay", 30);
final int radius = P.p.getConfig().getInt("hcf.stuck.radius", 10);
@Override
public void perform() {
final Player player = fme.getPlayer();
final Location sentAt = player.getLocation();
final FLocation chunk = fme.getLastStoodAt();
final long delay = P.p.getConfig().getLong("hcf.stuck.delay", 30);
final int radius = P.p.getConfig().getInt("hcf.stuck.radius", 10);
if (P.p.getStuckMap().containsKey(player.getUniqueId())) {
long wait = P.p.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
msg(TL.COMMAND_STUCK_EXISTS, time);
} else {
if (P.p.getStuckMap().containsKey(player.getUniqueId())) {
long wait = P.p.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
msg(TL.COMMAND_STUCK_EXISTS, time);
} else {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) {
return;
}
final int id = Bukkit.getScheduler().runTaskLater(P.p, new BukkitRunnable() {
final int id = Bukkit.getScheduler().runTaskLater(P.p, new BukkitRunnable() {
@Override
public void run() {
if (!P.p.getStuckMap().containsKey(player.getUniqueId())) {
return;
}
@Override
public void run() {
if (!P.p.getStuckMap().containsKey(player.getUniqueId())) {
return;
}
// check for world difference or radius exceeding
final World world = chunk.getWorld();
if (world.getUID() != player.getWorld().getUID() || sentAt.distance(player.getLocation()) > radius) {
msg(TL.COMMAND_STUCK_OUTSIDE.format(radius));
P.p.getTimers().remove(player.getUniqueId());
P.p.getStuckMap().remove(player.getUniqueId());
return;
}
// check for world difference or radius exceeding
final World world = chunk.getWorld();
if (world.getUID() != player.getWorld().getUID() || sentAt.distance(player.getLocation()) > radius) {
msg(TL.COMMAND_STUCK_OUTSIDE.format(radius));
P.p.getTimers().remove(player.getUniqueId());
P.p.getStuckMap().remove(player.getUniqueId());
return;
}
final Board board = Board.getInstance();
// spiral task to find nearest wilderness chunk
new SpiralTask(new FLocation(me), radius * 2) {
final Board board = Board.getInstance();
// spiral task to find nearest wilderness chunk
new SpiralTask(new FLocation(me), radius * 2) {
@Override
public boolean work() {
FLocation chunk = currentFLocation();
Faction faction = board.getFactionAt(chunk);
int buffer = P.p.getConfig().getInt("world-border.buffer", 0);
if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) {
int cx = FLocation.chunkToBlock((int) chunk.getX());
int cz = FLocation.chunkToBlock((int) chunk.getZ());
int y = world.getHighestBlockYAt(cx, cz);
Location tp = new Location(world, cx, y, cz);
msg(TL.COMMAND_STUCK_TELEPORT, tp.getBlockX(), tp.getBlockY(), tp.getBlockZ());
P.p.getTimers().remove(player.getUniqueId());
P.p.getStuckMap().remove(player.getUniqueId());
if (!Essentials.handleTeleport(player, tp)) {
player.teleport(tp);
P.p.debug("/f stuck used regular teleport, not essentials!");
}
this.stop();
return false;
}
return true;
}
};
}
}, delay * 20).getTaskId();
@Override
public boolean work() {
FLocation chunk = currentFLocation();
Faction faction = board.getFactionAt(chunk);
int buffer = P.p.getConfig().getInt("world-border.buffer", 0);
if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) {
int cx = FLocation.chunkToBlock((int) chunk.getX());
int cz = FLocation.chunkToBlock((int) chunk.getZ());
int y = world.getHighestBlockYAt(cx, cz);
Location tp = new Location(world, cx, y, cz);
msg(TL.COMMAND_STUCK_TELEPORT, tp.getBlockX(), tp.getBlockY(), tp.getBlockZ());
P.p.getTimers().remove(player.getUniqueId());
P.p.getStuckMap().remove(player.getUniqueId());
if (!Essentials.handleTeleport(player, tp)) {
player.teleport(tp);
P.p.debug("/f stuck used regular teleport, not essentials!");
}
this.stop();
return false;
}
return true;
}
};
}
}, delay * 20).getTaskId();
P.p.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000));
long wait = P.p.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
msg(TL.COMMAND_STUCK_START, time);
P.p.getStuckMap().put(player.getUniqueId(), id);
}
}
P.p.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000));
long wait = P.p.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
msg(TL.COMMAND_STUCK_START, time);
P.p.getStuckMap().put(player.getUniqueId(), id);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_STUCK_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_STUCK_DESCRIPTION;
}
}

View File

@ -12,87 +12,87 @@ import java.util.ArrayList;
public class CmdTag extends FCommand {
public CmdTag() {
this.aliases.add("tag");
this.aliases.add("rename");
public CmdTag() {
this.aliases.add("tag");
this.aliases.add("rename");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
this.permission = Permission.TAG.node;
this.disableOnLock = true;
this.disableOnSpam = true;
this.permission = Permission.TAG.node;
this.disableOnLock = true;
this.disableOnSpam = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
String tag = this.argAsString(0);
@Override
public void perform() {
String tag = this.argAsString(0);
if (!fme.isCooldownEnded("tag")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("tag"));
return;
}
if (!fme.isCooldownEnded("tag")) {
fme.msg(TL.COMMAND_ONCOOOLDOWN, fme.getCooldown("tag"));
return;
}
// TODO does not first test cover selfcase?
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) {
msg(TL.COMMAND_TAG_TAKEN);
return;
}
// TODO does not first test cover selfcase?
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) {
msg(TL.COMMAND_TAG_TAKEN);
return;
}
ArrayList<String> errors = MiscUtil.validateTag(tag);
if (errors.size() > 0) {
sendMessage(errors);
return;
}
ArrayList<String> errors = MiscUtil.validateTag(tag);
if (errors.size() > 0) {
sendMessage(errors);
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
return;
}
// trigger the faction rename event (cancellable)
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
if (renameEvent.isCancelled()) {
return;
}
// trigger the faction rename event (cancellable)
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
if (renameEvent.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
return;
}
String oldtag = myFaction.getTag();
myFaction.setTag(tag);
String oldtag = myFaction.getTag();
myFaction.setTag(tag);
// Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg(TL.COMMAND_TAG_FACTION, fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
continue;
}
// Inform
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (fplayer.getFactionId().equals(myFaction.getId())) {
fplayer.msg(TL.COMMAND_TAG_FACTION, fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
continue;
}
// Broadcast the tag change (if applicable)
if (Conf.broadcastTagChanges) {
Faction faction = fplayer.getFaction();
fplayer.msg(TL.COMMAND_TAG_CHANGED, fme.getColorTo(faction) + oldtag, myFaction.getTag(faction));
}
}
fme.setCooldown("tag", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-tag") * 1000));
FTeamWrapper.updatePrefixes(myFaction);
}
// Broadcast the tag change (if applicable)
if (Conf.broadcastTagChanges) {
Faction faction = fplayer.getFaction();
fplayer.msg(TL.COMMAND_TAG_CHANGED, fme.getColorTo(faction) + oldtag, myFaction.getTag(faction));
}
}
fme.setCooldown("tag", System.currentTimeMillis() + (P.p.getConfig().getInt("fcooldowns.f-tag") * 1000));
FTeamWrapper.updatePrefixes(myFaction);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TAG_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TAG_DESCRIPTION;
}
}

View File

@ -8,52 +8,52 @@ import com.massivecraft.factions.zcore.util.TextUtil;
public class CmdTitle extends FCommand {
public CmdTitle() {
this.aliases.add("title");
public CmdTitle() {
this.aliases.add("title");
this.requiredArgs.add("player name");
this.optionalArgs.put("title", "");
this.requiredArgs.add("player name");
this.optionalArgs.put("title", "");
this.permission = Permission.TITLE.node;
this.disableOnLock = true;
this.permission = Permission.TITLE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
return;
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
return;
}
args.remove(0);
String title = TextUtil.implode(args, " ");
title = title.replaceAll(",", "");
args.remove(0);
String title = TextUtil.implode(args, " ");
title = title.replaceAll(",", "");
if (!canIAdministerYou(fme, you)) {
return;
}
if (!canIAdministerYou(fme, you)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) {
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) {
return;
}
you.setTitle(sender, title);
you.setTitle(sender, title);
// Inform
myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true));
}
// Inform
myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TITLE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TITLE_DESCRIPTION;
}
}

View File

@ -6,39 +6,39 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdToggleAllianceChat extends FCommand {
public CmdToggleAllianceChat() {
super();
this.aliases.add("tac");
this.aliases.add("togglealliancechat");
this.aliases.add("ac");
public CmdToggleAllianceChat() {
super();
this.aliases.add("tac");
this.aliases.add("togglealliancechat");
this.aliases.add("ac");
this.disableOnLock = false;
this.disableOnLock = false;
this.permission = Permission.TOGGLE_ALLIANCE_CHAT.node;
this.disableOnLock = false;
this.permission = Permission.TOGGLE_ALLIANCE_CHAT.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TOGGLEALLIANCECHAT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TOGGLEALLIANCECHAT_DESCRIPTION;
}
@Override
public void perform() {
if (!Conf.factionOnlyChat) {
msg(TL.COMMAND_CHAT_DISABLED.toString());
return;
}
@Override
public void perform() {
if (!Conf.factionOnlyChat) {
msg(TL.COMMAND_CHAT_DISABLED.toString());
return;
}
boolean ignoring = fme.isIgnoreAllianceChat();
boolean ignoring = fme.isIgnoreAllianceChat();
msg(ignoring ? TL.COMMAND_TOGGLEALLIANCECHAT_UNIGNORE : TL.COMMAND_TOGGLEALLIANCECHAT_IGNORE);
fme.setIgnoreAllianceChat(!ignoring);
}
msg(ignoring ? TL.COMMAND_TOGGLEALLIANCECHAT_UNIGNORE : TL.COMMAND_TOGGLEALLIANCECHAT_IGNORE);
fme.setIgnoreAllianceChat(!ignoring);
}
}

View File

@ -12,168 +12,168 @@ import java.util.ArrayList;
public class CmdTop extends FCommand {
public CmdTop() {
super();
this.aliases.add("top");
this.aliases.add("t");
public CmdTop() {
super();
this.aliases.add("top");
this.aliases.add("t");
//this.requiredArgs.add("");
this.requiredArgs.add("criteria");
this.optionalArgs.put("page", "1");
//this.requiredArgs.add("");
this.requiredArgs.add("criteria");
this.optionalArgs.put("page", "1");
this.permission = Permission.TOP.node;
this.disableOnLock = false;
this.permission = Permission.TOP.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
// Can sort by: money, members, online, allies, enemies, power, land.
// Get all Factions and remove non player ones.
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
factionList.remove(Factions.getInstance().getWilderness());
factionList.remove(Factions.getInstance().getSafeZone());
factionList.remove(Factions.getInstance().getWarZone());
@Override
public void perform() {
// Can sort by: money, members, online, allies, enemies, power, land.
// Get all Factions and remove non player ones.
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
factionList.remove(Factions.getInstance().getWilderness());
factionList.remove(Factions.getInstance().getSafeZone());
factionList.remove(Factions.getInstance().getWarZone());
String criteria = argAsString(0);
String criteria = argAsString(0);
// TODO: Better way to sort?
if (criteria.equalsIgnoreCase("members")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayers().size();
int f2Size = f2.getFPlayers().size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("start")) {
factionList.sort((f1, f2) -> {
long f1start = f1.getFoundedDate();
long f2start = f2.getFoundedDate();
// flip signs because a smaller date is farther in the past
if (f1start > f2start) {
return 1;
} else if (f1start < f2start) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("power")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getPowerRounded();
int f2Size = f2.getPowerRounded();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("land")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getLandRounded();
int f2Size = f2.getLandRounded();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("online")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayersWhereOnline(true).size();
int f2Size = f2.getFPlayersWhereOnline(true).size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("money") || criteria.equalsIgnoreCase("balance") || criteria.equalsIgnoreCase("bal")) {
factionList.sort((f1, f2) -> {
double f1Size = Econ.getBalance(f1.getAccountId());
// Lets get the balance of /all/ the players in the Faction.
for (FPlayer fp : f1.getFPlayers()) {
f1Size = f1Size + Econ.getBalance(fp.getAccountId());
}
double f2Size = Econ.getBalance(f2.getAccountId());
for (FPlayer fp : f2.getFPlayers()) {
f2Size = f2Size + Econ.getBalance(fp.getAccountId());
}
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else {
msg(TL.COMMAND_TOP_INVALID, criteria);
return;
}
// TODO: Better way to sort?
if (criteria.equalsIgnoreCase("members")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayers().size();
int f2Size = f2.getFPlayers().size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("start")) {
factionList.sort((f1, f2) -> {
long f1start = f1.getFoundedDate();
long f2start = f2.getFoundedDate();
// flip signs because a smaller date is farther in the past
if (f1start > f2start) {
return 1;
} else if (f1start < f2start) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("power")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getPowerRounded();
int f2Size = f2.getPowerRounded();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("land")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getLandRounded();
int f2Size = f2.getLandRounded();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("online")) {
factionList.sort((f1, f2) -> {
int f1Size = f1.getFPlayersWhereOnline(true).size();
int f2Size = f2.getFPlayersWhereOnline(true).size();
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else if (criteria.equalsIgnoreCase("money") || criteria.equalsIgnoreCase("balance") || criteria.equalsIgnoreCase("bal")) {
factionList.sort((f1, f2) -> {
double f1Size = Econ.getBalance(f1.getAccountId());
// Lets get the balance of /all/ the players in the Faction.
for (FPlayer fp : f1.getFPlayers()) {
f1Size = f1Size + Econ.getBalance(fp.getAccountId());
}
double f2Size = Econ.getBalance(f2.getAccountId());
for (FPlayer fp : f2.getFPlayers()) {
f2Size = f2Size + Econ.getBalance(fp.getAccountId());
}
if (f1Size < f2Size) {
return 1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
});
} else {
msg(TL.COMMAND_TOP_INVALID, criteria);
return;
}
ArrayList<String> lines = new ArrayList<>();
ArrayList<String> lines = new ArrayList<>();
final int pageheight = 9;
int pagenumber = this.argAsInt(1, 1);
int pagecount = (factionList.size() / pageheight) + 1;
if (pagenumber > pagecount) {
pagenumber = pagecount;
} else if (pagenumber < 1) {
pagenumber = 1;
}
int start = (pagenumber - 1) * pageheight;
int end = start + pageheight;
if (end > factionList.size()) {
end = factionList.size();
}
final int pageheight = 9;
int pagenumber = this.argAsInt(1, 1);
int pagecount = (factionList.size() / pageheight) + 1;
if (pagenumber > pagecount) {
pagenumber = pagecount;
} else if (pagenumber < 1) {
pagenumber = 1;
}
int start = (pagenumber - 1) * pageheight;
int end = start + pageheight;
if (end > factionList.size()) {
end = factionList.size();
}
lines.add(TL.COMMAND_TOP_TOP.format(criteria.toUpperCase(), pagenumber, pagecount));
lines.add(TL.COMMAND_TOP_TOP.format(criteria.toUpperCase(), pagenumber, pagecount));
int rank = 1;
for (Faction faction : factionList.subList(start, end)) {
// Get the relation color if player is executing this.
String fac = sender instanceof Player ? faction.getRelationTo(fme).getColor() + faction.getTag() : faction.getTag();
lines.add(TL.COMMAND_TOP_LINE.format(rank, fac, getValue(faction, criteria)));
rank++;
}
int rank = 1;
for (Faction faction : factionList.subList(start, end)) {
// Get the relation color if player is executing this.
String fac = sender instanceof Player ? faction.getRelationTo(fme).getColor() + faction.getTag() : faction.getTag();
lines.add(TL.COMMAND_TOP_LINE.format(rank, fac, getValue(faction, criteria)));
rank++;
}
sendMessage(lines);
}
sendMessage(lines);
}
private String getValue(Faction faction, String criteria) {
if (criteria.equalsIgnoreCase("online")) {
return String.valueOf(faction.getFPlayersWhereOnline(true).size());
} else if (criteria.equalsIgnoreCase("start")) {
return TL.sdf.format(faction.getFoundedDate());
} else if (criteria.equalsIgnoreCase("members")) {
return String.valueOf(faction.getFPlayers().size());
} else if (criteria.equalsIgnoreCase("land")) {
return String.valueOf(faction.getLandRounded());
} else if (criteria.equalsIgnoreCase("power")) {
return String.valueOf(faction.getPowerRounded());
} else { // Last one is balance, and it has 3 different things it could be.
double balance = Econ.getBalance(faction.getAccountId());
for (FPlayer fp : faction.getFPlayers()) {
balance = Math.round(balance + Econ.getBalance(fp.getAccountId()));
}
return String.valueOf(balance);
}
}
private String getValue(Faction faction, String criteria) {
if (criteria.equalsIgnoreCase("online")) {
return String.valueOf(faction.getFPlayersWhereOnline(true).size());
} else if (criteria.equalsIgnoreCase("start")) {
return TL.sdf.format(faction.getFoundedDate());
} else if (criteria.equalsIgnoreCase("members")) {
return String.valueOf(faction.getFPlayers().size());
} else if (criteria.equalsIgnoreCase("land")) {
return String.valueOf(faction.getLandRounded());
} else if (criteria.equalsIgnoreCase("power")) {
return String.valueOf(faction.getPowerRounded());
} else { // Last one is balance, and it has 3 different things it could be.
double balance = Econ.getBalance(faction.getAccountId());
for (FPlayer fp : faction.getFPlayers()) {
balance = Math.round(balance + Econ.getBalance(fp.getAccountId()));
}
return String.valueOf(balance);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TOP_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TOP_DESCRIPTION;
}
}

View File

@ -7,39 +7,39 @@ import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.util.TL;
public class CmdTpBanner extends FCommand {
public CmdTpBanner() {
super();
public CmdTpBanner() {
super();
this.aliases.add("tpbanner");
this.aliases.add("tpbanner");
this.permission = Permission.TPBANNER.node;
this.disableOnLock = true;
this.permission = Permission.TPBANNER.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fbanners.Enabled")) {
return;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fbanners.Enabled")) {
return;
}
if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) {
fme.msg(TL.COMMAND_TPBANNER_SUCCESS);
this.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", () -> me.teleport(FactionsBlockListener.bannerLocations.get(fme.getTag())), this.p.getConfig().getLong("warmups.f-banner", 0));
} else {
fme.msg(TL.COMMAND_TPBANNER_NOTSET);
}
if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) {
fme.msg(TL.COMMAND_TPBANNER_SUCCESS);
this.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", () -> me.teleport(FactionsBlockListener.bannerLocations.get(fme.getTag())), this.p.getConfig().getLong("warmups.f-banner", 0));
} else {
fme.msg(TL.COMMAND_TPBANNER_NOTSET);
}
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TPBANNER_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TPBANNER_DESCRIPTION;
}
}

View File

@ -9,51 +9,51 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdUnban extends FCommand {
public CmdUnban() {
super();
this.aliases.add("unban");
public CmdUnban() {
super();
this.aliases.add("unban");
this.requiredArgs.add("target");
this.requiredArgs.add("target");
this.permission = Permission.BAN.node;
this.disableOnLock = true;
this.permission = Permission.BAN.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER && !Permission.BAN.has(sender, true)) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans");
return;
}
}
@Override
public void perform() {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER && !Permission.BAN.has(sender, true)) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans");
return;
}
}
// Good on permission checks. Now lets just ban the player.
FPlayer target = argAsFPlayer(0);
if (target == null) {
return; // the above method sends a message if fails to find someone.
}
// Good on permission checks. Now lets just ban the player.
FPlayer target = argAsFPlayer(0);
if (target == null) {
return; // the above method sends a message if fails to find someone.
}
if (!myFaction.isBanned(target)) {
fme.msg(TL.COMMAND_UNBAN_NOTBANNED, target.getName());
return;
}
if (!myFaction.isBanned(target)) {
fme.msg(TL.COMMAND_UNBAN_NOTBANNED, target.getName());
return;
}
myFaction.unban(target);
myFaction.unban(target);
myFaction.msg(TL.COMMAND_UNBAN_UNBANNED, fme.getName(), target.getName());
target.msg(TL.COMMAND_UNBAN_TARGET, myFaction.getTag(target));
}
myFaction.msg(TL.COMMAND_UNBAN_UNBANNED, fme.getName(), target.getName());
target.msg(TL.COMMAND_UNBAN_TARGET, myFaction.getTag(target));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_UNBAN_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_UNBAN_DESCRIPTION;
}
}

View File

@ -6,36 +6,36 @@ import com.massivecraft.factions.zcore.fupgrades.FUpgradesGUI;
import com.massivecraft.factions.zcore.util.TL;
public class CmdUpgrades extends FCommand {
public CmdUpgrades() {
super();
this.aliases.add("upgrades");
this.aliases.add("upgrade");
public CmdUpgrades() {
super();
this.aliases.add("upgrades");
this.aliases.add("upgrade");
//this.requiredArgs.add("");
this.optionalArgs.put("mobs/crops/exp/power", "");
//this.requiredArgs.add("");
this.optionalArgs.put("mobs/crops/exp/power", "");
this.permission = Permission.UPGRADES.node;
this.disableOnLock = true;
this.permission = Permission.UPGRADES.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fupgrades.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
new FUpgradesGUI().openMainMenu(fme);
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fupgrades.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
new FUpgradesGUI().openMainMenu(fme);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_UPGRADES_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_UPGRADES_DESCRIPTION;
}
}

View File

@ -14,66 +14,66 @@ import org.bukkit.inventory.Inventory;
public class CmdVault extends FCommand {
public CmdVault() {
this.aliases.add("vault");
public CmdVault() {
this.aliases.add("vault");
//this.requiredArgs.add("");
//this.requiredArgs.add("");
this.permission = Permission.VAULT.node;
this.disableOnLock = false;
this.permission = Permission.VAULT.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fvault.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
Access access = fme.getFaction().getAccess(fme, PermissableAction.VAULT);
if (access.equals(Access.DENY)) {
fme.msg(TL.GENERIC_NOPERMISSION, "vault");
return;
}
if (!P.p.getConfig().getBoolean("fvault.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
Access access = fme.getFaction().getAccess(fme, PermissableAction.VAULT);
if (access.equals(Access.DENY)) {
fme.msg(TL.GENERIC_NOPERMISSION, "vault");
return;
}
if (fme.isInVault()) {
me.closeInventory();
return;
}
fme.setInVault(true);
Location vaultLocation = fme.getFaction().getVault();
if (vaultLocation == null) {
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
FLocation vaultFLocation = new FLocation(vaultLocation);
if (Board.getInstance().getFactionAt(vaultFLocation) != fme.getFaction()) {
fme.getFaction().setVault(null);
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
if (vaultLocation.getBlock().getType() != Material.CHEST) {
fme.getFaction().setVault(null);
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
Chest chest = (Chest) vaultLocation.getBlock().getState();
Inventory chestInv = chest.getBlockInventory();
fme.msg(TL.COMMAND_VAULT_OPENING);
me.openInventory(chestInv);
if (fme.isInVault()) {
me.closeInventory();
return;
}
fme.setInVault(true);
Location vaultLocation = fme.getFaction().getVault();
if (vaultLocation == null) {
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
FLocation vaultFLocation = new FLocation(vaultLocation);
if (Board.getInstance().getFactionAt(vaultFLocation) != fme.getFaction()) {
fme.getFaction().setVault(null);
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
if (vaultLocation.getBlock().getType() != Material.CHEST) {
fme.getFaction().setVault(null);
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
Chest chest = (Chest) vaultLocation.getBlock().getState();
Inventory chestInv = chest.getBlockInventory();
fme.msg(TL.COMMAND_VAULT_OPENING);
me.openInventory(chestInv);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
}

View File

@ -7,30 +7,30 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdVersion extends FCommand {
public CmdVersion() {
this.aliases.add("version");
this.aliases.add("ver");
public CmdVersion() {
this.aliases.add("version");
this.aliases.add("ver");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
this.permission = Permission.VERSION.node;
this.disableOnLock = false;
this.permission = Permission.VERSION.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
msg(TL.COMMAND_VERSION_NAME); // Did this so people can differentiate between P and FactionsUUID (( Requested Feature ))
msg(TL.COMMAND_VERSION_VERSION, P.p.getDescription().getFullName());
}
@Override
public void perform() {
msg(TL.COMMAND_VERSION_NAME); // Did this so people can differentiate between P and FactionsUUID (( Requested Feature ))
msg(TL.COMMAND_VERSION_VERSION, P.p.getDescription().getFullName());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VERSION_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VERSION_DESCRIPTION;
}
}

View File

@ -27,294 +27,299 @@ import java.util.logging.Level;
public class FCmdRoot extends FCommand {
public CmdAdmin cmdAdmin = new CmdAdmin();
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
public CmdBoom cmdBoom = new CmdBoom();
public CmdBypass cmdBypass = new CmdBypass();
public CmdChat cmdChat = new CmdChat();
public CmdChatSpy cmdChatSpy = new CmdChatSpy();
public CmdClaim cmdClaim = new CmdClaim();
public CmdConfig cmdConfig = new CmdConfig();
public CmdCreate cmdCreate = new CmdCreate();
public CmdDeinvite cmdDeinvite = new CmdDeinvite();
public CmdDescription cmdDescription = new CmdDescription();
public CmdDisband cmdDisband = new CmdDisband();
public CmdFocus cmdFocus = new CmdFocus();
public CmdGrace cmdGrace = new CmdGrace();
public CmdHelp cmdHelp = new CmdHelp();
public CmdHome cmdHome = new CmdHome();
public CmdInvite cmdInvite = new CmdInvite();
public CmdJoin cmdJoin = new CmdJoin();
public CmdKick cmdKick = new CmdKick();
public CmdLeave cmdLeave = new CmdLeave();
public CmdList cmdList = new CmdList();
public CmdLock cmdLock = new CmdLock();
public CmdMap cmdMap = new CmdMap();
public CmdMod cmdMod = new CmdMod();
public CmdMoney cmdMoney = new CmdMoney();
public CmdOpen cmdOpen = new CmdOpen();
public CmdOwner cmdOwner = new CmdOwner();
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
public CmdPeaceful cmdPeaceful = new CmdPeaceful();
public CmdPermanent cmdPermanent = new CmdPermanent();
public CmdPermanentPower cmdPermanentPower = new CmdPermanentPower();
public CmdPowerBoost cmdPowerBoost = new CmdPowerBoost();
public CmdPower cmdPower = new CmdPower();
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
public CmdRelationNeutral cmdRelationNeutral = new CmdRelationNeutral();
public CmdRelationTruce cmdRelationTruce = new CmdRelationTruce();
public CmdReload cmdReload = new CmdReload();
public CmdSafeunclaimall cmdSafeunclaimall = new CmdSafeunclaimall();
public CmdSaveAll cmdSaveAll = new CmdSaveAll();
public CmdSethome cmdSethome = new CmdSethome();
public CmdShow cmdShow = new CmdShow();
public CmdStatus cmdStatus = new CmdStatus();
public CmdStealth cmdStealth = new CmdStealth();
public CmdStuck cmdStuck = new CmdStuck();
public CmdTag cmdTag = new CmdTag();
public CmdTitle cmdTitle = new CmdTitle();
public CmdToggleAllianceChat cmdToggleAllianceChat = new CmdToggleAllianceChat();
public CmdUnclaim cmdUnclaim = new CmdUnclaim();
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
public CmdVersion cmdVersion = new CmdVersion();
public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall();
public CmdSB cmdSB = new CmdSB();
public CmdShowInvites cmdShowInvites = new CmdShowInvites();
public CmdAnnounce cmdAnnounce = new CmdAnnounce();
public CmdPaypalSet cmdPaypalSet = new CmdPaypalSet();
public CmdPaypalSee cmdPaypalSee = new CmdPaypalSee();
public CmdSeeChunk cmdSeeChunk = new CmdSeeChunk();
public CmdConvert cmdConvert = new CmdConvert();
public CmdFWarp cmdFWarp = new CmdFWarp();
public CmdSetFWarp cmdSetFWarp = new CmdSetFWarp();
public CmdDelFWarp cmdDelFWarp = new CmdDelFWarp();
public CmdModifyPower cmdModifyPower = new CmdModifyPower();
public CmdLogins cmdLogins = new CmdLogins();
public CmdClaimLine cmdClaimLine = new CmdClaimLine();
public CmdTop cmdTop = new CmdTop();
public CmdAHome cmdAHome = new CmdAHome();
public CmdPerm cmdPerm = new CmdPerm();
public CmdPromote cmdPromote = new CmdPromote();
public CmdDemote cmdDemote = new CmdDemote();
public CmdSetDefaultRole cmdSetDefaultRole = new CmdSetDefaultRole();
public CmdMapHeight cmdMapHeight = new CmdMapHeight();
public CmdClaimAt cmdClaimAt = new CmdClaimAt();
public CmdBan cmdban = new CmdBan();
public CmdUnban cmdUnban = new CmdUnban();
public CmdBanlist cmdbanlist = new CmdBanlist();
public CmdRules cmdRules = new CmdRules();
public CmdCheckpoint cmdCheckpoint = new CmdCheckpoint();
public CmdTnt cmdTnt = new CmdTnt();
public CmdNear cmdNear = new CmdNear();
public CmdUpgrades cmdUpgrades = new CmdUpgrades();
public CmdVault cmdVault = new CmdVault();
public CmdGetVault cmdGetVault = new CmdGetVault();
public CmdFly cmdFly = new CmdFly();
public CmdColeader cmdColeader = new CmdColeader();
public CmdBanner cmdBanner = new CmdBanner();
public CmdTpBanner cmdTpBanner = new CmdTpBanner();
public CmdKillHolograms cmdKillHolograms = new CmdKillHolograms();
public CmdInspect cmdInspect = new CmdInspect();
public CmdCoords cmdCoords = new CmdCoords();
public CmdShowClaims cmdShowClaims = new CmdShowClaims();
public CmdLowPower cmdLowPower = new CmdLowPower();
public CmdTntFill cmdTntFill = new CmdTntFill();
public CmdChest cmdChest = new CmdChest();
public CmdSetBanner cmdSetBanner = new CmdSetBanner();
public CmdStrike cmdStrike = new CmdStrike();
public CmdStrikeSet cmdStrikeSet = new CmdStrikeSet();
public CmdAlts cmdAlts = new CmdAlts();
public CmdSpam cmdSpam = new CmdSpam();
public CmdCorner cmdCorner = new CmdCorner();
public CmdInventorySee cmdInventorySee = new CmdInventorySee();
public CmdFGlobal cmdFGlobal = new CmdFGlobal();
public CmdViewChest cmdViewChest = new CmdViewChest();
public CmdPoints cmdPoints = new CmdPoints();
public CmdLogout cmdLogout = new CmdLogout();
public CmdNotifications cmdNotifications = new CmdNotifications();
public CmdShop cmdShop = new CmdShop();
public CmdMissions cmdMissions = new CmdMissions();
public CmdAdmin cmdAdmin = new CmdAdmin();
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
public CmdBoom cmdBoom = new CmdBoom();
public CmdBypass cmdBypass = new CmdBypass();
public CmdChat cmdChat = new CmdChat();
public CmdChatSpy cmdChatSpy = new CmdChatSpy();
public CmdClaim cmdClaim = new CmdClaim();
public CmdConfig cmdConfig = new CmdConfig();
public CmdCreate cmdCreate = new CmdCreate();
public CmdDeinvite cmdDeinvite = new CmdDeinvite();
public CmdDescription cmdDescription = new CmdDescription();
public CmdDisband cmdDisband = new CmdDisband();
public CmdFocus cmdFocus = new CmdFocus();
public CmdGrace cmdGrace = new CmdGrace();
public CmdHelp cmdHelp = new CmdHelp();
public CmdHome cmdHome = new CmdHome();
public CmdInvite cmdInvite = new CmdInvite();
public CmdJoin cmdJoin = new CmdJoin();
public CmdKick cmdKick = new CmdKick();
public CmdLeave cmdLeave = new CmdLeave();
public CmdList cmdList = new CmdList();
public CmdLock cmdLock = new CmdLock();
public CmdMap cmdMap = new CmdMap();
public CmdMod cmdMod = new CmdMod();
public CmdMoney cmdMoney = new CmdMoney();
public CmdOpen cmdOpen = new CmdOpen();
public CmdOwner cmdOwner = new CmdOwner();
public CmdOwnerList cmdOwnerList = new CmdOwnerList();
public CmdPeaceful cmdPeaceful = new CmdPeaceful();
public CmdPermanent cmdPermanent = new CmdPermanent();
public CmdPermanentPower cmdPermanentPower = new CmdPermanentPower();
public CmdPowerBoost cmdPowerBoost = new CmdPowerBoost();
public CmdPower cmdPower = new CmdPower();
public CmdRelationAlly cmdRelationAlly = new CmdRelationAlly();
public CmdRelationEnemy cmdRelationEnemy = new CmdRelationEnemy();
public CmdRelationNeutral cmdRelationNeutral = new CmdRelationNeutral();
public CmdRelationTruce cmdRelationTruce = new CmdRelationTruce();
public CmdReload cmdReload = new CmdReload();
public CmdSafeunclaimall cmdSafeunclaimall = new CmdSafeunclaimall();
public CmdSaveAll cmdSaveAll = new CmdSaveAll();
public CmdSethome cmdSethome = new CmdSethome();
public CmdShow cmdShow = new CmdShow();
public CmdStatus cmdStatus = new CmdStatus();
public CmdStealth cmdStealth = new CmdStealth();
public CmdStuck cmdStuck = new CmdStuck();
public CmdTag cmdTag = new CmdTag();
public CmdTitle cmdTitle = new CmdTitle();
public CmdToggleAllianceChat cmdToggleAllianceChat = new CmdToggleAllianceChat();
public CmdUnclaim cmdUnclaim = new CmdUnclaim();
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
public CmdVersion cmdVersion = new CmdVersion();
public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall();
public CmdSB cmdSB = new CmdSB();
public CmdShowInvites cmdShowInvites = new CmdShowInvites();
public CmdAnnounce cmdAnnounce = new CmdAnnounce();
public CmdPaypalSet cmdPaypalSet = new CmdPaypalSet();
public CmdPaypalSee cmdPaypalSee = new CmdPaypalSee();
public CmdSeeChunk cmdSeeChunk = new CmdSeeChunk();
public CmdConvert cmdConvert = new CmdConvert();
public CmdFWarp cmdFWarp = new CmdFWarp();
public CmdSetFWarp cmdSetFWarp = new CmdSetFWarp();
public CmdDelFWarp cmdDelFWarp = new CmdDelFWarp();
public CmdModifyPower cmdModifyPower = new CmdModifyPower();
public CmdLogins cmdLogins = new CmdLogins();
public CmdClaimLine cmdClaimLine = new CmdClaimLine();
public CmdTop cmdTop = new CmdTop();
public CmdAHome cmdAHome = new CmdAHome();
public CmdPerm cmdPerm = new CmdPerm();
public CmdPromote cmdPromote = new CmdPromote();
public CmdDemote cmdDemote = new CmdDemote();
public CmdSetDefaultRole cmdSetDefaultRole = new CmdSetDefaultRole();
public CmdMapHeight cmdMapHeight = new CmdMapHeight();
public CmdClaimAt cmdClaimAt = new CmdClaimAt();
public CmdBan cmdban = new CmdBan();
public CmdUnban cmdUnban = new CmdUnban();
public CmdBanlist cmdbanlist = new CmdBanlist();
public CmdRules cmdRules = new CmdRules();
public CmdCheckpoint cmdCheckpoint = new CmdCheckpoint();
public CmdTnt cmdTnt = new CmdTnt();
public CmdNear cmdNear = new CmdNear();
public CmdUpgrades cmdUpgrades = new CmdUpgrades();
public CmdVault cmdVault = new CmdVault();
public CmdGetVault cmdGetVault = new CmdGetVault();
public CmdFly cmdFly = new CmdFly();
public CmdColeader cmdColeader = new CmdColeader();
public CmdBanner cmdBanner = new CmdBanner();
public CmdTpBanner cmdTpBanner = new CmdTpBanner();
public CmdKillHolograms cmdKillHolograms = new CmdKillHolograms();
public CmdInspect cmdInspect = new CmdInspect();
public CmdCoords cmdCoords = new CmdCoords();
public CmdShowClaims cmdShowClaims = new CmdShowClaims();
public CmdLowPower cmdLowPower = new CmdLowPower();
public CmdTntFill cmdTntFill = new CmdTntFill();
public CmdChest cmdChest = new CmdChest();
public CmdSetBanner cmdSetBanner = new CmdSetBanner();
public CmdStrike cmdStrike = new CmdStrike();
public CmdStrikeSet cmdStrikeSet = new CmdStrikeSet();
public CmdAlts cmdAlts = new CmdAlts();
public CmdSpam cmdSpam = new CmdSpam();
public CmdCorner cmdCorner = new CmdCorner();
public CmdInventorySee cmdInventorySee = new CmdInventorySee();
public CmdFGlobal cmdFGlobal = new CmdFGlobal();
public CmdViewChest cmdViewChest = new CmdViewChest();
public CmdPoints cmdPoints = new CmdPoints();
public CmdLogout cmdLogout = new CmdLogout();
public CmdNotifications cmdNotifications = new CmdNotifications();
public CmdShop cmdShop = new CmdShop();
public CmdMissions cmdMissions = new CmdMissions();
public CmdCheck cmdCheck = new CmdCheck();
public FCmdRoot() {
super();
this.aliases.addAll(Conf.baseCommandAliases);
this.aliases.removeAll(Collections.<String>singletonList(null)); // remove any nulls from extra commas
this.allowNoSlashAccess = Conf.allowNoSlashCommand;
public FCmdRoot() {
super();
this.aliases.addAll(Conf.baseCommandAliases);
this.aliases.removeAll(Collections.<String>singletonList(null)); // remove any nulls from extra commas
this.allowNoSlashAccess = Conf.allowNoSlashCommand;
//this.requiredArgs.add("");
//this.optionalArgs.put("","")
//this.requiredArgs.add("");
//this.optionalArgs.put("","")
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
this.disableOnLock = false;
this.disableOnLock = false;
this.setHelpShort("The faction base command");
this.helpLong.add(p.txt.parseTags("<i>This command contains all faction stuff."));
this.setHelpShort("The faction base command");
this.helpLong.add(p.txt.parseTags("<i>This command contains all faction stuff."));
//this.subCommands.add(plugin.cmdHelp);
//this.subCommands.add(plugin.cmdHelp);
this.addSubCommand(this.cmdAdmin);
this.addSubCommand(this.cmdAutoClaim);
this.addSubCommand(this.cmdBoom);
this.addSubCommand(this.cmdBypass);
this.addSubCommand(this.cmdChat);
this.addSubCommand(this.cmdToggleAllianceChat);
this.addSubCommand(this.cmdChatSpy);
this.addSubCommand(this.cmdClaim);
this.addSubCommand(this.cmdConfig);
this.addSubCommand(this.cmdCreate);
this.addSubCommand(this.cmdDeinvite);
this.addSubCommand(this.cmdDescription);
this.addSubCommand(this.cmdDisband);
this.addSubCommand(this.cmdStrike);
this.addSubCommand(this.cmdHelp);
this.addSubCommand(this.cmdHome);
this.addSubCommand(this.cmdInvite);
this.addSubCommand(this.cmdJoin);
this.addSubCommand(this.cmdKick);
this.addSubCommand(this.cmdLeave);
this.addSubCommand(this.cmdList);
this.addSubCommand(this.cmdLock);
this.addSubCommand(this.cmdMap);
this.addSubCommand(this.cmdMod);
this.addSubCommand(this.cmdMoney);
this.addSubCommand(this.cmdNotifications);
this.addSubCommand(this.cmdOpen);
this.addSubCommand(this.cmdOwner);
this.addSubCommand(this.cmdOwnerList);
this.addSubCommand(this.cmdPeaceful);
this.addSubCommand(this.cmdPermanent);
this.addSubCommand(this.cmdPermanentPower);
this.addSubCommand(this.cmdPower);
this.addSubCommand(this.cmdPowerBoost);
this.addSubCommand(this.cmdRelationAlly);
this.addSubCommand(this.cmdRelationEnemy);
this.addSubCommand(this.cmdRelationNeutral);
this.addSubCommand(this.cmdRelationTruce);
this.addSubCommand(this.cmdReload);
this.addSubCommand(this.cmdSafeunclaimall);
this.addSubCommand(this.cmdSaveAll);
this.addSubCommand(this.cmdSethome);
this.addSubCommand(this.cmdShow);
this.addSubCommand(this.cmdStatus);
this.addSubCommand(this.cmdStealth);
this.addSubCommand(this.cmdStuck);
this.addSubCommand(this.cmdLogout);
this.addSubCommand(this.cmdTag);
this.addSubCommand(this.cmdTitle);
this.addSubCommand(this.cmdUnclaim);
this.addSubCommand(this.cmdUnclaimall);
this.addSubCommand(this.cmdVersion);
this.addSubCommand(this.cmdWarunclaimall);
this.addSubCommand(this.cmdSB);
this.addSubCommand(this.cmdShowInvites);
this.addSubCommand(this.cmdAnnounce);
this.addSubCommand(this.cmdSeeChunk);
this.addSubCommand(this.cmdConvert);
this.addSubCommand(this.cmdFWarp);
this.addSubCommand(this.cmdSetFWarp);
this.addSubCommand(this.cmdDelFWarp);
this.addSubCommand(this.cmdModifyPower);
this.addSubCommand(this.cmdLogins);
this.addSubCommand(this.cmdClaimLine);
this.addSubCommand(this.cmdAHome);
this.addSubCommand(this.cmdPerm);
this.addSubCommand(this.cmdPromote);
this.addSubCommand(this.cmdDemote);
this.addSubCommand(this.cmdSetDefaultRole);
this.addSubCommand(this.cmdMapHeight);
this.addSubCommand(this.cmdClaimAt);
this.addSubCommand(this.cmdban);
this.addSubCommand(this.cmdUnban);
this.addSubCommand(this.cmdbanlist);
this.addSubCommand(this.cmdRules);
this.addSubCommand(this.cmdCheckpoint);
this.addSubCommand(this.cmdTnt);
this.addSubCommand(this.cmdNear);
this.addSubCommand(this.cmdUpgrades);
this.addSubCommand(this.cmdVault);
this.addSubCommand(this.cmdGetVault);
this.addSubCommand(this.cmdColeader);
this.addSubCommand(this.cmdBanner);
this.addSubCommand(this.cmdTpBanner);
this.addSubCommand(this.cmdKillHolograms);
this.addSubCommand(this.cmdCoords);
this.addSubCommand(this.cmdShowClaims);
this.addSubCommand(this.cmdLowPower);
this.addSubCommand(this.cmdTntFill);
this.addSubCommand(this.cmdChest);
this.addSubCommand(this.cmdSetBanner);
this.addSubCommand(this.cmdStrikeSet);
this.addSubCommand(this.cmdSpam);
this.addSubCommand(this.cmdCorner);
this.addSubCommand(this.cmdFGlobal);
this.addSubCommand(this.cmdViewChest);
this.addSubCommand(this.cmdAdmin);
this.addSubCommand(this.cmdAutoClaim);
this.addSubCommand(this.cmdBoom);
this.addSubCommand(this.cmdBypass);
this.addSubCommand(this.cmdChat);
this.addSubCommand(this.cmdToggleAllianceChat);
this.addSubCommand(this.cmdChatSpy);
this.addSubCommand(this.cmdClaim);
this.addSubCommand(this.cmdConfig);
this.addSubCommand(this.cmdCreate);
this.addSubCommand(this.cmdDeinvite);
this.addSubCommand(this.cmdDescription);
this.addSubCommand(this.cmdDisband);
this.addSubCommand(this.cmdStrike);
this.addSubCommand(this.cmdHelp);
this.addSubCommand(this.cmdHome);
this.addSubCommand(this.cmdInvite);
this.addSubCommand(this.cmdJoin);
this.addSubCommand(this.cmdKick);
this.addSubCommand(this.cmdLeave);
this.addSubCommand(this.cmdList);
this.addSubCommand(this.cmdLock);
this.addSubCommand(this.cmdMap);
this.addSubCommand(this.cmdMod);
this.addSubCommand(this.cmdMoney);
this.addSubCommand(this.cmdNotifications);
this.addSubCommand(this.cmdOpen);
this.addSubCommand(this.cmdOwner);
this.addSubCommand(this.cmdOwnerList);
this.addSubCommand(this.cmdPeaceful);
this.addSubCommand(this.cmdPermanent);
this.addSubCommand(this.cmdPermanentPower);
this.addSubCommand(this.cmdPower);
this.addSubCommand(this.cmdPowerBoost);
this.addSubCommand(this.cmdRelationAlly);
this.addSubCommand(this.cmdRelationEnemy);
this.addSubCommand(this.cmdRelationNeutral);
this.addSubCommand(this.cmdRelationTruce);
this.addSubCommand(this.cmdReload);
this.addSubCommand(this.cmdSafeunclaimall);
this.addSubCommand(this.cmdSaveAll);
this.addSubCommand(this.cmdSethome);
this.addSubCommand(this.cmdShow);
this.addSubCommand(this.cmdStatus);
this.addSubCommand(this.cmdStealth);
this.addSubCommand(this.cmdStuck);
this.addSubCommand(this.cmdLogout);
this.addSubCommand(this.cmdTag);
this.addSubCommand(this.cmdTitle);
this.addSubCommand(this.cmdUnclaim);
this.addSubCommand(this.cmdUnclaimall);
this.addSubCommand(this.cmdVersion);
this.addSubCommand(this.cmdWarunclaimall);
this.addSubCommand(this.cmdSB);
this.addSubCommand(this.cmdShowInvites);
this.addSubCommand(this.cmdAnnounce);
this.addSubCommand(this.cmdSeeChunk);
this.addSubCommand(this.cmdConvert);
this.addSubCommand(this.cmdFWarp);
this.addSubCommand(this.cmdSetFWarp);
this.addSubCommand(this.cmdDelFWarp);
this.addSubCommand(this.cmdModifyPower);
this.addSubCommand(this.cmdLogins);
this.addSubCommand(this.cmdClaimLine);
this.addSubCommand(this.cmdAHome);
this.addSubCommand(this.cmdPerm);
this.addSubCommand(this.cmdPromote);
this.addSubCommand(this.cmdDemote);
this.addSubCommand(this.cmdSetDefaultRole);
this.addSubCommand(this.cmdMapHeight);
this.addSubCommand(this.cmdClaimAt);
this.addSubCommand(this.cmdban);
this.addSubCommand(this.cmdUnban);
this.addSubCommand(this.cmdbanlist);
this.addSubCommand(this.cmdRules);
this.addSubCommand(this.cmdCheckpoint);
this.addSubCommand(this.cmdTnt);
this.addSubCommand(this.cmdNear);
this.addSubCommand(this.cmdUpgrades);
this.addSubCommand(this.cmdVault);
this.addSubCommand(this.cmdGetVault);
this.addSubCommand(this.cmdColeader);
this.addSubCommand(this.cmdBanner);
this.addSubCommand(this.cmdTpBanner);
this.addSubCommand(this.cmdKillHolograms);
this.addSubCommand(this.cmdCoords);
this.addSubCommand(this.cmdShowClaims);
this.addSubCommand(this.cmdLowPower);
this.addSubCommand(this.cmdTntFill);
this.addSubCommand(this.cmdChest);
this.addSubCommand(this.cmdSetBanner);
this.addSubCommand(this.cmdStrikeSet);
this.addSubCommand(this.cmdSpam);
this.addSubCommand(this.cmdCorner);
this.addSubCommand(this.cmdFGlobal);
this.addSubCommand(this.cmdViewChest);
if(P.p.getConfig().getBoolean("Missions-Enabled")){
this.addSubCommand(this.cmdMissions);
}
if (Conf.useCheckSystem) {
this.addSubCommand(this.cmdCheck);
}
if(P.p.getConfig().getBoolean("F-Shop.Enabled")){
this.addSubCommand(this.cmdShop);
}
if (P.p.getConfig().getBoolean("Missions-Enabled")) {
this.addSubCommand(this.cmdMissions);
}
if (P.p.getConfig().getBoolean("f-inventory-see.Enabled")) {
this.addSubCommand(this.cmdInventorySee);
}
if (P.p.getConfig().getBoolean("F-Shop.Enabled")) {
this.addSubCommand(this.cmdShop);
}
if(P.p.getConfig().getBoolean("f-points.Enabled")){
this.addSubCommand(this.cmdPoints);
}
if (P.p.getConfig().getBoolean("f-inventory-see.Enabled")) {
this.addSubCommand(this.cmdInventorySee);
}
if(P.p.getConfig().getBoolean("f-alts.Enabled")){
this.addSubCommand(this.cmdAlts);
}
if (P.p.getConfig().getBoolean("f-points.Enabled")) {
this.addSubCommand(this.cmdPoints);
}
if (P.p.getConfig().getBoolean("f-grace.Enabled")) {
this.addSubCommand(this.cmdGrace);
}
if (P.p.getConfig().getBoolean("f-alts.Enabled")) {
this.addSubCommand(this.cmdAlts);
}
if (P.p.getConfig().getBoolean("f-grace.Enabled")) {
this.addSubCommand(this.cmdGrace);
}
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) {
P.p.log("Found CoreProtect, enabling Inspect");
this.addSubCommand(this.cmdInspect);
} else {
P.p.log("CoreProtect not found, disabling Inspect");
}
if (P.p.getConfig().getBoolean("ffocus.Enabled")) {
addSubCommand(this.cmdFocus);
}
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) {
P.p.log("Found CoreProtect, enabling Inspect");
this.addSubCommand(this.cmdInspect);
} else {
P.p.log("CoreProtect not found, disabling Inspect");
}
if (P.p.getConfig().getBoolean("ffocus.Enabled")) {
addSubCommand(this.cmdFocus);
}
if (P.p.getConfig().getBoolean("enable-faction-flight", false)) {
this.addSubCommand(this.cmdFly);
}
if (Bukkit.getServer().getPluginManager().getPlugin("FactionsTop") != null || Bukkit.getServer().getPluginManager().getPlugin("SavageFTOP") != null) {
P.p.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command.");
} else {
P.p.log(Level.INFO, "Enabling FactionsTop command, this is a very basic /f top please get a dedicated /f top resource if you want land calculation etc.");
this.addSubCommand(this.cmdTop);
}
if (P.p.getConfig().getBoolean("fpaypal.Enabled")) {
this.addSubCommand(this.cmdPaypalSet);
this.addSubCommand(this.cmdPaypalSee);
}
if (P.p.getConfig().getBoolean("enable-faction-flight", false)) {
this.addSubCommand(this.cmdFly);
}
if (Bukkit.getServer().getPluginManager().getPlugin("FactionsTop") != null || Bukkit.getServer().getPluginManager().getPlugin("SavageFTOP") != null) {
P.p.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command.");
} else {
P.p.log(Level.INFO, "Enabling FactionsTop command, this is a very basic /f top please get a dedicated /f top resource if you want land calculation etc.");
this.addSubCommand(this.cmdTop);
}
if (P.p.getConfig().getBoolean("fpaypal.Enabled")) {
this.addSubCommand(this.cmdPaypalSet);
this.addSubCommand(this.cmdPaypalSee);
}
}
}
@Override
public void perform() {
this.commandChain.add(this);
this.cmdHelp.execute(this.sender, this.args, this.commandChain);
}
@Override
public void perform() {
this.commandChain.add(this);
this.cmdHelp.execute(this.sender, this.args, this.commandChain);
}
@Override
public TL getUsageTranslation() {
return TL.GENERIC_PLACEHOLDER;
}
@Override
public TL getUsageTranslation() {
return TL.GENERIC_PLACEHOLDER;
}
}

View File

@ -15,337 +15,337 @@ import java.util.List;
public abstract class FCommand extends MCommand<P> {
public static final SimpleDateFormat sdf = new SimpleDateFormat(TL.DATE_FORMAT.toString());
public boolean disableOnLock;
public boolean disableOnSpam;
public FPlayer fme;
public Faction myFaction;
public boolean senderMustBeMember;
public boolean senderMustBeModerator;
public boolean senderMustBeAdmin;
public boolean senderMustBeColeader;
public boolean isMoneyCommand;
public FCommand() {
super(P.p);
// Due to safety reasons it defaults to disable on lock.
disableOnLock = true;
disableOnSpam = false;
// The money commands must be disabled if money should not be used.
isMoneyCommand = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void setCommandSender(CommandSender sender) {
super.setCommandSender(sender);
if (sender instanceof Player) {
this.fme = FPlayers.getInstance().getByPlayer((Player) sender);
this.myFaction = this.fme.getFaction();
} else {
this.fme = null;
this.myFaction = null;
}
}
@Override
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
setCommandSender(sender);
super.execute(sender, args, commandChain);
}
@Override
public boolean isEnabled() {
if (p.getLocked() && this.disableOnLock) {
msg("<b>Factions was locked by an admin. Please try again later.");
return false;
}
if(p.getSpam() && this.disableOnSpam){
msg("<b>Anti-Spam is currently enabled! Please try again later.");
return false;
}
if (this.isMoneyCommand && !Conf.econEnabled) {
msg("<b>Faction economy features are disabled on this server.");
return false;
}
if (this.isMoneyCommand && !Conf.bankEnabled) {
msg("<b>The faction bank system is disabled on this server.");
return false;
}
return true;
}
@Override
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) {
boolean superValid = super.validSenderType(sender, informSenderIfNot);
if (!superValid) {
return false;
}
if (!(this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) {
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (!fme.hasFaction()) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_NOFACTION.toString()));
}
return false;
}
if (this.senderMustBeModerator && !fme.getRole().isAtLeast(Role.MODERATOR)) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "moderator").replace("{action}", this.getHelpShort())));
}
return false;
}
if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "coleader").replace("{action}", this.getHelpShort())));
}
return false;
}
if (this.senderMustBeAdmin && !fme.getRole().isAtLeast(Role.LEADER)) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "admin").replace("{action}", this.getHelpShort())));
}
return false;
}
return true;
}
// -------------------------------------------- //
// Assertions
// -------------------------------------------- //
public boolean assertHasFaction() {
if (me == null) {
return true;
}
if (!fme.hasFaction()) {
msg(TL.ACTIONS_NOFACTION);
return false;
}
return true;
}
public boolean assertMinRole(Role role) {
if (me == null) {
return true;
}
if (fme.getRole().value < role.value) {
msg(TL.ACTIONS_MUSTBE.toString().replace("{role}", role.nicename).replace("{action}", this.getHelpShort()));
return false;
}
return true;
}
// -------------------------------------------- //
// Argument Readers
// -------------------------------------------- //
// FPLAYER ======================
public FPlayer strAsFPlayer(String name, FPlayer def, boolean msg) {
FPlayer ret = def;
if (name != null) {
for (FPlayer fplayer : FPlayers.getInstance().getAllFPlayers()) {
if (fplayer.getName().equalsIgnoreCase(name)) {
ret = fplayer;
break;
}
}
}
if (msg && ret == null) {
this.msg("<b>No player \"<plugin>%s<b>\" could be found.", name);
}
return ret;
}
public FPlayer argAsFPlayer(int idx, FPlayer def, boolean msg) {
return this.strAsFPlayer(this.argAsString(idx), def, msg);
}
public FPlayer argAsFPlayer(int idx, FPlayer def) {
return this.argAsFPlayer(idx, def, true);
}
public FPlayer argAsFPlayer(int idx) {
return this.argAsFPlayer(idx, null);
}
// BEST FPLAYER MATCH ======================
public FPlayer strAsBestFPlayerMatch(String name, FPlayer def, boolean msg) {
return strAsFPlayer(name, def, msg);
}
public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def, boolean msg) {
return this.strAsBestFPlayerMatch(this.argAsString(idx), def, msg);
}
public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def) {
return this.argAsBestFPlayerMatch(idx, def, true);
}
public FPlayer argAsBestFPlayerMatch(int idx) {
return this.argAsBestFPlayerMatch(idx, null);
}
// FACTION ======================
public Faction strAsFaction(String name, Faction def, boolean msg) {
Faction ret = def;
if (name != null) {
// First we try an exact match
Faction faction = Factions.getInstance().getByTag(name); // Checks for faction name match.
// Now lets try for warzone / safezone. Helpful for custom warzone / safezone names.
// Do this after we check for an exact match in case they rename the warzone / safezone
// and a player created faction took one of the names.
if (faction == null) {
if (name.equalsIgnoreCase("warzone")) {
faction = Factions.getInstance().getWarZone();
} else if (name.equalsIgnoreCase("safezone")) {
faction = Factions.getInstance().getSafeZone();
}
}
// Next we match faction tags
if (faction == null) {
faction = Factions.getInstance().getBestTagMatch(name);
}
// Next we match player names
if (faction == null) {
FPlayer fplayer = strAsFPlayer(name, null, false);
if (fplayer != null) {
faction = fplayer.getFaction();
}
}
if (faction != null) {
ret = faction;
}
}
if (msg && ret == null) {
this.msg("<b>The faction or player \"<plugin>%s<b>\" could not be found.", name);
}
return ret;
}
public Faction argAsFaction(int idx, Faction def, boolean msg) {
return this.strAsFaction(this.argAsString(idx), def, msg);
}
public Faction argAsFaction(int idx, Faction def) {
return this.argAsFaction(idx, def, true);
}
public Faction argAsFaction(int idx) {
return this.argAsFaction(idx, null);
}
// -------------------------------------------- //
// Commonly used logic
// -------------------------------------------- //
public boolean canIAdministerYou(FPlayer i, FPlayer you) {
if (!i.getFaction().equals(you.getFaction())) {
i.sendMessage(p.txt.parse("%s <b>is not in the same faction as you.", you.describeTo(i, true)));
return false;
}
if (i.getRole().value > you.getRole().value || i.getRole().equals(Role.LEADER)) {
return true;
}
if (you.getRole().equals(Role.LEADER)) {
i.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "leader").replace("{action}", "do that")));
} else if ((you.getRole().equals(Role.COLEADER))) {
if (i == you) {
return true;
} else {
i.sendMessage(p.txt.parse(TL.ACTIONS_NOSAMEROLE.toString().replace("{role}", i.getRole().nicename)));
}
} else if (i.getRole().equals(Role.MODERATOR)) {
if (i == you) {
return true; //Moderators can control themselves
} else {
i.sendMessage(p.txt.parse(TL.ACTIONS_NOSAMEROLE.toString().replace("{role}", i.getRole().nicename)));
}
} else {
i.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "moderator").replace("{action}", "do that")));
}
return false;
}
// if economy is enabled and they're not on the bypass list, make 'em pay; returns true unless person can't afford the cost
public boolean payForCommand(double cost, String toDoThis, String forDoingThis) {
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
return true;
}
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis);
} else {
return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis);
}
}
public boolean payForCommand(double cost, TL toDoThis, TL forDoingThis) {
return payForCommand(cost, toDoThis.toString(), forDoingThis.toString());
}
// like above, but just make sure they can pay; returns true unless person can't afford the cost
public boolean canAffordCommand(double cost, String toDoThis) {
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
return true;
}
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
return Econ.hasAtLeast(myFaction, cost, toDoThis);
} else {
return Econ.hasAtLeast(fme, cost, toDoThis);
}
}
public void doWarmUp(WarmUpUtil.Warmup warmup, TL translationKey, String action, Runnable runnable, long delay) {
this.doWarmUp(this.fme, warmup, translationKey, action, runnable, delay);
}
public void doWarmUp(FPlayer player, WarmUpUtil.Warmup warmup, TL translationKey, String action, Runnable runnable, long delay) {
WarmUpUtil.process(player, warmup, translationKey, action, runnable, delay);
}
public static final SimpleDateFormat sdf = new SimpleDateFormat(TL.DATE_FORMAT.toString());
public boolean disableOnLock;
public boolean disableOnSpam;
public FPlayer fme;
public Faction myFaction;
public boolean senderMustBeMember;
public boolean senderMustBeModerator;
public boolean senderMustBeAdmin;
public boolean senderMustBeColeader;
public boolean isMoneyCommand;
public FCommand() {
super(P.p);
// Due to safety reasons it defaults to disable on lock.
disableOnLock = true;
disableOnSpam = false;
// The money commands must be disabled if money should not be used.
isMoneyCommand = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void setCommandSender(CommandSender sender) {
super.setCommandSender(sender);
if (sender instanceof Player) {
this.fme = FPlayers.getInstance().getByPlayer((Player) sender);
this.myFaction = this.fme.getFaction();
} else {
this.fme = null;
this.myFaction = null;
}
}
@Override
public void execute(CommandSender sender, List<String> args, List<MCommand<?>> commandChain) {
setCommandSender(sender);
super.execute(sender, args, commandChain);
}
@Override
public boolean isEnabled() {
if (p.getLocked() && this.disableOnLock) {
msg("<b>Factions was locked by an admin. Please try again later.");
return false;
}
if (p.getSpam() && this.disableOnSpam) {
msg("<b>Anti-Spam is currently enabled! Please try again later.");
return false;
}
if (this.isMoneyCommand && !Conf.econEnabled) {
msg("<b>Faction economy features are disabled on this server.");
return false;
}
if (this.isMoneyCommand && !Conf.bankEnabled) {
msg("<b>The faction bank system is disabled on this server.");
return false;
}
return true;
}
@Override
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) {
boolean superValid = super.validSenderType(sender, informSenderIfNot);
if (!superValid) {
return false;
}
if (!(this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) {
return true;
}
if (!(sender instanceof Player)) {
return false;
}
if (!fme.hasFaction()) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_NOFACTION.toString()));
}
return false;
}
if (this.senderMustBeModerator && !fme.getRole().isAtLeast(Role.MODERATOR)) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "moderator").replace("{action}", this.getHelpShort())));
}
return false;
}
if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "coleader").replace("{action}", this.getHelpShort())));
}
return false;
}
if (this.senderMustBeAdmin && !fme.getRole().isAtLeast(Role.LEADER)) {
if (informSenderIfNot) {
sender.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "admin").replace("{action}", this.getHelpShort())));
}
return false;
}
return true;
}
// -------------------------------------------- //
// Assertions
// -------------------------------------------- //
public boolean assertHasFaction() {
if (me == null) {
return true;
}
if (!fme.hasFaction()) {
msg(TL.ACTIONS_NOFACTION);
return false;
}
return true;
}
public boolean assertMinRole(Role role) {
if (me == null) {
return true;
}
if (fme.getRole().value < role.value) {
msg(TL.ACTIONS_MUSTBE.toString().replace("{role}", role.nicename).replace("{action}", this.getHelpShort()));
return false;
}
return true;
}
// -------------------------------------------- //
// Argument Readers
// -------------------------------------------- //
// FPLAYER ======================
public FPlayer strAsFPlayer(String name, FPlayer def, boolean msg) {
FPlayer ret = def;
if (name != null) {
for (FPlayer fplayer : FPlayers.getInstance().getAllFPlayers()) {
if (fplayer.getName().equalsIgnoreCase(name)) {
ret = fplayer;
break;
}
}
}
if (msg && ret == null) {
this.msg("<b>No player \"<plugin>%s<b>\" could be found.", name);
}
return ret;
}
public FPlayer argAsFPlayer(int idx, FPlayer def, boolean msg) {
return this.strAsFPlayer(this.argAsString(idx), def, msg);
}
public FPlayer argAsFPlayer(int idx, FPlayer def) {
return this.argAsFPlayer(idx, def, true);
}
public FPlayer argAsFPlayer(int idx) {
return this.argAsFPlayer(idx, null);
}
// BEST FPLAYER MATCH ======================
public FPlayer strAsBestFPlayerMatch(String name, FPlayer def, boolean msg) {
return strAsFPlayer(name, def, msg);
}
public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def, boolean msg) {
return this.strAsBestFPlayerMatch(this.argAsString(idx), def, msg);
}
public FPlayer argAsBestFPlayerMatch(int idx, FPlayer def) {
return this.argAsBestFPlayerMatch(idx, def, true);
}
public FPlayer argAsBestFPlayerMatch(int idx) {
return this.argAsBestFPlayerMatch(idx, null);
}
// FACTION ======================
public Faction strAsFaction(String name, Faction def, boolean msg) {
Faction ret = def;
if (name != null) {
// First we try an exact match
Faction faction = Factions.getInstance().getByTag(name); // Checks for faction name match.
// Now lets try for warzone / safezone. Helpful for custom warzone / safezone names.
// Do this after we check for an exact match in case they rename the warzone / safezone
// and a player created faction took one of the names.
if (faction == null) {
if (name.equalsIgnoreCase("warzone")) {
faction = Factions.getInstance().getWarZone();
} else if (name.equalsIgnoreCase("safezone")) {
faction = Factions.getInstance().getSafeZone();
}
}
// Next we match faction tags
if (faction == null) {
faction = Factions.getInstance().getBestTagMatch(name);
}
// Next we match player names
if (faction == null) {
FPlayer fplayer = strAsFPlayer(name, null, false);
if (fplayer != null) {
faction = fplayer.getFaction();
}
}
if (faction != null) {
ret = faction;
}
}
if (msg && ret == null) {
this.msg("<b>The faction or player \"<plugin>%s<b>\" could not be found.", name);
}
return ret;
}
public Faction argAsFaction(int idx, Faction def, boolean msg) {
return this.strAsFaction(this.argAsString(idx), def, msg);
}
public Faction argAsFaction(int idx, Faction def) {
return this.argAsFaction(idx, def, true);
}
public Faction argAsFaction(int idx) {
return this.argAsFaction(idx, null);
}
// -------------------------------------------- //
// Commonly used logic
// -------------------------------------------- //
public boolean canIAdministerYou(FPlayer i, FPlayer you) {
if (!i.getFaction().equals(you.getFaction())) {
i.sendMessage(p.txt.parse("%s <b>is not in the same faction as you.", you.describeTo(i, true)));
return false;
}
if (i.getRole().value > you.getRole().value || i.getRole().equals(Role.LEADER)) {
return true;
}
if (you.getRole().equals(Role.LEADER)) {
i.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "leader").replace("{action}", "do that")));
} else if ((you.getRole().equals(Role.COLEADER))) {
if (i == you) {
return true;
} else {
i.sendMessage(p.txt.parse(TL.ACTIONS_NOSAMEROLE.toString().replace("{role}", i.getRole().nicename)));
}
} else if (i.getRole().equals(Role.MODERATOR)) {
if (i == you) {
return true; //Moderators can control themselves
} else {
i.sendMessage(p.txt.parse(TL.ACTIONS_NOSAMEROLE.toString().replace("{role}", i.getRole().nicename)));
}
} else {
i.sendMessage(p.txt.parse(TL.ACTIONS_MUSTBE.toString().replace("{role}", "moderator").replace("{action}", "do that")));
}
return false;
}
// if economy is enabled and they're not on the bypass list, make 'em pay; returns true unless person can't afford the cost
public boolean payForCommand(double cost, String toDoThis, String forDoingThis) {
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
return true;
}
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis);
} else {
return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis);
}
}
public boolean payForCommand(double cost, TL toDoThis, TL forDoingThis) {
return payForCommand(cost, toDoThis.toString(), forDoingThis.toString());
}
// like above, but just make sure they can pay; returns true unless person can't afford the cost
public boolean canAffordCommand(double cost, String toDoThis) {
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
return true;
}
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
return Econ.hasAtLeast(myFaction, cost, toDoThis);
} else {
return Econ.hasAtLeast(fme, cost, toDoThis);
}
}
public void doWarmUp(WarmUpUtil.Warmup warmup, TL translationKey, String action, Runnable runnable, long delay) {
this.doWarmUp(this.fme, warmup, translationKey, action, runnable, delay);
}
public void doWarmUp(FPlayer player, WarmUpUtil.Warmup warmup, TL translationKey, String action, Runnable runnable, long delay) {
WarmUpUtil.process(player, warmup, translationKey, action, runnable, delay);
}
}

View File

@ -12,7 +12,7 @@ public class CmdAlts extends FCommand {
public CmdAltsList cmdAltsList = new CmdAltsList();
public CmdAlts(){
public CmdAlts() {
super();
this.aliases.add("alts");

View File

@ -33,17 +33,17 @@ public class CmdAltsList extends FCommand {
@Override
public void perform() {
Faction faction = myFaction;
if(argIsSet(0)){
if (argIsSet(0)) {
faction = argAsFaction(0);
}
if(faction == null)
if (faction == null)
return;
if(faction != myFaction && !fme.isAdminBypassing()){
if (faction != myFaction && !fme.isAdminBypassing()) {
return;
}
if(faction.getAltPlayers().size() == 0){
if (faction.getAltPlayers().size() == 0) {
msg(TL.COMMAND_ALTS_LIST_NOALTS, faction.getTag());
return;
}

View File

@ -33,7 +33,7 @@ public class CmdInviteAlt extends FCommand {
@Override
public void perform() {
if(!P.p.getConfig().getBoolean("f-alts.Enabled", false)){
if (!P.p.getConfig().getBoolean("f-alts.Enabled", false)) {
fme.msg(TL.GENERIC_DISABLED);
return;
}

View File

@ -94,7 +94,7 @@ public class ChestLogsHandler implements Listener {
if (e.getClickedInventory() != null) {
if (e.getClickedInventory().equals(topInventory)) {
ItemStack current = e.getCurrentItem();
if(current == null) return;
if (current == null) return;
ItemStack cursor = e.getCursor();
if (e.getClick().isShiftClick()) return;
if (cursor != null) {

View File

@ -10,44 +10,44 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdChest extends FCommand {
public CmdChest() {
this.aliases.add("chest");
this.aliases.add("pv");
public CmdChest() {
this.aliases.add("chest");
this.aliases.add("pv");
//this.requiredArgs.add("");
//this.requiredArgs.add("");
this.permission = Permission.CHEST.node;
this.disableOnLock = false;
this.permission = Permission.CHEST.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fchest.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
// This permission check is way too explicit but it's clean
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.CHEST);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
return;
}
}
me.openInventory(fme.getFaction().getChestInventory());
}
if (!P.p.getConfig().getBoolean("fchest.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
// This permission check is way too explicit but it's clean
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.CHEST);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
return;
}
}
me.openInventory(fme.getFaction().getChestInventory());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
}

View File

@ -8,51 +8,51 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdAutoClaim extends FCommand {
public CmdAutoClaim() {
super();
this.aliases.add("autoclaim");
public CmdAutoClaim() {
super();
this.aliases.add("autoclaim");
//this.requiredArgs.add("");
this.optionalArgs.put("faction", "your");
//this.requiredArgs.add("");
this.optionalArgs.put("faction", "your");
this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
this.disableOnSpam = false;
this.permission = Permission.AUTOCLAIM.node;
this.disableOnLock = true;
this.disableOnSpam = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction forFaction = this.argAsFaction(0, myFaction);
if (forFaction == null || forFaction == fme.getAutoClaimFor()) {
fme.setAutoClaimFor(null);
msg(TL.COMMAND_AUTOCLAIM_DISABLED);
return;
}
@Override
public void perform() {
Faction forFaction = this.argAsFaction(0, myFaction);
if (forFaction == null || forFaction == fme.getAutoClaimFor()) {
fme.setAutoClaimFor(null);
msg(TL.COMMAND_AUTOCLAIM_DISABLED);
return;
}
if (!fme.canClaimForFaction(forFaction)) {
if (myFaction == forFaction) {
msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation());
} else {
msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme));
}
if (!fme.canClaimForFaction(forFaction)) {
if (myFaction == forFaction) {
msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation());
} else {
msg(TL.COMMAND_AUTOCLAIM_OTHERFACTION, forFaction.describeTo(fme));
}
return;
}
return;
}
fme.setAutoClaimFor(forFaction);
fme.setAutoClaimFor(forFaction);
msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme));
fme.attemptClaim(forFaction, me.getLocation(), true);
}
msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(fme));
fme.attemptClaim(forFaction, me.getLocation(), true);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_AUTOCLAIM_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_AUTOCLAIM_DESCRIPTION;
}
}

View File

@ -8,38 +8,38 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdClaimAt extends FCommand {
public CmdClaimAt() {
super();
this.aliases.add("claimat");
public CmdClaimAt() {
super();
this.aliases.add("claimat");
this.requiredArgs.add("world");
this.requiredArgs.add("x");
this.requiredArgs.add("z");
this.requiredArgs.add("world");
this.requiredArgs.add("x");
this.requiredArgs.add("z");
this.permission = Permission.CLAIMAT.node;
this.disableOnLock = true;
this.permission = Permission.CLAIMAT.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
int x = argAsInt(1);
int z = argAsInt(2);
FLocation location = new FLocation(argAsString(0), x, z);
if (!((fme.getPlayer().getLocation().getX() + (x * 16)) > (fme.getPlayer().getLocation().getX() + (Conf.mapWidth * 16))) &&
!((fme.getPlayer().getLocation().getZ() + (z * 16)) > (fme.getPlayer().getLocation().getZ() + (Conf.mapHeight * 16)))) {
fme.attemptClaim(myFaction, location, true);
} else fme.msg(TL.COMMAND_CLAIM_DENIED);
}
@Override
public void perform() {
int x = argAsInt(1);
int z = argAsInt(2);
FLocation location = new FLocation(argAsString(0), x, z);
if (!((fme.getPlayer().getLocation().getX() + (x * 16)) > (fme.getPlayer().getLocation().getX() + (Conf.mapWidth * 16))) &&
!((fme.getPlayer().getLocation().getZ() + (z * 16)) > (fme.getPlayer().getLocation().getZ() + (Conf.mapHeight * 16)))) {
fme.attemptClaim(myFaction, location, true);
} else fme.msg(TL.COMMAND_CLAIM_DENIED);
}
@Override
public TL getUsageTranslation() {
return null;
}
@Override
public TL getUsageTranslation() {
return null;
}
}

View File

@ -10,70 +10,70 @@ import org.bukkit.block.BlockFace;
public class CmdClaimLine extends FCommand {
public static final BlockFace[] axis = {BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST};
public static final BlockFace[] axis = {BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST};
public CmdClaimLine() {
public CmdClaimLine() {
// Aliases
this.aliases.add("claimline");
this.aliases.add("cl");
// Aliases
this.aliases.add("claimline");
this.aliases.add("cl");
// Args
this.optionalArgs.put("amount", "1");
this.optionalArgs.put("direction", "facing");
this.optionalArgs.put("faction", "you");
// Args
this.optionalArgs.put("amount", "1");
this.optionalArgs.put("direction", "facing");
this.optionalArgs.put("faction", "you");
this.permission = Permission.CLAIM_LINE.node;
this.disableOnLock = true;
this.permission = Permission.CLAIM_LINE.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// Args
Integer amount = this.argAsInt(0, 1); // Default to 1
@Override
public void perform() {
// Args
Integer amount = this.argAsInt(0, 1); // Default to 1
if (amount > Conf.lineClaimLimit) {
fme.msg(TL.COMMAND_CLAIMLINE_ABOVEMAX, Conf.lineClaimLimit);
return;
}
if (amount > Conf.lineClaimLimit) {
fme.msg(TL.COMMAND_CLAIMLINE_ABOVEMAX, Conf.lineClaimLimit);
return;
}
String direction = this.argAsString(1);
BlockFace blockFace;
String direction = this.argAsString(1);
BlockFace blockFace;
if (direction == null) {
blockFace = axis[Math.round(me.getLocation().getYaw() / 90f) & 0x3];
} else if (direction.equalsIgnoreCase("north")) {
blockFace = BlockFace.NORTH;
} else if (direction.equalsIgnoreCase("east")) {
blockFace = BlockFace.EAST;
} else if (direction.equalsIgnoreCase("south")) {
blockFace = BlockFace.SOUTH;
} else if (direction.equalsIgnoreCase("west")) {
blockFace = BlockFace.WEST;
} else {
fme.msg(TL.COMMAND_CLAIMLINE_NOTVALID, direction);
return;
}
if (direction == null) {
blockFace = axis[Math.round(me.getLocation().getYaw() / 90f) & 0x3];
} else if (direction.equalsIgnoreCase("north")) {
blockFace = BlockFace.NORTH;
} else if (direction.equalsIgnoreCase("east")) {
blockFace = BlockFace.EAST;
} else if (direction.equalsIgnoreCase("south")) {
blockFace = BlockFace.SOUTH;
} else if (direction.equalsIgnoreCase("west")) {
blockFace = BlockFace.WEST;
} else {
fme.msg(TL.COMMAND_CLAIMLINE_NOTVALID, direction);
return;
}
final Faction forFaction = this.argAsFaction(2, myFaction);
Location location = me.getLocation();
final Faction forFaction = this.argAsFaction(2, myFaction);
Location location = me.getLocation();
// TODO: make this a task like claiming a radius?
for (int i = 0; i < amount; i++) {
fme.attemptClaim(forFaction, location, true);
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
}
}
// TODO: make this a task like claiming a radius?
for (int i = 0; i < amount; i++) {
fme.attemptClaim(forFaction, location, true);
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CLAIMLINE_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_CLAIMLINE_DESCRIPTION;
}
}

View File

@ -12,52 +12,52 @@ import org.bukkit.World;
public class CmdSafeunclaimall extends FCommand {
public CmdSafeunclaimall() {
this.aliases.add("safeunclaimall");
this.aliases.add("safedeclaimall");
public CmdSafeunclaimall() {
this.aliases.add("safeunclaimall");
this.aliases.add("safedeclaimall");
//this.requiredArgs.add("");
this.optionalArgs.put("world", "all");
//this.requiredArgs.add("");
this.optionalArgs.put("world", "all");
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
this.permission = Permission.MANAGE_SAFE_ZONE.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
}
@Override
public void perform() {
String worldName = argAsString(0);
World world = null;
@Override
public void perform() {
String worldName = argAsString(0);
World world = null;
if (worldName != null) {
world = Bukkit.getWorld(worldName);
}
if (worldName != null) {
world = Bukkit.getWorld(worldName);
}
String id = Factions.getInstance().getSafeZone().getId();
String id = Factions.getInstance().getSafeZone().getId();
if (world == null) {
Board.getInstance().unclaimAll(id);
} else {
Board.getInstance().unclaimAllInWorld(id, world);
}
if (world == null) {
Board.getInstance().unclaimAll(id);
} else {
Board.getInstance().unclaimAllInWorld(id, world);
}
msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED);
msg(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMED);
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName()));
}
}
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_SAFEUNCLAIMALL_UNCLAIMEDLOG.format(sender.getName()));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SAFEUNCLAIMALL_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SAFEUNCLAIMALL_DESCRIPTION;
}
}

View File

@ -14,172 +14,172 @@ import org.bukkit.Bukkit;
public class CmdUnclaim extends FCommand {
public CmdUnclaim() {
this.aliases.add("unclaim");
this.aliases.add("declaim");
public CmdUnclaim() {
this.aliases.add("unclaim");
this.aliases.add("declaim");
this.optionalArgs.put("radius", "1");
this.optionalArgs.put("radius", "1");
this.permission = Permission.UNCLAIM.node;
this.disableOnLock = true;
this.permission = Permission.UNCLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// Read and validate input
int radius = this.argAsInt(0, 1); // Default to 1
@Override
public void perform() {
// Read and validate input
int radius = this.argAsInt(0, 1); // Default to 1
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory");
return;
}
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory");
return;
}
}
if (radius < 1) {
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
return;
}
if (radius < 1) {
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
return;
}
if (radius < 2) {
// single chunk
unClaim(new FLocation(me));
} else {
// radius claim
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
msg(TL.COMMAND_CLAIM_DENIED);
return;
}
if (radius < 2) {
// single chunk
unClaim(new FLocation(me));
} else {
// radius claim
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
msg(TL.COMMAND_CLAIM_DENIED);
return;
}
new SpiralTask(new FLocation(me), radius) {
private final int limit = Conf.radiusClaimFailureLimit - 1;
private int failCount = 0;
new SpiralTask(new FLocation(me), radius) {
private final int limit = Conf.radiusClaimFailureLimit - 1;
private int failCount = 0;
@Override
public boolean work() {
boolean success = unClaim(this.currentFLocation());
if (success) {
failCount = 0;
} else if (failCount++ >= limit) {
this.stop();
return false;
}
@Override
public boolean work() {
boolean success = unClaim(this.currentFLocation());
if (success) {
failCount = 0;
} else if (failCount++ >= limit) {
this.stop();
return false;
}
return true;
}
};
}
}
return true;
}
};
}
}
private boolean unClaim(FLocation target) {
Faction targetFaction = Board.getInstance().getFactionAt(target);
if (targetFaction.isSafeZone()) {
if (Permission.MANAGE_SAFE_ZONE.has(sender)) {
Board.getInstance().removeAt(target);
msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS);
private boolean unClaim(FLocation target) {
Faction targetFaction = Board.getInstance().getFactionAt(target);
if (targetFaction.isSafeZone()) {
if (Permission.MANAGE_SAFE_ZONE.has(sender)) {
Board.getInstance().removeAt(target);
msg(TL.COMMAND_UNCLAIM_SAFEZONE_SUCCESS);
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
return true;
} else {
msg(TL.COMMAND_UNCLAIM_SAFEZONE_NOPERM);
return false;
}
} else if (targetFaction.isWarZone()) {
if (Permission.MANAGE_WAR_ZONE.has(sender)) {
Board.getInstance().removeAt(target);
msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS);
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
return true;
} else {
msg(TL.COMMAND_UNCLAIM_SAFEZONE_NOPERM);
return false;
}
} else if (targetFaction.isWarZone()) {
if (Permission.MANAGE_WAR_ZONE.has(sender)) {
Board.getInstance().removeAt(target);
msg(TL.COMMAND_UNCLAIM_WARZONE_SUCCESS);
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
return true;
} else {
msg(TL.COMMAND_UNCLAIM_WARZONE_NOPERM);
return false;
}
}
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
return true;
} else {
msg(TL.COMMAND_UNCLAIM_WARZONE_NOPERM);
return false;
}
}
if (fme.isAdminBypassing()) {
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimEvent));
if (unclaimEvent.isCancelled()) {
return false;
}
if (fme.isAdminBypassing()) {
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
Bukkit.getScheduler().runTask(P.p, () -> Bukkit.getServer().getPluginManager().callEvent(unclaimEvent));
if (unclaimEvent.isCancelled()) {
return false;
}
Board.getInstance().removeAt(target);
Board.getInstance().removeAt(target);
targetFaction.msg(TL.COMMAND_UNCLAIM_UNCLAIMED, fme.describeTo(targetFaction, true));
msg(TL.COMMAND_UNCLAIM_UNCLAIMS);
targetFaction.msg(TL.COMMAND_UNCLAIM_UNCLAIMED, fme.describeTo(targetFaction, true));
msg(TL.COMMAND_UNCLAIM_UNCLAIMS);
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
return true;
}
return true;
}
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) == Access.DENY) {
return false;
}
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) == Access.DENY) {
return false;
}
if (!assertHasFaction()) {
return false;
}
if (!assertHasFaction()) {
return false;
}
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && !assertMinRole(Role.MODERATOR)) {
return false;
}
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && !assertMinRole(Role.MODERATOR)) {
return false;
}
if (myFaction != targetFaction) {
msg(TL.COMMAND_UNCLAIM_WRONGFACTION);
return false;
}
if (myFaction != targetFaction) {
msg(TL.COMMAND_UNCLAIM_WRONGFACTION);
return false;
}
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
Bukkit.getServer().getPluginManager().callEvent(unclaimEvent);
if (unclaimEvent.isCancelled()) {
return false;
}
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(target, targetFaction, fme);
Bukkit.getServer().getPluginManager().callEvent(unclaimEvent);
if (unclaimEvent.isCancelled()) {
return false;
}
if (Econ.shouldBeUsed()) {
double refund = Econ.calculateClaimRefund(myFaction.getLandRounded());
if (Econ.shouldBeUsed()) {
double refund = Econ.calculateClaimRefund(myFaction.getLandRounded());
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
return false;
}
} else {
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
return false;
}
}
}
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
return false;
}
} else {
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
return false;
}
}
}
Board.getInstance().removeAt(target);
myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true));
Board.getInstance().removeAt(target);
myFaction.msg(TL.COMMAND_UNCLAIM_FACTIONUNCLAIMED, fme.describeTo(myFaction, true));
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
if (Conf.logLandUnclaims) {
P.p.log(TL.COMMAND_UNCLAIM_LOG.format(fme.getName(), target.getCoordString(), targetFaction.getTag()));
}
return true;
}
return true;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_UNCLAIM_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_UNCLAIM_DESCRIPTION;
}
}

Some files were not shown because too many files have changed in this diff Show More