Fixed Spawner Mining Error
This commit is contained in:
parent
bcc04e6174
commit
0fc3e47289
@ -162,20 +162,22 @@ public class FactionsBlockListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(event.getBlockPlaced()));
|
||||
|
||||
if (!event.canBuild()) return;
|
||||
if (event.getBlockPlaced().getType() == Material.FIRE) return;
|
||||
|
||||
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "build", false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial()) && Conf.spawnerLock) {
|
||||
|
||||
if (isSpawner) {
|
||||
if (Conf.spawnerLock) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
@ -494,12 +496,24 @@ public class FactionsBlockListener implements Listener {
|
||||
Block block = event.getBlock();
|
||||
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(block));
|
||||
boolean isSpawner = event.getBlock().getType() == XMaterial.SPAWNER.parseMaterial();
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), !isSpawner ? "destroy" : "mine spawners", false)) {
|
||||
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (block != null && isSpawner) {
|
||||
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
if (fme == null || !fme.hasFaction()) return;
|
||||
|
||||
if (isSpawner) {
|
||||
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
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());
|
||||
|
@ -925,16 +925,17 @@ public class FactionsPlayerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onLogoutMove(PlayerMoveEvent e) {
|
||||
LogoutHandler handler = LogoutHandler.getByName(e.getPlayer().getName());
|
||||
|
||||
if (Objects.requireNonNull(e.getTo()).getBlockX() == e.getFrom().getBlockX() &&
|
||||
e.getTo().getBlockY() == e.getFrom().getBlockY() &&
|
||||
e.getTo().getBlockZ() == e.getFrom().getBlockZ())
|
||||
return;
|
||||
|
||||
if (handler.isLogoutActive(e.getPlayer())) {
|
||||
handler.cancelLogout(e.getPlayer());
|
||||
e.getPlayer().sendMessage(String.valueOf(TL.COMMAND_LOGOUT_MOVED));
|
||||
}
|
||||
|
||||
if (e.getTo().getBlockX() == e.getFrom().getBlockX() &&
|
||||
e.getTo().getBlockY() == e.getFrom().getBlockY() &&
|
||||
e.getTo().getBlockZ() == e.getFrom().getBlockZ())
|
||||
return;
|
||||
|
||||
if (CmdWild.waitingTeleport.containsKey(e.getPlayer())) {
|
||||
CmdWild.waitingTeleport.remove(e.getPlayer());
|
||||
FPlayers.getInstance().getByPlayer(e.getPlayer()).msg(TL.COMMAND_WILD_INTERUPTED);
|
||||
|
Loading…
Reference in New Issue
Block a user