Code Cleanup

This commit is contained in:
Driftay 2019-09-24 17:54:12 -04:00
parent 2a08f167bb
commit a493f1494e
5 changed files with 3 additions and 31 deletions

View File

@ -101,9 +101,6 @@ public class FactionsBlockListener implements Listener {
return false; return false;
} }
public static boolean graceisEnabled() {
return Conf.gracePeriod;
}
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean shouldHurt) { private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean shouldHurt) {
boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty()); boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty());

View File

@ -288,19 +288,6 @@ public class FactionsPlayerListener implements Listener {
return false; return false;
} }
/// <summary>
/// This checks if the current player can execute an action based on it's factions access and surroundings
/// It will grant access in the following priorities:
/// - If Faction Land is Owned and the Owner is the current player, or player is faction leader.
/// - If Faction Land is not Owned and my access value is not set to DENY
/// - If none of the filters above matches, then we consider access is set to ALLOW|UNDEFINED
/// This check does not performs any kind of bypass check (i.e.: me.isAdminBypassing())
/// </summary>
/// <param name="player">The player entity which the check will be made upon</param>
/// <param name="me">The Faction player object related to the player</param>
/// <param name="loc">The World location where the action is being executed</param>
/// <param name="myFaction">The faction of the player being checked</param>
/// <param name="access">The current's faction access permission for the action</param>
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction factionToCheck, Access access, PermissableAction action, boolean pain) { private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction factionToCheck, Access access, PermissableAction action, boolean pain) {
boolean doPain = pain && Conf.handleExploitInteractionSpam; boolean doPain = pain && Conf.handleExploitInteractionSpam;
if (access != null && access != Access.UNDEFINED) { if (access != null && access != Access.UNDEFINED) {
@ -852,7 +839,6 @@ public class FactionsPlayerListener implements Listener {
&& event.hasItem() && event.getItem().getType() == XMaterial.BONE_MEAL.parseMaterial()) { && event.hasItem() && event.getItem().getType() == XMaterial.BONE_MEAL.parseMaterial()) {
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) { if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) {
FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString()); FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString());
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", "use bone meal")); me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", "use bone meal"));

View File

@ -33,7 +33,7 @@ public class JSONBoard extends MemoryBoard {
coords = entry.getKey().getCoordString(); coords = entry.getKey().getCoordString();
id = entry.getValue(); id = entry.getValue();
if (!worldCoordIds.containsKey(worldName)) { if (!worldCoordIds.containsKey(worldName)) {
worldCoordIds.put(worldName, new TreeMap<String, String>()); worldCoordIds.put(worldName, new TreeMap<>());
} }
worldCoordIds.get(worldName).put(coords, id); worldCoordIds.get(worldName).put(coords, id);

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.zcore.persist.json; package com.massivecraft.factions.zcore.persist.json;
import com.google.common.base.Function;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@ -39,12 +38,7 @@ public class JSONFPlayers extends MemoryFPlayers {
} }
public void convertFrom(MemoryFPlayers old) { public void convertFrom(MemoryFPlayers old) {
this.fPlayers.putAll(Maps.transformValues(old.fPlayers, new Function<FPlayer, JSONFPlayer>() { this.fPlayers.putAll(Maps.transformValues(old.fPlayers, arg0 -> new JSONFPlayer((MemoryFPlayer) arg0)));
@Override
public JSONFPlayer apply(FPlayer arg0) {
return new JSONFPlayer((MemoryFPlayer) arg0);
}
}));
forceSave(); forceSave();
FPlayers.instance = this; FPlayers.instance = this;
} }

View File

@ -241,12 +241,7 @@ public class JSONFactions extends MemoryFactions {
@Override @Override
public void convertFrom(MemoryFactions old) { public void convertFrom(MemoryFactions old) {
this.factions.putAll(Maps.transformValues(old.factions, new Function<Faction, JSONFaction>() { this.factions.putAll(Maps.transformValues(old.factions, arg0 -> new JSONFaction((MemoryFaction) arg0)));
@Override
public JSONFaction apply(Faction arg0) {
return new JSONFaction((MemoryFaction) arg0);
}
}));
this.nextId = old.nextId; this.nextId = old.nextId;
forceSave(); forceSave();
Factions.instance = this; Factions.instance = this;