mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Merge branch 'master' of https://github.com/IntellectualSites/PlotSquared
# Conflicts: # Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java # Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java
This commit is contained in:
@ -54,8 +54,7 @@ public class PlotAPI {
|
||||
* @deprecated Not needed
|
||||
*/
|
||||
@Deprecated
|
||||
public PlotAPI(JavaPlugin plugin) {
|
||||
}
|
||||
public PlotAPI(JavaPlugin plugin) {}
|
||||
|
||||
/**
|
||||
* Get all plots.
|
||||
|
@ -141,9 +141,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
this.getServer().getConsoleSender().sendMessage(message);
|
||||
return;
|
||||
} catch (Throwable ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
System.out.println(ConsoleColors.fromString(message));
|
||||
}
|
||||
|
||||
@ -401,14 +399,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
try {
|
||||
new SendChunk();
|
||||
MainUtil.canSendChunk = true;
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
||||
try {
|
||||
return new FastQueue_1_9();
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -416,11 +414,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 8, 0)) {
|
||||
try {
|
||||
return new FastQueue_1_8_3();
|
||||
} catch (Throwable e) {
|
||||
} catch (NoSuchMethodException | ClassNotFoundException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
return new FastQueue_1_8();
|
||||
} catch (Throwable e2) {
|
||||
} catch (NoSuchMethodException | NoSuchFieldException | ClassNotFoundException e2) {
|
||||
e2.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -428,7 +426,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
try {
|
||||
return new FastQueue_1_7();
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -620,11 +618,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;
|
||||
@ -654,7 +655,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
public List<String> getPluginIds() {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
names.add(plugin.getName() + ";" + plugin.getDescription().getVersion() + ":" + plugin.isEnabled());
|
||||
names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin.isEnabled());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manual set!");
|
||||
}
|
||||
|
||||
|
@ -42,9 +42,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
} else {
|
||||
return new SQLite(dataFolder + File.separator + "plots.db").openConnection();
|
||||
}
|
||||
} catch (SQLException | ClassNotFoundException ignored) {
|
||||
//ignored
|
||||
ignored.printStackTrace();
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -229,9 +228,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
resultSet.close();
|
||||
statement.close();
|
||||
|
||||
} catch (SQLException ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (SQLException ignored) {}
|
||||
return plots;
|
||||
}
|
||||
|
||||
|
@ -200,9 +200,7 @@ public class LikePlotMeConverter {
|
||||
PS.get().config.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||
String world = entry.getKey();
|
||||
@ -264,7 +262,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 +291,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 +302,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
|
||||
|
@ -233,7 +233,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ArrayList<BlockPopulator> toAdd = new ArrayList<BlockPopulator>();
|
||||
ArrayList<BlockPopulator> toAdd = new ArrayList<>();
|
||||
List<BlockPopulator> existing = world.getPopulators();
|
||||
for (BlockPopulator populator : this.populators) {
|
||||
if (!existing.contains(populator)) {
|
||||
|
@ -320,7 +320,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;
|
||||
@ -372,7 +373,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<>();
|
||||
@ -511,7 +512,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);
|
||||
@ -631,7 +633,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()
|
||||
@ -778,6 +781,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
Optional<Boolean> flag;
|
||||
switch (block.getType()) {
|
||||
case GRASS:
|
||||
if (Flags.GRASS_GROW.isFalse(plot)) {
|
||||
@ -829,10 +833,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);
|
||||
@ -848,8 +850,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) {
|
||||
@ -857,23 +859,23 @@ 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()) {
|
||||
case ICE:
|
||||
if (Flags.ICE_MELT.isFalse(plot)) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case SNOW:
|
||||
if (Flags.SNOW_MELT.isFalse(plot)) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
case SOIL:
|
||||
if (Flags.SOIL_DRY.isFalse(plot)) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -891,7 +893,7 @@ 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, false)) {
|
||||
if (Flags.DISABLE_PHYSICS.isFalse(plot)) {
|
||||
event.setCancelled(true);
|
||||
} else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects.equals(plot, area.getOwnedPlot(fLocation))) {
|
||||
event.setCancelled(true);
|
||||
@ -966,7 +968,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
this.pistonBlocks = false;
|
||||
}
|
||||
}
|
||||
@ -995,7 +997,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
this.pistonBlocks = false;
|
||||
}
|
||||
}
|
||||
@ -1172,7 +1174,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);
|
||||
@ -1330,11 +1333,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, false)) {
|
||||
if (plot == null || plot.getFlag(Flags.DISABLE_PHYSICS, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -1400,7 +1399,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()) {
|
||||
@ -1498,9 +1497,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);
|
||||
@ -1508,8 +1509,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();
|
||||
@ -1519,7 +1520,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_BURN, false)) {
|
||||
e.setCancelled(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1568,59 +1569,44 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (!plot.getFlag(Flags.BLOCK_IGNITION, false)) {
|
||||
} else if (Flags.BLOCK_IGNITION.isFalse(plot)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else if (ignitingEntity != null) {
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_IGNITION, 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,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, 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,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, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1920,8 +1906,9 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!plot.getFlag(Flags.HANGING_PLACE, false)) {
|
||||
}
|
||||
if (!plot.isAdded(pp.getUUID())) {
|
||||
if (!plot.getFlag(Flags.HANGING_PLACE,false)) {
|
||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||
event.setCancelled(true);
|
||||
@ -2044,13 +2031,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);
|
||||
@ -2058,13 +2045,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;
|
||||
@ -2075,7 +2062,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2102,15 +2089,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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2253,29 +2240,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2326,7 +2313,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;
|
||||
|
@ -131,8 +131,11 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
UUID uuid = pp.getUUID();
|
||||
if (plot.isAdded(uuid) && plot.getFlag(Flags.ITEM_DROP).or(false)) {
|
||||
event.setCancelled(true);
|
||||
if (plot.isAdded(uuid)) {
|
||||
Optional<Boolean> flag = plot.getFlag(Flags.ITEM_DROP);
|
||||
if (flag.isPresent() && !flag.get()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,25 +27,25 @@ 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 {
|
||||
|
||||
public final HashSet<String> rad1 = new HashSet<>(
|
||||
public final Set<String> other = new HashSet<>(Arrays.asList("undo", "redo"));
|
||||
private final Set<String> rad1 = new HashSet<>(
|
||||
Arrays.asList("forestgen", "pumpkins", "drain", "fixwater", "fixlava", "replacenear", "snow", "thaw", "ex", "butcher", "size"));
|
||||
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 HashSet<String> rad3_2 = new HashSet<>(Arrays.asList("brush sphere", "brush cylinder"));
|
||||
|
||||
public final HashSet<String> region = new HashSet<>(
|
||||
private final Set<String> rad2 = new HashSet<>(Arrays.asList("fill", "fillr", "removenear", "remove"));
|
||||
private final Set<String> rad2_1 = new HashSet<>(Arrays.asList("hcyl", "cyl"));
|
||||
private final Set<String> rad2_2 = new HashSet<>(Arrays.asList("sphere", "pyramid"));
|
||||
private final Set<String> rad2_3 = Collections.singleton("brush smooth");
|
||||
private final Set<String> rad3_1 = Collections.singleton("brush gravity");
|
||||
private final Set<String> rad3_2 = new HashSet<>(Arrays.asList("brush sphere", "brush cylinder"));
|
||||
private final Set<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 HashSet<String> other = new HashSet<>(Arrays.asList("undo", "redo"));
|
||||
private final Set<String> regionExtend = Collections.singleton("stack");
|
||||
private final Set<String> restricted = Collections.singleton("up");
|
||||
|
||||
public String reduceCmd(String cmd, boolean single) {
|
||||
if (cmd.startsWith("/worldedit:/")) {
|
||||
@ -74,14 +74,14 @@ public class WEListener implements Listener {
|
||||
}
|
||||
}
|
||||
return max;
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkVolume(PlotPlayer player, long volume, long max, Cancellable e) {
|
||||
if (volume > max) {
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_VOLUME.s().replaceAll("%current%", volume + "").replaceAll("%max%", max + ""));
|
||||
MainUtil.sendMessage(player, C.WORLDEDIT_VOLUME.s().replaceAll("%current%", String.valueOf(volume)).replaceAll("%max%", String.valueOf(max)));
|
||||
e.setCancelled(true);
|
||||
}
|
||||
if (Permissions.hasPermission(player, "plots.worldedit.bypass")) {
|
||||
@ -180,7 +180,7 @@ public class WEListener implements Listener {
|
||||
boolean single = true;
|
||||
if (split.length >= 2) {
|
||||
String reduced = reduceCmd(split[0], single);
|
||||
String reduced2 = reduceCmd(split[0] + " " + split[1], single);
|
||||
String reduced2 = reduceCmd(split[0] + ' ' + split[1], single);
|
||||
if (this.rad1.contains(reduced)) {
|
||||
if (delay(p, message, false)) {
|
||||
e.setCancelled(true);
|
||||
@ -233,7 +233,8 @@ public class WEListener implements Listener {
|
||||
int iterations = getInt(split[3]);
|
||||
if (iterations > maxIterations) {
|
||||
MainUtil.sendMessage(pp,
|
||||
C.WORLDEDIT_ITERATIONS.s().replaceAll("%current%", iterations + "").replaceAll("%max%", maxIterations + ""));
|
||||
C.WORLDEDIT_ITERATIONS.s().replaceAll("%current%", String.valueOf(iterations)).replaceAll("%max%",
|
||||
String.valueOf(maxIterations)));
|
||||
e.setCancelled(true);
|
||||
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
|
||||
|
@ -465,8 +465,7 @@ public class EntityWrapper {
|
||||
if (this.base.passenger != null) {
|
||||
try {
|
||||
entity.setPassenger(this.base.passenger.spawn(world, x_offset, z_offset));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
if (this.base.fall != 0) {
|
||||
entity.setFallDistance(this.base.fall);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -143,12 +143,11 @@ public class HackTitleManager extends TitleManager {
|
||||
private Class<?> getClass(String namespace) {
|
||||
try {
|
||||
return Class.forName(namespace);
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
@ -616,25 +617,25 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
public static class ContentMap {
|
||||
|
||||
public final HashMap<BlockLoc, ItemStack[]> chestContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> furnaceContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> dispenserContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> dropperContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> brewingStandContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> beaconContents;
|
||||
public final HashMap<BlockLoc, ItemStack[]> hopperContents;
|
||||
public final HashMap<BlockLoc, Short[]> furnaceTime;
|
||||
public final HashMap<BlockLoc, Object[]> skullData;
|
||||
public final HashMap<BlockLoc, Material> jukeboxDisc;
|
||||
public final HashMap<BlockLoc, Short> brewTime;
|
||||
public final HashMap<BlockLoc, EntityType> spawnerData;
|
||||
public final HashMap<BlockLoc, String> cmdData;
|
||||
public final HashMap<BlockLoc, String[]> signContents;
|
||||
public final HashMap<BlockLoc, Note> noteBlockContents;
|
||||
public final HashMap<BlockLoc, List<Pattern>> bannerPatterns;
|
||||
public final HashMap<BlockLoc, DyeColor> bannerBase;
|
||||
public final HashSet<EntityWrapper> entities;
|
||||
public final HashMap<PlotLoc, PlotBlock[]> allBlocks;
|
||||
public final Map<BlockLoc, ItemStack[]> chestContents;
|
||||
public final Map<BlockLoc, ItemStack[]> furnaceContents;
|
||||
public final Map<BlockLoc, ItemStack[]> dispenserContents;
|
||||
public final Map<BlockLoc, ItemStack[]> dropperContents;
|
||||
public final Map<BlockLoc, ItemStack[]> brewingStandContents;
|
||||
public final Map<BlockLoc, ItemStack[]> beaconContents;
|
||||
public final Map<BlockLoc, ItemStack[]> hopperContents;
|
||||
public final Map<BlockLoc, Short[]> furnaceTime;
|
||||
public final Map<BlockLoc, Object[]> skullData;
|
||||
public final Map<BlockLoc, Material> jukeboxDisc;
|
||||
public final Map<BlockLoc, Short> brewTime;
|
||||
public final Map<BlockLoc, EntityType> spawnerData;
|
||||
public final Map<BlockLoc, String> cmdData;
|
||||
public final Map<BlockLoc, String[]> signContents;
|
||||
public final Map<BlockLoc, Note> noteBlockContents;
|
||||
public final Map<BlockLoc, List<Pattern>> bannerPatterns;
|
||||
public final Map<BlockLoc, DyeColor> bannerBase;
|
||||
public final Set<EntityWrapper> entities;
|
||||
public final Map<PlotLoc, PlotBlock[]> allBlocks;
|
||||
|
||||
public ContentMap() {
|
||||
this.chestContents = new HashMap<>();
|
||||
@ -742,12 +743,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 +766,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 +786,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 +803,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 +820,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 +838,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 +864,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 +882,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 +899,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 +919,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 +939,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 +958,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 +979,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 +1001,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 +1019,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 +1040,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 +1075,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();
|
||||
|
@ -49,8 +49,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
}
|
||||
final BiomeGrid nullBiomeGrid = new BiomeGrid() {
|
||||
@Override
|
||||
public void setBiome(int a, int b, Biome c) {
|
||||
}
|
||||
public void setBiome(int a, int b, Biome c) {}
|
||||
|
||||
@Override
|
||||
public Biome getBiome(int a, int b) {
|
||||
|
@ -22,12 +22,10 @@ public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tooltip(PlotMessage message, PlotMessage... tooltips) {
|
||||
}
|
||||
public void tooltip(PlotMessage message, PlotMessage... tooltips) {}
|
||||
|
||||
@Override
|
||||
public void command(PlotMessage message, String command) {
|
||||
}
|
||||
public void command(PlotMessage message, String command) {}
|
||||
|
||||
@Override
|
||||
public void text(PlotMessage message, String text) {
|
||||
@ -44,7 +42,6 @@ public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suggest(PlotMessage plotMessage, String command) {
|
||||
}
|
||||
public void suggest(PlotMessage plotMessage, String command) {}
|
||||
|
||||
}
|
||||
|
@ -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,9 +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;
|
||||
String[] split = name.split(":");
|
||||
@ -297,9 +295,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;
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,7 @@ public class Metrics {
|
||||
if (gzos != null) {
|
||||
try {
|
||||
gzos.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
} catch (IOException ignore) {}
|
||||
}
|
||||
}
|
||||
return baos.toByteArray();
|
||||
@ -117,7 +116,7 @@ public class Metrics {
|
||||
Double.parseDouble(value);
|
||||
isValueNumeric = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
isValueNumeric = false;
|
||||
}
|
||||
if (json.charAt(json.length() - 1) != '{') {
|
||||
@ -446,7 +445,7 @@ public class Metrics {
|
||||
try {
|
||||
Class.forName("mineshafter.MineServer");
|
||||
return true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -520,11 +519,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() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -574,8 +568,7 @@ public class Metrics {
|
||||
/**
|
||||
* Called after the website graphs have been updated
|
||||
*/
|
||||
public void reset() {
|
||||
}
|
||||
public void reset() {}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
@ -42,7 +42,7 @@ public class SendChunk {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public SendChunk() {
|
||||
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
|
||||
RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
|
||||
this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
|
@ -38,7 +38,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
|
||||
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
|
||||
|
||||
public FastQueue_1_7() throws RuntimeException {
|
||||
public FastQueue_1_7() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException {
|
||||
this.methodGetHandle = this.classCraftWorld.getMethod("getHandle");
|
||||
this.methodGetChunkAt = this.classWorld.getMethod("getChunkAt", int.class, int.class);
|
||||
this.methodA = this.classChunk.getMethod("a", int.class, int.class, int.class, this.classBlock, int.class);
|
||||
|
@ -41,7 +41,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
private final RefConstructor constructorBlockPosition;
|
||||
private final SendChunk sendChunk;
|
||||
|
||||
public FastQueue_1_8() throws RuntimeException {
|
||||
public FastQueue_1_8() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException {
|
||||
this.methodInitLighting = this.classChunk.getMethod("initLighting");
|
||||
this.constructorBlockPosition = this.classBlockPosition.getConstructor(int.class, int.class, int.class);
|
||||
this.methodGetByCombinedId = this.classBlock.getMethod("getByCombinedId", int.class);
|
||||
@ -56,7 +56,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
return;
|
||||
}
|
||||
int count = 0;
|
||||
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
ArrayList<Chunk> chunks = new ArrayList<>();
|
||||
Iterator<Entry<ChunkWrapper, Chunk>> i = FastQueue_1_8.this.toUpdate.entrySet().iterator();
|
||||
while (i.hasNext() && count < 128) {
|
||||
chunks.add(i.next().getValue());
|
||||
|
@ -49,7 +49,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
private final RefMethod methodGetWorld;
|
||||
private final RefField tileEntityListTick;
|
||||
|
||||
public FastQueue_1_8_3() throws RuntimeException {
|
||||
public FastQueue_1_8_3() throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException {
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
|
@ -51,7 +51,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
private final RefField tileEntityListTick;
|
||||
|
||||
|
||||
public FastQueue_1_9() throws RuntimeException {
|
||||
public FastQueue_1_9() throws NoSuchFieldException, NoSuchMethodException, ClassNotFoundException {
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
@ -48,11 +49,9 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
||||
@Override
|
||||
public OfflinePlotPlayer getOfflinePlayer(UUID uuid) {
|
||||
BiMap<UUID, StringWrapper> map = UUIDHandler.getUuidMap().inverse();
|
||||
String name;
|
||||
try {
|
||||
String name = null;
|
||||
if (map.containsKey(uuid)) {
|
||||
name = map.get(uuid).value;
|
||||
} catch (NullPointerException e) {
|
||||
name = null;
|
||||
}
|
||||
if (name != null) {
|
||||
OfflinePlayer op = Bukkit.getOfflinePlayer(name);
|
||||
@ -81,7 +80,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
||||
@SuppressWarnings("unchecked") Collection<? extends Player> p = (Collection<? extends Player>) players;
|
||||
return p.toArray(new Player[p.size()]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) {
|
||||
PS.debug("Failed to resolve online players");
|
||||
this.getOnline = null;
|
||||
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
|
||||
|
Reference in New Issue
Block a user