mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Bug Fix and Cleanup
This commit is contained in:
@ -620,11 +620,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
public PlotPlayer wrapPlayer(Object player) {
|
||||
if (player instanceof Player) {
|
||||
return BukkitUtil.getPlayer((Player) player);
|
||||
} else if (player instanceof OfflinePlayer) {
|
||||
}
|
||||
if (player instanceof OfflinePlayer) {
|
||||
return BukkitUtil.getPlayer((OfflinePlayer) player);
|
||||
} else if (player instanceof String) {
|
||||
}
|
||||
if (player instanceof String) {
|
||||
return UUIDHandler.getPlayer((String) player);
|
||||
} else if (player instanceof UUID) {
|
||||
}
|
||||
if (player instanceof UUID) {
|
||||
return UUIDHandler.getPlayer((UUID) player);
|
||||
}
|
||||
return null;
|
||||
|
@ -192,7 +192,7 @@ public abstract class TextualComponent implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextualComponent clone() throws CloneNotSupportedException {
|
||||
public TextualComponent clone() {
|
||||
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
|
||||
return new ArbitraryTextTypeComponent(getKey(), getValue());
|
||||
}
|
||||
@ -266,7 +266,7 @@ public abstract class TextualComponent implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextualComponent clone() throws CloneNotSupportedException {
|
||||
public TextualComponent clone() {
|
||||
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
|
||||
return new ComplexTextTypeComponent(getKey(), getValue());
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ public class LikePlotMeConverter {
|
||||
sendMessage("Saving configuration...");
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
sendMessage(" - &cFailed to save configuration.");
|
||||
}
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@ -293,7 +293,7 @@ public class LikePlotMeConverter {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ex) {
|
||||
} catch (InterruptedException ignored) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
// load world with MV
|
||||
@ -304,7 +304,7 @@ public class LikePlotMeConverter {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName);
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ex) {
|
||||
} catch (InterruptedException ignored) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
// load world with MW
|
||||
|
@ -196,8 +196,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if (plot.getFlag(Flags.REDSTONE).isPresent()) {
|
||||
if (plot.getFlag(Flags.REDSTONE).get()) {
|
||||
Optional<Boolean> flag = plot.getFlag(Flags.REDSTONE);
|
||||
if (flag.isPresent()) {
|
||||
if (flag.get()) {
|
||||
return;
|
||||
} else {
|
||||
event.setNewCurrent(0);
|
||||
@ -245,7 +246,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if (plot.getFlag(Flags.REDSTONE).isPresent() && !plot.getFlag(Flags.REDSTONE).get()) {
|
||||
Optional<Boolean> flag = plot.getFlag(Flags.REDSTONE);
|
||||
if (flag.isPresent() && !flag.get()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
@ -322,7 +324,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
entity.remove();
|
||||
return false;
|
||||
} else if (!(shooter instanceof Entity) && shooter != null) {
|
||||
}
|
||||
if (!(shooter instanceof Entity) && shooter != null) {
|
||||
if (plot == null) {
|
||||
entity.remove();
|
||||
return false;
|
||||
@ -374,7 +377,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
String c = parts[0];
|
||||
if (parts[0].contains(":")) {
|
||||
c = parts[0].split(":")[1];
|
||||
msg = msg.replace(parts[0].split(":")[0] + ":", "");
|
||||
msg = msg.replace(parts[0].split(":")[0] + ':', "");
|
||||
}
|
||||
String l = c;
|
||||
List<String> aliases = new ArrayList<>();
|
||||
@ -513,7 +516,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
player.teleport(event.getTo());
|
||||
MainUtil.sendMessage(pp, C.BORDER);
|
||||
return;
|
||||
} else if (x2 < -border) {
|
||||
}
|
||||
if (x2 < -border) {
|
||||
to.setX(-border + 4);
|
||||
player.teleport(event.getTo());
|
||||
MainUtil.sendMessage(pp, C.BORDER);
|
||||
@ -633,7 +637,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
}
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
|
||||
Block block = event.getBlock();
|
||||
if (destroy.isPresent() && destroy.get()
|
||||
@ -686,7 +691,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
if (plot != null) {
|
||||
if (plot.getFlag(Flags.EXPLOSION).isPresent() && plot.getFlag(Flags.EXPLOSION).get()) {
|
||||
Optional<Boolean> flag = plot.getFlag(Flags.EXPLOSION);
|
||||
if (flag.isPresent() && flag.get()) {
|
||||
List<MetadataValue> meta = event.getEntity().getMetadata("plot");
|
||||
Plot origin;
|
||||
if (meta.isEmpty()) {
|
||||
@ -780,19 +786,23 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
Optional<Boolean> flag;
|
||||
switch (block.getType()) {
|
||||
case GRASS:
|
||||
if (plot.getFlag(Flags.GRASS_GROW).isPresent() && plot.getFlag(Flags.GRASS_GROW).get()) {
|
||||
flag = plot.getFlag(Flags.GRASS_GROW);
|
||||
if (flag.isPresent() && flag.get()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case MYCEL:
|
||||
if (plot.getFlag(Flags.MYCEL_GROW).isPresent() && plot.getFlag(Flags.MYCEL_GROW).get()) {
|
||||
flag = plot.getFlag(Flags.MYCEL_GROW);
|
||||
if (flag.isPresent() && flag.get()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case VINE:
|
||||
if (plot.getFlag(Flags.VINE_GROW).isPresent() && plot.getFlag(Flags.VINE_GROW).get()) {
|
||||
flag = plot.getFlag(Flags.VINE_GROW);
|
||||
if (flag.isPresent() && flag.get()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
@ -831,10 +841,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
Optional<HashSet<PlotBlock>> destroy = plot.getFlag(Flags.BREAK);
|
||||
Block block = event.getBlock();
|
||||
if (destroy.isPresent() && destroy.get().contains(new PlotBlock((short) block.getTypeId(), block.getData()))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||
if (destroy.isPresent() && destroy.get().contains(new PlotBlock((short) block.getTypeId(), block.getData())) || Permissions
|
||||
.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -850,8 +858,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFade(BlockFadeEvent e) {
|
||||
Block b = e.getBlock();
|
||||
public void onFade(BlockFadeEvent event) {
|
||||
Block b = event.getBlock();
|
||||
Location location = BukkitUtil.getLocation(b.getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
@ -859,7 +867,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
if (plot == null) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
switch (b.getType()) {
|
||||
@ -867,7 +875,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Optional<Boolean> ice_melt = plot.getFlag(Flags.ICE_MELT);
|
||||
if (ice_melt.isPresent()) {
|
||||
if (!ice_melt.get()) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -875,7 +883,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Optional<Boolean> snow_melt = plot.getFlag(Flags.SNOW_MELT);
|
||||
if (snow_melt.isPresent()) {
|
||||
if (!snow_melt.get()) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -883,7 +891,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Optional<Boolean> soil_dry = plot.getFlag(Flags.SOIL_DRY);
|
||||
if (soil_dry.isPresent()) {
|
||||
if (!soil_dry.get()) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -902,9 +910,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Plot plot = area.getOwnedPlot(tLocation);
|
||||
Location fLocation = BukkitUtil.getLocation(from.getLocation());
|
||||
if (plot != null) {
|
||||
if (plot.getFlag(Flags.DISABLE_PHYSICS).or(false)) {
|
||||
event.setCancelled(true);
|
||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
|
||||
if (plot.getFlag(Flags.DISABLE_PHYSICS).or(false) || !area.contains(fLocation.getX(), fLocation.getZ()) || !Objects
|
||||
.equals(plot, area.getOwnedPlot(fLocation))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
|
||||
@ -977,7 +984,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
this.pistonBlocks = false;
|
||||
}
|
||||
}
|
||||
@ -1006,7 +1013,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
this.pistonBlocks = false;
|
||||
}
|
||||
}
|
||||
@ -1183,7 +1190,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
lb = new BukkitLazyBlock(0, block);
|
||||
break;
|
||||
} else if (id < 198) {
|
||||
}
|
||||
if (id < 198) {
|
||||
location = BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||
lb = new BukkitLazyBlock(id, block);
|
||||
@ -1341,11 +1349,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlotAbs(location);
|
||||
if (plot == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (plot.getFlag(Flags.DISABLE_PHYSICS).or(false)) {
|
||||
if (plot == null || plot.getFlag(Flags.DISABLE_PHYSICS).or(false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1411,7 +1415,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
public boolean checkEntity(Entity entity, Plot plot) {
|
||||
if (plot == null || plot.owner == null || plot.getFlags().isEmpty() && plot.getArea().DEFAULT_FLAGS.isEmpty()) {
|
||||
if (plot == null || !plot.hasOwner() || plot.getFlags().isEmpty() && plot.getArea().DEFAULT_FLAGS.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
switch (entity.getType()) {
|
||||
@ -1509,9 +1513,11 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
} else {
|
||||
return checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP);
|
||||
}
|
||||
} else if (entity instanceof Vehicle) {
|
||||
}
|
||||
if (entity instanceof Vehicle) {
|
||||
return checkEntity(plot, Flags.ENTITY_CAP, Flags.VEHICLE_CAP);
|
||||
} else if (entity instanceof Hanging) {
|
||||
}
|
||||
if (entity instanceof Hanging) {
|
||||
return checkEntity(plot, Flags.ENTITY_CAP, Flags.MISC_CAP);
|
||||
}
|
||||
return checkEntity(plot, Flags.ENTITY_CAP);
|
||||
@ -1519,8 +1525,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockBurn(BlockBurnEvent e) {
|
||||
Block b = e.getBlock();
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
Block b = event.getBlock();
|
||||
Location location = BukkitUtil.getLocation(b.getLocation());
|
||||
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -1530,8 +1536,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_BURN).or(false)) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1582,56 +1587,41 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
} else if (!plot.getFlag(Flags.BLOCK_IGNITION).or(false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (ignitingEntity != null) {
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_IGNITION).or(false)) {
|
||||
} else {
|
||||
if (plot == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FIREBALL) {
|
||||
if (ignitingEntity instanceof Fireball) {
|
||||
Projectile fireball = (Projectile) ignitingEntity;
|
||||
Location location = null;
|
||||
if (fireball.getShooter() instanceof Entity) {
|
||||
Entity shooter = (Entity) fireball.getShooter();
|
||||
location = BukkitUtil.getLocation(shooter.getLocation());
|
||||
} else if (fireball.getShooter() instanceof BlockProjectileSource) {
|
||||
Block shooter = ((BlockProjectileSource) fireball.getShooter()).getBlock();
|
||||
location = BukkitUtil.getLocation(shooter.getLocation());
|
||||
}
|
||||
if (location != null && (location.getPlot() == null || !location.getPlot().equals(plot))) {
|
||||
event.setCancelled(true);
|
||||
if (ignitingEntity != null) {
|
||||
if (!plot.getFlag(Flags.BLOCK_IGNITION).or(false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FIREBALL) {
|
||||
if (ignitingEntity instanceof Fireball) {
|
||||
Projectile fireball = (Projectile) ignitingEntity;
|
||||
Location location = null;
|
||||
if (fireball.getShooter() instanceof Entity) {
|
||||
Entity shooter = (Entity) fireball.getShooter();
|
||||
location = BukkitUtil.getLocation(shooter.getLocation());
|
||||
} else if (fireball.getShooter() instanceof BlockProjectileSource) {
|
||||
Block shooter = ((BlockProjectileSource) fireball.getShooter()).getBlock();
|
||||
location = BukkitUtil.getLocation(shooter.getLocation());
|
||||
}
|
||||
if (location != null && !plot.equals(location.getPlot())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (event.getIgnitingBlock() != null) {
|
||||
Block ignitingBlock = event.getIgnitingBlock();
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL) {
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_IGNITION).or(false)) {
|
||||
} else if (event.getIgnitingBlock() != null) {
|
||||
Block ignitingBlock = event.getIgnitingBlock();
|
||||
Plot plotIgnited = BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot();
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL && (!plot.getFlag(Flags.BLOCK_IGNITION).or(false)
|
||||
|| plotIgnited == null || !plotIgnited.equals(plot))
|
||||
|| (igniteCause == BlockIgniteEvent.IgniteCause.SPREAD || igniteCause == BlockIgniteEvent.IgniteCause.LAVA) && (
|
||||
!plot.getFlag(Flags.BLOCK_IGNITION).or(false) || plotIgnited == null || !plotIgnited.equals(plot))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot() == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot().equals(plot)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (igniteCause == BlockIgniteEvent.IgniteCause.SPREAD || igniteCause == BlockIgniteEvent.IgniteCause.LAVA) {
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_IGNITION).or(false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot() == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!BukkitUtil.getLocation(ignitingBlock.getLocation()).getPlot().equals(plot)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1931,7 +1921,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
}
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!plot.getFlag(Flags.HANGING_PLACE).or(false)) {
|
||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||
@ -2055,13 +2046,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onVehicleDestroy(VehicleDestroyEvent e) {
|
||||
Location l = BukkitUtil.getLocation(e.getVehicle());
|
||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||
Location l = BukkitUtil.getLocation(event.getVehicle());
|
||||
PlotArea area = l.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
Entity d = e.getAttacker();
|
||||
Entity d = event.getAttacker();
|
||||
if (d instanceof Player) {
|
||||
Player p = (Player) d;
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
@ -2069,13 +2060,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.road");
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.unowned");
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
@ -2086,7 +2077,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.vehicle.break.other")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.vehicle.break.other");
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2113,15 +2104,15 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
|
||||
Entity damager = e.getDamager();
|
||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||
Entity damager = event.getDamager();
|
||||
Location l = BukkitUtil.getLocation(damager);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Entity victim = e.getEntity();
|
||||
Entity victim = event.getEntity();
|
||||
if (!entityDamage(damager, victim)) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2267,29 +2258,29 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent e) {
|
||||
Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
|
||||
Location l = BukkitUtil.getLocation(event.getEgg().getLocation());
|
||||
PlotArea area = l.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
Player p = e.getPlayer();
|
||||
Player p = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
Plot plot = area.getPlot(l);
|
||||
if (plot == null) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.projectile.road")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.projectile.road");
|
||||
e.setHatching(false);
|
||||
event.setHatching(false);
|
||||
}
|
||||
} else if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.projectile.unowned")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.projectile.unowned");
|
||||
e.setHatching(false);
|
||||
event.setHatching(false);
|
||||
}
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!Permissions.hasPermission(pp, "plots.admin.projectile.other")) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.projectile.other");
|
||||
e.setHatching(false);
|
||||
event.setHatching(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2336,7 +2327,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (loc.getY() > area.MAX_BUILD_HEIGHT && loc.getY() < area.MIN_BUILD_HEIGHT && !Permissions
|
||||
.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) {
|
||||
event.setCancelled(true);
|
||||
MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", "" + area.MAX_BUILD_HEIGHT));
|
||||
MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||
}
|
||||
} else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD);
|
||||
|
@ -9,9 +9,6 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
||||
|
||||
/**
|
||||
* Created by Jesse on 3/30/2016.
|
||||
*/
|
||||
public class PlayerEvents_1_9 implements Listener {
|
||||
|
||||
private final PlayerEvents parent;
|
||||
|
@ -27,6 +27,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class WEListener implements Listener {
|
||||
|
||||
@ -35,16 +36,16 @@ public class WEListener implements Listener {
|
||||
public final HashSet<String> rad2 = new HashSet<>(Arrays.asList("fill", "fillr", "removenear", "remove"));
|
||||
public final HashSet<String> rad2_1 = new HashSet<>(Arrays.asList("hcyl", "cyl"));
|
||||
public final HashSet<String> rad2_2 = new HashSet<>(Arrays.asList("sphere", "pyramid"));
|
||||
public final HashSet<String> rad2_3 = new HashSet<>(Collections.singletonList("brush smooth"));
|
||||
public final HashSet<String> rad3_1 = new HashSet<>(Collections.singletonList("brush gravity"));
|
||||
public final Set<String> rad2_3 = Collections.singleton("brush smooth");
|
||||
public final Set<String> rad3_1 = Collections.singleton("brush gravity");
|
||||
public final HashSet<String> rad3_2 = new HashSet<>(Arrays.asList("brush sphere", "brush cylinder"));
|
||||
|
||||
public final HashSet<String> region = new HashSet<>(
|
||||
Arrays.asList("move", "set", "replace", "overlay", "walls", "outline", "deform", "hollow", "smooth", "naturalize", "paste", "count",
|
||||
"distr",
|
||||
"regen", "copy", "cut", "green", "setbiome"));
|
||||
public final HashSet<String> regionExtend = new HashSet<>(Collections.singletonList("stack"));
|
||||
public final HashSet<String> restricted = new HashSet<>(Collections.singletonList("up"));
|
||||
public final Set<String> regionExtend = Collections.singleton("stack");
|
||||
public final Set<String> restricted = Collections.singleton("up");
|
||||
public final HashSet<String> other = new HashSet<>(Arrays.asList("undo", "redo"));
|
||||
|
||||
public String reduceCmd(String cmd, boolean single) {
|
||||
|
@ -57,14 +57,14 @@ public class DefaultTitleManager extends TitleManager {
|
||||
// Send title
|
||||
Object serialized = getMethod(this.nmsChatSerializer, "a", String.class).invoke(null,
|
||||
"{text:\"" + ChatColor.translateAlternateColorCodes('&', this.getTitle()) + "\",color:" + this.titleColor.name().toLowerCase()
|
||||
+ "}");
|
||||
+ '}');
|
||||
packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[0], serialized);
|
||||
sendPacket.invoke(connection, packet);
|
||||
if (!this.getSubtitle().isEmpty()) {
|
||||
// Send subtitle if present
|
||||
serialized = getMethod(this.nmsChatSerializer, "a", String.class).invoke(null,
|
||||
"{text:\"" + ChatColor.translateAlternateColorCodes('&', this.getSubtitle()) + "\",color:" + this.subtitleColor.name()
|
||||
.toLowerCase() + "}");
|
||||
.toLowerCase() + '}');
|
||||
packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent).newInstance(actions[1], serialized);
|
||||
sendPacket.invoke(connection, packet);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class HackTitleManager extends TitleManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Field getField(String name, Class<?> clazz) throws Exception {
|
||||
private Field getField(String name, Class<?> clazz) throws NoSuchFieldException, SecurityException {
|
||||
return clazz.getDeclaredField(name);
|
||||
}
|
||||
|
||||
|
@ -742,12 +742,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
chest.getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, String[]> blockLocEntry : this.signContents.entrySet()) {
|
||||
@ -765,14 +765,14 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug(
|
||||
"&c[WARN] Plot clear failed to regenerate sign: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
"&c[WARN] Plot clear failed to regenerate sign: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y
|
||||
+ "," + (
|
||||
+ ',' + (
|
||||
blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry.getKey().y
|
||||
+ "," + (
|
||||
} catch (IndexOutOfBoundsException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry.getKey().y
|
||||
+ ',' + (
|
||||
blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
@ -785,12 +785,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((InventoryHolder) state).getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.dropperContents.entrySet()) {
|
||||
@ -802,12 +802,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((InventoryHolder) state).getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.beaconContents.entrySet()) {
|
||||
@ -819,12 +819,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((InventoryHolder) state).getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, Material> blockLocMaterialEntry : this.jukeboxDisc.entrySet()) {
|
||||
@ -837,15 +837,15 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Jukebox) state).setPlaying(blockLocMaterialEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore jukebox: " + (blockLocMaterialEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to restore jukebox: " + (blockLocMaterialEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocMaterialEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocMaterialEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (blockLocMaterialEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (blockLocMaterialEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocMaterialEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocMaterialEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
@ -863,12 +863,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Skull) state).setSkullType((SkullType) data[3]);
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore skull: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to restore skull: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate skull (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -881,12 +881,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((InventoryHolder) state).getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, Note> blockLocNoteEntry : this.noteBlockContents.entrySet()) {
|
||||
@ -898,15 +898,15 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((NoteBlock) state).setNote(blockLocNoteEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + (blockLocNoteEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + (blockLocNoteEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocNoteEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (blockLocNoteEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (blockLocNoteEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocNoteEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
@ -918,14 +918,14 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
if (state instanceof BrewingStand) {
|
||||
((BrewingStand) state).setBrewingTime(blockLocShortEntry.getValue());
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (blockLocShortEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + (blockLocShortEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocShortEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (blockLocShortEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocShortEntry.getKey().y + "," + (blockLocShortEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (blockLocShortEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocShortEntry.getKey().y + ',' + (blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, EntityType> blockLocEntityTypeEntry : this.spawnerData.entrySet()) {
|
||||
@ -938,14 +938,14 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((CreatureSpawner) state).setSpawnedType(blockLocEntityTypeEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + (blockLocEntityTypeEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + (blockLocEntityTypeEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocEntityTypeEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + (blockLocEntityTypeEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocEntityTypeEntry.getKey().y + "," + (blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore spawner type (e): " + (blockLocEntityTypeEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocEntityTypeEntry.getKey().y + ',' + (blockLocEntityTypeEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, String> blockLocStringEntry : this.cmdData.entrySet()) {
|
||||
@ -957,15 +957,15 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((CommandBlock) state).setCommand(blockLocStringEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore command block: " + (blockLocStringEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to restore command block: " + (blockLocStringEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocStringEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocStringEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore command block (e): " + (blockLocStringEntry.getKey().x + xOffset) + ","
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore command block (e): " + (blockLocStringEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocStringEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocStringEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
@ -978,15 +978,15 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((InventoryHolder) state).getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (blockLocEntry.getKey().x + xOffset) + ","
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + (blockLocEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocEntry
|
||||
.getKey().y + "," + (
|
||||
.getKey().y + ',' + (
|
||||
blockLocEntry.getKey().z
|
||||
+ zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (blockLocEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocEntry.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand (e): " + (blockLocEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocEntry.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, Short[]> blockLocEntry : this.furnaceTime.entrySet()) {
|
||||
@ -1000,13 +1000,13 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((Furnace) state).setCookTime(time[1]);
|
||||
} else {
|
||||
PS.debug(
|
||||
"&c[WARN] Plot clear failed to restore furnace cooking: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
"&c[WARN] Plot clear failed to restore furnace cooking: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
PS.debug(
|
||||
"&c[WARN] Plot clear failed to restore furnace cooking (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
"&c[WARN] Plot clear failed to restore furnace cooking (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, ItemStack[]> blockLocEntry : this.furnaceContents.entrySet()) {
|
||||
@ -1018,12 +1018,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
((InventoryHolder) state).getInventory().setContents(blockLocEntry.getValue());
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate furnace (e): " + (blockLocEntry.getKey().x + xOffset) + ',' + blockLocEntry
|
||||
.getKey().y + ',' + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
for (Entry<BlockLoc, DyeColor> blockLocByteEntry : this.bannerBase.entrySet()) {
|
||||
@ -1039,12 +1039,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
banner.setPatterns(patterns);
|
||||
state.update(true);
|
||||
} else {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (blockLocByteEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocByteEntry.getKey().y + "," + (blockLocByteEntry.getKey().z + zOffset));
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + (blockLocByteEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocByteEntry.getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (blockLocByteEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocByteEntry.getKey().y + "," + (blockLocByteEntry.getKey().z + zOffset));
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate banner (e): " + (blockLocByteEntry.getKey().x + xOffset) + ','
|
||||
+ blockLocByteEntry.getKey().y + ',' + (blockLocByteEntry.getKey().z + zOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1074,33 +1074,42 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
if (block.getState() instanceof InventoryHolder) {
|
||||
InventoryHolder inventoryHolder = (InventoryHolder) block.getState();
|
||||
ItemStack[] inventory = inventoryHolder.getInventory().getContents().clone();
|
||||
if (id == Material.CHEST) {
|
||||
this.chestContents.put(bl, inventory);
|
||||
} else if (id == Material.DISPENSER) {
|
||||
this.dispenserContents.put(bl, inventory);
|
||||
} else if (id == Material.BEACON) {
|
||||
this.beaconContents.put(bl, inventory);
|
||||
} else if (id == Material.DROPPER) {
|
||||
this.dropperContents.put(bl, inventory);
|
||||
} else if (id == Material.HOPPER) {
|
||||
this.hopperContents.put(bl, inventory);
|
||||
} else if (id == Material.BREWING_STAND) {
|
||||
BrewingStand brewingStand = (BrewingStand) inventoryHolder;
|
||||
short time = (short) brewingStand.getBrewingTime();
|
||||
if (time > 0) {
|
||||
this.brewTime.put(bl, time);
|
||||
}
|
||||
ItemStack[] invBre = brewingStand.getInventory().getContents().clone();
|
||||
this.brewingStandContents.put(bl, invBre);
|
||||
} else if (id == Material.FURNACE || id == Material.BURNING_FURNACE) {
|
||||
Furnace furnace = (Furnace) inventoryHolder;
|
||||
short burn = furnace.getBurnTime();
|
||||
short cook = furnace.getCookTime();
|
||||
ItemStack[] invFur = furnace.getInventory().getContents().clone();
|
||||
this.furnaceContents.put(bl, invFur);
|
||||
if (cook != 0) {
|
||||
this.furnaceTime.put(bl, new Short[]{burn, cook});
|
||||
}
|
||||
switch (id) {
|
||||
case CHEST:
|
||||
this.chestContents.put(bl, inventory);
|
||||
break;
|
||||
case DISPENSER:
|
||||
this.dispenserContents.put(bl, inventory);
|
||||
break;
|
||||
case BEACON:
|
||||
this.beaconContents.put(bl, inventory);
|
||||
break;
|
||||
case DROPPER:
|
||||
this.dropperContents.put(bl, inventory);
|
||||
break;
|
||||
case HOPPER:
|
||||
this.hopperContents.put(bl, inventory);
|
||||
break;
|
||||
case BREWING_STAND:
|
||||
BrewingStand brewingStand = (BrewingStand) inventoryHolder;
|
||||
short time = (short) brewingStand.getBrewingTime();
|
||||
if (time > 0) {
|
||||
this.brewTime.put(bl, time);
|
||||
}
|
||||
ItemStack[] invBre = brewingStand.getInventory().getContents().clone();
|
||||
this.brewingStandContents.put(bl, invBre);
|
||||
break;
|
||||
case FURNACE:
|
||||
case BURNING_FURNACE:
|
||||
Furnace furnace = (Furnace) inventoryHolder;
|
||||
short burn = furnace.getBurnTime();
|
||||
short cook = furnace.getCookTime();
|
||||
ItemStack[] invFur = furnace.getInventory().getContents().clone();
|
||||
this.furnaceContents.put(bl, invFur);
|
||||
if (cook != 0) {
|
||||
this.furnaceTime.put(bl, new Short[]{burn, cook});
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (block.getState() instanceof CreatureSpawner) {
|
||||
CreatureSpawner spawner = (CreatureSpawner) block.getState();
|
||||
|
@ -194,7 +194,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
try {
|
||||
Biome biome = Biome.valueOf(biomeStr.toUpperCase());
|
||||
return Arrays.asList(Biome.values()).indexOf(biome);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -252,7 +252,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -271,8 +271,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
try {
|
||||
Material material = Material.valueOf(name.toUpperCase());
|
||||
return new StringComparison<PlotBlock>().new ComparisonResult(0, new PlotBlock((short) material.getId(), (byte) 0));
|
||||
} catch (IllegalArgumentException e) {
|
||||
//ignored
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
try {
|
||||
byte data;
|
||||
@ -297,8 +296,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
StringComparison<PlotBlock> outer = new StringComparison<>();
|
||||
return outer.new ComparisonResult(match, block);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
//ignored
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -520,11 +520,6 @@ public class Metrics {
|
||||
return graph.name.equals(this.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
|
||||
*/
|
||||
protected void onOptOut() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,8 +24,8 @@ import org.bukkit.block.Biome;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
@ -223,7 +223,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendChunk(fs.getChunkWrapper().world, Arrays.asList(new ChunkLoc(fs.getX(), fs.getZ())));
|
||||
sendChunk(fs.getChunkWrapper().world, Collections.singletonList(new ChunkLoc(fs.getX(), fs.getZ())));
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
try {
|
||||
UUID uuid = UUID.fromString(s);
|
||||
uuids.add(uuid);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
PS.debug(C.PREFIX + "Invalid PlayerData: " + current);
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
} catch (Throwable e) {
|
||||
} catch (IOException ignored) {
|
||||
PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user