mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-02 08:50:17 +01:00
Fix plot redstone disabling (not sure why it was the way it was, but it was never going to work, so I fixed? it)
also minor reformat to PlayerEvents
This commit is contained in:
parent
750be6c5fe
commit
3156741664
@ -58,8 +58,7 @@ import java.util.regex.Pattern;
|
|||||||
/**
|
/**
|
||||||
* Player Events involving plots.
|
* Player Events involving plots.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused") public class PlayerEvents extends PlotListener implements Listener {
|
||||||
public class PlayerEvents extends PlotListener implements Listener {
|
|
||||||
|
|
||||||
private boolean pistonBlocks = true;
|
private boolean pistonBlocks = true;
|
||||||
private float lastRadius;
|
private float lastRadius;
|
||||||
@ -88,7 +87,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
if (loc.getWorld().equals(world)) {
|
if (loc.getWorld().equals(world)) {
|
||||||
if (16 * Math.abs(loc.getX() - x) / 16 > distance
|
if (16 * Math.abs(loc.getX() - x) / 16 > distance
|
||||||
|| 16 * Math.abs(loc.getZ() - z) / 16 > distance) {
|
|| 16 * Math.abs(loc.getZ() - z) / 16 > distance) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
((BukkitPlayer) player).player.sendBlockChange(bloc, data);
|
((BukkitPlayer) player).player.sendBlockChange(bloc, data);
|
||||||
@ -99,7 +98,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
|
|
||||||
public static boolean checkEntity(Entity entity, Plot plot) {
|
public static boolean checkEntity(Entity entity, Plot plot) {
|
||||||
if (plot == null || !plot.hasOwner() || plot.getFlags().isEmpty() && plot
|
if (plot == null || !plot.hasOwner() || plot.getFlags().isEmpty() && plot
|
||||||
.getArea().DEFAULT_FLAGS.isEmpty()) {
|
.getArea().DEFAULT_FLAGS.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
@ -182,7 +181,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case TROPICAL_FISH:
|
case TROPICAL_FISH:
|
||||||
// animal
|
// animal
|
||||||
return EntityUtil
|
return EntityUtil
|
||||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
|
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
|
||||||
case BLAZE:
|
case BLAZE:
|
||||||
case CAVE_SPIDER:
|
case CAVE_SPIDER:
|
||||||
case CREEPER:
|
case CREEPER:
|
||||||
@ -214,15 +213,15 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case ILLUSIONER:
|
case ILLUSIONER:
|
||||||
// monster
|
// monster
|
||||||
return EntityUtil
|
return EntityUtil
|
||||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
|
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
|
||||||
default:
|
default:
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
if (entity instanceof Animals || entity instanceof WaterMob) {
|
if (entity instanceof Animals || entity instanceof WaterMob) {
|
||||||
return EntityUtil
|
return EntityUtil
|
||||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
|
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
|
||||||
} else if (entity instanceof Monster) {
|
} else if (entity instanceof Monster) {
|
||||||
return EntityUtil
|
return EntityUtil
|
||||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
|
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
|
||||||
} else {
|
} else {
|
||||||
return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP);
|
return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP);
|
||||||
}
|
}
|
||||||
@ -237,10 +236,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler public void onRedstoneEvent(BlockRedstoneEvent event) {
|
||||||
public void onRedstoneEvent(BlockRedstoneEvent event) {
|
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
switch (block.getType()) {
|
/* switch (block.getType()) {
|
||||||
case OBSERVER:
|
case OBSERVER:
|
||||||
case REDSTONE:
|
case REDSTONE:
|
||||||
case REDSTONE_ORE:
|
case REDSTONE_ORE:
|
||||||
@ -286,55 +284,55 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case OAK_FENCE_GATE:
|
case OAK_FENCE_GATE:
|
||||||
case POWERED_RAIL:
|
case POWERED_RAIL:
|
||||||
return;
|
return;
|
||||||
default:
|
default:*/
|
||||||
Location loc = BukkitUtil.getLocation(block.getLocation());
|
Location loc = BukkitUtil.getLocation(block.getLocation());
|
||||||
PlotArea area = loc.getPlotArea();
|
PlotArea area = loc.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
Plot plot = area.getOwnedPlot(loc);
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Flags.REDSTONE.isFalse(plot)) {
|
|
||||||
event.setNewCurrent(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Settings.Redstone.DISABLE_OFFLINE) {
|
|
||||||
boolean disable;
|
|
||||||
if (plot.isMerged()) {
|
|
||||||
disable = true;
|
|
||||||
for (UUID owner : plot.getOwners()) {
|
|
||||||
if (UUIDHandler.getPlayer(owner) != null) {
|
|
||||||
disable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
disable = UUIDHandler.getPlayer(plot.guessOwner()) == null;
|
|
||||||
}
|
|
||||||
if (disable) {
|
|
||||||
for (UUID trusted : plot.getTrusted()) {
|
|
||||||
if (UUIDHandler.getPlayer(trusted) != null) {
|
|
||||||
disable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (disable) {
|
|
||||||
event.setNewCurrent(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
|
|
||||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
|
||||||
if (plot.equals(entry.getValue().getCurrentPlot())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setNewCurrent(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Plot plot = area.getOwnedPlot(loc);
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Flags.REDSTONE.isFalse(plot)) {
|
||||||
|
event.setNewCurrent(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Settings.Redstone.DISABLE_OFFLINE) {
|
||||||
|
boolean disable;
|
||||||
|
if (plot.isMerged()) {
|
||||||
|
disable = true;
|
||||||
|
for (UUID owner : plot.getOwners()) {
|
||||||
|
if (UUIDHandler.getPlayer(owner) != null) {
|
||||||
|
disable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
disable = UUIDHandler.getPlayer(plot.guessOwner()) == null;
|
||||||
|
}
|
||||||
|
if (disable) {
|
||||||
|
for (UUID trusted : plot.getTrusted()) {
|
||||||
|
if (UUIDHandler.getPlayer(trusted) != null) {
|
||||||
|
disable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (disable) {
|
||||||
|
event.setNewCurrent(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
|
||||||
|
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||||
|
if (plot.equals(entry.getValue().getCurrentPlot())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.setNewCurrent(0);
|
||||||
|
}
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
@ -416,8 +414,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
|
||||||
Projectile entity = event.getEntity();
|
Projectile entity = event.getEntity();
|
||||||
if (!(entity instanceof ThrownPotion)) {
|
if (!(entity instanceof ThrownPotion)) {
|
||||||
return;
|
return;
|
||||||
@ -438,8 +435,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||||
public boolean onProjectileHit(ProjectileHitEvent event) {
|
|
||||||
Projectile entity = event.getEntity();
|
Projectile entity = event.getEntity();
|
||||||
Location loc = BukkitUtil.getLocation(entity);
|
Location loc = BukkitUtil.getLocation(entity);
|
||||||
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
|
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
|
||||||
@ -461,7 +457,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions
|
if (plot.isAdded(pp.getUUID()) || Permissions
|
||||||
.hasPermission(pp, C.PERMISSION_PROJECTILE_OTHER)) {
|
.hasPermission(pp, C.PERMISSION_PROJECTILE_OTHER)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
@ -473,7 +469,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Location sLoc =
|
Location sLoc =
|
||||||
BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
|
BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
|
||||||
if (!area.contains(sLoc.getX(), sLoc.getZ())) {
|
if (!area.contains(sLoc.getX(), sLoc.getZ())) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
return false;
|
return false;
|
||||||
@ -509,7 +505,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case "worldedit:up":
|
case "worldedit:up":
|
||||||
case "worldedit:/up":
|
case "worldedit:/up":
|
||||||
if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions
|
if (plot == null || (!plot.isAdded(pp.getUUID()) && !Permissions
|
||||||
.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER, true))) {
|
.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER, true))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -520,7 +516,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
|
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
|
||||||
if (flag.isPresent() && !Permissions
|
if (flag.isPresent() && !Permissions
|
||||||
.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
||||||
List<String> blocked_cmds = flag.get();
|
List<String> blocked_cmds = flag.get();
|
||||||
String c = parts[0];
|
String c = parts[0];
|
||||||
if (parts[0].contains(":")) {
|
if (parts[0].contains(":")) {
|
||||||
@ -622,7 +618,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
|
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
|
||||||
.equals(event.getTo().getWorld())) {
|
.equals(event.getTo().getWorld())) {
|
||||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
|
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
|
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
org.bukkit.Location to = event.getTo();
|
org.bukkit.Location to = event.getTo();
|
||||||
@ -651,7 +647,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
|
|
||||||
int toX, toZ;
|
int toX, toZ;
|
||||||
if ((toX = MathMan.roundInt(to.getX())) != MathMan.roundInt(from.getX())
|
if ((toX = MathMan.roundInt(to.getX())) != MathMan.roundInt(from.getX())
|
||||||
| (toZ = MathMan.roundInt(to.getZ())) != MathMan.roundInt(from.getZ())) {
|
| (toZ = MathMan.roundInt(to.getZ())) != MathMan.roundInt(from.getZ())) {
|
||||||
Vehicle vehicle = event.getVehicle();
|
Vehicle vehicle = event.getVehicle();
|
||||||
|
|
||||||
// Check allowed
|
// Check allowed
|
||||||
@ -675,7 +671,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (moveTmp.isCancelled()) {
|
if (moveTmp.isCancelled()) {
|
||||||
dest = from;
|
dest = from;
|
||||||
} else if (MathMan.roundInt(moveTmp.getTo().getX()) != toX
|
} else if (MathMan.roundInt(moveTmp.getTo().getX()) != toX
|
||||||
|| MathMan.roundInt(moveTmp.getTo().getZ()) != toZ) {
|
|| MathMan.roundInt(moveTmp.getTo().getZ()) != toZ) {
|
||||||
dest = to;
|
dest = to;
|
||||||
} else {
|
} else {
|
||||||
dest = null;
|
dest = null;
|
||||||
@ -715,7 +711,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (toPlot != null) {
|
} else if (toPlot != null) {
|
||||||
vehicle.setMetadata("plot",
|
vehicle.setMetadata("plot",
|
||||||
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, toPlot));
|
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, toPlot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -850,8 +846,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW) public void onChat(AsyncPlayerChatEvent event) {
|
||||||
public void onChat(AsyncPlayerChatEvent event) {
|
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -885,7 +880,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String partial = ChatColor.translateAlternateColorCodes('&',
|
String partial = ChatColor.translateAlternateColorCodes('&',
|
||||||
format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
|
format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
|
||||||
if (plotPlayer.hasPermission("plots.chat.color")) {
|
if (plotPlayer.hasPermission("plots.chat.color")) {
|
||||||
message = C.color(message);
|
message = C.color(message);
|
||||||
}
|
}
|
||||||
@ -895,7 +890,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!spies.isEmpty()) {
|
if (!spies.isEmpty()) {
|
||||||
String spyMessage = C.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y)
|
String spyMessage = C.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y)
|
||||||
.replace("%sender%", sender).replace("%msg%", message);
|
.replace("%sender%", sender).replace("%msg%", message);
|
||||||
for (Player player : spies) {
|
for (Player player : spies) {
|
||||||
player.sendMessage(spyMessage);
|
player.sendMessage(spyMessage);
|
||||||
}
|
}
|
||||||
@ -903,8 +898,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
PlotSquared.debug(full);
|
PlotSquared.debug(full);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
|
||||||
public void blockDestroy(BlockBreakEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
@ -916,26 +910,26 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (event.getBlock().getY() == 0) {
|
if (event.getBlock().getY() == 0) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
|
C.PERMISSION_ADMIN_DESTROY_GROUNDLEVEL);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
(location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
||||||
&& !Permissions
|
&& !Permissions
|
||||||
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
MainUtil.sendMessage(plotPlayer,
|
MainUtil.sendMessage(plotPlayer,
|
||||||
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -943,19 +937,19 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
|
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (destroy.isPresent() && destroy.get()
|
if (destroy.isPresent() && destroy.get()
|
||||||
.contains(PlotBlock.get(block.getType().name()))) {
|
.contains(PlotBlock.get(block.getType().name()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_OTHER);
|
C.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
} else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_BUILD_OTHER);
|
C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -968,7 +962,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||||
if (player.getInventory().getItemInMainHand().getType() == Material
|
if (player.getInventory().getItemInMainHand().getType() == Material
|
||||||
.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) {
|
.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1005,13 +999,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (this.lastRadius != 0) {
|
if (this.lastRadius != 0) {
|
||||||
List<Entity> nearby = event.getEntity()
|
List<Entity> nearby = event.getEntity()
|
||||||
.getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius);
|
.getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius);
|
||||||
for (Entity near : nearby) {
|
for (Entity near : nearby) {
|
||||||
if (near instanceof TNTPrimed || near.getType()
|
if (near instanceof TNTPrimed || near.getType()
|
||||||
.equals(EntityType.MINECART_TNT)) {
|
.equals(EntityType.MINECART_TNT)) {
|
||||||
if (!near.hasMetadata("plot")) {
|
if (!near.hasMetadata("plot")) {
|
||||||
near.setMetadata("plot",
|
near.setMetadata("plot",
|
||||||
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1022,7 +1016,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Block block = iterator.next();
|
Block block = iterator.next();
|
||||||
location = BukkitUtil.getLocation(block.getLocation());
|
location = BukkitUtil.getLocation(block.getLocation());
|
||||||
if (!area.contains(location.getX(), location.getZ()) || !origin
|
if (!area.contains(location.getX(), location.getZ()) || !origin
|
||||||
.equals(area.getOwnedPlot(location))) {
|
.equals(area.getOwnedPlot(location))) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1226,8 +1220,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
|
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (destroy.isPresent() && destroy.get()
|
if (destroy.isPresent() && destroy.get()
|
||||||
.contains(PlotBlock.get(block.getType().name())) || Permissions
|
.contains(PlotBlock.get(block.getType().name())) || Permissions
|
||||||
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1290,7 +1284,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
||||||
.equals(plot, area.getOwnedPlot(fLocation))) {
|
.equals(plot, area.getOwnedPlot(fLocation))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1302,7 +1296,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
||||||
.equals(null, area.getOwnedPlot(fLocation))) {
|
.equals(null, area.getOwnedPlot(fLocation))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1344,12 +1338,12 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
for (Block b : blocks) {
|
for (Block b : blocks) {
|
||||||
Location bloc = BukkitUtil.getLocation(b.getLocation());
|
Location bloc = BukkitUtil.getLocation(b.getLocation());
|
||||||
if (!area.contains(bloc.getX(), bloc.getZ()) || !area
|
if (!area.contains(bloc.getX(), bloc.getZ()) || !area
|
||||||
.contains(bloc.getX() + relative.getBlockX(), bloc.getZ() + relative.getBlockZ())) {
|
.contains(bloc.getX() + relative.getBlockX(), bloc.getZ() + relative.getBlockZ())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(
|
if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(
|
||||||
bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
|
bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1381,7 +1375,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!this.pistonBlocks && !block.getType().toString().contains("PISTON")) {
|
if (!this.pistonBlocks && !block.getType().toString().contains("PISTON")) {
|
||||||
BlockFace dir = event.getDirection();
|
BlockFace dir = event.getDirection();
|
||||||
location = BukkitUtil.getLocation(block.getLocation()
|
location = BukkitUtil.getLocation(block.getLocation()
|
||||||
.add(dir.getModX() * 2, dir.getModY() * 2, dir.getModZ() * 2));
|
.add(dir.getModX() * 2, dir.getModY() * 2, dir.getModZ() * 2));
|
||||||
if (location.getPlotArea() != null) {
|
if (location.getPlotArea() != null) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -1402,7 +1396,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
try {
|
try {
|
||||||
for (Block pulled : event.getBlocks()) {
|
for (Block pulled : event.getBlocks()) {
|
||||||
Location from = BukkitUtil.getLocation(
|
Location from = BukkitUtil.getLocation(
|
||||||
pulled.getLocation().add(dir.getModX(), dir.getModY(), dir.getModZ()));
|
pulled.getLocation().add(dir.getModX(), dir.getModY(), dir.getModZ()));
|
||||||
Location to = BukkitUtil.getLocation(pulled.getLocation());
|
Location to = BukkitUtil.getLocation(pulled.getLocation());
|
||||||
if (!area.contains(to.getX(), to.getZ())) {
|
if (!area.contains(to.getX(), to.getZ())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1421,7 +1415,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!this.pistonBlocks && !block.getType().toString().contains("PISTON")) {
|
if (!this.pistonBlocks && !block.getType().toString().contains("PISTON")) {
|
||||||
location = BukkitUtil.getLocation(
|
location = BukkitUtil.getLocation(
|
||||||
block.getLocation().add(dir.getModX() * 2, dir.getModY() * 2, dir.getModZ() * 2));
|
block.getLocation().add(dir.getModX() * 2, dir.getModY() * 2, dir.getModZ() * 2));
|
||||||
if (!area.contains(location)) {
|
if (!area.contains(location)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -1442,10 +1436,10 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (event.getBlock().getType() == Material.DROPPER)
|
if (event.getBlock().getType() == Material.DROPPER)
|
||||||
return;
|
return;
|
||||||
BlockFace targetFace =
|
BlockFace targetFace =
|
||||||
((org.bukkit.material.Dispenser) event.getBlock().getState().getData())
|
((org.bukkit.material.Dispenser) event.getBlock().getState().getData())
|
||||||
.getFacing();
|
.getFacing();
|
||||||
Location location =
|
Location location =
|
||||||
BukkitUtil.getLocation(event.getBlock().getRelative(targetFace).getLocation());
|
BukkitUtil.getLocation(event.getBlock().getRelative(targetFace).getLocation());
|
||||||
if (location.isPlotRoad()) {
|
if (location.isPlotRoad()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -1519,7 +1513,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}*/
|
}*/
|
||||||
HumanEntity entity = event.getWhoClicked();
|
HumanEntity entity = event.getWhoClicked();
|
||||||
if (!(entity instanceof Player) || !PlotSquared.get()
|
if (!(entity instanceof Player) || !PlotSquared.get()
|
||||||
.hasPlotArea(entity.getWorld().getName())) {
|
.hasPlotArea(entity.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1618,14 +1612,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem
|
if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem
|
||||||
.getDurability())) {
|
.getDurability())) {
|
||||||
event.setCursor(
|
event.setCursor(
|
||||||
new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCursor(
|
event.setCursor(
|
||||||
new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1705,7 +1699,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
event.blockList().removeIf(
|
event.blockList().removeIf(
|
||||||
b -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation()))));
|
b -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
@ -1733,7 +1727,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
location = BukkitUtil.getLocation(block.getLocation());
|
location = BukkitUtil.getLocation(block.getLocation());
|
||||||
Material blockType = block.getType();
|
Material blockType = block.getType();
|
||||||
int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings()
|
int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings()
|
||||||
.fromStringToLegacy(blockType.name())).id;
|
.fromStringToLegacy(blockType.name())).id;
|
||||||
switch (blockType) {
|
switch (blockType) {
|
||||||
case ANVIL:
|
case ANVIL:
|
||||||
case ACACIA_DOOR:
|
case ACACIA_DOOR:
|
||||||
@ -1866,7 +1860,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
lb = new BukkitLazyBlock(PlotBlock.get(block.getType().toString()));
|
lb = new BukkitLazyBlock(PlotBlock.get(block.getType().toString()));
|
||||||
ItemStack hand = player.getInventory().getItemInMainHand();
|
ItemStack hand = player.getInventory().getItemInMainHand();
|
||||||
if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK
|
if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK
|
||||||
|| !player.isSneaking())) {
|
|| !player.isSneaking())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Material type = (hand == null) ? null : hand.getType();
|
Material type = (hand == null) ? null : hand.getType();
|
||||||
@ -1876,7 +1870,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (type == null || type.isBlock()) {
|
if (type == null || type.isBlock()) {
|
||||||
location = BukkitUtil
|
location = BukkitUtil
|
||||||
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1892,7 +1886,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
case ARMOR_STAND:
|
case ARMOR_STAND:
|
||||||
location = BukkitUtil
|
location = BukkitUtil
|
||||||
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
eventType = PlayerBlockEventType.PLACE_MISC;
|
eventType = PlayerBlockEventType.PLACE_MISC;
|
||||||
break;
|
break;
|
||||||
case WRITTEN_BOOK:
|
case WRITTEN_BOOK:
|
||||||
@ -1950,7 +1944,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
case PAINTING:
|
case PAINTING:
|
||||||
case ITEM_FRAME:
|
case ITEM_FRAME:
|
||||||
location = BukkitUtil
|
location = BukkitUtil
|
||||||
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||||
eventType = PlayerBlockEventType.PLACE_HANGING;
|
eventType = PlayerBlockEventType.PLACE_HANGING;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1971,7 +1965,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||||
if (player.getInventory().getItemInMainHand().getType() == Material
|
if (player.getInventory().getItemInMainHand().getType() == Material
|
||||||
.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) {
|
.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2069,12 +2063,11 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else if (event.getTo() == Material.AIR) {
|
} else if (event.getTo() == Material.AIR) {
|
||||||
event.getEntity()
|
event.getEntity()
|
||||||
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler public void onPrime(ExplosionPrimeEvent event) {
|
||||||
public void onPrime(ExplosionPrimeEvent event) {
|
|
||||||
this.lastRadius = event.getRadius() + 1;
|
this.lastRadius = event.getRadius() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2132,7 +2125,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
@ -2162,7 +2155,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
location = BukkitUtil.getLocation(shooter.getLocation());
|
location = BukkitUtil.getLocation(shooter.getLocation());
|
||||||
} else if (fireball.getShooter() instanceof BlockProjectileSource) {
|
} else if (fireball.getShooter() instanceof BlockProjectileSource) {
|
||||||
Block shooter =
|
Block shooter =
|
||||||
((BlockProjectileSource) fireball.getShooter()).getBlock();
|
((BlockProjectileSource) fireball.getShooter()).getBlock();
|
||||||
location = BukkitUtil.getLocation(shooter.getLocation());
|
location = BukkitUtil.getLocation(shooter.getLocation());
|
||||||
}
|
}
|
||||||
if (location != null && !plot.equals(location.getPlot())) {
|
if (location != null && !plot.equals(location.getPlot())) {
|
||||||
@ -2175,12 +2168,12 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Block ignitingBlock = event.getIgnitingBlock();
|
Block ignitingBlock = event.getIgnitingBlock();
|
||||||
Plot plotIgnited = BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot();
|
Plot plotIgnited = BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot();
|
||||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && (
|
if (igniteCause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && (
|
||||||
!plot.getFlag(Flags.BLOCK_IGNITION, false) || plotIgnited == null
|
!plot.getFlag(Flags.BLOCK_IGNITION, false) || plotIgnited == null
|
||||||
|| !plotIgnited.equals(plot)) ||
|
|| !plotIgnited.equals(plot)) ||
|
||||||
(igniteCause == BlockIgniteEvent.IgniteCause.SPREAD
|
(igniteCause == BlockIgniteEvent.IgniteCause.SPREAD
|
||||||
|| igniteCause == BlockIgniteEvent.IgniteCause.LAVA) && (
|
|| igniteCause == BlockIgniteEvent.IgniteCause.LAVA) && (
|
||||||
!plot.getFlag(Flags.BLOCK_IGNITION).or(false) || plotIgnited == null
|
!plot.getFlag(Flags.BLOCK_IGNITION).or(false) || plotIgnited == null
|
||||||
|| !plotIgnited.equals(plot))) {
|
|| !plotIgnited.equals(plot))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2191,8 +2184,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
|
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||||
BlockFace bf = event.getBlockFace();
|
BlockFace bf = event.getBlockFace();
|
||||||
Block b =
|
Block b =
|
||||||
event.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ())
|
event.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ())
|
||||||
.getBlock();
|
.getBlock();
|
||||||
Location location = BukkitUtil.getLocation(b.getLocation());
|
Location location = BukkitUtil.getLocation(b.getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
@ -2234,8 +2227,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
PlotInventory.removePlotInventoryOpen(BukkitUtil.getPlayer(player));
|
PlotInventory.removePlotInventoryOpen(BukkitUtil.getPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR) public void onLeave(PlayerQuitEvent event) {
|
||||||
public void onLeave(PlayerQuitEvent event) {
|
|
||||||
TaskManager.TELEPORT_QUEUE.remove(event.getPlayer().getName());
|
TaskManager.TELEPORT_QUEUE.remove(event.getPlayer().getName());
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
||||||
pp.unregister();
|
pp.unregister();
|
||||||
@ -2263,7 +2255,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
|
Optional<HashSet<PlotBlock>> use = plot.getFlag(Flags.USE);
|
||||||
@ -2294,7 +2286,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||||
entity
|
entity
|
||||||
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2318,7 +2310,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -2327,7 +2319,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (!plot.getFlag(Flags.HANGING_PLACE, false)) {
|
if (!plot.getFlag(Flags.HANGING_PLACE, false)) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -2355,13 +2347,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_ROAD);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
@ -2370,7 +2362,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2388,17 +2380,17 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(player.getUUID())) {
|
} else if (!plot.isAdded(player.getUUID())) {
|
||||||
if (!plot.getFlag(Flags.HANGING_BREAK, false)) {
|
if (!plot.getFlag(Flags.HANGING_BREAK, false)) {
|
||||||
if (!Permissions
|
if (!Permissions
|
||||||
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
.hasPermission(player, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(player, C.NO_PERMISSION_EVENT,
|
||||||
C.PERMISSION_ADMIN_DESTROY_OTHER);
|
C.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2428,7 +2420,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_UNOWNED);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_INTERACT_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(pp.getUUID())) {
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
@ -2440,7 +2432,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity instanceof Tameable && ((Tameable) entity).isTamed() && plot
|
if (entity instanceof Tameable && ((Tameable) entity).isTamed() && plot
|
||||||
.getFlag(Flags.TAMED_INTERACT, false)) {
|
.getFlag(Flags.TAMED_INTERACT, false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity instanceof Vehicle && plot.getFlag(Flags.VEHICLE_USE, false)) {
|
if (entity instanceof Vehicle && plot.getFlag(Flags.VEHICLE_USE, false)) {
|
||||||
@ -2477,14 +2469,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road");
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
|
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.vehicle.break.unowned");
|
"plots.admin.vehicle.break.unowned");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2496,7 +2488,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
|
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.vehicle.break.other");
|
"plots.admin.vehicle.break.other");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2523,12 +2515,11 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
|
||||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||||
EntityDamageByEntityEvent eventChange = null;
|
EntityDamageByEntityEvent eventChange = null;
|
||||||
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
||||||
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
||||||
onEntityDamageByEntityEvent(eventChange);
|
onEntityDamageByEntityEvent(eventChange);
|
||||||
if (eventChange.isCancelled()) {
|
if (eventChange.isCancelled()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -2562,7 +2553,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Location vloc = BukkitUtil.getLocation(victim);
|
Location vloc = BukkitUtil.getLocation(victim);
|
||||||
PlotArea dArea = dloc.getPlotArea();
|
PlotArea dArea = dloc.getPlotArea();
|
||||||
PlotArea vArea =
|
PlotArea vArea =
|
||||||
dArea != null && dArea.contains(vloc.getX(), vloc.getZ()) ? dArea : vloc.getPlotArea();
|
dArea != null && dArea.contains(vloc.getX(), vloc.getZ()) ? dArea : vloc.getPlotArea();
|
||||||
if (dArea == null && vArea == null) {
|
if (dArea == null && vArea == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2619,7 +2610,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
} else { // shooter is not player
|
} else { // shooter is not player
|
||||||
if (shooter instanceof BlockProjectileSource) {
|
if (shooter instanceof BlockProjectileSource) {
|
||||||
Location sLoc = BukkitUtil
|
Location sLoc = BukkitUtil
|
||||||
.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
|
.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
|
||||||
dplot = dArea.getPlot(sLoc);
|
dplot = dArea.getPlot(sLoc);
|
||||||
}
|
}
|
||||||
player = null;
|
player = null;
|
||||||
@ -2631,51 +2622,51 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(player);
|
||||||
if (victim instanceof Hanging) { // hanging
|
if (victim instanceof Hanging) { // hanging
|
||||||
if (plot != null && (plot.getFlag(Flags.HANGING_BREAK, false) || plot
|
if (plot != null && (plot.getFlag(Flags.HANGING_BREAK, false) || plot
|
||||||
.isAdded(plotPlayer.getUUID()))) {
|
.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.destroy." + stub);
|
"plots.admin.destroy." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim.getEntityId() == 30) {
|
} else if (victim.getEntityId() == 30) {
|
||||||
if (plot != null && (plot.getFlag(Flags.MISC_BREAK, false) || plot
|
if (plot != null && (plot.getFlag(Flags.MISC_BREAK, false) || plot
|
||||||
.isAdded(plotPlayer.getUUID()))) {
|
.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.destroy." + stub);
|
"plots.admin.destroy." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Monster
|
} else if (victim instanceof Monster
|
||||||
|| victim instanceof EnderDragon) { // victim is monster
|
|| victim instanceof EnderDragon) { // victim is monster
|
||||||
if (plot != null && (plot.getFlag(Flags.HOSTILE_ATTACK, false) || plot
|
if (plot != null && (plot.getFlag(Flags.HOSTILE_ATTACK, false) || plot
|
||||||
.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) {
|
.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Tameable) { // victim is tameable
|
} else if (victim instanceof Tameable) { // victim is tameable
|
||||||
if (plot != null && (plot.getFlag(Flags.TAMED_ATTACK, false) || plot
|
if (plot != null && (plot.getFlag(Flags.TAMED_ATTACK, false) || plot
|
||||||
.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) {
|
.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Player) {
|
} else if (victim instanceof Player) {
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (Flags.PVP.isFalse(plot) && !Permissions
|
if (Flags.PVP.isFalse(plot) && !Permissions
|
||||||
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.pvp." + stub);
|
"plots.admin.pvp." + stub);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -2683,39 +2674,39 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub);
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pvp." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Creature) { // victim is animal
|
} else if (victim instanceof Creature) { // victim is animal
|
||||||
if (plot != null && (plot.getFlag(Flags.ANIMAL_ATTACK, false) || plot
|
if (plot != null && (plot.getFlag(Flags.ANIMAL_ATTACK, false) || plot
|
||||||
.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) {
|
.getFlag(Flags.PVE, false) || plot.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event
|
} else if (victim instanceof Vehicle) { // Vehicles are managed in vehicle destroy event
|
||||||
return true;
|
return true;
|
||||||
} else { // victim is something else
|
} else { // victim is something else
|
||||||
if (plot != null && (plot.getFlag(Flags.PVE, false) || plot
|
if (plot != null && (plot.getFlag(Flags.PVE, false) || plot
|
||||||
.isAdded(plotPlayer.getUUID()))) {
|
.isAdded(plotPlayer.getUUID()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.pve." + stub);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (dplot != null && (!dplot.equals(vplot) || Objects
|
} else if (dplot != null && (!dplot.equals(vplot) || Objects
|
||||||
.equals(dplot.guessOwner(), vplot.guessOwner()))) {
|
.equals(dplot.guessOwner(), vplot.guessOwner()))) {
|
||||||
return vplot != null && Flags.PVE.isTrue(vplot);
|
return vplot != null && Flags.PVE.isTrue(vplot);
|
||||||
}
|
}
|
||||||
return ((vplot != null && Flags.PVE.isTrue(vplot)) || !(damager instanceof Arrow
|
return ((vplot != null && Flags.PVE.isTrue(vplot)) || !(damager instanceof Arrow
|
||||||
&& !(victim instanceof Creature)));
|
&& !(victim instanceof Creature)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
@ -2731,19 +2722,19 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.road")) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
|
||||||
event.setHatching(false);
|
event.setHatching(false);
|
||||||
}
|
}
|
||||||
} else if (!plot.hasOwner()) {
|
} else if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.unowned")) {
|
||||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT,
|
||||||
"plots.admin.projectile.unowned");
|
"plots.admin.projectile.unowned");
|
||||||
event.setHatching(false);
|
event.setHatching(false);
|
||||||
}
|
}
|
||||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
|
if (!Permissions.hasPermission(plotPlayer, "plots.admin.projectile.other")) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
|
.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
|
||||||
event.setHatching(false);
|
event.setHatching(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2761,15 +2752,15 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Plot plot = area.getPlot(location);
|
Plot plot = area.getPlot(location);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT)
|
||||||
&& !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
&& !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
MainUtil.sendMessage(pp,
|
MainUtil.sendMessage(pp,
|
||||||
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
MainUtil
|
MainUtil
|
||||||
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user