Reformatted Code
This commit is contained in:
parent
cd09e77b42
commit
b1b9bd1b73
@ -35,7 +35,7 @@ public class Conf {
|
||||
public static ChatColor colorWar = ChatColor.DARK_RED;
|
||||
// Power
|
||||
public static double powerPlayerMax = 10.0;
|
||||
public static double powerPlayerMin = -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
|
||||
|
@ -11,7 +11,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class FLocation implements Serializable {
|
||||
private static final long serialVersionUID = -8292915234027387983L;
|
||||
private static final long serialVersionUID = - 8292915234027387983L;
|
||||
private static final boolean worldBorderSupport;
|
||||
|
||||
static {
|
||||
@ -64,7 +64,7 @@ public class FLocation implements Serializable {
|
||||
//----------------------------------------------//
|
||||
|
||||
public static FLocation fromString(String string) {
|
||||
int index = string.indexOf(",", 0);
|
||||
int index = string.indexOf(",");
|
||||
int start = 1;
|
||||
String worldName = string.substring(start, index);
|
||||
start = index + 1;
|
||||
@ -99,10 +99,6 @@ public class FLocation implements Serializable {
|
||||
return regionVal << 5; // "<< 5" == "* 32"
|
||||
}
|
||||
|
||||
public Chunk getChunk(){
|
||||
return Bukkit.getWorld(worldName).getChunkAt(x, z);
|
||||
}
|
||||
|
||||
public static HashSet<FLocation> getArea(FLocation from, FLocation to) {
|
||||
HashSet<FLocation> ret = new HashSet<>();
|
||||
|
||||
@ -115,6 +111,10 @@ public class FLocation implements Serializable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Chunk getChunk() {
|
||||
return Bukkit.getWorld(worldName).getChunkAt(x, z);
|
||||
}
|
||||
|
||||
public String getWorldName() {
|
||||
return worldName;
|
||||
}
|
||||
@ -191,7 +191,7 @@ public class FLocation implements Serializable {
|
||||
* @return whether this location is outside of the border
|
||||
*/
|
||||
public boolean isOutsideWorldBorder(int buffer) {
|
||||
if (!worldBorderSupport) {
|
||||
if (! worldBorderSupport) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class FLocation implements Serializable {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof FLocation)) {
|
||||
if (! (obj instanceof FLocation)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ import java.net.URL;
|
||||
* @author Sam Jakob Harker, Brianna Hazel O'Keefe
|
||||
* @version 3.0
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
@SuppressWarnings ("all")
|
||||
public class MassiveStats implements Listener {
|
||||
|
||||
/* START: MASSIVESTATS SETTINGS */
|
||||
@ -224,7 +224,7 @@ public class MassiveStats implements Listener {
|
||||
}
|
||||
|
||||
// and only notify operators - or players with the correct permission.
|
||||
if (!event.getPlayer().isOp() && !event.getPlayer().hasPermission(MassiveStats.MASSIVE_UPDATE_PERMISSION)) {
|
||||
if (! event.getPlayer().isOp() && ! event.getPlayer().hasPermission(MassiveStats.MASSIVE_UPDATE_PERMISSION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ class MassiveStatsUpdateTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
@SuppressWarnings ("all")
|
||||
public void run() {
|
||||
try {
|
||||
// Generate the request payload and serialize it as JSON.
|
||||
@ -431,7 +431,7 @@ class MassiveStatsDataRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
@SuppressWarnings ("all")
|
||||
public String serialize() {
|
||||
//return object.toString();
|
||||
try {
|
||||
@ -446,7 +446,7 @@ class MassiveStatsDataRequest {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings ("unused")
|
||||
final class MassiveStatsDataResponse {
|
||||
|
||||
private final boolean isUpToDate;
|
||||
@ -456,7 +456,7 @@ final class MassiveStatsDataResponse {
|
||||
MassiveStatsDataResponse(boolean isUpToDate, String newVersion, String updateMessage) {
|
||||
this.isUpToDate = isUpToDate;
|
||||
|
||||
if (!isUpToDate) {
|
||||
if (! isUpToDate) {
|
||||
this.newVersion = newVersion;
|
||||
this.updateMessage = updateMessage;
|
||||
return;
|
||||
|
@ -60,7 +60,12 @@ public class SavageFactions extends MPlugin {
|
||||
public boolean mc113 = false;
|
||||
public boolean useNonPacketParticles = false;
|
||||
public boolean factionsFlight = false;
|
||||
|
||||
//multiversion material fields
|
||||
public Material SUGAR_CANE_BLOCK, BANNER, CROPS, REDSTONE_LAMP_ON,
|
||||
STAINED_GLASS, STATIONARY_WATER, STAINED_CLAY, WOOD_BUTTON,
|
||||
SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE,
|
||||
WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF,
|
||||
DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL;
|
||||
// Persistence related
|
||||
private boolean locked = false;
|
||||
private Integer AutoLeaveTask = null;
|
||||
@ -68,7 +73,6 @@ public class SavageFactions extends MPlugin {
|
||||
private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
|
||||
private boolean mvdwPlaceholderAPIManager = false;
|
||||
|
||||
|
||||
public SavageFactions() {
|
||||
plugin = this;
|
||||
}
|
||||
@ -141,7 +145,7 @@ public class SavageFactions extends MPlugin {
|
||||
setupMultiversionMaterials();
|
||||
log("==== End Setup ====");
|
||||
|
||||
if (!preEnable()) {
|
||||
if (! preEnable()) {
|
||||
return;
|
||||
}
|
||||
this.loadSuccessful = false;
|
||||
@ -189,8 +193,6 @@ public class SavageFactions extends MPlugin {
|
||||
new MassiveStats(this);
|
||||
|
||||
|
||||
|
||||
|
||||
if (version > 8) {
|
||||
useNonPacketParticles = true;
|
||||
SavageFactions.plugin.log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||
@ -201,7 +203,6 @@ public class SavageFactions extends MPlugin {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Register Event Handlers
|
||||
getServer().getPluginManager().registerEvents(new FactionsPlayerListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new FactionsChatListener(this), this);
|
||||
@ -229,14 +230,6 @@ public class SavageFactions extends MPlugin {
|
||||
this.loadSuccessful = true;
|
||||
}
|
||||
|
||||
|
||||
//multiversion material fields
|
||||
public Material SUGAR_CANE_BLOCK, BANNER, CROPS, REDSTONE_LAMP_ON,
|
||||
STAINED_GLASS, STATIONARY_WATER, STAINED_CLAY, WOOD_BUTTON,
|
||||
SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE,
|
||||
WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF,
|
||||
DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL;
|
||||
|
||||
private void setupMultiversionMaterials() {
|
||||
if (mc113) {
|
||||
BANNER = Material.valueOf("LEGACY_BANNER");
|
||||
@ -263,7 +256,7 @@ public class SavageFactions extends MPlugin {
|
||||
FIREBALL = Material.valueOf("LEGACY_FIREBALL");
|
||||
|
||||
} else {
|
||||
if (!mc17) {
|
||||
if (! mc17) {
|
||||
BANNER = Material.valueOf("BANNER");
|
||||
}
|
||||
CROPS = Material.valueOf("CROPS");
|
||||
@ -427,7 +420,7 @@ public class SavageFactions extends MPlugin {
|
||||
|
||||
public void startAutoLeaveTask(boolean restartIfRunning) {
|
||||
if (AutoLeaveTask != null) {
|
||||
if (!restartIfRunning) {
|
||||
if (! restartIfRunning) {
|
||||
return;
|
||||
}
|
||||
this.getServer().getScheduler().cancelTask(AutoLeaveTask);
|
||||
@ -547,7 +540,7 @@ public class SavageFactions extends MPlugin {
|
||||
// TODO: GET THIS BACK AND WORKING
|
||||
|
||||
public boolean isFactionsCommand(String check) {
|
||||
return !(check == null || check.isEmpty()) && this.handleCommand(null, check, true);
|
||||
return ! (check == null || check.isEmpty()) && this.handleCommand(null, check, true);
|
||||
}
|
||||
|
||||
// Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat
|
||||
@ -569,7 +562,7 @@ public class SavageFactions extends MPlugin {
|
||||
}
|
||||
|
||||
// if listener isn't set, or config option is disabled, give back uncolored tag
|
||||
if (listener == null || !Conf.chatTagRelationColored) {
|
||||
if (listener == null || ! Conf.chatTagRelationColored) {
|
||||
tag = me.getChatTag().trim();
|
||||
} else {
|
||||
FPlayer you = FPlayers.getInstance().getByPlayer(listener);
|
||||
@ -648,7 +641,7 @@ public class SavageFactions extends MPlugin {
|
||||
}
|
||||
|
||||
public String getPrimaryGroup(OfflinePlayer player) {
|
||||
return perms == null || !perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player);
|
||||
return perms == null || ! perms.hasGroupSupport() ? " " : perms.getPrimaryGroup(Bukkit.getWorlds().get(0).toString(), player);
|
||||
}
|
||||
|
||||
public void debug(Level level, String s) {
|
||||
|
@ -40,7 +40,7 @@ public class CmdAdmin extends FCommand {
|
||||
boolean permAny = Permission.ADMIN_ANY.has(sender, false);
|
||||
Faction targetFaction = fyou.getFaction();
|
||||
|
||||
if (targetFaction != myFaction && !permAny) {
|
||||
if (targetFaction != myFaction && ! permAny) {
|
||||
msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true));
|
||||
return;
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class CmdAdmin extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fyou == fme && !permAny) {
|
||||
if (fyou == fme && ! permAny) {
|
||||
msg(TL.COMMAND_ADMIN_TARGETSELF);
|
||||
return;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class CmdAutoClaim extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fme.canClaimForFaction(forFaction)) {
|
||||
if (! fme.canClaimForFaction(forFaction)) {
|
||||
if (myFaction == forFaction) {
|
||||
msg(TL.COMMAND_AUTOCLAIM_REQUIREDRANK, Role.MODERATOR.getTranslation());
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ public class CmdBan extends FCommand {
|
||||
public void perform() {
|
||||
|
||||
// Adds bypass to admins and clean permission check
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
|
@ -33,7 +33,7 @@ public class CmdBanlist extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction target = myFaction;
|
||||
if (!args.isEmpty()) {
|
||||
if (! args.isEmpty()) {
|
||||
target = argAsFaction(0);
|
||||
}
|
||||
|
||||
|
@ -27,17 +27,17 @@ public class CmdBoom extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!myFaction.isPeaceful()) {
|
||||
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)) {
|
||||
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();
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class CmdBypass extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
fme.setIsAdminBypassing(this.argAsBool(0, !fme.isAdminBypassing()));
|
||||
fme.setIsAdminBypassing(this.argAsBool(0, ! fme.isAdminBypassing()));
|
||||
|
||||
// TODO: Move this to a transient field in the model??
|
||||
if (fme.isAdminBypassing()) {
|
||||
|
@ -28,7 +28,7 @@ public class CmdChat extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!Conf.factionOnlyChat) {
|
||||
if (! Conf.factionOnlyChat) {
|
||||
msg(TL.COMMAND_CHAT_DISABLED.toString());
|
||||
return;
|
||||
}
|
||||
@ -41,7 +41,7 @@ public class CmdChat extends FCommand {
|
||||
// Only allow Mods and higher rank to switch to this channel.
|
||||
if (modeString.startsWith("m") && fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
modeTarget = ChatMode.MOD;
|
||||
} else if (modeString.startsWith("m") && !fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
} else if (modeString.startsWith("m") && ! fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
msg(TL.COMMAND_CHAT_MOD_ONLY);
|
||||
return;
|
||||
} else if (modeString.startsWith("p")) {
|
||||
|
@ -24,7 +24,7 @@ public class CmdChatSpy extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
fme.setSpyingChat(this.argAsBool(0, !fme.isSpyingChat()));
|
||||
fme.setSpyingChat(this.argAsBool(0, ! fme.isSpyingChat()));
|
||||
|
||||
if (fme.isSpyingChat()) {
|
||||
fme.msg(TL.COMMAND_CHATSPY_ENABLE);
|
||||
|
@ -33,7 +33,7 @@ public class CmdChest extends FCommand {
|
||||
return;
|
||||
}
|
||||
// This permission check is way too explicit but it's clean
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
|
@ -37,7 +37,7 @@ public class CmdClaim extends FCommand {
|
||||
int radius = this.argAsInt(0, 1); // Default to 1
|
||||
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
if (! fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory");
|
||||
@ -56,7 +56,7 @@ public class CmdClaim extends FCommand {
|
||||
fme.attemptClaim(forFaction, me.getLocation(), true);
|
||||
} else {
|
||||
// radius claim
|
||||
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
|
||||
if (! Permission.CLAIM_RADIUS.has(sender, false)) {
|
||||
msg(TL.COMMAND_CLAIM_DENIED);
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class CmdColeader extends FCommand {
|
||||
boolean permAny = Permission.COLEADER_ANY.has(sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
|
||||
if (targetFaction != myFaction && !permAny) {
|
||||
if (targetFaction != myFaction && ! permAny) {
|
||||
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
|
||||
return;
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class CmdColeader extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == fme && !permAny) {
|
||||
if (you == fme && ! permAny) {
|
||||
msg(TL.COMMAND_COLEADER_SELF);
|
||||
return;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class CmdConfig extends FCommand {
|
||||
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)) {
|
||||
@ -192,7 +192,7 @@ public class CmdConfig extends FCommand {
|
||||
|
||||
// Set<String>
|
||||
else if (innerType == String.class) {
|
||||
@SuppressWarnings("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
|
||||
@SuppressWarnings ("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
|
||||
|
||||
// String already present, so remove it
|
||||
if (stringSet.contains(value.toString())) {
|
||||
@ -228,7 +228,7 @@ public class CmdConfig extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!success.isEmpty()) {
|
||||
if (! success.isEmpty()) {
|
||||
if (sender instanceof Player) {
|
||||
sendMessage(success);
|
||||
SavageFactions.plugin.log(success + TL.COMMAND_CONFIG_LOG.format((Player) sender));
|
||||
|
@ -16,7 +16,7 @@ public class CmdConvert extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!(this.sender instanceof ConsoleCommandSender)) {
|
||||
if (! (this.sender instanceof ConsoleCommandSender)) {
|
||||
this.sender.sendMessage(TL.GENERIC_CONSOLEONLY.toString());
|
||||
}
|
||||
Backend nb = Backend.valueOf(this.argAsString(0).toUpperCase());
|
||||
|
@ -52,7 +52,7 @@ public class CmdCreate extends FCommand {
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
if (! canAffordCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ public class CmdCreate extends FCommand {
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
|
||||
if (! payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class CmdDeinvite extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
FPlayer you = this.argAsBestFPlayerMatch(0);
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
|
@ -23,7 +23,7 @@ public class CmdDelFWarp extends FCommand {
|
||||
public void perform() {
|
||||
String warp = argAsString(0);
|
||||
if (myFaction.isWarp(warp)) {
|
||||
if (!transact(fme)) {
|
||||
if (! transact(fme)) {
|
||||
return;
|
||||
}
|
||||
myFaction.removeWarp(warp);
|
||||
|
@ -4,6 +4,6 @@ public class CmdDemote extends FPromoteCommand {
|
||||
|
||||
public CmdDemote() {
|
||||
aliases.add("demote");
|
||||
this.relative = -1;
|
||||
this.relative = - 1;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class CmdDescription extends FCommand {
|
||||
@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)) {
|
||||
if (! payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public class CmdDescription extends FCommand {
|
||||
// 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) {
|
||||
if (! Conf.broadcastDescriptionChanges) {
|
||||
fme.msg(TL.COMMAND_DESCRIPTION_CHANGED, myFaction.describeTo(fme));
|
||||
fme.sendMessage(myFaction.getDescription());
|
||||
return;
|
||||
|
@ -31,7 +31,7 @@ public class CmdFWarp extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
//TODO: check if in combat.
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
@ -54,13 +54,13 @@ public class CmdFWarp extends FCommand {
|
||||
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)) {
|
||||
if (myFaction.hasWarpPassword(warpName) && ! myFaction.isWarpPassword(warpName, passwordAttempt)) {
|
||||
fme.msg(TL.COMMAND_FWARP_INVALID_PASSWORD);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check transaction AFTER password check.
|
||||
if (!transact(fme)) {
|
||||
if (! transact(fme)) {
|
||||
return;
|
||||
}
|
||||
final FPlayer fPlayer = fme;
|
||||
|
@ -23,8 +23,8 @@ 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 int id = - 1;
|
||||
public static int flyid = - 1;
|
||||
|
||||
public CmdFly() {
|
||||
super();
|
||||
@ -51,7 +51,7 @@ public class CmdFly extends FCommand {
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (!player.isFlying()) {
|
||||
if (! player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
if (! SavageFactions.plugin.mc17) {
|
||||
@ -72,15 +72,15 @@ public class CmdFly extends FCommand {
|
||||
// 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);
|
||||
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);
|
||||
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;
|
||||
id = - 1;
|
||||
}
|
||||
}
|
||||
}, 10L, 3L);
|
||||
@ -100,7 +100,7 @@ public class CmdFly extends FCommand {
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (!player.isFlying()) {
|
||||
if (! player.isFlying()) {
|
||||
continue;
|
||||
}
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
@ -125,7 +125,7 @@ public class CmdFly extends FCommand {
|
||||
FLocation myFloc = new FLocation(player.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myFloc);
|
||||
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
|
||||
if (!checkBypassPerms(fPlayer, player, toFac)) {
|
||||
if (! checkBypassPerms(fPlayer, player, toFac)) {
|
||||
fPlayer.setFlying(false);
|
||||
flyMap.remove(name);
|
||||
continue;
|
||||
@ -141,25 +141,25 @@ public class CmdFly extends FCommand {
|
||||
|
||||
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()) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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)) {
|
||||
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;
|
||||
}
|
||||
@ -177,7 +177,7 @@ public class CmdFly extends FCommand {
|
||||
public static void checkTaskState() {
|
||||
if (flyMap.keySet().size() == 0) {
|
||||
Bukkit.getScheduler().cancelTask(flyid);
|
||||
flyid = -1;
|
||||
flyid = - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,14 +195,14 @@ public class CmdFly extends FCommand {
|
||||
|
||||
FLocation myfloc = new FLocation(me.getLocation());
|
||||
Faction toFac = Board.getInstance().getFactionAt(myfloc);
|
||||
if (!checkBypassPerms(fme, me, toFac)) return;
|
||||
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) {
|
||||
for (int i = 0; i <= entities.size() - 1; ++ i) {
|
||||
if (entities.get(i) instanceof Player) {
|
||||
Player eplayer = (Player)entities.get(i);
|
||||
Player eplayer = (Player) entities.get(i);
|
||||
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
|
||||
if (efplayer.getRelationTo(this.fme) == Relation.ENEMY && !efplayer.isStealthEnabled()) {
|
||||
if (efplayer.getRelationTo(this.fme) == Relation.ENEMY && ! efplayer.isStealthEnabled()) {
|
||||
this.fme.msg(TL.COMMAND_FLY_CHECK_ENEMY);
|
||||
return;
|
||||
}
|
||||
@ -210,14 +210,14 @@ public class CmdFly extends FCommand {
|
||||
}
|
||||
|
||||
if (args.size() == 0) {
|
||||
toggleFlight(!fme.isFlying(), me);
|
||||
toggleFlight(! fme.isFlying(), me);
|
||||
} else if (args.size() == 1) {
|
||||
toggleFlight(argAsBool(0), me);
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleFlight(final boolean toggle, final Player player) {
|
||||
if (!toggle) {
|
||||
if (! toggle) {
|
||||
fme.setFlying(false);
|
||||
flyMap.remove(player.getName());
|
||||
return;
|
||||
@ -230,12 +230,12 @@ public class CmdFly extends FCommand {
|
||||
public void run() {
|
||||
fme.setFlying(true);
|
||||
flyMap.put(player.getName(), true);
|
||||
if (id == -1) {
|
||||
if (id == - 1) {
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
|
||||
startParticles();
|
||||
}
|
||||
}
|
||||
if (flyid == -1) {
|
||||
if (flyid == - 1) {
|
||||
startFlyCheck();
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class CmdGetVault extends FCommand {
|
||||
|
||||
//has enough money?
|
||||
int amount = SavageFactions.plugin.getConfig().getInt("fvault.Price");
|
||||
if (!fme.hasMoney(amount)) {
|
||||
if (! fme.hasMoney(amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,16 +40,16 @@ public class CmdHome extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
// TODO: Hide this command on help also.
|
||||
if (!Conf.homesEnabled) {
|
||||
if (! Conf.homesEnabled) {
|
||||
fme.msg(TL.COMMAND_HOME_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.homesTeleportCommandEnabled) {
|
||||
if (! Conf.homesTeleportCommandEnabled) {
|
||||
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
|
||||
return;
|
||||
}
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
@ -58,18 +58,18 @@ public class CmdHome extends FCommand {
|
||||
}
|
||||
|
||||
|
||||
if (!myFaction.hasHome()) {
|
||||
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()) {
|
||||
if (! Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
|
||||
fme.msg(TL.COMMAND_HOME_INENEMY);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
|
||||
if (! Conf.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
|
||||
fme.msg(TL.COMMAND_HOME_WRONGWORLD);
|
||||
return;
|
||||
}
|
||||
@ -79,15 +79,15 @@ public class CmdHome extends FCommand {
|
||||
|
||||
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
|
||||
if (Conf.homesTeleportAllowedEnemyDistance > 0 &&
|
||||
!faction.isSafeZone() &&
|
||||
(!fme.isInOwnTerritory() || (fme.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
|
||||
! faction.isSafeZone() &&
|
||||
(! fme.isInOwnTerritory() || (fme.isInOwnTerritory() && ! Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
|
||||
World w = loc.getWorld();
|
||||
double x = loc.getX();
|
||||
double y = loc.getY();
|
||||
double z = loc.getZ();
|
||||
|
||||
for (Player p : me.getServer().getOnlinePlayers()) {
|
||||
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w) {
|
||||
if (p == null || ! p.isOnline() || p.isDead() || p == me || p.getWorld() != w) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ public class CmdHome extends FCommand {
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
if (! payForCommand(Conf.econCostHome, TL.COMMAND_HOME_TOTELEPORT.toString(), TL.COMMAND_HOME_FORTELEPORT.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -44,11 +44,11 @@ public class CmdInvite extends FCommand {
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
if (! payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
|
@ -35,12 +35,12 @@ public class CmdJoin extends FCommand {
|
||||
FPlayer fplayer = this.argAsBestFPlayerMatch(1, fme, false);
|
||||
boolean samePlayer = fplayer == fme;
|
||||
|
||||
if (!samePlayer && !Permission.JOIN_OTHERS.has(sender, false)) {
|
||||
if (! samePlayer && ! Permission.JOIN_OTHERS.has(sender, false)) {
|
||||
msg(TL.COMMAND_JOIN_CANNOTFORCE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!faction.isNormal()) {
|
||||
if (! faction.isNormal()) {
|
||||
msg(TL.COMMAND_JOIN_SYSTEMFACTION);
|
||||
return;
|
||||
}
|
||||
@ -62,12 +62,12 @@ public class CmdJoin extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.canLeaveWithNegativePower && fplayer.getPower() < 0) {
|
||||
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))) {
|
||||
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));
|
||||
@ -76,12 +76,12 @@ public class CmdJoin extends FCommand {
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
if (samePlayer && ! canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for ban
|
||||
if (!fme.isAdminBypassing() && faction.isBanned(fme)) {
|
||||
if (! fme.isAdminBypassing() && faction.isBanned(fme)) {
|
||||
fme.msg(TL.COMMAND_JOIN_BANNED, faction.getTag(fme));
|
||||
return;
|
||||
}
|
||||
@ -94,13 +94,13 @@ public class CmdJoin extends FCommand {
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (samePlayer && !payForCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString(), TL.COMMAND_JOIN_FORJOIN.toString())) {
|
||||
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));
|
||||
|
||||
if (!samePlayer) {
|
||||
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));
|
||||
|
@ -78,7 +78,7 @@ public class CmdKick extends FCommand {
|
||||
// - 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()) {
|
||||
if (! fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
|
||||
@ -92,14 +92,14 @@ public class CmdKick extends FCommand {
|
||||
msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
|
||||
return;
|
||||
}
|
||||
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
|
||||
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())) {
|
||||
if (! canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public class CmdKick extends FCommand {
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
|
||||
if (! payForCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString(), TL.COMMAND_KICK_FORKICK.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class CmdList extends FCommand {
|
||||
@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")) {
|
||||
if (! payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class CmdList extends FCommand {
|
||||
factionList.remove(Factions.getInstance().getWarZone());
|
||||
|
||||
// remove exempt factions
|
||||
if (!fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||
if (! fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||
List<String> exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt");
|
||||
Iterator<Faction> factionIterator = factionList.iterator();
|
||||
while (factionIterator.hasNext()) {
|
||||
@ -71,7 +71,7 @@ public class CmdList extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -86,7 +86,7 @@ public class CmdList extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class CmdLock extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
p.setLocked(this.argAsBool(0, !p.getLocked()));
|
||||
p.setLocked(this.argAsBool(0, ! p.getLocked()));
|
||||
msg(p.getLocked() ? TL.COMMAND_LOCK_LOCKED : TL.COMMAND_LOCK_UNLOCKED);
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ public class CmdLogins extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
boolean monitor = fme.isMonitoringJoins();
|
||||
fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor));
|
||||
fme.setMonitorJoins(!monitor);
|
||||
fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(! monitor));
|
||||
fme.setMonitorJoins(! monitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,11 +29,11 @@ public class CmdMap extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
if (this.argIsSet(0)) {
|
||||
if (this.argAsBool(0, !fme.isMapAutoUpdating())) {
|
||||
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")) {
|
||||
if (! payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public class CmdMap extends FCommand {
|
||||
}
|
||||
} 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)) {
|
||||
if (! payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class CmdMod extends FCommand {
|
||||
|
||||
boolean permAny = Permission.MOD_ANY.has(sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
if (targetFaction != myFaction && !permAny) {
|
||||
if (targetFaction != myFaction && ! permAny) {
|
||||
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
|
||||
return;
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class CmdMod extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == fme && !permAny) {
|
||||
if (you == fme && ! permAny) {
|
||||
msg(TL.COMMAND_MOD_SELF);
|
||||
return;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class CmdMoneyBalance extends FCommand {
|
||||
if (faction == null) {
|
||||
return;
|
||||
}
|
||||
if (faction != myFaction && !Permission.MONEY_BALANCE_ANY.has(sender, true)) {
|
||||
if (faction != myFaction && ! Permission.MONEY_BALANCE_ANY.has(sender, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,11 @@ public class CmdOpen extends FCommand {
|
||||
@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)) {
|
||||
if (! payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
|
||||
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();
|
||||
|
||||
|
@ -31,16 +31,16 @@ public class CmdOwner extends FCommand {
|
||||
public void perform() {
|
||||
boolean hasBypass = fme.isAdminBypassing();
|
||||
|
||||
if (!hasBypass && !assertHasFaction()) {
|
||||
if (! hasBypass && ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.ownedAreasEnabled) {
|
||||
if (! Conf.ownedAreasEnabled) {
|
||||
fme.msg(TL.COMMAND_OWNER_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
|
||||
if (! hasBypass && Conf.ownedAreasLimitPerFaction > 0 && myFaction.getCountOfClaimsWithOwners() >= Conf.ownedAreasLimitPerFaction) {
|
||||
fme.msg(TL.COMMAND_OWNER_LIMIT, Conf.ownedAreasLimitPerFaction);
|
||||
return;
|
||||
}
|
||||
@ -53,12 +53,12 @@ public class CmdOwner extends FCommand {
|
||||
|
||||
Faction factionHere = Board.getInstance().getFactionAt(flocation);
|
||||
if (factionHere != myFaction) {
|
||||
if (!factionHere.isNormal()) {
|
||||
if (! factionHere.isNormal()) {
|
||||
fme.msg(TL.COMMAND_OWNER_NOTCLAIMED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasBypass) {
|
||||
if (! hasBypass) {
|
||||
fme.msg(TL.COMMAND_OWNER_WRONGFACTION);
|
||||
return;
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class CmdOwner extends FCommand {
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
if (! payForCommand(Conf.econCostOwner, TL.COMMAND_OWNER_TOSET, TL.COMMAND_OWNER_FORSET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,11 @@ public class CmdOwnerList extends FCommand {
|
||||
public void perform() {
|
||||
boolean hasBypass = fme.isAdminBypassing();
|
||||
|
||||
if (!hasBypass && !assertHasFaction()) {
|
||||
if (! hasBypass && ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.ownedAreasEnabled) {
|
||||
if (! Conf.ownedAreasEnabled) {
|
||||
fme.msg(TL.COMMAND_OWNERLIST_DISABLED);
|
||||
return;
|
||||
}
|
||||
@ -42,13 +42,13 @@ public class CmdOwnerList extends FCommand {
|
||||
FLocation flocation = new FLocation(fme);
|
||||
|
||||
if (Board.getInstance().getFactionAt(flocation) != myFaction) {
|
||||
if (!hasBypass) {
|
||||
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()) {
|
||||
if (! myFaction.isNormal()) {
|
||||
fme.msg(TL.COMMAND_OWNERLIST_NOTCLAIMED);
|
||||
return;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.massivecraft.factions.SavageFactions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdPaypalSee extends FCommand{
|
||||
public class CmdPaypalSee extends FCommand {
|
||||
public CmdPaypalSee() {
|
||||
aliases.add("seepaypal");
|
||||
aliases.add("getpaypal");
|
||||
@ -27,7 +27,7 @@ public class CmdPaypalSee extends FCommand{
|
||||
String paypal = argAsString(1);
|
||||
|
||||
if (faction != null) {
|
||||
if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) {
|
||||
if (! faction.isWilderness() && ! faction.isSafeZone() && ! faction.isWarZone()) {
|
||||
if (faction.getPaypal() != null) {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
|
||||
} else {
|
||||
|
@ -4,7 +4,7 @@ import com.massivecraft.factions.SavageFactions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdPaypalSet extends FCommand{
|
||||
public class CmdPaypalSet extends FCommand {
|
||||
|
||||
public CmdPaypalSet() {
|
||||
this.aliases.add("setpaypal");
|
||||
|
@ -32,12 +32,12 @@ public class CmdPower extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target != fme && !Permission.POWER_ANY.has(sender, true)) {
|
||||
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)) {
|
||||
if (! payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class CmdPowerBoost extends FCommand {
|
||||
|
||||
int roundedPower = (int) Math.round(targetPower);
|
||||
msg(TL.COMMAND_POWERBOOST_BOOST, target, roundedPower);
|
||||
if (!senderIsConsole) {
|
||||
if (! senderIsConsole) {
|
||||
SavageFactions.plugin.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class CmdSB extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
boolean toggleTo = !fme.showScoreboard();
|
||||
boolean toggleTo = ! fme.showScoreboard();
|
||||
FScoreboard board = FScoreboard.get(fme);
|
||||
if (board == null) {
|
||||
me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString());
|
||||
|
@ -23,7 +23,7 @@ public class CmdSeeChunk extends FCommand {
|
||||
private boolean useParticles;
|
||||
private int length;
|
||||
private ParticleEffect effect;
|
||||
private int taskID = -1;
|
||||
private int taskID = - 1;
|
||||
|
||||
|
||||
//I remade it cause of people getting mad that I had the same seechunk as drtshock
|
||||
@ -62,10 +62,10 @@ public class CmdSeeChunk extends FCommand {
|
||||
}
|
||||
|
||||
private void manageTask() {
|
||||
if (taskID != -1) {
|
||||
if (taskID != - 1) {
|
||||
if (seeChunkMap.keySet().size() == 0) {
|
||||
Bukkit.getScheduler().cancelTask(taskID);
|
||||
taskID = -1;
|
||||
taskID = - 1;
|
||||
}
|
||||
} else {
|
||||
startTask();
|
||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class CmdSetBanner extends FCommand {
|
||||
|
||||
@ -20,7 +19,7 @@ public class CmdSetBanner extends FCommand {
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if (!me.getItemInHand().getType().toString().contains("BANNER")) {
|
||||
if (! me.getItemInHand().getType().toString().contains("BANNER")) {
|
||||
fme.msg(TL.COMMAND_SETBANNER_NOTBANNER);
|
||||
return;
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ public class CmdSetFWarp extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!(fme.getRelationToLocation() == Relation.MEMBER)) {
|
||||
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()) {
|
||||
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");
|
||||
@ -52,7 +52,7 @@ public class CmdSetFWarp extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!transact(fme)) {
|
||||
if (! transact(fme)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class CmdSetMaxVaults extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
Faction targetFaction = argAsFaction(0);
|
||||
int value = argAsInt(1, -1);
|
||||
int value = argAsInt(1, - 1);
|
||||
if (value < 0) {
|
||||
sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@ public class CmdSethome extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!Conf.homesEnabled) {
|
||||
if (! Conf.homesEnabled) {
|
||||
fme.msg(TL.COMMAND_SETHOME_DISABLED);
|
||||
return;
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class CmdSethome extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
@ -49,7 +49,7 @@ public class CmdSethome extends FCommand {
|
||||
}
|
||||
|
||||
// Can the player set the faction home HERE?
|
||||
if (!Permission.BYPASS.has(me) &&
|
||||
if (! Permission.BYPASS.has(me) &&
|
||||
Conf.homesMustBeInClaimedTerritory &&
|
||||
Board.getInstance().getFactionAt(new FLocation(me)) != faction) {
|
||||
fme.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
|
||||
@ -57,7 +57,7 @@ public class CmdSethome extends FCommand {
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
if (! payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,14 +54,14 @@ public class CmdShow extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")
|
||||
if (fme != null && ! fme.getPlayer().hasPermission("factions.show.bypassexempt")
|
||||
&& SavageFactions.plugin.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)) {
|
||||
if (! payForCommand(Conf.econCostShow, TL.COMMAND_SHOW_TOSHOW, TL.COMMAND_SHOW_FORSHOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public class CmdShow extends FCommand {
|
||||
show = defaults;
|
||||
}
|
||||
|
||||
if (!faction.isNormal()) {
|
||||
if (! faction.isNormal()) {
|
||||
String tag = faction.getTag(fme);
|
||||
// send header and that's all
|
||||
String header = show.get(0);
|
||||
@ -99,7 +99,7 @@ public class CmdShow extends FCommand {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {
|
||||
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();
|
||||
|
@ -21,8 +21,8 @@ public class CmdStealth extends FCommand {
|
||||
|
||||
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());
|
||||
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);
|
||||
|
@ -44,7 +44,7 @@ public class CmdStuck extends FCommand {
|
||||
} 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()))) {
|
||||
if (! payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class CmdStuck extends FCommand {
|
||||
FLocation chunk = currentFLocation();
|
||||
Faction faction = board.getFactionAt(chunk);
|
||||
int buffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0);
|
||||
if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) {
|
||||
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);
|
||||
@ -82,7 +82,7 @@ public class CmdStuck extends FCommand {
|
||||
msg(TL.COMMAND_STUCK_TELEPORT, tp.getBlockX(), tp.getBlockY(), tp.getBlockZ());
|
||||
SavageFactions.plugin.getTimers().remove(player.getUniqueId());
|
||||
SavageFactions.plugin.getStuckMap().remove(player.getUniqueId());
|
||||
if (!Essentials.handleTeleport(player, tp)) {
|
||||
if (! Essentials.handleTeleport(player, tp)) {
|
||||
player.teleport(tp);
|
||||
SavageFactions.plugin.debug("/f stuck used regular teleport, not essentials!");
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class CmdTag extends FCommand {
|
||||
String tag = this.argAsString(0);
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) {
|
||||
if (Factions.getInstance().isTagTaken(tag) && ! MiscUtil.getComparisonString(tag).equals(myFaction.getComparisonTag())) {
|
||||
msg(TL.COMMAND_TAG_TAKEN);
|
||||
return;
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class CmdTag extends FCommand {
|
||||
}
|
||||
|
||||
// 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())) {
|
||||
if (! canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class CmdTag extends FCommand {
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
|
||||
if (! payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ public class CmdTitle extends FCommand {
|
||||
args.remove(0);
|
||||
String title = TextUtil.implode(args, " ");
|
||||
|
||||
if (!canIAdministerYou(fme, you)) {
|
||||
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)) {
|
||||
if (! payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class CmdTnt extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
if (! fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.TNTBANK);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt bank");
|
||||
@ -46,7 +46,7 @@ public class CmdTnt extends FCommand {
|
||||
|
||||
if (args.size() == 2) {
|
||||
if (args.get(0).equalsIgnoreCase("add") || args.get(0).equalsIgnoreCase("a")) {
|
||||
int testNumber = -1;
|
||||
int testNumber = - 1;
|
||||
try {
|
||||
testNumber = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
@ -87,7 +87,7 @@ public class CmdTnt extends FCommand {
|
||||
|
||||
}
|
||||
if (args.get(0).equalsIgnoreCase("take") || args.get(0).equalsIgnoreCase("t")) {
|
||||
int testNumber = -1;
|
||||
int testNumber = - 1;
|
||||
try {
|
||||
testNumber = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
@ -105,11 +105,11 @@ public class CmdTnt extends FCommand {
|
||||
}
|
||||
int fullStacks = amount / 64;
|
||||
int remainderAmt = amount % 64;
|
||||
if ((remainderAmt == 0 && !hasAvaliableSlot(me, fullStacks))) {
|
||||
if ((remainderAmt == 0 && ! hasAvaliableSlot(me, fullStacks))) {
|
||||
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE);
|
||||
return;
|
||||
}
|
||||
if (!hasAvaliableSlot(me, fullStacks + 1)) {
|
||||
if (! hasAvaliableSlot(me, fullStacks + 1)) {
|
||||
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE);
|
||||
return;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class CmdTntFill extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!fme.isAdminBypassing()) {
|
||||
if (! fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.TNTFILL);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt fill");
|
||||
@ -54,7 +54,7 @@ public class CmdTntFill extends FCommand {
|
||||
msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", SavageFactions.plugin.getConfig().getInt("Tntfill.max-amount") + ""));
|
||||
return;
|
||||
}
|
||||
int testNumber = -1;
|
||||
int testNumber = - 1;
|
||||
try {
|
||||
testNumber = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
@ -78,8 +78,8 @@ public class CmdTntFill extends FCommand {
|
||||
if (canHold(dispenser, amount)) {
|
||||
int fullStacks = amount / 64;
|
||||
int remainderAmt = amount % 64;
|
||||
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) {
|
||||
if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
if (! inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) {
|
||||
if (! fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
|
||||
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + ""));
|
||||
me.updateInventory();
|
||||
@ -88,7 +88,7 @@ public class CmdTntFill extends FCommand {
|
||||
//msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
|
||||
bankMode = true;
|
||||
removeFromBank(amount);
|
||||
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) {
|
||||
if (! inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) {
|
||||
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
|
||||
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + ""));
|
||||
me.updateInventory();
|
||||
@ -124,7 +124,7 @@ public class CmdTntFill extends FCommand {
|
||||
}
|
||||
|
||||
private void removeFromBank(int amount) {
|
||||
int testNumber = -1;
|
||||
int testNumber = - 1;
|
||||
try {
|
||||
testNumber = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -30,7 +30,7 @@ public class CmdToggleAllianceChat extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!Conf.factionOnlyChat) {
|
||||
if (! Conf.factionOnlyChat) {
|
||||
msg(TL.COMMAND_CHAT_DISABLED.toString());
|
||||
return;
|
||||
}
|
||||
@ -38,6 +38,6 @@ public class CmdToggleAllianceChat extends FCommand {
|
||||
boolean ignoring = fme.isIgnoreAllianceChat();
|
||||
|
||||
msg(ignoring ? TL.COMMAND_TOGGLEALLIANCECHAT_UNIGNORE : TL.COMMAND_TOGGLEALLIANCECHAT_IGNORE);
|
||||
fme.setIgnoreAllianceChat(!ignoring);
|
||||
fme.setIgnoreAllianceChat(! ignoring);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class CmdTop extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class CmdTop extends FCommand {
|
||||
if (f1start > f2start) {
|
||||
return 1;
|
||||
} else if (f1start < f2start) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class CmdTop extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -96,7 +96,7 @@ public class CmdTop extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -110,7 +110,7 @@ public class CmdTop extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class CmdTop extends FCommand {
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
return - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class CmdUnban extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
@ -40,7 +40,7 @@ public class CmdUnban extends FCommand {
|
||||
return; // the above method sends a message if fails to find someone.
|
||||
}
|
||||
|
||||
if (!myFaction.isBanned(target)) {
|
||||
if (! myFaction.isBanned(target)) {
|
||||
fme.msg(TL.COMMAND_UNBAN_NOTBANNED, target.getName());
|
||||
return;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class CmdUnclaim extends FCommand {
|
||||
int radius = this.argAsInt(0, 1); // Default to 1
|
||||
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
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");
|
||||
@ -53,7 +53,7 @@ public class CmdUnclaim extends FCommand {
|
||||
unClaim(new FLocation(me));
|
||||
} else {
|
||||
// radius claim
|
||||
if (!Permission.CLAIM_RADIUS.has(sender, false)) {
|
||||
if (! Permission.CLAIM_RADIUS.has(sender, false)) {
|
||||
msg(TL.COMMAND_CLAIM_DENIED);
|
||||
return;
|
||||
}
|
||||
@ -133,11 +133,11 @@ public class CmdUnclaim extends FCommand {
|
||||
}
|
||||
|
||||
|
||||
if (!assertHasFaction()) {
|
||||
if (! assertHasFaction()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && !assertMinRole(Role.MODERATOR)) {
|
||||
if (targetFaction.getAccess(fme, PermissableAction.TERRITORY) != Access.ALLOW && ! assertMinRole(Role.MODERATOR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -158,11 +158,11 @@ public class CmdUnclaim extends FCommand {
|
||||
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())) {
|
||||
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())) {
|
||||
if (! Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIM_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIM_FORUNCLAIM.toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ public class CmdUnclaimall extends FCommand {
|
||||
if (Econ.shouldBeUsed()) {
|
||||
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
|
||||
if (!Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
if (! Econ.modifyMoney(myFaction, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
if (! Econ.modifyMoney(fme, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -62,12 +62,12 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isMoneyCommand && !Conf.econEnabled) {
|
||||
if (this.isMoneyCommand && ! Conf.econEnabled) {
|
||||
msg("<b>Faction economy features are disabled on this server.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isMoneyCommand && !Conf.bankEnabled) {
|
||||
if (this.isMoneyCommand && ! Conf.bankEnabled) {
|
||||
msg("<b>The faction bank system is disabled on this server.");
|
||||
return false;
|
||||
}
|
||||
@ -78,29 +78,29 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
||||
@Override
|
||||
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) {
|
||||
boolean superValid = super.validSenderType(sender, informSenderIfNot);
|
||||
if (!superValid) {
|
||||
if (! superValid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) {
|
||||
if (! (this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if (! (sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!fme.hasFaction()) {
|
||||
if (! fme.hasFaction()) {
|
||||
sender.sendMessage(p.txt.parse("<b>You are not member of any faction."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.senderMustBeModerator && !fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
if (this.senderMustBeModerator && ! fme.getRole().isAtLeast(Role.MODERATOR)) {
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction moderators can %s.", this.getHelpShort()));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)) {
|
||||
if (this.senderMustBeColeader && ! fme.getRole().isAtLeast(Role.COLEADER)) {
|
||||
sender.sendMessage(p.txt.parse("<b>Only faction coleaders can %s.", this.getHelpShort()));
|
||||
return false;
|
||||
}
|
||||
@ -123,7 +123,7 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!fme.hasFaction()) {
|
||||
if (! fme.hasFaction()) {
|
||||
sendMessage("You are not member of any faction.");
|
||||
return false;
|
||||
}
|
||||
@ -256,7 +256,7 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean canIAdministerYou(FPlayer i, FPlayer you) {
|
||||
if (!i.getFaction().equals(you.getFaction())) {
|
||||
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;
|
||||
}
|
||||
@ -290,14 +290,14 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
||||
|
||||
// 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()) {
|
||||
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);
|
||||
return Econ.modifyMoney(myFaction, - cost, toDoThis, forDoingThis);
|
||||
} else {
|
||||
return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis);
|
||||
return Econ.modifyMoney(fme, - cost, toDoThis, forDoingThis);
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ public abstract class FCommand extends MCommand<SavageFactions> {
|
||||
|
||||
// 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()) {
|
||||
if (! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -33,16 +33,16 @@ public class FPromoteCommand extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target.getFaction().equals(myFaction)) {
|
||||
if (! target.getFaction().equals(myFaction)) {
|
||||
msg(TL.COMMAND_PROMOTE_WRONGFACTION, target.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
Role current = target.getRole();
|
||||
Role promotion = Role.getRelative(current, +relative);
|
||||
Role promotion = Role.getRelative(current, + relative);
|
||||
|
||||
// Now it ain't that messy
|
||||
if (!fme.isAdminBypassing()) {
|
||||
if (! fme.isAdminBypassing()) {
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.PROMOTE);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_NOPERMISSION, "manage ranks");
|
||||
|
@ -37,7 +37,7 @@ public abstract class FRelationCommand extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!them.isNormal()) {
|
||||
if (! them.isNormal()) {
|
||||
msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
|
||||
return;
|
||||
}
|
||||
@ -64,7 +64,7 @@ public abstract class FRelationCommand extends FCommand {
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!payForCommand(targetRelation.getRelationCost(), TL.COMMAND_RELATIONS_TOMARRY, TL.COMMAND_RELATIONS_FORMARRY)) {
|
||||
if (! payForCommand(targetRelation.getRelationCost(), TL.COMMAND_RELATIONS_TOMARRY, TL.COMMAND_RELATIONS_FORMARRY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -88,12 +88,12 @@ public abstract class FRelationCommand extends FCommand {
|
||||
myFaction.msg(TL.COMMAND_RELATIONS_PROPOSAL_SENT, currentRelationColor + them.getTag(), "" + targetRelation.getColor() + targetRelation);
|
||||
}
|
||||
|
||||
if (!targetRelation.isNeutral() && them.isPeaceful()) {
|
||||
if (! targetRelation.isNeutral() && them.isPeaceful()) {
|
||||
them.msg(TL.COMMAND_RELATIONS_PEACEFUL);
|
||||
myFaction.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
|
||||
}
|
||||
|
||||
if (!targetRelation.isNeutral() && myFaction.isPeaceful()) {
|
||||
if (! targetRelation.isNeutral() && myFaction.isPeaceful()) {
|
||||
them.msg(TL.COMMAND_RELATIONS_PEACEFULOTHER);
|
||||
myFaction.msg(TL.COMMAND_RELATIONS_PEACEFUL);
|
||||
}
|
||||
@ -105,7 +105,7 @@ public abstract class FRelationCommand extends FCommand {
|
||||
private boolean hasMaxRelations(Faction them, Relation targetRelation) {
|
||||
int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), - 1);
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) {
|
||||
if (max != -1) {
|
||||
if (max != - 1) {
|
||||
if (myFaction.getRelationCount(targetRelation) >= max) {
|
||||
msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation());
|
||||
return true;
|
||||
|
@ -47,7 +47,7 @@ public class Econ {
|
||||
|
||||
SavageFactions.plugin.log("Economy integration through Vault plugin successful.");
|
||||
|
||||
if (!Conf.econEnabled) {
|
||||
if (! Conf.econEnabled) {
|
||||
SavageFactions.plugin.log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static void modifyUniverseMoney(double delta) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public class Econ {
|
||||
if (Conf.econUniverseAccount.length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (!econ.hasAccount(Conf.econUniverseAccount)) {
|
||||
if (! econ.hasAccount(Conf.econUniverseAccount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static void sendBalanceInfo(FPlayer to, EconomyParticipator about) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
|
||||
return;
|
||||
}
|
||||
@ -134,21 +134,21 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The amount must be positive.
|
||||
// If the amount is negative we must flip and multiply amount with -1.
|
||||
if (amount < 0) {
|
||||
amount *= -1;
|
||||
amount *= - 1;
|
||||
EconomyParticipator temp = from;
|
||||
from = to;
|
||||
to = temp;
|
||||
}
|
||||
|
||||
// Check the rights
|
||||
if (!canIControllYou(invoker, from)) {
|
||||
if (! canIControllYou(invoker, from)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
// Is there enough money for the transaction to happen?
|
||||
if (!econ.has(fromAcc, amount)) {
|
||||
if (! econ.has(fromAcc, amount)) {
|
||||
// There was not enough money to pay
|
||||
if (invoker != null && notify) {
|
||||
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
|
||||
@ -247,7 +247,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -270,8 +270,8 @@ public class Econ {
|
||||
affordable = true;
|
||||
}
|
||||
|
||||
if (!affordable) {
|
||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
||||
if (! affordable) {
|
||||
if (toDoThis != null && ! toDoThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), moneyString(delta), toDoThis);
|
||||
}
|
||||
return false;
|
||||
@ -280,7 +280,7 @@ public class Econ {
|
||||
}
|
||||
|
||||
public static boolean modifyMoney(EconomyParticipator ep, double delta, String toDoThis, String forDoingThis) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -308,14 +308,14 @@ public class Econ {
|
||||
// The account might not have enough space
|
||||
EconomyResponse er = econ.depositPlayer(acc, delta);
|
||||
if (er.transactionSuccess()) {
|
||||
modifyUniverseMoney(-delta);
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
modifyUniverseMoney(- delta);
|
||||
if (forDoingThis != null && ! forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// transfer to account failed
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
if (forDoingThis != null && ! forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> would have gained <h>%s<i> %s, but the deposit failed.", You, moneyString(delta), forDoingThis);
|
||||
}
|
||||
return false;
|
||||
@ -324,17 +324,17 @@ public class Econ {
|
||||
// The player should loose money
|
||||
// The player might not have enough.
|
||||
|
||||
if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
|
||||
if (econ.has(acc, - delta) && econ.withdrawPlayer(acc, - delta).transactionSuccess()) {
|
||||
// There is enough money to pay
|
||||
modifyUniverseMoney(-delta);
|
||||
if (forDoingThis != null && !forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(-delta), forDoingThis);
|
||||
modifyUniverseMoney(- delta);
|
||||
if (forDoingThis != null && ! forDoingThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(- delta), forDoingThis);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// There was not enough money to pay
|
||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(-delta), toDoThis);
|
||||
if (toDoThis != null && ! toDoThis.isEmpty()) {
|
||||
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(- delta), toDoThis);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -347,7 +347,7 @@ public class Econ {
|
||||
|
||||
// calculate the cost for claiming land
|
||||
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) {
|
||||
if (!shouldBeUsed()) {
|
||||
if (! shouldBeUsed()) {
|
||||
return 0d;
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ public class Econ {
|
||||
|
||||
public static boolean modifyBalance(String account, double amount) {
|
||||
if (amount < 0) {
|
||||
return econ.withdrawPlayer(account, -amount).transactionSuccess();
|
||||
return econ.withdrawPlayer(account, - amount).transactionSuccess();
|
||||
} else {
|
||||
return econ.depositPlayer(account, amount).transactionSuccess();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class Essentials {
|
||||
|
||||
// return false if feature is disabled or Essentials isn't available
|
||||
public static boolean handleTeleport(Player player, Location loc) {
|
||||
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) {
|
||||
if (! Conf.homesTeleportCommandEssentialsIntegration || essentials == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class Worldguard {
|
||||
|
||||
public static void init(Plugin plugin) {
|
||||
Plugin wgplug = plugin.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if (wgplug == null || !(wgplug instanceof WorldGuardPlugin)) {
|
||||
if (wgplug == null || ! (wgplug instanceof WorldGuardPlugin)) {
|
||||
enabled = false;
|
||||
wg = null;
|
||||
SavageFactions.plugin.log("Could not hook to WorldGuard. WorldGuard checks are disabled.");
|
||||
@ -55,7 +55,7 @@ public class Worldguard {
|
||||
// True: PVP is allowed
|
||||
// False: PVP is disallowed
|
||||
public static boolean isPVP(Player player) {
|
||||
if (!enabled) {
|
||||
if (! enabled) {
|
||||
// No WG hooks so we'll always bypass this check.
|
||||
return true;
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class Worldguard {
|
||||
// True: Player can build in the region.
|
||||
// False: Player can not build in the region.
|
||||
public static boolean playerCanBuild(Player player, Location loc) {
|
||||
if (!enabled) {
|
||||
if (! enabled) {
|
||||
// No WG hooks so we'll always bypass this check.
|
||||
return false;
|
||||
}
|
||||
@ -103,7 +103,7 @@ public class Worldguard {
|
||||
}
|
||||
|
||||
public static boolean checkForRegionsInChunk(Chunk chunk) {
|
||||
if (!enabled) {
|
||||
if (! enabled) {
|
||||
// No WG hooks so we'll always bypass this check.
|
||||
return false;
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class Worldguard {
|
||||
|
||||
try {
|
||||
overlaps = region.getIntersectingRegions(allregionslist);
|
||||
foundregions = overlaps != null && !overlaps.isEmpty();
|
||||
foundregions = overlaps != null && ! overlaps.isEmpty();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class EngineDynmap {
|
||||
public DynmapAPI dynmapApi;
|
||||
public MarkerAPI markerApi;
|
||||
public MarkerSet markerset;
|
||||
|
||||
private EngineDynmap() {
|
||||
}
|
||||
|
||||
@ -103,12 +104,12 @@ public class EngineDynmap {
|
||||
public void init() {
|
||||
Plugin dynmap = Bukkit.getServer().getPluginManager().getPlugin("dynmap");
|
||||
|
||||
if (dynmap == null || !dynmap.isEnabled()) {
|
||||
if (dynmap == null || ! dynmap.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Should we even use dynmap?
|
||||
if (!Conf.dynmapUse) {
|
||||
if (! Conf.dynmapUse) {
|
||||
if (this.markerset != null) {
|
||||
this.markerset.deleteMarkerSet();
|
||||
this.markerset = null;
|
||||
@ -125,12 +126,12 @@ public class EngineDynmap {
|
||||
final Map<String, TempAreaMarker> areas = createAreas();
|
||||
final Map<String, Set<String>> playerSets = createPlayersets();
|
||||
|
||||
if (!updateCore()) {
|
||||
if (! updateCore()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// createLayer() is thread safe but it makes use of fields set in updateCore() so we must have it after.
|
||||
if (!updateLayer(createLayer())) {
|
||||
if (! updateLayer(createLayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -170,7 +171,7 @@ public class EngineDynmap {
|
||||
ret.label = Conf.dynmapLayerName;
|
||||
ret.minimumZoom = Conf.dynmapLayerMinimumZoom;
|
||||
ret.priority = Conf.dynmapLayerPriority;
|
||||
ret.hideByDefault = !Conf.dynmapLayerVisible;
|
||||
ret.hideByDefault = ! Conf.dynmapLayerVisible;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -322,7 +323,7 @@ public class EngineDynmap {
|
||||
Map<String, TempAreaMarker> ret = new HashMap<>();
|
||||
|
||||
// If the faction is visible ...
|
||||
if (!isVisible(faction, world)) {
|
||||
if (! isVisible(faction, world)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -406,10 +407,10 @@ public class EngineDynmap {
|
||||
while ((currentX != initialX) || (currentZ != initialZ) || (direction != Direction.ZMINUS)) {
|
||||
switch (direction) {
|
||||
case XPLUS: // Segment in X+ direction
|
||||
if (!ourChunkFlags.getFlag(currentX + 1, currentZ)) { // Right turn?
|
||||
if (! ourChunkFlags.getFlag(currentX + 1, currentZ)) { // Right turn?
|
||||
linelist.add(new int[]{currentX + 1, currentZ}); // Finish line
|
||||
direction = Direction.ZPLUS; // Change direction
|
||||
} else if (!ourChunkFlags.getFlag(currentX + 1, currentZ - 1)) { // Straight?
|
||||
} else if (! ourChunkFlags.getFlag(currentX + 1, currentZ - 1)) { // Straight?
|
||||
currentX++;
|
||||
} else { // Left turn
|
||||
linelist.add(new int[]{currentX + 1, currentZ}); // Finish line
|
||||
@ -419,10 +420,10 @@ public class EngineDynmap {
|
||||
}
|
||||
break;
|
||||
case ZPLUS: // Segment in Z+ direction
|
||||
if (!ourChunkFlags.getFlag(currentX, currentZ + 1)) { // Right turn?
|
||||
if (! ourChunkFlags.getFlag(currentX, currentZ + 1)) { // Right turn?
|
||||
linelist.add(new int[]{currentX + 1, currentZ + 1}); // Finish line
|
||||
direction = Direction.XMINUS; // Change direction
|
||||
} else if (!ourChunkFlags.getFlag(currentX + 1, currentZ + 1)) { // Straight?
|
||||
} else if (! ourChunkFlags.getFlag(currentX + 1, currentZ + 1)) { // Straight?
|
||||
currentZ++;
|
||||
} else { // Left turn
|
||||
linelist.add(new int[]{currentX + 1, currentZ + 1}); // Finish line
|
||||
@ -432,10 +433,10 @@ public class EngineDynmap {
|
||||
}
|
||||
break;
|
||||
case XMINUS: // Segment in X- direction
|
||||
if (!ourChunkFlags.getFlag(currentX - 1, currentZ)) { // Right turn?
|
||||
if (! ourChunkFlags.getFlag(currentX - 1, currentZ)) { // Right turn?
|
||||
linelist.add(new int[]{currentX, currentZ + 1}); // Finish line
|
||||
direction = Direction.ZMINUS; // Change direction
|
||||
} else if (!ourChunkFlags.getFlag(currentX - 1, currentZ + 1)) { // Straight?
|
||||
} else if (! ourChunkFlags.getFlag(currentX - 1, currentZ + 1)) { // Straight?
|
||||
currentX--;
|
||||
} else { // Left turn
|
||||
linelist.add(new int[]{currentX, currentZ + 1}); // Finish line
|
||||
@ -445,10 +446,10 @@ public class EngineDynmap {
|
||||
}
|
||||
break;
|
||||
case ZMINUS: // Segment in Z- direction
|
||||
if (!ourChunkFlags.getFlag(currentX, currentZ - 1)) { // Right turn?
|
||||
if (! ourChunkFlags.getFlag(currentX, currentZ - 1)) { // Right turn?
|
||||
linelist.add(new int[]{currentX, currentZ}); // Finish line
|
||||
direction = Direction.XPLUS; // Change direction
|
||||
} else if (!ourChunkFlags.getFlag(currentX - 1, currentZ - 1)) { // Straight?
|
||||
} else if (! ourChunkFlags.getFlag(currentX - 1, currentZ - 1)) { // Straight?
|
||||
currentZ--;
|
||||
} else { // Left turn
|
||||
linelist.add(new int[]{currentX, currentZ}); // Finish line
|
||||
@ -570,7 +571,7 @@ public class EngineDynmap {
|
||||
|
||||
// Thread Safe / Asynchronous: Yes
|
||||
public Map<String, Set<String>> createPlayersets() {
|
||||
if (!Conf.dynmapVisibilityByFaction) {
|
||||
if (! Conf.dynmapVisibilityByFaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -599,7 +600,7 @@ public class EngineDynmap {
|
||||
|
||||
// Remove
|
||||
for (PlayerSet set : this.markerApi.getPlayerSets()) {
|
||||
if (!set.getSetID().startsWith(FACTIONS_PLAYERSET_)) {
|
||||
if (! set.getSetID().startsWith(FACTIONS_PLAYERSET_)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -713,11 +714,11 @@ public class EngineDynmap {
|
||||
Set<String> visible = Conf.dynmapVisibleFactions;
|
||||
Set<String> hidden = Conf.dynmapHiddenFactions;
|
||||
|
||||
if (!visible.isEmpty() && !visible.contains(factionId) && !visible.contains(factionName) && !visible.contains("world:" + world)) {
|
||||
if (! visible.isEmpty() && ! visible.contains(factionId) && ! visible.contains(factionName) && ! visible.contains("world:" + world)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !hidden.contains(factionId) && !hidden.contains(factionName) && !hidden.contains("world:" + world);
|
||||
return ! hidden.contains(factionId) && ! hidden.contains(factionName) && ! hidden.contains("world:" + world);
|
||||
}
|
||||
|
||||
// Thread Safe / Asynchronous: Yes
|
||||
@ -743,7 +744,7 @@ public class EngineDynmap {
|
||||
ArrayDeque<int[]> stack = new ArrayDeque<>();
|
||||
stack.push(new int[]{x, y});
|
||||
|
||||
while (!stack.isEmpty()) {
|
||||
while (! stack.isEmpty()) {
|
||||
int[] nxt = stack.pop();
|
||||
x = nxt[0];
|
||||
y = nxt[1];
|
||||
|
@ -82,17 +82,17 @@ public class TempAreaMarker {
|
||||
|
||||
public void update(AreaMarker marker) {
|
||||
// Corner Locations
|
||||
if (!equals(marker, this.x, this.z)) {
|
||||
if (! equals(marker, this.x, this.z)) {
|
||||
marker.setCornerLocations(this.x, this.z);
|
||||
}
|
||||
|
||||
// Label
|
||||
if (!marker.getLabel().equals(this.label)) {
|
||||
if (! marker.getLabel().equals(this.label)) {
|
||||
marker.setLabel(this.label);
|
||||
}
|
||||
|
||||
// Description
|
||||
if (!marker.getDescription().equals(this.description)) {
|
||||
if (! marker.getDescription().equals(this.description)) {
|
||||
marker.setDescription(this.description);
|
||||
}
|
||||
|
||||
|
@ -53,11 +53,11 @@ public class TempMarker {
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void update(MarkerAPI markerApi, Marker marker) {
|
||||
if (!this.world.equals(marker.getWorld()) || this.x != marker.getX() || this.y != marker.getY() || this.z != marker.getZ()) {
|
||||
if (! this.world.equals(marker.getWorld()) || this.x != marker.getX() || this.y != marker.getY() || this.z != marker.getZ()) {
|
||||
marker.setLocation(this.world, this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
if (!marker.getLabel().equals(this.label)) {
|
||||
if (! marker.getLabel().equals(this.label)) {
|
||||
marker.setLabel(this.label);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class TempMarker {
|
||||
marker.setMarkerIcon(icon);
|
||||
}
|
||||
|
||||
if (!marker.getDescription().equals(this.description)) {
|
||||
if (! marker.getDescription().equals(this.description)) {
|
||||
marker.setDescription(this.description);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class TempMarkerSet {
|
||||
|
||||
public void update(MarkerSet markerset) {
|
||||
// Name
|
||||
if (!markerset.getMarkerSetLabel().equals(this.label)) {
|
||||
if (! markerset.getMarkerSetLabel().equals(this.label)) {
|
||||
markerset.setMarkerSetLabel(this.label);
|
||||
}
|
||||
|
||||
|
@ -32,54 +32,14 @@ import java.util.List;
|
||||
|
||||
public class FactionsBlockListener implements Listener {
|
||||
|
||||
public SavageFactions savageFactions;
|
||||
public static HashMap<String, Location> bannerLocations = new HashMap<>();
|
||||
public SavageFactions savageFactions;
|
||||
private HashMap<String, Boolean> bannerCooldownMap = new HashMap<>();
|
||||
|
||||
public FactionsBlockListener(SavageFactions savageFactions) {
|
||||
this.savageFactions = savageFactions;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (!event.canBuild()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// special case for flint&steel, which should only be prevented by DenyUsage list
|
||||
if (event.getBlockPlaced().getType() == Material.FIRE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if (!Conf.handleExploitLiquidFlow) {
|
||||
return;
|
||||
}
|
||||
if (event.getBlock().isLiquid()) {
|
||||
if (event.getToBlock().isEmpty()) {
|
||||
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
||||
if (from == to) {
|
||||
// not concerned with inter-faction events
|
||||
return;
|
||||
}
|
||||
// from faction != to faction
|
||||
if (to.isNormal()) {
|
||||
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) {
|
||||
String name = player.getName();
|
||||
if (Conf.playersWhoBypassAllProtection.contains(name)) {
|
||||
@ -201,16 +161,56 @@ public class FactionsBlockListener implements Listener {
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (! event.canBuild()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// special case for flint&steel, which should only be prevented by DenyUsage list
|
||||
if (event.getBlockPlaced().getType() == Material.FIRE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if (! Conf.handleExploitLiquidFlow) {
|
||||
return;
|
||||
}
|
||||
if (event.getBlock().isLiquid()) {
|
||||
if (event.getToBlock().isEmpty()) {
|
||||
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
||||
if (from == to) {
|
||||
// not concerned with inter-faction events
|
||||
return;
|
||||
}
|
||||
// from faction != to faction
|
||||
if (to.isNormal()) {
|
||||
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
if (event.getInstaBreak() && ! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
if (!Conf.pistonProtectionThroughDenyBuild) {
|
||||
if (! Conf.pistonProtectionThroughDenyBuild) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ public class FactionsBlockListener implements Listener {
|
||||
Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1);
|
||||
|
||||
// if potentially pushing into air/water/lava in another territory, we need to check it out
|
||||
if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && !canPistonMoveBlock(pistonFaction, targetBlock.getLocation())) {
|
||||
if ((targetBlock.isEmpty() || targetBlock.isLiquid()) && ! canPistonMoveBlock(pistonFaction, targetBlock.getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -315,10 +315,10 @@ public class FactionsBlockListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
// if not a sticky piston, retraction should be fine
|
||||
if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) {
|
||||
if (! event.isSticky() || ! Conf.pistonProtectionThroughDenyBuild) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ public class FactionsBlockListener implements Listener {
|
||||
|
||||
Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
|
||||
if (!canPistonMoveBlock(pistonFaction, targetLoc)) {
|
||||
if (! canPistonMoveBlock(pistonFaction, targetLoc)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -450,7 +450,7 @@ public class FactionsBlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onFrostWalker(EntityBlockFormEvent event) {
|
||||
if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) {
|
||||
return;
|
||||
@ -462,12 +462,12 @@ public class FactionsBlockListener implements Listener {
|
||||
// only notify every 10 seconds
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
boolean justCheck = fPlayer.getLastFrostwalkerMessage() + 10000 > System.currentTimeMillis();
|
||||
if (!justCheck) {
|
||||
if (! justCheck) {
|
||||
fPlayer.setLastFrostwalkerMessage();
|
||||
}
|
||||
|
||||
// Check if they have build permissions here. If not, block this from happening.
|
||||
if (!playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) {
|
||||
if (! playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -481,19 +481,19 @@ public class FactionsBlockListener implements Listener {
|
||||
}
|
||||
|
||||
if (otherFaction.isWilderness()) {
|
||||
return !Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName());
|
||||
return ! Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName());
|
||||
|
||||
} else if (otherFaction.isSafeZone()) {
|
||||
return !Conf.safeZoneDenyBuild;
|
||||
return ! Conf.safeZoneDenyBuild;
|
||||
|
||||
} else if (otherFaction.isWarZone()) {
|
||||
return !Conf.warZoneDenyBuild;
|
||||
return ! Conf.warZoneDenyBuild;
|
||||
|
||||
}
|
||||
|
||||
Relation rel = pistonFaction.getRelationTo(otherFaction);
|
||||
|
||||
return !rel.confDenyBuild(otherFaction.hasPlayersOnline());
|
||||
return ! rel.confDenyBuild(otherFaction.hasPlayersOnline());
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
|
@ -27,7 +27,7 @@ public class FactionsChatListener implements Listener {
|
||||
|
||||
|
||||
// this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerEarlyChat(AsyncPlayerChatEvent event) {
|
||||
Player talkingPlayer = event.getPlayer();
|
||||
String msg = event.getMessage();
|
||||
@ -100,7 +100,7 @@ public class FactionsChatListener implements Listener {
|
||||
|
||||
//Send to all our allies
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (myFaction.getRelationTo(fplayer) == Relation.ALLY && !fplayer.isIgnoreAllianceChat()) {
|
||||
if (myFaction.getRelationTo(fplayer) == Relation.ALLY && ! fplayer.isIgnoreAllianceChat()) {
|
||||
fplayer.sendMessage(message);
|
||||
} else if (fplayer.isSpyingChat() && me != fplayer) {
|
||||
fplayer.sendMessage("[ACspy]: " + message);
|
||||
@ -134,11 +134,11 @@ public class FactionsChatListener implements Listener {
|
||||
|
||||
|
||||
// this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
// Are we to insert the Faction tag into the format?
|
||||
// If we are not to insert it - we are done.
|
||||
if (!Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) {
|
||||
if (! Conf.chatTagEnabled || Conf.chatTagHandledByAnotherPlugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public class FactionsChatListener implements Listener {
|
||||
FPlayer me = FPlayers.getInstance().getByPlayer(talkingPlayer);
|
||||
int InsertIndex;
|
||||
|
||||
if (!Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) {
|
||||
if (! Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) {
|
||||
// we're using the "replace" method of inserting the faction tags
|
||||
if (eventFormat.contains("[FACTION_TITLE]")) {
|
||||
eventFormat = eventFormat.replace("[FACTION_TITLE]", me.getTitle());
|
||||
@ -158,10 +158,10 @@ public class FactionsChatListener implements Listener {
|
||||
eventFormat = eventFormat.replace(Conf.chatTagReplaceString, "");
|
||||
Conf.chatTagPadAfter = false;
|
||||
Conf.chatTagPadBefore = false;
|
||||
} else if (!Conf.chatTagInsertAfterString.isEmpty() && eventFormat.contains(Conf.chatTagInsertAfterString)) {
|
||||
} else if (! Conf.chatTagInsertAfterString.isEmpty() && eventFormat.contains(Conf.chatTagInsertAfterString)) {
|
||||
// we're using the "insert after string" method
|
||||
InsertIndex = eventFormat.indexOf(Conf.chatTagInsertAfterString) + Conf.chatTagInsertAfterString.length();
|
||||
} else if (!Conf.chatTagInsertBeforeString.isEmpty() && eventFormat.contains(Conf.chatTagInsertBeforeString)) {
|
||||
} else if (! Conf.chatTagInsertBeforeString.isEmpty() && eventFormat.contains(Conf.chatTagInsertBeforeString)) {
|
||||
// we're using the "insert before string" method
|
||||
InsertIndex = eventFormat.indexOf(Conf.chatTagInsertBeforeString);
|
||||
} else {
|
||||
@ -172,8 +172,8 @@ public class FactionsChatListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
String formatStart = eventFormat.substring(0, InsertIndex) + ((Conf.chatTagPadBefore && !me.getChatTag().isEmpty()) ? " " : "");
|
||||
String formatEnd = ((Conf.chatTagPadAfter && !me.getChatTag().isEmpty()) ? " " : "") + eventFormat.substring(InsertIndex);
|
||||
String formatStart = eventFormat.substring(0, InsertIndex) + ((Conf.chatTagPadBefore && ! me.getChatTag().isEmpty()) ? " " : "");
|
||||
String formatEnd = ((Conf.chatTagPadAfter && ! me.getChatTag().isEmpty()) ? " " : "") + eventFormat.substring(InsertIndex);
|
||||
|
||||
String nonColoredMsgFormat = formatStart + me.getChatTag().trim() + formatEnd;
|
||||
|
||||
|
@ -38,10 +38,10 @@ public class FactionsEntityListener implements Listener {
|
||||
this.savageFactions = savageFactions;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@EventHandler (priority = EventPriority.NORMAL)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (!(entity instanceof Player)) {
|
||||
if (! (entity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,14 +53,14 @@ public class FactionsEntityListener implements Listener {
|
||||
// Check for no power loss conditions
|
||||
if (faction.isWarZone()) {
|
||||
// war zones always override worldsNoPowerLoss either way, thus this layout
|
||||
if (!Conf.warZonePowerLoss) {
|
||||
if (! Conf.warZonePowerLoss) {
|
||||
powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WARZONE.toString());
|
||||
powerLossEvent.setCancelled(true);
|
||||
}
|
||||
if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
|
||||
powerLossEvent.setMessage(TL.PLAYER_POWER_LOSS_WARZONE.toString());
|
||||
}
|
||||
} else if (faction.isWilderness() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) {
|
||||
} else if (faction.isWilderness() && ! Conf.wildernessPowerLoss && ! Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) {
|
||||
powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WILDERNESS.toString());
|
||||
powerLossEvent.setCancelled(true);
|
||||
} else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
|
||||
@ -77,12 +77,12 @@ public class FactionsEntityListener implements Listener {
|
||||
Bukkit.getPluginManager().callEvent(powerLossEvent);
|
||||
|
||||
// Call player onDeath if the event is not cancelled
|
||||
if (!powerLossEvent.isCancelled()) {
|
||||
if (! powerLossEvent.isCancelled()) {
|
||||
fplayer.onDeath();
|
||||
}
|
||||
// Send the message from the powerLossEvent
|
||||
final String msg = powerLossEvent.getMessage();
|
||||
if (msg != null && !msg.isEmpty()) {
|
||||
if (msg != null && ! msg.isEmpty()) {
|
||||
fplayer.msg(msg, fplayer.getPowerRounded(), fplayer.getPowerMaxRounded());
|
||||
}
|
||||
}
|
||||
@ -91,11 +91,11 @@ public class FactionsEntityListener implements Listener {
|
||||
* Who can I hurt? I can never hurt members or allies. I can always hurt enemies. I can hurt neutrals as long as
|
||||
* they are outside their own territory.
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
|
||||
if (!this.canDamagerHurtDamagee(sub, true)) {
|
||||
if (! this.canDamagerHurtDamagee(sub, true)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
// event is not cancelled by factions
|
||||
@ -152,13 +152,13 @@ public class FactionsEntityListener implements Listener {
|
||||
entityAction = "armor stands";
|
||||
}
|
||||
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy " + entityAction, false)) {
|
||||
if (! FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy " + entityAction, false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
// we don't want to let mobs/arrows destroy item frames/armor stands
|
||||
// so we only have to run the check as if there had been an explosion at the damager location
|
||||
if (!this.checkExplosionForBlock(damager, damagee.getLocation().getBlock())) {
|
||||
if (! this.checkExplosionForBlock(damager, damagee.getLocation().getBlock())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ public class FactionsEntityListener implements Listener {
|
||||
} else if (event.getCause() == EntityDamageEvent.DamageCause.FALL && event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (fPlayer != null && !fPlayer.shouldTakeFallDamage()) {
|
||||
if (fPlayer != null && ! fPlayer.shouldTakeFallDamage()) {
|
||||
event.setCancelled(true); // Falling after /f fly
|
||||
}
|
||||
}
|
||||
@ -238,12 +238,12 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
Entity boomer = event.getEntity();
|
||||
|
||||
// Before we need to check the location where the block is placed
|
||||
if (!this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) {
|
||||
if (! this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class FactionsEntityListener implements Listener {
|
||||
while (blockList.hasNext()) {
|
||||
Block block = blockList.next();
|
||||
|
||||
if (!this.checkExplosionForBlock(boomer, block)) {
|
||||
if (! this.checkExplosionForBlock(boomer, block)) {
|
||||
// The block don't have to explode
|
||||
blockList.remove();
|
||||
}
|
||||
@ -275,11 +275,11 @@ public class FactionsEntityListener implements Listener {
|
||||
// a single surrounding block in all 6 directions is broken if the material is weak enough
|
||||
List<Block> targets = new ArrayList<>();
|
||||
targets.add(center.getRelative(0, 0, 1));
|
||||
targets.add(center.getRelative(0, 0, -1));
|
||||
targets.add(center.getRelative(0, 0, - 1));
|
||||
targets.add(center.getRelative(0, 1, 0));
|
||||
targets.add(center.getRelative(0, -1, 0));
|
||||
targets.add(center.getRelative(0, - 1, 0));
|
||||
targets.add(center.getRelative(1, 0, 0));
|
||||
targets.add(center.getRelative(-1, 0, 0));
|
||||
targets.add(center.getRelative(- 1, 0, 0));
|
||||
for (Block target : targets) {
|
||||
int id = target.getType().getId();
|
||||
// ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet
|
||||
@ -301,7 +301,7 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
boolean online = faction.hasPlayersOnline();
|
||||
|
||||
if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
|
||||
if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && ! Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
|
||||
(faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) ||
|
||||
(faction.isWarZone() && Conf.warZoneBlockCreepers) ||
|
||||
faction.isSafeZone())) {
|
||||
@ -309,31 +309,31 @@ public class FactionsEntityListener implements Listener {
|
||||
return false;
|
||||
} else if (
|
||||
// it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
|
||||
(boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
|
||||
(boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && ! Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
|
||||
(faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
|
||||
(faction.isWarZone() && Conf.warZoneBlockFireballs) ||
|
||||
faction.isSafeZone())) {
|
||||
// ghast fireball which needs prevention
|
||||
return false;
|
||||
} else
|
||||
return (!(boomer instanceof TNTPrimed) && !(boomer instanceof ExplosiveMinecart)) || ((!faction.isWilderness() || !Conf.wildernessBlockTNT || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) &&
|
||||
(!faction.isNormal() || (online ? !Conf.territoryBlockTNT : !Conf.territoryBlockTNTWhenOffline)) &&
|
||||
(!faction.isWarZone() || !Conf.warZoneBlockTNT) &&
|
||||
(!faction.isSafeZone() || !Conf.safeZoneBlockTNT));
|
||||
return (! (boomer instanceof TNTPrimed) && ! (boomer instanceof ExplosiveMinecart)) || ((! faction.isWilderness() || ! Conf.wildernessBlockTNT || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) &&
|
||||
(! faction.isNormal() || (online ? ! Conf.territoryBlockTNT : ! Conf.territoryBlockTNTWhenOffline)) &&
|
||||
(! faction.isWarZone() || ! Conf.warZoneBlockTNT) &&
|
||||
(! faction.isSafeZone() || ! Conf.safeZoneBlockTNT));
|
||||
|
||||
// No condition retained, destroy the block!
|
||||
}
|
||||
|
||||
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0d);
|
||||
if (!this.canDamagerHurtDamagee(sub, false)) {
|
||||
if (! this.canDamagerHurtDamagee(sub, false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPotionSplashEvent(PotionSplashEvent event) {
|
||||
// see if the potion has a harmful effect
|
||||
boolean badjuju = false;
|
||||
@ -343,12 +343,12 @@ public class FactionsEntityListener implements Listener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!badjuju) {
|
||||
if (! badjuju) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProjectileSource thrower = event.getPotion().getShooter();
|
||||
if (!(thrower instanceof Entity)) {
|
||||
if (! (thrower instanceof Entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -364,14 +364,14 @@ public class FactionsEntityListener implements Listener {
|
||||
// scan through affected entities to make sure they're all valid targets
|
||||
for (LivingEntity target : event.getAffectedEntities()) {
|
||||
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent((Entity) thrower, target, EntityDamageEvent.DamageCause.CUSTOM, 0);
|
||||
if (!this.canDamagerHurtDamagee(sub, true)) {
|
||||
if (! this.canDamagerHurtDamagee(sub, true)) {
|
||||
event.setIntensity(target, 0.0); // affected entity list doesn't accept modification (so no iter.remove()), but this works
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPlayerInSafeZone(Entity damagee) {
|
||||
if (!(damagee instanceof Player)) {
|
||||
if (! (damagee instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
||||
@ -385,7 +385,7 @@ public class FactionsEntityListener implements Listener {
|
||||
Entity damager = sub.getDamager();
|
||||
Entity damagee = sub.getEntity();
|
||||
|
||||
if (!(damagee instanceof Player)) {
|
||||
if (! (damagee instanceof Player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ public class FactionsEntityListener implements Listener {
|
||||
if (damager instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) damager;
|
||||
|
||||
if (!(projectile.getShooter() instanceof Entity)) {
|
||||
if (! (projectile.getShooter() instanceof Entity)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -423,10 +423,10 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return !defLocFaction.noMonstersInTerritory();
|
||||
return ! defLocFaction.noMonstersInTerritory();
|
||||
}
|
||||
|
||||
if (!(damager instanceof Player)) {
|
||||
if (! (damager instanceof Player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
|
||||
// Players without faction may be hurt anywhere
|
||||
if (!defender.hasFaction()) {
|
||||
if (! defender.hasFaction()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ public class FactionsEntityListener implements Listener {
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
if (event.getLocation() == null) {
|
||||
return;
|
||||
@ -558,7 +558,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
// if there is a target
|
||||
Entity target = event.getTarget();
|
||||
@ -567,7 +567,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
|
||||
// We are interested in blocking targeting for certain mobs:
|
||||
if (!Conf.safeZoneNerfedCreatureTypes.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) {
|
||||
if (! Conf.safeZoneNerfedCreatureTypes.contains(MiscUtil.creatureTypeFromEntity(event.getEntity()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -577,7 +577,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPaintingBreak(HangingBreakEvent event) {
|
||||
if (event.getCause() == RemoveCause.EXPLOSION) {
|
||||
Location loc = event.getEntity().getLocation();
|
||||
@ -590,7 +590,7 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
boolean online = faction.hasPlayersOnline();
|
||||
|
||||
if ((faction.isWilderness() && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()) && (Conf.wildernessBlockCreepers || Conf.wildernessBlockFireballs || Conf.wildernessBlockTNT)) ||
|
||||
if ((faction.isWilderness() && ! Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName()) && (Conf.wildernessBlockCreepers || Conf.wildernessBlockFireballs || Conf.wildernessBlockTNT)) ||
|
||||
(faction.isNormal() && (online ? (Conf.territoryBlockCreepers || Conf.territoryBlockFireballs || Conf.territoryBlockTNT) : (Conf.territoryBlockCreepersWhenOffline || Conf.territoryBlockFireballsWhenOffline || Conf.territoryBlockTNTWhenOffline))) ||
|
||||
(faction.isWarZone() && (Conf.warZoneBlockCreepers || Conf.warZoneBlockFireballs || Conf.warZoneBlockTNT)) ||
|
||||
faction.isSafeZone()) {
|
||||
@ -599,35 +599,35 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (!(event instanceof HangingBreakByEntityEvent)) {
|
||||
if (! (event instanceof HangingBreakByEntityEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity breaker = ((HangingBreakByEntityEvent) event).getRemover();
|
||||
if (!(breaker instanceof Player)) {
|
||||
if (! (breaker instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) breaker, event.getEntity().getLocation(), "remove paintings", false)) {
|
||||
if (! FactionsBlockListener.playerCanBuildDestroyBlock((Player) breaker, event.getEntity().getLocation(), "remove paintings", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPaintingPlace(HangingPlaceEvent event) {
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) {
|
||||
if (! FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) {
|
||||
event.setCancelled(true);
|
||||
// Fix: update player's inventory to avoid items glitches
|
||||
event.getPlayer().updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
// for now, only interested in Enderman and Wither boss tomfoolery
|
||||
if (!(entity instanceof Enderman) && !(entity instanceof Wither)) {
|
||||
if (! (entity instanceof Enderman) && ! (entity instanceof Wither)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -640,7 +640,7 @@ public class FactionsEntityListener implements Listener {
|
||||
} else if (entity instanceof Wither) {
|
||||
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
|
||||
// it's a bit crude just using fireball protection, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
|
||||
if ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
|
||||
if ((faction.isWilderness() && Conf.wildernessBlockFireballs && ! Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
|
||||
(faction.isNormal() && (faction.hasPlayersOnline() ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
|
||||
(faction.isWarZone() && Conf.warZoneBlockFireballs) ||
|
||||
faction.isSafeZone()) {
|
||||
@ -663,7 +663,7 @@ public class FactionsEntityListener implements Listener {
|
||||
Faction faction = Board.getInstance().getFactionAt(loc);
|
||||
if (faction.isWilderness()) {
|
||||
return; // We don't care about wilderness.
|
||||
} else if (!faction.isNormal() && !event.getPlayer().isOp()) {
|
||||
} else if (! faction.isNormal() && ! event.getPlayer().isOp()) {
|
||||
// Don't let non ops make portals in safezone or warzone.
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -671,7 +671,7 @@ public class FactionsEntityListener implements Listener {
|
||||
|
||||
FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
String mininumRelation = SavageFactions.plugin.getConfig().getString("portals.minimum-relation", "MEMBER"); // Defaults to Neutral if typed wrong.
|
||||
if (!fp.getFaction().getRelationTo(faction).isAtLeast(Relation.fromString(mininumRelation))) {
|
||||
if (! fp.getFaction().getRelationTo(faction).isAtLeast(Relation.fromString(mininumRelation))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -718,7 +718,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
|
||||
// For disabling interactions with item frames in another faction's territory
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
// only need to check for item frames
|
||||
if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) {
|
||||
@ -728,13 +728,13 @@ public class FactionsEntityListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
Entity entity = event.getRightClicked();
|
||||
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(player, entity.getLocation(), "use item frames", false)) {
|
||||
if (! FactionsBlockListener.playerCanBuildDestroyBlock(player, entity.getLocation(), "use item frames", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// For disabling interactions with armor stands in another faction's territory
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
|
||||
Entity entity = event.getRightClicked();
|
||||
|
||||
@ -743,7 +743,7 @@ public class FactionsEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), entity.getLocation(), "use armor stands", false)) {
|
||||
if (! FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), entity.getLocation(), "use armor stands", false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ public class FactionsExploitListener implements Listener {
|
||||
return ((from.getX() > target.getX() && (from.getX() - target.getX() < thickness)) || (target.getX() > from.getX() && (target.getX() - from.getX() < thickness)) || (from.getZ() > target.getZ() && (from.getZ() - target.getZ() < thickness)) || (target.getZ() > from.getZ() && (target.getZ() - from.getZ() < thickness)));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void obsidianGenerator(BlockFromToEvent event) {
|
||||
if (!Conf.handleExploitObsidianGenerators) {
|
||||
if (! Conf.handleExploitObsidianGenerators) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -33,9 +33,9 @@ public class FactionsExploitListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void enderPearlTeleport(PlayerTeleportEvent event) {
|
||||
if (!Conf.handleExploitEnderPearlClipping) {
|
||||
if (! Conf.handleExploitEnderPearlClipping) {
|
||||
return;
|
||||
}
|
||||
if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
|
||||
|
@ -766,7 +766,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
/// Prevents the use of montster eggs in oned land.
|
||||
|
@ -62,7 +62,7 @@ public class BufferedObjective {
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
if (this.title == null || !this.title.equals(title)) {
|
||||
if (this.title == null || ! this.title.equals(title)) {
|
||||
this.title = title;
|
||||
requiresUpdate = true;
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class BufferedObjective {
|
||||
}
|
||||
content = ChatColor.translateAlternateColorCodes('&', content);
|
||||
|
||||
if (contents.get(lineNumber) == null || !contents.get(lineNumber).equals(content)) {
|
||||
if (contents.get(lineNumber) == null || ! contents.get(lineNumber).equals(content)) {
|
||||
contents.put(lineNumber, content);
|
||||
requiresUpdate = true;
|
||||
}
|
||||
@ -102,7 +102,7 @@ public class BufferedObjective {
|
||||
}
|
||||
|
||||
public void flip() {
|
||||
if (!requiresUpdate) {
|
||||
if (! requiresUpdate) {
|
||||
return;
|
||||
}
|
||||
requiresUpdate = false;
|
||||
|
@ -79,7 +79,7 @@ public class FScoreboard {
|
||||
}
|
||||
|
||||
public void setSidebarVisibility(boolean visible) {
|
||||
if (!isSupportedByServer()) {
|
||||
if (! isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public class FScoreboard {
|
||||
}
|
||||
|
||||
public void setDefaultSidebar(final FSidebarProvider provider, int updateInterval) {
|
||||
if (!isSupportedByServer()) {
|
||||
if (! isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ public class FScoreboard {
|
||||
}
|
||||
|
||||
public void setTemporarySidebar(final FSidebarProvider provider) {
|
||||
if (!isSupportedByServer()) {
|
||||
if (! isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class FTeamWrapper {
|
||||
}
|
||||
|
||||
public static void applyUpdatesLater(final Faction faction) {
|
||||
if (!FScoreboard.isSupportedByServer()) {
|
||||
if (! FScoreboard.isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class FTeamWrapper {
|
||||
}
|
||||
|
||||
public static void applyUpdates(Faction faction) {
|
||||
if (!FScoreboard.isSupportedByServer()) {
|
||||
if (! FScoreboard.isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -88,14 +88,14 @@ public class FTeamWrapper {
|
||||
}
|
||||
|
||||
for (OfflinePlayer player : wrapper.getPlayers()) {
|
||||
if (!player.isOnline() || !factionMembers.contains(FPlayers.getInstance().getByOfflinePlayer(player))) {
|
||||
if (! player.isOnline() || ! factionMembers.contains(FPlayers.getInstance().getByOfflinePlayer(player))) {
|
||||
// Player is offline or no longer in faction
|
||||
wrapper.removePlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
for (FPlayer fmember : factionMembers) {
|
||||
if (!fmember.isOnline()) {
|
||||
if (! fmember.isOnline()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -107,11 +107,11 @@ public class FTeamWrapper {
|
||||
}
|
||||
|
||||
public static void updatePrefixes(Faction faction) {
|
||||
if (!FScoreboard.isSupportedByServer()) {
|
||||
if (! FScoreboard.isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wrappers.containsKey(faction)) {
|
||||
if (! wrappers.containsKey(faction)) {
|
||||
applyUpdates(faction);
|
||||
} else {
|
||||
wrappers.get(faction).updatePrefixes();
|
||||
@ -119,7 +119,7 @@ public class FTeamWrapper {
|
||||
}
|
||||
|
||||
protected static void track(FScoreboard fboard) {
|
||||
if (!FScoreboard.isSupportedByServer()) {
|
||||
if (! FScoreboard.isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
tracking.add(fboard);
|
||||
@ -129,7 +129,7 @@ public class FTeamWrapper {
|
||||
}
|
||||
|
||||
protected static void untrack(FScoreboard fboard) {
|
||||
if (!FScoreboard.isSupportedByServer()) {
|
||||
if (! FScoreboard.isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
tracking.remove(fboard);
|
||||
@ -174,7 +174,7 @@ public class FTeamWrapper {
|
||||
}
|
||||
prefix = prefix.replace("{relationcolor}", faction.getRelationTo(fplayer).getColor().toString());
|
||||
prefix = prefix.replace("{faction}", faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), faction.getTag().length())));
|
||||
if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) {
|
||||
if (team.getPrefix() == null || ! team.getPrefix().equals(prefix)) {
|
||||
team.setPrefix(prefix);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!readyToGo) {
|
||||
if (! readyToGo) {
|
||||
return;
|
||||
}
|
||||
// this is set so it only does one iteration at a time, no matter how frequently the timer fires
|
||||
@ -49,7 +49,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
FPlayer fplayer = iterator.next();
|
||||
|
||||
// Check if they should be exempt from this.
|
||||
if (!fplayer.willAutoLeave()) {
|
||||
if (! fplayer.willAutoLeave()) {
|
||||
SavageFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to.");
|
||||
continue;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class AutoLeaveTask implements Runnable {
|
||||
}
|
||||
|
||||
public synchronized void run() {
|
||||
if (task != null && !task.isFinished()) {
|
||||
if (task != null && ! task.isFinished()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,13 @@ public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
||||
|
||||
public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() {
|
||||
return new TypeAdapterFactory() {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings ({"rawtypes", "unchecked"})
|
||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||
Class<? super T> rawType = typeToken.getRawType();
|
||||
if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {
|
||||
if (! Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {
|
||||
return null;
|
||||
}
|
||||
if (!rawType.isEnum()) {
|
||||
if (! rawType.isEnum()) {
|
||||
rawType = rawType.getSuperclass(); // handle anonymous subclasses
|
||||
}
|
||||
return (TypeAdapter<T>) new EnumTypeAdapter(rawType);
|
||||
|
@ -17,7 +17,6 @@ public class InventoryTypeAdapter implements JsonSerializer<Inventory>, JsonDese
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Inventory deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
|
||||
JsonObject object = jsonElement.getAsJsonObject();
|
||||
@ -25,5 +24,4 @@ public class InventoryTypeAdapter implements JsonSerializer<Inventory>, JsonDese
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
|
||||
nameArray.add(nameElement);
|
||||
}
|
||||
|
||||
if (!obj.has(locWorld)) {
|
||||
if (! obj.has(locWorld)) {
|
||||
obj.add(locWorld, new JsonObject());
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class MiscUtil {
|
||||
new HashSet<>(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"));
|
||||
|
||||
public static EntityType creatureTypeFromEntity(Entity entity) {
|
||||
if (!(entity instanceof Creature)) {
|
||||
if (! (entity instanceof Creature)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public class MiscUtil {
|
||||
}
|
||||
|
||||
for (char c : str.toCharArray()) {
|
||||
if (!substanceChars.contains(String.valueOf(c))) {
|
||||
if (! substanceChars.contains(String.valueOf(c))) {
|
||||
errors.add(SavageFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public enum MultiversionMaterials {
|
||||
|
||||
ACACIA_BOAT("BOAT_ACACIA", 0),
|
||||
@ -858,27 +858,21 @@ public enum MultiversionMaterials {
|
||||
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
||||
ZOMBIE_WALL_HEAD("SKULL", 0),
|
||||
;
|
||||
static int newV = - 1;
|
||||
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
|
||||
String m;
|
||||
int data;
|
||||
|
||||
MultiversionMaterials(String m, int data ){
|
||||
MultiversionMaterials(String m, int data) {
|
||||
this.m = m;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ItemStack parseItem(){
|
||||
Material mat = parseMaterial();
|
||||
if(isNewVersion()){
|
||||
return new ItemStack(mat);
|
||||
}
|
||||
return new ItemStack(mat,1,(byte) data);
|
||||
}
|
||||
static int newV = -1;
|
||||
public static boolean isNewVersion(){
|
||||
if(newV == 0) return false;
|
||||
if(newV == 1) return true;
|
||||
public static boolean isNewVersion() {
|
||||
if (newV == 0) return false;
|
||||
if (newV == 1) return true;
|
||||
Material mat = Material.matchMaterial("RED_WOOL");
|
||||
if(mat != null){
|
||||
if (mat != null) {
|
||||
newV = 1;
|
||||
return true;
|
||||
}
|
||||
@ -886,43 +880,65 @@ public enum MultiversionMaterials {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
|
||||
public static MultiversionMaterials requestXMaterial(String name, byte data){
|
||||
if(cachedSearch.containsKey(name.toUpperCase()+","+data)){
|
||||
return cachedSearch.get(name.toUpperCase()+","+data);
|
||||
public static MultiversionMaterials requestXMaterial(String name, byte data) {
|
||||
if (cachedSearch.containsKey(name.toUpperCase() + "," + data)) {
|
||||
return cachedSearch.get(name.toUpperCase() + "," + data);
|
||||
}
|
||||
for(MultiversionMaterials mat:MultiversionMaterials.values()){
|
||||
if(name.toUpperCase().equals(mat.m) && ((byte)mat.data) == data){
|
||||
cachedSearch.put(mat.m+","+data,mat);
|
||||
for (MultiversionMaterials mat : MultiversionMaterials.values()) {
|
||||
if (name.toUpperCase().equals(mat.m) && ((byte) mat.data) == data) {
|
||||
cachedSearch.put(mat.m + "," + data, mat);
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isSameMaterial(ItemStack comp){
|
||||
if(isNewVersion()){
|
||||
public static MultiversionMaterials fromString(String key) {
|
||||
MultiversionMaterials xmat = null;
|
||||
try {
|
||||
xmat = MultiversionMaterials.valueOf(key);
|
||||
return xmat;
|
||||
} catch (IllegalArgumentException e) {
|
||||
String[] split = key.split(":");
|
||||
if (split.length == 1) {
|
||||
xmat = requestXMaterial(key, (byte) 0);
|
||||
} else {
|
||||
xmat = requestXMaterial(split[0], (byte) Integer.parseInt(split[1]));
|
||||
}
|
||||
return xmat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ItemStack parseItem() {
|
||||
Material mat = parseMaterial();
|
||||
if (isNewVersion()) {
|
||||
return new ItemStack(mat);
|
||||
}
|
||||
return new ItemStack(mat, 1, (byte) data);
|
||||
}
|
||||
|
||||
public boolean isSameMaterial(ItemStack comp) {
|
||||
if (isNewVersion()) {
|
||||
return comp.getType() == this.parseMaterial();
|
||||
}
|
||||
if(comp.getType() == this.parseMaterial() &&
|
||||
(int) comp.getData().getData() == (int) this.data){
|
||||
if (comp.getType() == this.parseMaterial() &&
|
||||
(int) comp.getData().getData() == this.data) {
|
||||
return true;
|
||||
}
|
||||
MultiversionMaterials xmat = fromMaterial(comp.getType());
|
||||
if(isDamageable(xmat)){
|
||||
if(this.parseMaterial() == comp.getType()){
|
||||
return true;
|
||||
}
|
||||
if (isDamageable(xmat)) {
|
||||
return this.parseMaterial() == comp.getType();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public MultiversionMaterials fromMaterial(Material mat){
|
||||
try{
|
||||
public MultiversionMaterials fromMaterial(Material mat) {
|
||||
try {
|
||||
return MultiversionMaterials.valueOf(mat.toString());
|
||||
}catch(IllegalArgumentException e){
|
||||
for(MultiversionMaterials xmat:MultiversionMaterials.values()){
|
||||
if(xmat.m.equals(mat.toString())){
|
||||
} catch (IllegalArgumentException e) {
|
||||
for (MultiversionMaterials xmat : MultiversionMaterials.values()) {
|
||||
if (xmat.m.equals(mat.toString())) {
|
||||
return xmat;
|
||||
}
|
||||
}
|
||||
@ -930,27 +946,10 @@ public enum MultiversionMaterials {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MultiversionMaterials fromString(String key){
|
||||
MultiversionMaterials xmat = null;
|
||||
try{
|
||||
xmat = MultiversionMaterials.valueOf(key);
|
||||
return xmat;
|
||||
}catch(IllegalArgumentException e){
|
||||
String[] split = key.split(":");
|
||||
if(split.length == 1){
|
||||
xmat = requestXMaterial(key,(byte) 0);
|
||||
}else{
|
||||
xmat = requestXMaterial(split[0],(byte) Integer.parseInt(split[1]));
|
||||
}
|
||||
return xmat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isDamageable(MultiversionMaterials type){
|
||||
public boolean isDamageable(MultiversionMaterials type) {
|
||||
String[] split = type.toString().split("_");
|
||||
int length = split.length;
|
||||
switch(split[length-1]){
|
||||
switch (split[length - 1]) {
|
||||
case "HELMET":
|
||||
return true;
|
||||
case "CHESTPLATE":
|
||||
@ -984,9 +983,9 @@ public enum MultiversionMaterials {
|
||||
}
|
||||
}
|
||||
|
||||
public Material parseMaterial(){
|
||||
public Material parseMaterial() {
|
||||
Material mat = Material.matchMaterial(this.toString());
|
||||
if(mat != null){
|
||||
if (mat != null) {
|
||||
return mat;
|
||||
}
|
||||
return Material.matchMaterial(m);
|
||||
|
@ -50,7 +50,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
EXPLOSION_NORMAL("explode", 0, -1, ParticleProperty.DIRECTIONAL),
|
||||
EXPLOSION_NORMAL("explode", 0, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by exploding ghast fireballs and wither skulls:
|
||||
* <ul>
|
||||
@ -58,7 +58,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value slightly influences the size of this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
EXPLOSION_LARGE("largeexplode", 1, -1),
|
||||
EXPLOSION_LARGE("largeexplode", 1, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by exploding tnt and creepers:
|
||||
* <ul>
|
||||
@ -66,7 +66,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
EXPLOSION_HUGE("hugeexplosion", 2, -1),
|
||||
EXPLOSION_HUGE("hugeexplosion", 2, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by launching fireworks:
|
||||
* <ul>
|
||||
@ -74,7 +74,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
FIREWORKS_SPARK("fireworksSpark", 3, -1, ParticleProperty.DIRECTIONAL),
|
||||
FIREWORKS_SPARK("fireworksSpark", 3, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by swimming entities and arrows in water:
|
||||
* <ul>
|
||||
@ -82,7 +82,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
WATER_BUBBLE("bubble", 4, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
|
||||
WATER_BUBBLE("bubble", 4, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
|
||||
/**
|
||||
* A particle effect which is displayed by swimming entities and shaking wolves:
|
||||
* <ul>
|
||||
@ -90,7 +90,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
WATER_SPLASH("splash", 5, -1, ParticleProperty.DIRECTIONAL),
|
||||
WATER_SPLASH("splash", 5, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed on water when fishing:
|
||||
* <ul>
|
||||
@ -106,7 +106,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SUSPENDED("suspended", 7, -1, ParticleProperty.REQUIRES_WATER),
|
||||
SUSPENDED("suspended", 7, - 1, ParticleProperty.REQUIRES_WATER),
|
||||
/**
|
||||
* A particle effect which is displayed by air when close to bedrock and the in the void:
|
||||
* <ul>
|
||||
@ -114,7 +114,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SUSPENDED_DEPTH("depthSuspend", 8, -1, ParticleProperty.DIRECTIONAL),
|
||||
SUSPENDED_DEPTH("depthSuspend", 8, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed when landing a critical hit and by arrows:
|
||||
* <ul>
|
||||
@ -122,7 +122,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
CRIT("crit", 9, -1, ParticleProperty.DIRECTIONAL),
|
||||
CRIT("crit", 9, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed when landing a hit with an enchanted weapon:
|
||||
* <ul>
|
||||
@ -130,7 +130,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
CRIT_MAGIC("magicCrit", 10, -1, ParticleProperty.DIRECTIONAL),
|
||||
CRIT_MAGIC("magicCrit", 10, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners:
|
||||
* <ul>
|
||||
@ -138,7 +138,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
SMOKE_NORMAL("smoke", 11, -1, ParticleProperty.DIRECTIONAL),
|
||||
SMOKE_NORMAL("smoke", 11, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by fire, minecarts with furnace and blazes:
|
||||
* <ul>
|
||||
@ -146,7 +146,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
SMOKE_LARGE("largesmoke", 12, -1, ParticleProperty.DIRECTIONAL),
|
||||
SMOKE_LARGE("largesmoke", 12, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed when splash potions or bottles o' enchanting hit something:
|
||||
* <ul>
|
||||
@ -155,7 +155,7 @@ public enum ParticleEffect {
|
||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||
* </ul>
|
||||
*/
|
||||
SPELL("spell", 13, -1),
|
||||
SPELL("spell", 13, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when instant splash potions hit something:
|
||||
* <ul>
|
||||
@ -164,7 +164,7 @@ public enum ParticleEffect {
|
||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_INSTANT("instantSpell", 14, -1),
|
||||
SPELL_INSTANT("instantSpell", 14, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by entities with active potion effects:
|
||||
* <ul>
|
||||
@ -173,7 +173,7 @@ public enum ParticleEffect {
|
||||
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_MOB("mobSpell", 15, -1, ParticleProperty.COLORABLE),
|
||||
SPELL_MOB("mobSpell", 15, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed by entities with active potion effects applied through a beacon:
|
||||
* <ul>
|
||||
@ -182,7 +182,7 @@ public enum ParticleEffect {
|
||||
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, -1, ParticleProperty.COLORABLE),
|
||||
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed by witches:
|
||||
* <ul>
|
||||
@ -191,7 +191,7 @@ public enum ParticleEffect {
|
||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_WITCH("witchMagic", 17, -1),
|
||||
SPELL_WITCH("witchMagic", 17, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by blocks beneath a water source:
|
||||
* <ul>
|
||||
@ -199,7 +199,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
DRIP_WATER("dripWater", 18, -1),
|
||||
DRIP_WATER("dripWater", 18, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by blocks beneath a lava source:
|
||||
* <ul>
|
||||
@ -207,7 +207,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
DRIP_LAVA("dripLava", 19, -1),
|
||||
DRIP_LAVA("dripLava", 19, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when attacking a villager in a village:
|
||||
* <ul>
|
||||
@ -215,7 +215,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
VILLAGER_ANGRY("angryVillager", 20, -1),
|
||||
VILLAGER_ANGRY("angryVillager", 20, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when using bone meal and trading with a villager in a village:
|
||||
* <ul>
|
||||
@ -223,7 +223,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
VILLAGER_HAPPY("happyVillager", 21, -1, ParticleProperty.DIRECTIONAL),
|
||||
VILLAGER_HAPPY("happyVillager", 21, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by mycelium:
|
||||
* <ul>
|
||||
@ -231,7 +231,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
TOWN_AURA("townaura", 22, -1, ParticleProperty.DIRECTIONAL),
|
||||
TOWN_AURA("townaura", 22, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by note blocks:
|
||||
* <ul>
|
||||
@ -239,7 +239,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value causes the particle to be colored green when set to 0
|
||||
* </ul>
|
||||
*/
|
||||
NOTE("note", 23, -1, ParticleProperty.COLORABLE),
|
||||
NOTE("note", 23, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs:
|
||||
* <ul>
|
||||
@ -247,7 +247,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the spread of this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
PORTAL("portal", 24, -1, ParticleProperty.DIRECTIONAL),
|
||||
PORTAL("portal", 24, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by enchantment tables which are nearby bookshelves:
|
||||
* <ul>
|
||||
@ -255,7 +255,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the spread of this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
ENCHANTMENT_TABLE("enchantmenttable", 25, -1, ParticleProperty.DIRECTIONAL),
|
||||
ENCHANTMENT_TABLE("enchantmenttable", 25, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners:
|
||||
* <ul>
|
||||
@ -263,7 +263,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
FLAME("flame", 26, -1, ParticleProperty.DIRECTIONAL),
|
||||
FLAME("flame", 26, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by lava:
|
||||
* <ul>
|
||||
@ -271,7 +271,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
LAVA("lava", 27, -1),
|
||||
LAVA("lava", 27, - 1),
|
||||
/**
|
||||
* A particle effect which is currently unused:
|
||||
* <ul>
|
||||
@ -279,7 +279,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
FOOTSTEP("footstep", 28, -1),
|
||||
FOOTSTEP("footstep", 28, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when a mob dies:
|
||||
* <ul>
|
||||
@ -287,7 +287,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
CLOUD("cloud", 29, -1, ParticleProperty.DIRECTIONAL),
|
||||
CLOUD("cloud", 29, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters:
|
||||
* <ul>
|
||||
@ -295,7 +295,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value causes the particle to be colored red when set to 0
|
||||
* </ul>
|
||||
*/
|
||||
REDSTONE("reddust", 30, -1, ParticleProperty.COLORABLE),
|
||||
REDSTONE("reddust", 30, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed when snowballs hit a block:
|
||||
* <ul>
|
||||
@ -303,7 +303,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SNOWBALL("snowballpoof", 31, -1),
|
||||
SNOWBALL("snowballpoof", 31, - 1),
|
||||
/**
|
||||
* A particle effect which is currently unused:
|
||||
* <ul>
|
||||
@ -311,7 +311,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
SNOW_SHOVEL("snowshovel", 32, -1, ParticleProperty.DIRECTIONAL),
|
||||
SNOW_SHOVEL("snowshovel", 32, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by slimes:
|
||||
* <ul>
|
||||
@ -319,7 +319,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SLIME("slime", 33, -1),
|
||||
SLIME("slime", 33, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when breeding and taming animals:
|
||||
* <ul>
|
||||
@ -327,7 +327,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
HEART("heart", 34, -1),
|
||||
HEART("heart", 34, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by barriers:
|
||||
* <ul>
|
||||
@ -342,7 +342,7 @@ public enum ParticleEffect {
|
||||
* <li>It looks like a little piece with an item texture
|
||||
* </ul>
|
||||
*/
|
||||
ITEM_CRACK("iconcrack", 36, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
|
||||
ITEM_CRACK("iconcrack", 36, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
|
||||
/**
|
||||
* A particle effect which is displayed when breaking blocks or sprinting:
|
||||
* <ul>
|
||||
@ -350,7 +350,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
BLOCK_CRACK("blockcrack", 37, -1, ParticleProperty.REQUIRES_DATA),
|
||||
BLOCK_CRACK("blockcrack", 37, - 1, ParticleProperty.REQUIRES_DATA),
|
||||
/**
|
||||
* A particle effect which is displayed when falling:
|
||||
* <ul>
|
||||
@ -422,7 +422,7 @@ public enum ParticleEffect {
|
||||
*/
|
||||
public static ParticleEffect fromName(String name) {
|
||||
for (Entry<String, ParticleEffect> entry : NAME_MAP.entrySet()) {
|
||||
if (!entry.getKey().equalsIgnoreCase(name)) {
|
||||
if (! entry.getKey().equalsIgnoreCase(name)) {
|
||||
continue;
|
||||
}
|
||||
return entry.getValue();
|
||||
@ -467,7 +467,7 @@ public enum ParticleEffect {
|
||||
String world = location.getWorld().getName();
|
||||
for (Player player : players) {
|
||||
Location playerLocation = player.getLocation();
|
||||
if (!world.equals(playerLocation.getWorld().getName()) || playerLocation.distanceSquared(location) < 65536) {
|
||||
if (! world.equals(playerLocation.getWorld().getName()) || playerLocation.distanceSquared(location) < 65536) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
@ -539,7 +539,7 @@ public enum ParticleEffect {
|
||||
* @return Whether the particle effect is supported or not
|
||||
*/
|
||||
public boolean isSupported() {
|
||||
if (requiredVersion == -1) {
|
||||
if (requiredVersion == - 1) {
|
||||
return true;
|
||||
}
|
||||
return ParticlePacket.getVersion() >= requiredVersion;
|
||||
@ -562,13 +562,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, null).sendTo(center, range);
|
||||
@ -591,13 +591,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), null).sendTo(center, players);
|
||||
@ -636,16 +636,16 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
if (! hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
throw new IllegalArgumentException("This particle effect is not directional");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, range > 256, null).sendTo(center, range);
|
||||
@ -665,16 +665,16 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(Vector direction, float speed, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
if (! hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
throw new IllegalArgumentException("This particle effect is not directional");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, isLongDistance(center, players), null).sendTo(center, players);
|
||||
@ -708,13 +708,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(ParticleColor color, Location center, double range) throws ParticleVersionException, ParticleColorException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (! hasProperty(ParticleProperty.COLORABLE)) {
|
||||
throw new ParticleColorException("This particle effect is not colorable");
|
||||
}
|
||||
if (!isColorCorrect(this, color)) {
|
||||
if (! isColorCorrect(this, color)) {
|
||||
throw new ParticleColorException("The particle color type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, color, range > 256).sendTo(center, range);
|
||||
@ -732,13 +732,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(ParticleColor color, Location center, List<Player> players) throws ParticleVersionException, ParticleColorException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (! hasProperty(ParticleProperty.COLORABLE)) {
|
||||
throw new ParticleColorException("This particle effect is not colorable");
|
||||
}
|
||||
if (!isColorCorrect(this, color)) {
|
||||
if (! isColorCorrect(this, color)) {
|
||||
throw new ParticleColorException("The particle color type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, color, isLongDistance(center, players)).sendTo(center, players);
|
||||
@ -775,13 +775,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(ParticleData data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, data).sendTo(center, range);
|
||||
@ -804,13 +804,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(ParticleData data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), data).sendTo(center, players);
|
||||
@ -849,13 +849,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(ParticleData data, Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, range > 256, data).sendTo(center, range);
|
||||
@ -875,13 +875,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(ParticleData data, Vector direction, float speed, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, isLongDistance(center, players), data).sendTo(center, players);
|
||||
@ -949,7 +949,7 @@ public enum ParticleEffect {
|
||||
* @param material Material of the item/block
|
||||
* @param data Data value of the item/block
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public ParticleData(Material material, byte data) {
|
||||
this.material = material;
|
||||
this.data = data;
|
||||
@ -1033,7 +1033,7 @@ public enum ParticleEffect {
|
||||
*/
|
||||
public BlockData(Material material, byte data) throws IllegalArgumentException {
|
||||
super(material, data);
|
||||
if (!material.isBlock()) {
|
||||
if (! material.isBlock()) {
|
||||
throw new IllegalArgumentException("The material is not a block");
|
||||
}
|
||||
}
|
||||
@ -1425,7 +1425,7 @@ public enum ParticleEffect {
|
||||
* @return The version number
|
||||
*/
|
||||
public static int getVersion() {
|
||||
if (!initialized) {
|
||||
if (! initialized) {
|
||||
initialize();
|
||||
}
|
||||
return version;
|
||||
@ -1530,7 +1530,7 @@ public enum ParticleEffect {
|
||||
String worldName = center.getWorld().getName();
|
||||
double squared = range * range;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) {
|
||||
if (! player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) {
|
||||
continue;
|
||||
}
|
||||
sendTo(center, player);
|
||||
|
@ -44,7 +44,7 @@ public final class ReflectionUtils {
|
||||
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) throws NoSuchMethodException {
|
||||
Class<?>[] primitiveTypes = DataType.getPrimitive(parameterTypes);
|
||||
for (Constructor<?> constructor : clazz.getConstructors()) {
|
||||
if (!DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) {
|
||||
if (! DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) {
|
||||
continue;
|
||||
}
|
||||
return constructor;
|
||||
@ -118,7 +118,7 @@ public final class ReflectionUtils {
|
||||
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException {
|
||||
Class<?>[] primitiveTypes = DataType.getPrimitive(parameterTypes);
|
||||
for (Method method : clazz.getMethods()) {
|
||||
if (!method.getName().equals(methodName) || !DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) {
|
||||
if (! method.getName().equals(methodName) || ! DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) {
|
||||
continue;
|
||||
}
|
||||
return method;
|
||||
|
@ -65,7 +65,7 @@ public class RelationUtil {
|
||||
return Relation.NEUTRAL; // ERROR
|
||||
}
|
||||
|
||||
if (!fthat.isNormal() || !fme.isNormal()) {
|
||||
if (! fthat.isNormal() || ! fme.isNormal()) {
|
||||
return Relation.NEUTRAL;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public class RelationUtil {
|
||||
return Relation.MEMBER;
|
||||
}
|
||||
|
||||
if (!ignorePeaceful && (fme.isPeaceful() || fthat.isPeaceful())) {
|
||||
if (! ignorePeaceful && (fme.isPeaceful() || fthat.isPeaceful())) {
|
||||
return Relation.NEUTRAL;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
// general task-related reference data
|
||||
private transient World world = null;
|
||||
private transient boolean readyToGo = false;
|
||||
private transient int taskID = -1;
|
||||
private transient int taskID = - 1;
|
||||
private transient int limit = 0;
|
||||
|
||||
// values for the spiral pattern routine
|
||||
@ -35,10 +35,10 @@ public abstract class SpiralTask implements Runnable {
|
||||
private transient int z = 0;
|
||||
private transient boolean isZLeg = false;
|
||||
private transient boolean isNeg = false;
|
||||
private transient int length = -1;
|
||||
private transient int length = - 1;
|
||||
private transient int current = 0;
|
||||
|
||||
@SuppressWarnings("LeakingThisInConstructor")
|
||||
@SuppressWarnings ("LeakingThisInConstructor")
|
||||
public SpiralTask(FLocation fLocation, int radius) {
|
||||
// limit is determined based on spiral leg length for given radius; see insideRadius()
|
||||
this.limit = (radius - 1) * 2;
|
||||
@ -103,14 +103,14 @@ public abstract class SpiralTask implements Runnable {
|
||||
}
|
||||
|
||||
public final void setTaskID(int ID) {
|
||||
if (ID == -1) {
|
||||
if (ID == - 1) {
|
||||
this.stop();
|
||||
}
|
||||
taskID = ID;
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
if (!this.valid() || !readyToGo) {
|
||||
if (! this.valid() || ! readyToGo) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
readyToGo = false;
|
||||
|
||||
// make sure we're still inside the specified radius
|
||||
if (!this.insideRadius()) {
|
||||
if (! this.insideRadius()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,13 +128,13 @@ public abstract class SpiralTask implements Runnable {
|
||||
// keep going until the task has been running for 20ms or more, then stop to take a breather
|
||||
while (now() < loopStartTime + 20) {
|
||||
// run the primary task on the current X/Z coordinates
|
||||
if (!this.work()) {
|
||||
if (! this.work()) {
|
||||
this.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// move on to next chunk in spiral
|
||||
if (!this.moveToNext()) {
|
||||
if (! this.moveToNext()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
// step through chunks in spiral pattern from center; returns false if we're done, otherwise returns true
|
||||
public final boolean moveToNext() {
|
||||
if (!this.valid()) {
|
||||
if (! this.valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
current++;
|
||||
|
||||
// if we're outside the radius, we're done
|
||||
if (!this.insideRadius()) {
|
||||
if (! this.insideRadius()) {
|
||||
return false;
|
||||
}
|
||||
} else { // one leg/side of the spiral down...
|
||||
@ -169,9 +169,9 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
// move one chunk further in the appropriate direction
|
||||
if (isZLeg) {
|
||||
z += (isNeg) ? -1 : 1;
|
||||
z += (isNeg) ? - 1 : 1;
|
||||
} else {
|
||||
x += (isNeg) ? -1 : 1;
|
||||
x += (isNeg) ? - 1 : 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -179,7 +179,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
public final boolean insideRadius() {
|
||||
boolean inside = current < limit;
|
||||
if (!inside) {
|
||||
if (! inside) {
|
||||
this.finish();
|
||||
}
|
||||
return inside;
|
||||
@ -193,17 +193,17 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
// we're done, whether finished or cancelled
|
||||
public final void stop() {
|
||||
if (!this.valid()) {
|
||||
if (! this.valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
readyToGo = false;
|
||||
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
||||
taskID = -1;
|
||||
taskID = - 1;
|
||||
}
|
||||
|
||||
// is this task still valid/workable?
|
||||
public final boolean valid() {
|
||||
return taskID != -1;
|
||||
return taskID != - 1;
|
||||
}
|
||||
}
|
||||
|
@ -24,21 +24,20 @@ public class VisualizeUtil {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addLocation(Player player, Location location, Material type, byte data) {
|
||||
getPlayerLocations(player).add(location);
|
||||
player.sendBlockChange(location, type, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addLocation(Player player, Location location, Material material) {
|
||||
getPlayerLocations(player).add(location);
|
||||
player.sendBlockChange(location, material, (byte) 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addLocations(Player player, Collection<Location> locations, Material material) {
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Location location : locations) {
|
||||
@ -47,7 +46,7 @@ public class VisualizeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addBlocks(Player player, Collection<Block> blocks, Material material) {
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Block block : blocks) {
|
||||
@ -57,7 +56,7 @@ public class VisualizeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void clear(Player player) {
|
||||
Set<Location> locations = getPlayerLocations(player);
|
||||
if (locations == null) {
|
||||
|
@ -95,7 +95,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
// All clear lets TP them or ask for password
|
||||
String warp = warpSlots.get(slot);
|
||||
if (!fme.getFaction().hasWarpPassword(warp)) {
|
||||
if (! fme.getFaction().hasWarpPassword(warp)) {
|
||||
if (transact(fme)) {
|
||||
doWarmup(warp);
|
||||
}
|
||||
@ -135,14 +135,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
double cost = SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5);
|
||||
|
||||
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
|
||||
if (! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
|
||||
return Econ.modifyMoney(fme.getFaction(), -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
return Econ.modifyMoney(fme.getFaction(), - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
} else {
|
||||
return Econ.modifyMoney(fme, -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
return Econ.modifyMoney(fme, - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ public abstract class MCommand<T extends MPlugin> {
|
||||
// This field may be left blank and will in such case be loaded from the permissions node instead.
|
||||
// Thus make sure the permissions node description is an action description like "eat hamburgers" or "do admin stuff".
|
||||
private String helpShort;
|
||||
|
||||
public MCommand(T p) {
|
||||
this.p = p;
|
||||
|
||||
@ -112,11 +113,11 @@ public abstract class MCommand<T extends MPlugin> {
|
||||
}
|
||||
}
|
||||
|
||||
if (!validCall(this.sender, this.args)) {
|
||||
if (! validCall(this.sender, this.args)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isEnabled()) {
|
||||
if (! this.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -152,7 +153,7 @@ public abstract class MCommand<T extends MPlugin> {
|
||||
}
|
||||
|
||||
public boolean validSenderType(CommandSender sender, boolean informSenderIfNot) {
|
||||
if (this.senderMustBePlayer && !(sender instanceof Player)) {
|
||||
if (this.senderMustBePlayer && ! (sender instanceof Player)) {
|
||||
if (informSenderIfNot) {
|
||||
msg(TL.GENERIC_PLAYERONLY);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public abstract class MPlugin extends JavaPlugin {
|
||||
// reference command will be used to prevent "unknown command" console messages
|
||||
try {
|
||||
Map<String, Map<String, Object>> refCmd = this.getDescription().getCommands();
|
||||
if (refCmd != null && !refCmd.isEmpty()) {
|
||||
if (refCmd != null && ! refCmd.isEmpty()) {
|
||||
this.refCommand = (String) (refCmd.keySet().toArray()[0]);
|
||||
}
|
||||
} catch (ClassCastException ex) {
|
||||
@ -114,7 +114,7 @@ public abstract class MPlugin extends JavaPlugin {
|
||||
File lang = new File(getDataFolder(), "lang.yml");
|
||||
OutputStream out = null;
|
||||
InputStream defLangStream = this.getResource("lang.yml");
|
||||
if (!lang.exists()) {
|
||||
if (! lang.exists()) {
|
||||
try {
|
||||
getDataFolder().mkdir();
|
||||
lang.createNewFile();
|
||||
@ -123,7 +123,7 @@ public abstract class MPlugin extends JavaPlugin {
|
||||
int read;
|
||||
byte[] bytes = new byte[1024];
|
||||
|
||||
while ((read = defLangStream.read(bytes)) != -1) {
|
||||
while ((read = defLangStream.read(bytes)) != - 1) {
|
||||
out.write(bytes, 0, read);
|
||||
}
|
||||
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(defLangStream)));
|
||||
@ -259,7 +259,7 @@ public abstract class MPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
for (final MCommand<?> command : this.getBaseCommands()) {
|
||||
if (noSlash && !command.allowNoSlashAccess) {
|
||||
if (noSlash && ! command.allowNoSlashAccess) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class MPluginSecretPlayerListener implements Listener {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (FactionsPlayerListener.preventCommand(event.getMessage(), event.getPlayer())) {
|
||||
if (p.logPlayerCommands()) {
|
||||
@ -28,7 +28,7 @@ public class MPluginSecretPlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
if (p.handleCommand(event.getPlayer(), event.getMessage(), false, true)) {
|
||||
if (p.logPlayerCommands()) {
|
||||
@ -45,7 +45,7 @@ public class MPluginSecretPlayerListener implements Listener {
|
||||
*/
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
public void onPlayerPreLogin(PlayerLoginEvent event) {
|
||||
FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
|
||||
boolean disabled = false;
|
||||
for (String key : section.getConfigurationSection("slots").getKeys(false)) {
|
||||
int slot = section.getInt("slots." + key);
|
||||
if (slot == -1) {
|
||||
if (slot == - 1) {
|
||||
disabled = true;
|
||||
continue;
|
||||
}
|
||||
@ -92,12 +92,12 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
|
||||
if (disabled) {
|
||||
break;
|
||||
}
|
||||
if (!usedDummySlots.isEmpty()) {
|
||||
if (! usedDummySlots.isEmpty()) {
|
||||
int slot = usedDummySlots.get(0);
|
||||
actionSlots.put(slot, action);
|
||||
} else {
|
||||
int slot = actionGUI.firstEmpty();
|
||||
if (slot != -1) {
|
||||
if (slot != - 1) {
|
||||
actionSlots.put(slot, action);
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!actionSlots.containsKey(slot)) {
|
||||
if (! actionSlots.containsKey(slot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
for (String key : section.getConfigurationSection("slots").getKeys(false)) {
|
||||
int slot = section.getInt("slots." + key);
|
||||
if (slot == -1) {
|
||||
if (slot == - 1) {
|
||||
continue;
|
||||
}
|
||||
if (slot + 1 > guiSize && slot > 0) {
|
||||
@ -85,7 +85,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
@Override
|
||||
public void onClick(int slot, ClickType clickType) {
|
||||
if (!relationSlots.containsKey(slot)) {
|
||||
if (! relationSlots.containsKey(slot)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class CropUpgrades implements Listener {
|
||||
if (below.getType() == SavageFactions.plugin.SUGAR_CANE_BLOCK) {
|
||||
|
||||
org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
|
||||
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
|
||||
if (above.getType() == Material.AIR && above.getLocation().add(0, - 2, 0).getBlock().getType() != Material.AIR) {
|
||||
above.setType(SavageFactions.plugin.SUGAR_CANE_BLOCK);
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class CropUpgrades implements Listener {
|
||||
|
||||
org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
|
||||
|
||||
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
|
||||
if (above.getType() == Material.AIR && above.getLocation().add(0, - 2, 0).getBlock().getType() != Material.AIR) {
|
||||
above.setType(Material.CACTUS);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (spawnerLevel == 2) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -123,7 +123,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (spawnerLevel == 1) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-2");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -132,7 +132,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (spawnerLevel == 0) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -147,7 +147,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (expLevel == 2) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -156,7 +156,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (expLevel == 1) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-2");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -165,7 +165,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (expLevel == 0) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -180,7 +180,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (chestLevel == 2) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -190,7 +190,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (chestLevel == 1) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
@ -200,7 +200,7 @@ public class FUpgradesGUI implements Listener {
|
||||
}
|
||||
if (chestLevel == 0) {
|
||||
int cost = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1");
|
||||
if (!hasMoney(fme, cost)) {
|
||||
if (! hasMoney(fme, cost)) {
|
||||
return;
|
||||
}
|
||||
takeMoney(fme, cost);
|
||||
|
@ -159,7 +159,8 @@ public class NBTCompound {
|
||||
}
|
||||
|
||||
public NBTType getType(String name) {
|
||||
if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4) return NBTType.NBTTagEnd;
|
||||
if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4)
|
||||
return NBTType.NBTTagEnd;
|
||||
return NBTType.valueOf(NBTReflectionUtil.getType(this, name));
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class NBTFile extends NBTCompound {
|
||||
}
|
||||
|
||||
public void save() throws IOException {
|
||||
if (!file.exists()) {
|
||||
if (! file.exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user