Add patch for interact event. Fixes issue #53. Thanks @swifteh

This commit is contained in:
drtshock 2014-09-25 13:39:22 -05:00
parent 649147c47f
commit 39e0380570
2 changed files with 18 additions and 4 deletions

View File

@ -37,7 +37,7 @@ public class FactionsBlockListener implements Listener {
} }
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) { if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
event.setCancelled(true); event.setBuild(false);
} }
} }

View File

@ -305,6 +305,23 @@ public class FactionsPlayerListener implements Listener {
return true; return true;
} }
// Dupe fix.
Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction);
if (!rel.isMember() || !otherFaction.playerHasOwnershipRights(me, loc) && player.getItemInHand() != null) {
switch (player.getItemInHand().getType()) {
case CHEST:
case SIGN_POST:
case TRAPPED_CHEST:
case SIGN:
case WOOD_DOOR:
case IRON_DOOR:
return false;
default:
break;
}
}
// We only care about some material types. // We only care about some material types.
if (otherFaction.hasPlayersOnline()) { if (otherFaction.hasPlayersOnline()) {
if (!Conf.territoryProtectedMaterials.contains(material)) { if (!Conf.territoryProtectedMaterials.contains(material)) {
@ -316,9 +333,6 @@ public class FactionsPlayerListener implements Listener {
} }
} }
Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction);
// You may use any block unless it is another faction's territory... // You may use any block unless it is another faction's territory...
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) { if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) {
if (!justCheck) { if (!justCheck) {