Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 90a5f53

Browse files
author
SvenjaReißaus
committed
Let's try something else, to finish it up
1 parent f658a6d commit 90a5f53

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed
-2 Bytes
Binary file not shown.

src/main/java/com/massivecraft/factions/Faction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public interface Faction extends EconomyParticipator {
176176
boolean noMonstersInTerritory();
177177

178178
boolean isNormal();
179-
179+
boolean isSystemFaction();
180180
@Deprecated
181181
boolean isNone();
182182

src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName
501501
}
502502
me.msg(TL.GENERIC_NOPERMISSION, action);
503503
return false;
504-
} else return access == Access.ALLOW;
504+
} else if (access == Access.ALLOW) return true;
505+
me.msg(TL.GENERIC_NOPERMISSION, action);
506+
return false;
505507
}
506508

507509
private static boolean CheckActionState(Faction target, FLocation location, FPlayer me, PermissableAction action, boolean pain) {

src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java

+8-12
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,15 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
169169
Relation rel = myFaction.getRelationTo(otherFaction);
170170

171171
// no door/chest/whatever protection in wilderness, war zones, or safe zones
172-
if (!otherFaction.isNormal()) return true;
172+
if (otherFaction.isSystemFaction()) return true;
173+
if (myFaction.isWilderness()) {
174+
me.msg(TL.GENERIC_NOPERMISSION, TL.GENERIC_DOTHAT);
175+
return false;
176+
}
173177

174178
if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
175179
return true;
176180

177-
if (!rel.isMember() || !otherFaction.playerHasOwnershipRights(me, loc) && player.getItemInHand().getType() != null) {
178-
if (player.getItemInHand().getType().toString().toUpperCase().contains("DOOR"))
179-
return false;
180-
}
181-
182181
PermissableAction action = null;
183182
if (SavageFactions.plugin.mc113) {
184183
switch (block.getType()) {
@@ -320,8 +319,6 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
320319

321320
// Move up access check to check for exceptions
322321
if (!otherFaction.getId().equals(myFaction.getId())) { // If the faction target is not my own
323-
if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
324-
return true;
325322
// Get faction pain build access relation to me
326323
boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
327324
return CheckPlayerAccess(player, me, loc, otherFaction, otherFaction.getAccess(me, action), action, pain);
@@ -872,22 +869,20 @@ public void onPlayerInteract(PlayerInteractEvent event) {
872869

873870
Block block = event.getClickedBlock();
874871
Player player = event.getPlayer();
875-
FLocation loc = new FLocation(block.getLocation());
876-
Faction faction = MemoryBoard.getInstance().getFactionAt(loc);
877-
FPlayer fplayer = MemoryFPlayers.getInstance().getByPlayer(player);
878872

879873
// Check if the material is bypassing protection
880874
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
881875

882876
if (block == null) return; // clicked in air, apparently
883877

884878
if (!block.getType().isInteractable()) return;
885-
879+
player.sendMessage("Checking if you can use that block");
886880
if (!canPlayerUseBlock(player, block, false)) {
887881
event.setCancelled(true);
888882
event.setUseInteractedBlock(Event.Result.DENY);
889883
return;
890884
}
885+
player.sendMessage("Checking if you can use that item");
891886
if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) {
892887
event.setCancelled(true);
893888
event.setUseInteractedBlock(Event.Result.DENY);
@@ -1042,6 +1037,7 @@ else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName
10421037
return false;
10431038
}
10441039
}
1040+
me.msg(TL.GENERIC_NOPERMISSION, action);
10451041
return false;
10461042
}
10471043
}

src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java

+1
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ public boolean isSafeZone() {
754754
public boolean isWarZone() {
755755
return this.getId().equals("-2");
756756
}
757+
public boolean isSystemFaction() { return this.isSafeZone() || this.isWarZone() || this.isWilderness(); }
757758

758759
public boolean isPlayerFreeType() {
759760
return this.isSafeZone() || this.isWarZone();

0 commit comments

Comments
 (0)