From a493f1494e658e6c68390f06420b1872e911adb7 Mon Sep 17 00:00:00 2001 From: Driftay Date: Tue, 24 Sep 2019 17:54:12 -0400 Subject: [PATCH] Code Cleanup --- .../factions/listeners/FactionsBlockListener.java | 3 --- .../factions/listeners/FactionsPlayerListener.java | 14 -------------- .../factions/zcore/persist/json/JSONBoard.java | 2 +- .../factions/zcore/persist/json/JSONFPlayers.java | 8 +------- .../factions/zcore/persist/json/JSONFactions.java | 7 +------ 5 files changed, 3 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index e223cd3a..99221986 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -101,9 +101,6 @@ public class FactionsBlockListener implements Listener { 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) { boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty()); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 95ce78e1..92b2a930 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -288,19 +288,6 @@ public class FactionsPlayerListener implements Listener { return false; } - /// - /// 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()) - /// - /// The player entity which the check will be made upon - /// The Faction player object related to the player - /// The World location where the action is being executed - /// The faction of the player being checked - /// The current's faction access permission for the action private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction factionToCheck, Access access, PermissableAction action, boolean pain) { boolean doPain = pain && Conf.handleExploitInteractionSpam; if (access != null && access != Access.UNDEFINED) { @@ -852,7 +839,6 @@ public class FactionsPlayerListener implements Listener { && event.hasItem() && event.getItem().getType() == XMaterial.BONE_MEAL.parseMaterial()) { if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) { FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString()); - Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation())); Faction myFaction = me.getFaction(); me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", "use bone meal")); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java index b0baaf3e..43a9b39e 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONBoard.java @@ -33,7 +33,7 @@ public class JSONBoard extends MemoryBoard { coords = entry.getKey().getCoordString(); id = entry.getValue(); if (!worldCoordIds.containsKey(worldName)) { - worldCoordIds.put(worldName, new TreeMap()); + worldCoordIds.put(worldName, new TreeMap<>()); } worldCoordIds.get(worldName).put(coords, id); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java index 677c062e..831ab481 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFPlayers.java @@ -1,6 +1,5 @@ package com.massivecraft.factions.zcore.persist.json; -import com.google.common.base.Function; import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -39,12 +38,7 @@ public class JSONFPlayers extends MemoryFPlayers { } public void convertFrom(MemoryFPlayers old) { - this.fPlayers.putAll(Maps.transformValues(old.fPlayers, new Function() { - @Override - public JSONFPlayer apply(FPlayer arg0) { - return new JSONFPlayer((MemoryFPlayer) arg0); - } - })); + this.fPlayers.putAll(Maps.transformValues(old.fPlayers, arg0 -> new JSONFPlayer((MemoryFPlayer) arg0))); forceSave(); FPlayers.instance = this; } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java index 23df3f8d..2ee042f4 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/json/JSONFactions.java @@ -241,12 +241,7 @@ public class JSONFactions extends MemoryFactions { @Override public void convertFrom(MemoryFactions old) { - this.factions.putAll(Maps.transformValues(old.factions, new Function() { - @Override - public JSONFaction apply(Faction arg0) { - return new JSONFaction((MemoryFaction) arg0); - } - })); + this.factions.putAll(Maps.transformValues(old.factions, arg0 -> new JSONFaction((MemoryFaction) arg0))); this.nextId = old.nextId; forceSave(); Factions.instance = this;