diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index c26926e71..73856f638 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -178,6 +178,7 @@ public class Conf { public static boolean disablePVPForFactionlessPlayers = false; public static boolean enablePVPAgainstFactionlessInAttackersLand = false; public static int noPVPDamageToOthersForXSecondsAfterLogin = 3; + public static boolean allFactionsPeaceful = false; public static boolean peacefulTerritoryDisablePVP = true; public static boolean peacefulTerritoryDisableMonsters = false; public static boolean peacefulTerritoryDisableBoom = false; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index 6ef0ba022..d46d05911 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -143,6 +143,10 @@ public void perform(CommandContext context) { Logger.print(context.fPlayer.getName() + TL.COMMAND_CREATE_CREATEDLOG + tag, Logger.PrefixType.DEFAULT); if (FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) context.msg(TL.COMMAND_PAYPALSET_CREATED); + if(Conf.allFactionsPeaceful) { + faction.setPeaceful(true); + faction.setPeacefulExplosionsEnabled(false); + } if (Conf.useCustomDefaultPermissions) faction.setDefaultPerms(); if (Conf.usePermissionHints) context.msg(TL.COMMAND_HINT_PERMISSION); } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 911fb68b8..212bb6ac7 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -141,22 +141,6 @@ public void handleSpawnerUpdate(Faction at, Player player, ItemStack spawnerItem } } - @EventHandler( - priority = EventPriority.HIGH, - ignoreCancelled = true - ) - public void onPlayerPlace(BlockPlaceEvent event) { - ItemStack item = event.getItemInHand(); - if (item != null && item.getType() == XMaterial.SPAWNER.parseMaterial()) { - Faction at = Board.getInstance().getFactionAt(new FLocation(event.getBlockPlaced())); - if (at != null && at.isNormal()) { - FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer()); - if (fplayer != null && at.getRelationTo(fplayer.getFaction()).isAtLeast(Relation.TRUCE)) { - this.handleSpawnerUpdate(at, event.getPlayer(), item, LogTimer.TimerSubType.SPAWNER_PLACE); - } - } - } - } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockPlace(BlockPlaceEvent event) { @@ -482,7 +466,7 @@ public void onBlockBreak(BlockBreakEvent event) { Block block = event.getBlock(); Faction at = Board.getInstance().getFactionAt(new FLocation(block)); - boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial()); + boolean isSpawner = event.getBlock().getType().equals(XMaterial.matchXMaterial("MOB_SPAWNER").get().parseMaterial()); if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { event.setCancelled(true); return; @@ -497,21 +481,6 @@ public void onBlockBreak(BlockBreakEvent event) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners"); } } - - if (isSpawner && !fme.isAdminBypassing()) { - ItemStack item = new ItemStack(block.getType(), 1, block.getData()); - if (at != null && at.isNormal()) { - FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer()); - if (fplayer != null) { - BlockState state = block.getState(); - if (state instanceof CreatureSpawner) { - CreatureSpawner spawner = (CreatureSpawner) state; - item.setDurability(spawner.getSpawnedType().getTypeId()); - } - handleSpawnerUpdate(at, event.getPlayer(), item, LogTimer.TimerSubType.SPAWNER_BREAK); - } - } - } } catch (Exception e) { event.setCancelled(true); e.printStackTrace();