One Final Reformat

This commit is contained in:
Driftay 2019-08-24 13:21:39 -04:00
parent 72f76aeb71
commit 6a7258b692
53 changed files with 6311 additions and 6312 deletions

View File

@ -7,14 +7,13 @@ import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.util.SimpleExpression; import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean; import ch.njol.util.Kleenean;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import org.bukkit.Chunk;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
public class PlayerChunkLocationExpression extends SimpleExpression<String> { public class PlayerChunkLocationExpression extends SimpleExpression<String> {
static{ static {
Skript.registerExpression(PlayerChunkLocationExpression.class, String.class, ExpressionType.SIMPLE,"[the] faction chunk at %player%", "[the] %player%['s] chunk"); Skript.registerExpression(PlayerChunkLocationExpression.class, String.class, ExpressionType.SIMPLE, "[the] faction chunk at %player%", "[the] %player%['s] chunk");
} }
Expression<Player> playerExpression; Expression<Player> playerExpression;

View File

@ -26,6 +26,11 @@ public enum Access {
return null; return null;
} }
public static Access booleanToAccess(boolean access) {
if (access) return Access.ALLOW;
else return Access.DENY;
}
public String getName() { public String getName() {
return this.name.toLowerCase(); return this.name.toLowerCase();
} }
@ -35,10 +40,7 @@ public enum Access {
return name(); return name();
} }
public String getColor() { return P.p.getConfig().getString("fperm-gui.action.Access-Colors." + this.name); } public String getColor() {
return P.p.getConfig().getString("fperm-gui.action.Access-Colors." + this.name);
public static Access booleanToAccess(boolean access) {
if (access) return Access.ALLOW;
else return Access.DENY;
} }
} }

View File

@ -1,8 +1,5 @@
package com.massivecraft.factions.zcore.fperms; package com.massivecraft.factions.zcore.fperms;
import com.massivecraft.factions.util.XMaterial;
import javafx.scene.paint.Material;
public class DefaultPermissions { public class DefaultPermissions {
public boolean ban; public boolean ban;
public boolean build; public boolean build;
@ -153,7 +150,7 @@ public class DefaultPermissions {
else if (name == "tntfill") return this.tntfill; else if (name == "tntfill") return this.tntfill;
else if (name == "withdraw") return this.withdraw; else if (name == "withdraw") return this.withdraw;
else if (name == "chest") return this.chest; else if (name == "chest") return this.chest;
else if(name == "check") return this.check; else if (name == "check") return this.check;
else if (name == "spawner") return this.spawner; else if (name == "spawner") return this.spawner;
else return false; else return false;
} }

View File

@ -64,8 +64,6 @@ public enum PermissableAction {
return null; return null;
} }
public int getSlot() { return P.p.getConfig().getInt("fperm-gui.action.slots." + this.name.toLowerCase()); }
public static Map<PermissableAction, Access> fromDefaults(DefaultPermissions defaultPermissions) { public static Map<PermissableAction, Access> fromDefaults(DefaultPermissions defaultPermissions) {
Map<PermissableAction, Access> defaultMap = new HashMap<>(); Map<PermissableAction, Access> defaultMap = new HashMap<>();
for (PermissableAction permissableAction : PermissableAction.values()) { for (PermissableAction permissableAction : PermissableAction.values()) {
@ -74,6 +72,17 @@ public enum PermissableAction {
return defaultMap; return defaultMap;
} }
public static PermissableAction fromSlot(int slot) {
for (PermissableAction action : PermissableAction.values()) {
if (action.getSlot() == slot) return action;
}
return null;
}
public int getSlot() {
return P.p.getConfig().getInt("fperm-gui.action.slots." + this.name.toLowerCase());
}
/** /**
* Get the friendly name of this action. Used for editing in commands. * Get the friendly name of this action. Used for editing in commands.
* *
@ -105,11 +114,4 @@ public enum PermissableAction {
return item; return item;
} }
public static PermissableAction fromSlot(int slot) {
for (PermissableAction action : PermissableAction.values()) {
if (action.getSlot() == slot) return action;
}
return null;
}
} }

View File

@ -173,13 +173,13 @@ public class FUpgradesGUI implements Listener {
break; break;
} }
} }
} else if(e.getCurrentItem().equals(memberItem)){ } else if (e.getCurrentItem().equals(memberItem)) {
int memberLevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS) + 1; int memberLevel = fme.getFaction().getUpgrade(UpgradeType.MEMBERS) + 1;
if(!P.p.getConfig().isSet("fupgrades.MainMenu.Members.Cost.level-" + memberLevel)){ if (!P.p.getConfig().isSet("fupgrades.MainMenu.Members.Cost.level-" + memberLevel)) {
return; return;
} }
int cost = P.p.getConfig().getInt("fupgrades.MainMenu.Members.Cost.level-" + memberLevel); int cost = P.p.getConfig().getInt("fupgrades.MainMenu.Members.Cost.level-" + memberLevel);
if(hasMoney(fme, cost)){ if (hasMoney(fme, cost)) {
fme.getFaction().setUpgrade(UpgradeType.MEMBERS, memberLevel); fme.getFaction().setUpgrade(UpgradeType.MEMBERS, memberLevel);
fme.getPlayer().closeInventory(); fme.getPlayer().closeInventory();
takeMoney(fme, cost); takeMoney(fme, cost);
@ -268,7 +268,6 @@ public class FUpgradesGUI implements Listener {
} }
Material cropMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type")); Material cropMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Crops.CropItem.Type"));
int cropAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount"); int cropAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Amount");
short cropData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + ""); short cropData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Crops.CropItem.Damage") + "");

View File

@ -41,8 +41,8 @@ import java.util.*;
*/ */
public abstract class MemoryFPlayer implements FPlayer { public abstract class MemoryFPlayer implements FPlayer {
protected HashMap<String, Long> commandCooldown = new HashMap<>();
public boolean inVault = false; public boolean inVault = false;
protected HashMap<String, Long> commandCooldown = new HashMap<>();
protected String factionId; protected String factionId;
protected Role role; protected Role role;
protected String title; protected String title;
@ -76,16 +76,8 @@ public abstract class MemoryFPlayer implements FPlayer {
protected transient boolean shouldTakeFallDamage = true; protected transient boolean shouldTakeFallDamage = true;
protected boolean isStealthEnabled = false; protected boolean isStealthEnabled = false;
protected boolean notificationsEnabled = true; protected boolean notificationsEnabled = true;
boolean inspectMode = false;
protected boolean isAlt = false; protected boolean isAlt = false;
boolean inspectMode = false;
public void setAlt(boolean alt){
this.isAlt = alt;
}
public boolean isAlt() {
return isAlt;
}
public MemoryFPlayer() { public MemoryFPlayer() {
} }
@ -139,7 +131,13 @@ public abstract class MemoryFPlayer implements FPlayer {
this.mapHeight = Conf.mapHeight; this.mapHeight = Conf.mapHeight;
} }
public boolean isAlt() {
return isAlt;
}
public void setAlt(boolean alt) {
this.isAlt = alt;
}
public boolean isStealthEnabled() { public boolean isStealthEnabled() {
return this.isStealthEnabled; return this.isStealthEnabled;
@ -758,7 +756,7 @@ public abstract class MemoryFPlayer implements FPlayer {
myFaction.removeAnnouncements(this); myFaction.removeAnnouncements(this);
if(this.isAlt()){ if (this.isAlt()) {
myFaction.removeAltPlayer(this); myFaction.removeAltPlayer(this);
this.msg(TL.LEAVE_LEFT, this.describeTo(this, true), myFaction.describeTo(this)); this.msg(TL.LEAVE_LEFT, this.describeTo(this, true), myFaction.describeTo(this));
} }
@ -913,7 +911,7 @@ public abstract class MemoryFPlayer implements FPlayer {
public void setFFlying(boolean fly, boolean damage) { public void setFFlying(boolean fly, boolean damage) {
Player player = getPlayer(); Player player = getPlayer();
if(player == null) return; if (player == null) return;
player.setAllowFlight(fly); player.setAllowFlight(fly);
player.setFlying(fly); player.setFlying(fly);
@ -1253,7 +1251,6 @@ public abstract class MemoryFPlayer implements FPlayer {
} }
@Override @Override
public String getRolePrefix() { public String getRolePrefix() {

View File

@ -1276,7 +1276,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc) { public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc) {
// in own faction, with sufficient role or permission to bypass // in own faction, with sufficient role or permission to bypass
// ownership? // ownership?
if (fplayer.getFaction() == this && (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.LEADER) || Permission.OWNERSHIP_BYPASS.has(fplayer.getPlayer()))) return true; if (fplayer.getFaction() == this && (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.LEADER) || Permission.OWNERSHIP_BYPASS.has(fplayer.getPlayer())))
return true;
// make sure claimOwnership is initialized // make sure claimOwnership is initialized
if (claimOwnership.isEmpty()) return true; if (claimOwnership.isEmpty()) return true;
@ -1309,5 +1310,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
} }
} }
public Set<FLocation> getAllClaims() { return Board.getInstance().getAllClaims(this); } public Set<FLocation> getAllClaims() {
return Board.getInstance().getAllClaims(this);
}
} }