diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index af38aea0f..aa4131cdd 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -7,7 +7,7 @@ repositories { dependencies { compile project(':Core') - compile 'org.spigotmc:spigot-api:1.13-R0.1-SNAPSHOT' + compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile("net.milkbowl.vault:VaultAPI:1.6") { exclude module: 'bukkit' diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 70e3301ce..f7b9239a2 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -576,34 +576,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } catch (final NoSuchMethodException | ClassNotFoundException ignored) { PlotSquared.debug("Not running Spigot. Skipping EntitySpawnListener event."); } - if (PlotSquared.get().checkVersion(getServerVersion(), 1, 7, 9)) { - try { - getServer().getPluginManager().registerEvents(new EntityPortal_1_7_9(), this); - } catch (Throwable e) { - e.printStackTrace(); - } - } - if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) { - try { - getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this); - } catch (Throwable e) { - e.printStackTrace(); - } - } - if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) { - try { - getServer().getPluginManager().registerEvents(new PlayerEvents183(), this); - } catch (Throwable e) { - e.printStackTrace(); - } - } - if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) { - try { - getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this); - } catch (Throwable e) { - e.printStackTrace(); - } - } } @Override public void registerInventoryEvents() { @@ -613,11 +585,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain @Override public void registerPlotPlusEvents() { PlotPlusListener.startRunnable(this); getServer().getPluginManager().registerEvents(new PlotPlusListener(), this); - if (PlotSquared.get().checkVersion(getServerVersion(), BukkitVersion.v1_12_0)) { - getServer().getPluginManager().registerEvents(new PlotPlusListener_1_12(), this); - } else { - getServer().getPluginManager().registerEvents(new PlotPlusListener_Legacy(), this); - } } @Override public void registerForceFieldEvents() { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java deleted file mode 100644 index a168d8069..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntityPortal_1_7_9.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.listeners; - -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Vehicle; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityTeleportEvent; -import org.bukkit.event.vehicle.*; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.plugin.Plugin; - -import java.util.List; - -@SuppressWarnings("unused") public class EntityPortal_1_7_9 implements Listener { - private static boolean ignoreTP = false; - - public EntityPortal_1_7_9() { - } - - public static void test(Entity entity) { - List meta = entity.getMetadata("plotworld"); - World world = entity.getLocation().getWorld(); - if (meta == null || meta.isEmpty()) { - if (PlotSquared.get().hasPlotArea(world.getName())) { - entity.setMetadata("plotworld", - new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); - } - } else { - Location origin = (Location) meta.get(0).value(); - World originWorld = origin.getWorld(); - if (!originWorld.equals(world)) { - if (!ignoreTP) { - if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) { - try { - ignoreTP = true; - entity.teleport(origin); - } finally { - ignoreTP = false; - } - if (entity.getLocation().getWorld().equals(world)) { - entity.remove(); - } - } - } else { - entity.remove(); - } - } - } - } - - @EventHandler public void onVehicle(VehicleUpdateEvent event) { - test(event.getVehicle()); - } - - @EventHandler public void onVehicle(VehicleDestroyEvent event) { - test(event.getVehicle()); - } - - @EventHandler public void onVehicle(VehicleEntityCollisionEvent event) { - test(event.getVehicle()); - } - - @EventHandler public void onVehicle(VehicleCreateEvent event) { - test(event.getVehicle()); - } - - @EventHandler public void onVehicle(VehicleBlockCollisionEvent event) { - test(event.getVehicle()); - } - - @EventHandler public void onTeleport(EntityTeleportEvent event) { - Entity ent = event.getEntity(); - if (ent instanceof Vehicle || ent instanceof ArmorStand) - test(event.getEntity()); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void vehicleMove(VehicleMoveEvent event) throws IllegalAccessException { - test(event.getVehicle()); - } - - @EventHandler public void spawn(CreatureSpawnEvent event) { - switch (event.getEntityType()) { - case ARMOR_STAND: - test(event.getEntity()); - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index dc24740c3..9f787297d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -7,16 +7,59 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.Plot; import com.github.intellectualsites.plotsquared.plot.object.PlotArea; +import org.bukkit.World; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Vehicle; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.event.entity.EntityTeleportEvent; +import org.bukkit.event.vehicle.*; import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; +import java.util.List; + @SuppressWarnings("unused") public class EntitySpawnListener implements Listener { + + private static boolean ignoreTP = false; + + public static void test(Entity entity) { + List meta = entity.getMetadata("plotworld"); + World world = entity.getLocation().getWorld(); + if (meta == null || meta.isEmpty()) { + if (PlotSquared.get().hasPlotArea(world.getName())) { + entity.setMetadata("plotworld", + new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); + } + } else { + org.bukkit.Location origin = (org.bukkit.Location) meta.get(0).value(); + World originWorld = origin.getWorld(); + if (!originWorld.equals(world)) { + if (!ignoreTP) { + if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) { + try { + ignoreTP = true; + entity.teleport(origin); + } finally { + ignoreTP = false; + } + if (entity.getLocation().getWorld().equals(world)) { + entity.remove(); + } + } + } else { + entity.remove(); + } + } + } + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void creatureSpawnEvent(EntitySpawnEvent event) { Entity entity = event.getEntity(); @@ -58,4 +101,42 @@ import org.bukkit.plugin.Plugin; } } } + + @EventHandler public void onVehicle(VehicleUpdateEvent event) { + test(event.getVehicle()); + } + + @EventHandler public void onVehicle(VehicleDestroyEvent event) { + test(event.getVehicle()); + } + + @EventHandler public void onVehicle(VehicleEntityCollisionEvent event) { + test(event.getVehicle()); + } + + @EventHandler public void onVehicle(VehicleCreateEvent event) { + test(event.getVehicle()); + } + + @EventHandler public void onVehicle(VehicleBlockCollisionEvent event) { + test(event.getVehicle()); + } + + @EventHandler public void onTeleport(EntityTeleportEvent event) { + Entity ent = event.getEntity(); + if (ent instanceof Vehicle || ent instanceof ArmorStand) + test(event.getEntity()); + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void vehicleMove(VehicleMoveEvent event) throws IllegalAccessException { + test(event.getVehicle()); + } + + @EventHandler public void spawn(CreatureSpawnEvent event) { + switch (event.getEntityType()) { + case ARMOR_STAND: + test(event.getEntity()); + } + } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 89d045bef..97c0fb1fa 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -4,7 +4,6 @@ import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitLazyBlock; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.C; import com.github.intellectualsites.plotsquared.plot.config.Settings; @@ -21,6 +20,8 @@ import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; +import org.bukkit.block.data.BlockData; +import org.bukkit.block.data.type.Piston; import org.bukkit.command.PluginCommand; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; @@ -30,6 +31,7 @@ import org.bukkit.event.block.*; import org.bukkit.event.entity.*; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; +import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.player.*; @@ -39,6 +41,8 @@ import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.help.HelpTopic; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; @@ -46,9 +50,7 @@ import org.bukkit.projectiles.BlockProjectileSource; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; -import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.Map.Entry; import java.util.regex.Pattern; @@ -64,8 +66,6 @@ import java.util.regex.Pattern; private boolean tmpTeleport = true; private Field fieldPlayer; private PlayerMoveEvent moveTmp; - private boolean v112 = - PlotSquared.get().checkVersion(PlotSquared.imp().getServerVersion(), BukkitVersion.v1_12_0); { try { @@ -76,8 +76,7 @@ import java.util.regex.Pattern; } } - public static void sendBlockChange(final org.bukkit.Location bloc, final Material type, - final byte data) { + public static void sendBlockChange(final org.bukkit.Location bloc, final BlockData data) { TaskManager.runTaskLater(() -> { String world = bloc.getWorld().getName(); int x = bloc.getBlockX(); @@ -91,7 +90,7 @@ import java.util.regex.Pattern; || 16 * Math.abs(loc.getZ() - z) / 16 > distance) { continue; } - ((BukkitPlayer) player).player.sendBlockChange(bloc, type, data); + ((BukkitPlayer) player).player.sendBlockChange(bloc, data); } } }, 3); @@ -232,32 +231,48 @@ import java.util.regex.Pattern; Block block = event.getBlock(); switch (block.getType()) { case OBSERVER: - case LEGACY_REDSTONE_LAMP_OFF: + case REDSTONE: + case REDSTONE_ORE: + case REDSTONE_BLOCK: + case REDSTONE_TORCH: + case REDSTONE_WALL_TORCH: case REDSTONE_WIRE: - case LEGACY_REDSTONE_LAMP_ON: - case LEGACY_PISTON_BASE: - case LEGACY_PISTON_STICKY_BASE: - case LEGACY_IRON_DOOR_BLOCK: + case REDSTONE_LAMP: + case PISTON_HEAD: + case PISTON: + case STICKY_PISTON: + case MOVING_PISTON: case LEVER: - case LEGACY_WOODEN_DOOR: - case LEGACY_FENCE_GATE: - case LEGACY_WOOD_BUTTON: + case ACACIA_BUTTON: + case BIRCH_BUTTON: + case DARK_OAK_BUTTON: + case JUNGLE_BUTTON: + case OAK_BUTTON: + case SPRUCE_BUTTON: case STONE_BUTTON: - case LEGACY_IRON_PLATE: - case LEGACY_WOOD_PLATE: - case LEGACY_STONE_PLATE: - case LEGACY_GOLD_PLATE: + case STONE_PRESSURE_PLATE: + case ACACIA_PRESSURE_PLATE: + case BIRCH_PRESSURE_PLATE: + case DARK_OAK_PRESSURE_PLATE: + case HEAVY_WEIGHTED_PRESSURE_PLATE: + case JUNGLE_PRESSURE_PLATE: + case LIGHT_WEIGHTED_PRESSURE_PLATE: + case OAK_PRESSURE_PLATE: + case SPRUCE_PRESSURE_PLATE: case SPRUCE_DOOR: case BIRCH_DOOR: case JUNGLE_DOOR: case ACACIA_DOOR: case DARK_OAK_DOOR: + case IRON_DOOR: + case OAK_DOOR: case IRON_TRAPDOOR: case SPRUCE_FENCE_GATE: case BIRCH_FENCE_GATE: case JUNGLE_FENCE_GATE: case ACACIA_FENCE_GATE: case DARK_OAK_FENCE_GATE: + case OAK_FENCE_GATE: case POWERED_RAIL: return; default: @@ -285,7 +300,7 @@ import java.util.regex.Pattern; } } } else { - disable = UUIDHandler.getPlayer(plot.owner) == null; + disable = UUIDHandler.getPlayer(plot.guessOwner()) == null; } if (disable) { for (UUID trusted : plot.getTrusted()) { @@ -314,8 +329,7 @@ import java.util.regex.Pattern; @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void onPhysicsEvent(BlockPhysicsEvent event) { switch (event.getChangedType()) { - case LEGACY_REDSTONE_COMPARATOR_OFF: - case LEGACY_REDSTONE_COMPARATOR_ON: { + case COMPARATOR: { Block block = event.getBlock(); Location loc = BukkitUtil.getLocation(block.getLocation()); PlotArea area = loc.getPlotArea(); @@ -354,8 +368,9 @@ import java.util.regex.Pattern; if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) { Block block = event.getBlock(); switch (block.getType()) { - case LEGACY_PISTON_BASE: - case LEGACY_PISTON_STICKY_BASE: + case PISTON: + case STICKY_PISTON: + Piston piston = (Piston) block.getBlockData(); Location loc = BukkitUtil.getLocation(block.getLocation()); PlotArea area = loc.getPlotArea(); if (area == null) { @@ -365,22 +380,17 @@ import java.util.regex.Pattern; if (plot == null) { return; } - int data = block.getData(); - switch (data) { - case 5: - case 13: + switch (piston.getFacing()) { + case EAST: loc.setX(loc.getX() + 1); break; - case 4: - case 12: + case SOUTH: loc.setX(loc.getX() - 1); break; - case 3: - case 11: + case WEST: loc.setZ(loc.getZ() + 1); break; - case 2: - case 10: + case NORTH: loc.setZ(loc.getZ() - 1); break; } @@ -634,7 +644,7 @@ import java.util.regex.Pattern; // Check allowed - Entity passenger = vehicle.getPassenger(); + Entity passenger = vehicle.getPassengers().get(1); if (passenger instanceof Player) { final Player player = (Player) passenger; @@ -646,11 +656,7 @@ import java.util.regex.Pattern; moveTmp.setCancelled(false); fieldPlayer.set(moveTmp, player); - List passengers; - if (v112) - passengers = vehicle.getPassengers(); - else - passengers = null; + List passengers = vehicle.getPassengers(); this.playerMove(moveTmp); org.bukkit.Location dest; @@ -945,9 +951,8 @@ import java.util.regex.Pattern; return; } if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { - if (player.getInventory().getItemInMainHand().getType() == BukkitUtil.getBukkitLegacyMappings() - .fromLegacyToString(PlotSquared.get().worldedit.getConfiguration().wandItem) - .to(Material.class)) { + if (player.getInventory().getItemInMainHand().getType() == Material + .getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) { return; } } @@ -1121,7 +1126,7 @@ import java.util.regex.Pattern; event.setCancelled(true); } break; - case LEGACY_MYCEL: + case MYCELIUM: if (Flags.MYCEL_GROW.isFalse(plot)) { event.setCancelled(true); } @@ -1245,7 +1250,7 @@ import java.util.regex.Pattern; event.setCancelled(true); } break; - case LEGACY_SOIL: + case FARMLAND: if (Flags.SOIL_DRY.isFalse(plot)) { event.setCancelled(true); } @@ -1281,7 +1286,7 @@ import java.util.regex.Pattern; } } } else if (!area.contains(fLocation.getX(), fLocation.getZ()) || !Objects - .equals(plot, area.getOwnedPlot(fLocation))) { + .equals(null, area.getOwnedPlot(fLocation))) { event.setCancelled(true); } } @@ -1357,7 +1362,7 @@ import java.util.regex.Pattern; this.pistonBlocks = false; } } - if (!this.pistonBlocks && block.getType() != Material.LEGACY_PISTON_BASE) { + if (!this.pistonBlocks && !block.getType().toString().contains("PISTON")) { BlockFace dir = event.getDirection(); location = BukkitUtil.getLocation(block.getLocation() .add(dir.getModX() * 2, dir.getModY() * 2, dir.getModZ() * 2)); @@ -1398,7 +1403,7 @@ import java.util.regex.Pattern; this.pistonBlocks = false; } } - if (!this.pistonBlocks && block.getType() != Material.LEGACY_PISTON_BASE) { + if (!this.pistonBlocks && !block.getType().toString().contains("PISTON")) { location = BukkitUtil.getLocation( block.getLocation().add(dir.getModX() * 2, dir.getModY() * 2, dir.getModZ() * 2)); if (!area.contains(location)) { @@ -1489,6 +1494,203 @@ import java.util.regex.Pattern; } } + @SuppressWarnings("deprecation") + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onInventoryClick(InventoryClickEvent event) { + if (!event.isLeftClick() || (event.getAction() != InventoryAction.PLACE_ALL) || event + .isShiftClick()) { + return; + } + HumanEntity entity = event.getWhoClicked(); + if (!(entity instanceof Player) || !PlotSquared.get() + .hasPlotArea(entity.getWorld().getName())) { + return; + } + + HumanEntity clicker = event.getWhoClicked(); + if (!(clicker instanceof Player)) { + return; + } + Player player = (Player) clicker; + PlotPlayer pp = BukkitUtil.getPlayer(player); + PlotInventory inventory = pp.getMeta("inventory"); + if (inventory != null && event.getRawSlot() == event.getSlot()) { + if (!inventory.onClick(event.getSlot())) { + event.setCancelled(true); + inventory.close(); + } + } + PlayerInventory inv = player.getInventory(); + int slot = inv.getHeldItemSlot(); + if ((slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) { + return; + } + ItemStack current = inv.getItemInHand(); + ItemStack newItem = event.getCursor(); + ItemMeta newMeta = newItem.getItemMeta(); + ItemMeta oldMeta = newItem.getItemMeta(); + String newLore = ""; + if (newMeta != null) { + List lore = newMeta.getLore(); + if (lore != null) { + newLore = lore.toString(); + } + } + String oldLore = ""; + if (oldMeta != null) { + List lore = oldMeta.getLore(); + if (lore != null) { + oldLore = lore.toString(); + } + } + if (!"[(+NBT)]".equals(newLore) || (current.equals(newItem) && newLore.equals(oldLore))) { + switch (newItem.getType()) { + case LEGACY_BANNER: + case PLAYER_HEAD: + if (newMeta != null) + break; + default: + return; + } + } + Block block = player.getTargetBlock(null, 7); + BlockState state = block.getState(); + if (state == null) { + return; + } + Material stateType = state.getType(); + Material itemType = newItem.getType(); + if (stateType != itemType) { + switch (stateType) { + case LEGACY_STANDING_BANNER: + case LEGACY_WALL_BANNER: + if (itemType == Material.LEGACY_BANNER) + break; + case LEGACY_SKULL: + if (itemType == Material.LEGACY_SKULL_ITEM) + break; + default: + return; + } + } + Location l = BukkitUtil.getLocation(state.getLocation()); + PlotArea area = l.getPlotArea(); + if (area == null) { + return; + } + Plot plot = area.getPlotAbs(l); + boolean cancelled = false; + if (plot == null) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { + MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road"); + cancelled = true; + } + } else if (!plot.hasOwner()) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { + MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); + cancelled = true; + } + } else { + UUID uuid = pp.getUUID(); + if (!plot.isAdded(uuid)) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { + MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other"); + cancelled = true; + } + } + } + if (cancelled) { + if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem + .getDurability())) { + event.setCursor( + new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability())); + event.setCancelled(true); + return; + } + event.setCursor( + new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability())); + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onPotionSplash(LingeringPotionSplashEvent event) { + LingeringPotion entity = event.getEntity(); + Location l = BukkitUtil.getLocation(entity); + if (!PlotSquared.get().hasPlotArea(l.getWorld())) { + return; + } + if (!this.onProjectileHit(event)) { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onInteract(PlayerInteractAtEntityEvent e) { + Entity entity = e.getRightClicked(); + if (!(entity instanceof ArmorStand)) { + return; + } + Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation()); + PlotArea area = l.getPlotArea(); + if (area == null) { + return; + } + + EntitySpawnListener.test(entity); + + Plot plot = area.getPlotAbs(l); + PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer()); + if (plot == null) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { + MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road"); + e.setCancelled(true); + } + } else if (!plot.hasOwner()) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { + MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); + e.setCancelled(true); + } + } else { + UUID uuid = pp.getUUID(); + if (!plot.isAdded(uuid)) { + if (Flags.MISC_INTERACT.isTrue(plot)) { + return; + } + if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { + MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other"); + e.setCancelled(true); + } + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onBigBoom(BlockExplodeEvent event) { + Block block = event.getBlock(); + Location location = BukkitUtil.getLocation(block.getLocation()); + String world = location.getWorld(); + if (!PlotSquared.get().hasPlotArea(world)) { + return; + } + PlotArea area = location.getPlotArea(); + if (area == null) { + Iterator iterator = event.blockList().iterator(); + while (iterator.hasNext()) { + location = BukkitUtil.getLocation(iterator.next().getLocation()); + if (location.getPlotArea() != null) { + iterator.remove(); + } + } + return; + } + Plot plot = area.getOwnedPlot(location); + if (plot == null || !plot.getFlag(Flags.EXPLOSION).or(false)) { + event.setCancelled(true); + } + event.blockList().removeIf( + b -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))); + } + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); @@ -1513,7 +1715,8 @@ import java.util.regex.Pattern; Block block = event.getClickedBlock(); location = BukkitUtil.getLocation(block.getLocation()); Material blockType = block.getType(); - int blockId = blockType.getId(); + int blockId = ((LegacyPlotBlock) PlotSquared.get().IMP.getLegacyMappings() + .fromStringToLegacy(blockType.name())).id; switch (blockType) { case ANVIL: case ACACIA_DOOR: @@ -1522,38 +1725,89 @@ import java.util.regex.Pattern; case IRON_DOOR: case JUNGLE_DOOR: case SPRUCE_DOOR: - case LEGACY_TRAP_DOOR: + case OAK_DOOR: + case ACACIA_TRAPDOOR: + case BIRCH_TRAPDOOR: + case DARK_OAK_TRAPDOOR: + case JUNGLE_TRAPDOOR: + case OAK_TRAPDOOR: + case SPRUCE_TRAPDOOR: case IRON_TRAPDOOR: - case LEGACY_WOOD_DOOR: - case LEGACY_WOODEN_DOOR: case TRAPPED_CHEST: case ENDER_CHEST: case CHEST: case ACACIA_FENCE_GATE: case BIRCH_FENCE_GATE: case DARK_OAK_FENCE_GATE: - case LEGACY_FENCE_GATE: + case OAK_FENCE_GATE: case JUNGLE_FENCE_GATE: case SPRUCE_FENCE_GATE: case LEVER: - case LEGACY_DIODE: - case LEGACY_DIODE_BLOCK_OFF: - case LEGACY_DIODE_BLOCK_ON: + case REDSTONE_TORCH: + case REDSTONE_WALL_TORCH: case COMMAND_BLOCK: - case LEGACY_REDSTONE_COMPARATOR: - case LEGACY_REDSTONE_COMPARATOR_OFF: - case LEGACY_REDSTONE_COMPARATOR_ON: + case COMPARATOR: case REDSTONE_ORE: - case LEGACY_WOOD_BUTTON: + case BIRCH_BUTTON: + case DARK_OAK_BUTTON: + case JUNGLE_BUTTON: + case ACACIA_BUTTON: + case OAK_BUTTON: + case SPRUCE_BUTTON: case STONE_BUTTON: case BEACON: - case LEGACY_BED_BLOCK: + case BLACK_BED: + case BLUE_BED: + case BROWN_BED: + case CYAN_BED: + case GRAY_BED: + case GREEN_BED: + case LIGHT_BLUE_BED: + case LIGHT_GRAY_BED: + case LIME_BED: + case MAGENTA_BED: + case ORANGE_BED: + case PINK_BED: + case PURPLE_BED: + case RED_BED: + case WHITE_BED: + case YELLOW_BED: case SIGN: case WALL_SIGN: - case LEGACY_ENCHANTMENT_TABLE: + case ENCHANTING_TABLE: case BREWING_STAND: - case LEGACY_STANDING_BANNER: - case LEGACY_BURNING_FURNACE: + case BLACK_BANNER: + case BLACK_WALL_BANNER: + case BLUE_BANNER: + case BLUE_WALL_BANNER: + case BROWN_BANNER: + case BROWN_WALL_BANNER: + case CYAN_BANNER: + case CYAN_WALL_BANNER: + case GRAY_BANNER: + case GRAY_WALL_BANNER: + case GREEN_BANNER: + case GREEN_WALL_BANNER: + case LIGHT_BLUE_BANNER: + case LIGHT_BLUE_WALL_BANNER: + case LIGHT_GRAY_BANNER: + case LIGHT_GRAY_WALL_BANNER: + case LIME_BANNER: + case LIME_WALL_BANNER: + case MAGENTA_BANNER: + case MAGENTA_WALL_BANNER: + case ORANGE_BANNER: + case ORANGE_WALL_BANNER: + case PINK_BANNER: + case PINK_WALL_BANNER: + case PURPLE_BANNER: + case PURPLE_WALL_BANNER: + case RED_BANNER: + case RED_WALL_BANNER: + case WHITE_BANNER: + case WHITE_WALL_BANNER: + case YELLOW_BANNER: + case YELLOW_WALL_BANNER: case FURNACE: case CAKE: case DISPENSER: @@ -1562,7 +1816,7 @@ import java.util.regex.Pattern; case NOTE_BLOCK: case JUKEBOX: case CRAFTING_TABLE: - case LEGACY_SILVER_SHULKER_BOX: + case LIGHT_GRAY_SHULKER_BOX: case BLACK_SHULKER_BOX: case BLUE_SHULKER_BOX: case RED_SHULKER_BOX: @@ -1578,8 +1832,8 @@ import java.util.regex.Pattern; case LIME_SHULKER_BOX: case LIGHT_BLUE_SHULKER_BOX: case MAGENTA_SHULKER_BOX: - case LEGACY_COMMAND_REPEATING: - case LEGACY_COMMAND_CHAIN: + case CHAIN_COMMAND_BLOCK: + case REPEATING_COMMAND_BLOCK: eventType = PlayerBlockEventType.INTERACT_BLOCK; break; @@ -1593,18 +1847,17 @@ import java.util.regex.Pattern; break; } lb = new BukkitLazyBlock(PlotBlock.get(block.getType().toString())); - ItemStack hand = player.getItemInHand(); + ItemStack hand = player.getInventory().getItemInMainHand(); if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK || !player.isSneaking())) { break; } Material type = (hand == null) ? null : hand.getType(); - int id = (type == null) ? 0 : type.getId(); if (type == Material.AIR) { eventType = PlayerBlockEventType.INTERACT_BLOCK; break; } - if (id < 198) { + if (type == null || type.isBlock()) { location = BukkitUtil .getLocation(block.getRelative(event.getBlockFace()).getLocation()); eventType = PlayerBlockEventType.PLACE_BLOCK; @@ -1612,63 +1865,81 @@ import java.util.regex.Pattern; } Material handType = hand.getType(); lb = new BukkitLazyBlock(PlotBlock.get(handType.toString())); - switch (handType) { - case LEGACY_FIREWORK: - case LEGACY_MONSTER_EGG: - case LEGACY_MONSTER_EGGS: - eventType = PlayerBlockEventType.SPAWN_MOB; - break; - case ARMOR_STAND: - location = BukkitUtil - .getLocation(block.getRelative(event.getBlockFace()).getLocation()); - eventType = PlayerBlockEventType.PLACE_MISC; - break; - case WRITTEN_BOOK: - case LEGACY_BOOK_AND_QUILL: - case BOOK: - eventType = PlayerBlockEventType.READ; - break; - case APPLE: - case BAKED_POTATO: - case LEGACY_MUSHROOM_SOUP: - case BREAD: - case CARROT: - case LEGACY_CARROT_ITEM: - case COOKIE: - case LEGACY_GRILLED_PORK: - case POISONOUS_POTATO: - case MUTTON: - case LEGACY_PORK: - case POTATO: - case LEGACY_POTATO_ITEM: - case POTION: - case PUMPKIN_PIE: - case RABBIT: - case RABBIT_FOOT: - case RABBIT_STEW: - case LEGACY_RAW_BEEF: - case LEGACY_RAW_FISH: - case LEGACY_RAW_CHICKEN: - eventType = PlayerBlockEventType.EAT; - break; - case MINECART: - case LEGACY_STORAGE_MINECART: - case LEGACY_POWERED_MINECART: - case HOPPER_MINECART: - case LEGACY_EXPLOSIVE_MINECART: - case LEGACY_COMMAND_MINECART: - case LEGACY_BOAT: - eventType = PlayerBlockEventType.PLACE_VEHICLE; - break; - case PAINTING: - case ITEM_FRAME: - location = BukkitUtil - .getLocation(block.getRelative(event.getBlockFace()).getLocation()); - eventType = PlayerBlockEventType.PLACE_HANGING; - break; - default: - eventType = PlayerBlockEventType.INTERACT_BLOCK; - break; + if (handType.toString().endsWith("egg")) { + eventType = PlayerBlockEventType.SPAWN_MOB; + } else { + switch (handType) { + case FIREWORK_ROCKET: + case FIREWORK_STAR: + eventType = PlayerBlockEventType.SPAWN_MOB; + break; + case ARMOR_STAND: + location = BukkitUtil + .getLocation(block.getRelative(event.getBlockFace()).getLocation()); + eventType = PlayerBlockEventType.PLACE_MISC; + break; + case WRITTEN_BOOK: + case WRITABLE_BOOK: + case ENCHANTED_BOOK: + case KNOWLEDGE_BOOK: + case BOOK: + eventType = PlayerBlockEventType.READ; + break; + case APPLE: + case BAKED_POTATO: + case MUSHROOM_STEW: + case BREAD: + case CARROT: + case GOLDEN_CARROT: + case COOKIE: + case PORKCHOP: + case POISONOUS_POTATO: + case MUTTON: + case COOKED_PORKCHOP: + case POTATO: + case POTION: + case PUMPKIN_PIE: + case RABBIT: + case RABBIT_FOOT: + case RABBIT_STEW: + case BEEF: + case COOKED_BEEF: + case TROPICAL_FISH: + case PUFFERFISH: + case CHICKEN: + case COOKED_CHICKEN: + case COOKED_MUTTON: + case COOKED_RABBIT: + case COOKED_SALMON: + case SALMON: + case COD: + case COOKED_COD: + eventType = PlayerBlockEventType.EAT; + break; + case MINECART: + case CHEST_MINECART: + case FURNACE_MINECART: + case HOPPER_MINECART: + case TNT_MINECART: + case COMMAND_BLOCK_MINECART: + case BIRCH_BOAT: + case ACACIA_BOAT: + case DARK_OAK_BOAT: + case JUNGLE_BOAT: + case OAK_BOAT: + case SPRUCE_BOAT: + eventType = PlayerBlockEventType.PLACE_VEHICLE; + break; + case PAINTING: + case ITEM_FRAME: + location = BukkitUtil + .getLocation(block.getRelative(event.getBlockFace()).getLocation()); + eventType = PlayerBlockEventType.PLACE_HANGING; + break; + default: + eventType = PlayerBlockEventType.INTERACT_BLOCK; + break; + } } break; } @@ -1682,12 +1953,9 @@ import java.util.regex.Pattern; return; } if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { - if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) { - if (player.getInventory().getItemInMainHand().getType() == BukkitUtil.getBukkitLegacyMappings() - .fromLegacyToString(PlotSquared.get().worldedit.getConfiguration().wandItem) - .to(Material.class)) { - return; - } + if (player.getInventory().getItemInMainHand().getType() == Material + .getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) { + return; } } if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, lb, true)) { @@ -1723,7 +1991,7 @@ import java.util.regex.Pattern; case BUILD_WITHER: case BUILD_SNOWMAN: case CUSTOM: - if (!area.SPAWN_CUSTOM && entity.getType().getTypeId() != 30) { + if (!area.SPAWN_CUSTOM && entity.getType() != EntityType.ARMOR_STAND) { event.setCancelled(true); return; } @@ -1935,23 +2203,6 @@ import java.util.regex.Pattern; } } - @EventHandler(priority = EventPriority.HIGHEST) - public void onInventoryClick(InventoryClickEvent event) { - HumanEntity clicker = event.getWhoClicked(); - if (!(clicker instanceof Player)) { - return; - } - Player player = (Player) clicker; - PlotPlayer pp = BukkitUtil.getPlayer(player); - PlotInventory inventory = pp.getMeta("inventory"); - if (inventory != null && event.getRawSlot() == event.getSlot()) { - if (!inventory.onClick(event.getSlot())) { - event.setCancelled(true); - inventory.close(); - } - } - } - @EventHandler(priority = EventPriority.HIGHEST) public void onInventoryClose(InventoryCloseEvent event) { HumanEntity closer = event.getPlayer(); @@ -2255,24 +2506,8 @@ import java.util.regex.Pattern; @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST) public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { EntityDamageByEntityEvent eventChange = null; - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) { - eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), - EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration()); - } else { - try { - Constructor constructor = EntityDamageByEntityEvent.class - .getConstructor(Entity.class, Entity.class, EntityDamageEvent.DamageCause.class, - Integer.TYPE); - eventChange = constructor.newInstance(event.getCombuster(), event.getEntity(), - EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration()); - } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { - e.printStackTrace(); - } - } - if (eventChange == null) { - return; - } + eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), + EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration()); onEntityDamageByEntityEvent(eventChange); if (eventChange.isCancelled()) { event.setCancelled(true); @@ -2454,8 +2689,8 @@ import java.util.regex.Pattern; } } return true; - } else if (dplot != null && (!(dplot.equals(vplot)) || (vplot != null && Objects - .equals(dplot.owner, vplot.owner)))) { + } else if (dplot != null && (!dplot.equals(vplot) || Objects + .equals(dplot.guessOwner(), vplot.guessOwner()))) { return vplot != null && Flags.PVE.isTrue(vplot); } return ((vplot != null && Flags.PVE.isTrue(vplot)) || !(damager instanceof Arrow @@ -2540,7 +2775,7 @@ import java.util.regex.Pattern; if (plot.getFlag(Flags.DISABLE_PHYSICS, false)) { Block block = event.getBlockPlaced(); if (block.getType().hasGravity()) { - sendBlockChange(block.getLocation(), block.getType(), block.getData()); + sendBlockChange(block.getLocation(), block.getBlockData()); } } } else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java deleted file mode 100644 index 4b3b83045..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents183.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.listeners; - -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import org.bukkit.block.Block; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockExplodeEvent; - -import java.util.Iterator; - -@SuppressWarnings("unused") public class PlayerEvents183 implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onBigBoom(BlockExplodeEvent event) { - Block block = event.getBlock(); - Location location = BukkitUtil.getLocation(block.getLocation()); - String world = location.getWorld(); - if (!PlotSquared.get().hasPlotArea(world)) { - return; - } - PlotArea area = location.getPlotArea(); - if (area == null) { - Iterator iterator = event.blockList().iterator(); - while (iterator.hasNext()) { - location = BukkitUtil.getLocation(iterator.next().getLocation()); - if (location.getPlotArea() != null) { - iterator.remove(); - } - } - return; - } - Plot plot = area.getOwnedPlot(location); - if (plot == null || !plot.getFlag(Flags.EXPLOSION).or(false)) { - event.setCancelled(true); - } - event.blockList().removeIf( - b -> !plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))); - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java deleted file mode 100644 index a8757ab97..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_8.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.listeners; - -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.C; -import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; -import com.github.intellectualsites.plotsquared.plot.object.Location; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -import com.github.intellectualsites.plotsquared.plot.util.Permissions; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerInteractAtEntityEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.bukkit.inventory.meta.ItemMeta; - -import java.util.HashSet; -import java.util.List; -import java.util.UUID; - -@SuppressWarnings("unused") public class PlayerEvents_1_8 extends PlotListener implements Listener { - - @SuppressWarnings("deprecation") - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onInventoryClick(InventoryClickEvent event) { - if (!event.isLeftClick() || (event.getAction() != InventoryAction.PLACE_ALL) || event - .isShiftClick()) { - return; - } - HumanEntity entity = event.getWhoClicked(); - if (!(entity instanceof Player) || !PlotSquared.get() - .hasPlotArea(entity.getWorld().getName())) { - return; - } - Player player = (Player) entity; - PlayerInventory inv = player.getInventory(); - int slot = inv.getHeldItemSlot(); - if ((slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) { - return; - } - ItemStack current = inv.getItemInHand(); - ItemStack newItem = event.getCursor(); - ItemMeta newMeta = newItem.getItemMeta(); - ItemMeta oldMeta = newItem.getItemMeta(); - String newLore = ""; - if (newMeta != null) { - List lore = newMeta.getLore(); - if (lore != null) { - newLore = lore.toString(); - } - } - String oldLore = ""; - if (oldMeta != null) { - List lore = oldMeta.getLore(); - if (lore != null) { - oldLore = lore.toString(); - } - } - if (!"[(+NBT)]".equals(newLore) || (current.equals(newItem) && newLore.equals(oldLore))) { - switch (newItem.getType()) { - case LEGACY_BANNER: - case PLAYER_HEAD: - if (newMeta != null) - break; - default: - return; - } - } - - HashSet blocks = null; - Block block = player.getTargetBlock(blocks, 7); - BlockState state = block.getState(); - if (state == null) { - return; - } - Material stateType = state.getType(); - Material itemType = newItem.getType(); - if (stateType != itemType) { - switch (stateType) { - case LEGACY_STANDING_BANNER: - case LEGACY_WALL_BANNER: - if (itemType == Material.LEGACY_BANNER) - break; - case LEGACY_SKULL: - if (itemType == Material.LEGACY_SKULL_ITEM) - break; - default: - return; - } - } - Location l = BukkitUtil.getLocation(state.getLocation()); - PlotArea area = l.getPlotArea(); - if (area == null) { - return; - } - Plot plot = area.getPlotAbs(l); - PlotPlayer pp = BukkitUtil.getPlayer(player); - boolean cancelled = false; - if (plot == null) { - if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road"); - cancelled = true; - } - } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); - cancelled = true; - } - } else { - UUID uuid = pp.getUUID(); - if (!plot.isAdded(uuid)) { - if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other"); - cancelled = true; - } - } - } - if (cancelled) { - if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem - .getDurability())) { - event.setCursor( - new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability())); - event.setCancelled(true); - return; - } - event.setCursor( - new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability())); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onInteract(PlayerInteractAtEntityEvent e) { - Entity entity = e.getRightClicked(); - if (!(entity instanceof ArmorStand)) { - return; - } - Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation()); - PlotArea area = l.getPlotArea(); - if (area == null) { - return; - } - - EntityPortal_1_7_9.test(entity); - - Plot plot = area.getPlotAbs(l); - PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer()); - if (plot == null) { - if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road"); - e.setCancelled(true); - } - } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); - e.setCancelled(true); - } - } else { - UUID uuid = pp.getUUID(); - if (!plot.isAdded(uuid)) { - if (Flags.MISC_INTERACT.isTrue(plot)) { - return; - } - if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) { - MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other"); - e.setCancelled(true); - } - } - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java deleted file mode 100644 index 51c64ea42..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents_1_9.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.listeners; - -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.object.Location; -import org.bukkit.entity.LingeringPotion; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.LingeringPotionSplashEvent; - -@SuppressWarnings("unused") public class PlayerEvents_1_9 implements Listener { - - private final PlayerEvents parent; - - public PlayerEvents_1_9(PlayerEvents parent) { - this.parent = parent; - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onPotionSplash(LingeringPotionSplashEvent event) { - LingeringPotion entity = event.getEntity(); - Location l = BukkitUtil.getLocation(entity); - if (!PlotSquared.get().hasPlotArea(l.getWorld())) { - return; - } - if (!parent.onProjectileHit(event)) { - event.setCancelled(true); - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java index 0daeeb26f..afabd8250 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -12,6 +12,7 @@ import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.block.Block; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -19,6 +20,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -30,16 +32,16 @@ import java.util.UUID; @SuppressWarnings("unused") public class PlotPlusListener extends PlotListener implements Listener { - private static final HashMap feedRunnable = new HashMap<>(); - private static final HashMap healRunnable = new HashMap<>(); + private static final HashMap feedRunnable = new HashMap<>(); + private static final HashMap healRunnable = new HashMap<>(); public static void startRunnable(JavaPlugin plugin) { plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { @Override public void run() { if (!healRunnable.isEmpty()) { - for (Iterator> iterator = + for (Iterator> iterator = healRunnable.entrySet().iterator(); iterator.hasNext(); ) { - Entry entry = iterator.next(); + Entry entry = iterator.next(); Interval value = entry.getValue(); ++value.count; if (value.count == value.interval) { @@ -57,9 +59,9 @@ import java.util.UUID; } } if (!feedRunnable.isEmpty()) { - for (Iterator> iterator = + for (Iterator> iterator = feedRunnable.entrySet().iterator(); iterator.hasNext(); ) { - Entry entry = iterator.next(); + Entry entry = iterator.next(); Interval value = entry.getValue(); ++value.count; if (value.count == value.interval) { @@ -134,20 +136,19 @@ import java.util.UUID; Optional feed = plot.getFlag(Flags.FEED); if (feed.isPresent()) { Integer[] value = feed.get(); - feedRunnable.put(player.getName(), new Interval(value[0], value[1], 20)); + feedRunnable.put(player.getUniqueId(), new Interval(value[0], value[1], 20)); } Optional heal = plot.getFlag(Flags.HEAL); if (heal.isPresent()) { Integer[] value = heal.get(); - healRunnable.put(player.getName(), new Interval(value[0], value[1], 20)); + healRunnable.put(player.getUniqueId(), new Interval(value[0], value[1], 20)); } } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); - String name = player.getName(); - feedRunnable.remove(name); - healRunnable.remove(name); + feedRunnable.remove(player.getUniqueId()); + healRunnable.remove(player.getUniqueId()); } @EventHandler public void onPlotLeave(PlayerLeavePlotEvent event) { @@ -157,9 +158,24 @@ import java.util.UUID; return; } BukkitUtil.getPlayer(leaver); - String name = leaver.getName(); - feedRunnable.remove(name); - healRunnable.remove(name); + feedRunnable.remove(leaver.getUniqueId()); + healRunnable.remove(leaver.getUniqueId()); + } + + @EventHandler public void onItemPickup(EntityPickupItemEvent event) { + LivingEntity ent = event.getEntity(); + if (ent instanceof Player) { + Player player = (Player) ent; + PlotPlayer pp = BukkitUtil.getPlayer(player); + Plot plot = BukkitUtil.getLocation(player).getOwnedPlot(); + if (plot == null) { + return; + } + UUID uuid = pp.getUUID(); + if (!plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) { + event.setCancelled(true); + } + } } private static class Interval { diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java deleted file mode 100644 index 007d8b2b3..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_1_12.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.listeners; - -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityPickupItemEvent; - -import java.util.UUID; - -@SuppressWarnings("unused") public class PlotPlusListener_1_12 implements Listener { - - @EventHandler public void onItemPickup(EntityPickupItemEvent event) { - LivingEntity ent = event.getEntity(); - if (ent instanceof Player) { - Player player = (Player) ent; - PlotPlayer pp = BukkitUtil.getPlayer(player); - Plot plot = BukkitUtil.getLocation(player).getOwnedPlot(); - if (plot == null) { - return; - } - UUID uuid = pp.getUUID(); - if (!plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) { - event.setCancelled(true); - } - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java deleted file mode 100644 index 28215f192..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlotPlusListener_Legacy.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.listeners; - -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.flag.Flags; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerPickupItemEvent; - -import java.util.UUID; - -@SuppressWarnings("unused") public class PlotPlusListener_Legacy implements Listener { - - @EventHandler public void onItemPickup(PlayerPickupItemEvent event) { - Player player = event.getPlayer(); - PlotPlayer pp = BukkitUtil.getPlayer(player); - Plot plot = BukkitUtil.getLocation(player).getOwnedPlot(); - if (plot == null) { - return; - } - UUID uuid = pp.getUUID(); - if (!plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) { - event.setCancelled(true); - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java index 04e9d2f5e..e71373771 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java @@ -1,6 +1,5 @@ package com.github.intellectualsites.plotsquared.bukkit.object.entity; -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion; import com.github.intellectualsites.plotsquared.plot.PlotSquared; import org.bukkit.*; import org.bukkit.block.BlockFace; @@ -53,21 +52,15 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { if (depth == 1) { return; } - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) - || entity instanceof ArmorStand) { - if (!entity.hasGravity()) { - this.noGravity = true; - } + if (!entity.hasGravity()) { + this.noGravity = true; } switch (entity.getType()) { - case ARROW: case BOAT: - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { - Boat boat = (Boat) entity; - this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType()); - } + Boat boat = (Boat) entity; + this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType()); + return; + case ARROW: case COMPLEX_PART: case EGG: case ENDER_CRYSTAL: @@ -103,9 +96,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { case AREA_EFFECT_CLOUD: // Do this stuff later return; - default: - PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); - return; // MISC // case DROPPED_ITEM: Item item = (Item) entity; @@ -284,6 +274,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { } storeLiving((LivingEntity) entity); // END LIVING // + default: + PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); } } @@ -324,13 +316,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { void restoreEquipment(LivingEntity entity) { EntityEquipment equipment = entity.getEquipment(); - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { - equipment.setItemInMainHand(this.lived.mainHand); - equipment.setItemInOffHand(this.lived.offHand); - } else { - equipment.setItemInHand(this.lived.mainHand); - } + equipment.setItemInMainHand(this.lived.mainHand); + equipment.setItemInOffHand(this.lived.offHand); equipment.setHelmet(this.lived.helmet); equipment.setChestplate(this.lived.chestplate); equipment.setLeggings(this.lived.leggings); @@ -369,14 +356,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { } void storeEquipment(EntityEquipment equipment) { - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { - this.lived.mainHand = equipment.getItemInMainHand().clone(); - this.lived.offHand = equipment.getItemInOffHand().clone(); - } else { - this.lived.mainHand = equipment.getItemInHand().clone(); - this.lived.offHand = null; - } + this.lived.mainHand = equipment.getItemInMainHand().clone(); + this.lived.offHand = equipment.getItemInOffHand().clone(); this.lived.boots = equipment.getBoots().clone(); this.lived.leggings = equipment.getLeggings().clone(); this.lived.chestplate = equipment.getChestplate().clone(); @@ -461,22 +442,18 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { if (this.depth == 1) { return entity; } - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) - || entity instanceof ArmorStand) { - if (this.noGravity) { - entity.setGravity(false); - } + if (this.noGravity) { + entity.setGravity(false); } switch (entity.getType()) { - case ARROW: case BOAT: - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) { - Boat boat = (Boat) entity; - boat.setWoodType(TreeSpecies.values()[dataByte]); - } - + Boat boat = (Boat) entity; + boat.setWoodType(TreeSpecies.values()[dataByte]); + return entity; + case SLIME: + ((Slime) entity).setSize(this.dataByte); + return entity; + case ARROW: case COMPLEX_PART: case EGG: case ENDER_CRYSTAL: @@ -496,10 +473,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { case MINECART_TNT: case PLAYER: case PRIMED_TNT: - return entity; - case SLIME: - ((Slime) entity).setSize(this.dataByte); - return entity; case SMALL_FIREBALL: case SNOWBALL: case SPLASH_POTION: @@ -516,9 +489,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { case UNKNOWN: // Do this stuff later return entity; - default: - PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); - return entity; // MISC // case ITEM_FRAME: ItemFrame itemframe = (ItemFrame) entity; @@ -703,6 +673,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { } restoreLiving((LivingEntity) entity); return entity; + default: + PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); + return entity; // END LIVING } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitleManager_183.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitleManager_183.java deleted file mode 100644 index 7f9f7aef7..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitleManager_183.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.titles; - -import com.github.intellectualsites.plotsquared.bukkit.chat.Reflection; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - -import java.lang.reflect.Method; - -public class DefaultTitleManager_183 extends DefaultTitleManager { - - /** - * Create a new 1.8 title. - * - * @param title Title text - * @param subtitle Subtitle text - * @param fadeInTime Fade in time - * @param stayTime Stay on screen time - * @param fadeOutTime Fade out time - */ - DefaultTitleManager_183(String title, String subtitle, int fadeInTime, int stayTime, - int fadeOutTime) { - super(title, subtitle, fadeInTime, stayTime, fadeOutTime); - } - - /** - * Load spigot and NMS classes. - */ - @Override void loadClasses() { - this.packetTitle = Reflection.getNMSClass("PacketPlayOutTitle"); - this.chatBaseComponent = Reflection.getNMSClass("IChatBaseComponent"); - this.packetActions = Reflection.getNMSClass("PacketPlayOutTitle$EnumTitleAction"); - this.nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer"); - } - - @Override public void send(Player player) - throws IllegalArgumentException, ReflectiveOperationException, SecurityException { - if (this.packetTitle != null) { - // First reset previous settings - resetTitle(player); - // Send timings first - Object handle = getHandle(player); - Object connection = getField(handle.getClass(), "playerConnection").get(handle); - Object[] actions = this.packetActions.getEnumConstants(); - Method sendPacket = getMethod(connection.getClass(), "sendPacket"); - Object packet = this.packetTitle - .getConstructor(this.packetActions, this.chatBaseComponent, Integer.TYPE, - Integer.TYPE, Integer.TYPE) - .newInstance(actions[2], null, this.fadeInTime * (this.ticks ? 1 : 20), - this.stayTime * (this.ticks ? 1 : 20), - this.fadeOutTime * (this.ticks ? 1 : 20)); - // Send if set - if ((this.fadeInTime != -1) && (this.fadeOutTime != -1) && (this.stayTime != -1)) { - sendPacket.invoke(connection, packet); - } - // 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() + "}"); - packet = this.packetTitle.getConstructor(this.packetActions, this.chatBaseComponent) - .newInstance(actions[1], serialized); - sendPacket.invoke(connection, packet); - } - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java index 8b8f14e61..c0d176019 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_111.java @@ -1,33 +1,20 @@ package com.github.intellectualsites.plotsquared.bukkit.titles; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitVersion; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; import org.bukkit.entity.Player; @SuppressWarnings("deprecation") public class DefaultTitle_111 extends AbstractTitle { - private final boolean valid; - - public DefaultTitle_111() { - this.valid = PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_11_0); - } - @Override public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) { - if (valid) { - try { - final Player playerObj = ((BukkitPlayer) player).player; - TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out); - title.send(playerObj); - return; - } catch (Throwable ignored) { - } + try { + final Player playerObj = ((BukkitPlayer) player).player; + TitleManager_1_11 title = new TitleManager_1_11(head, sub, in, delay, out); + title.send(playerObj); + return; + } catch (Throwable ignored) { } - AbstractTitle.TITLE_CLASS = new DefaultTitle_180(); - AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_180.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_180.java deleted file mode 100644 index 89662bad5..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_180.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.titles; - -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; - -public class DefaultTitle_180 extends AbstractTitle { - - @Override - public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) { - try { - DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out); - title.send(((BukkitPlayer) player).player); - } catch (Exception ignored) { - AbstractTitle.TITLE_CLASS = new DefaultTitle_19(); - AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out); - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_183.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_183.java deleted file mode 100644 index cc87ea67b..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_183.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.titles; - -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; - -public class DefaultTitle_183 extends AbstractTitle { - - @Override - public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) { - try { - DefaultTitleManager_183 title = new DefaultTitleManager_183(head, sub, in, delay, out); - title.send(((BukkitPlayer) player).player); - } catch (Exception ignored) { - AbstractTitle.TITLE_CLASS = new HackTitle(); - AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out); - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_19.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_19.java deleted file mode 100644 index 5795b3364..000000000 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/titles/DefaultTitle_19.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.github.intellectualsites.plotsquared.bukkit.titles; - -import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle; -import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -import org.bukkit.entity.Player; - -@SuppressWarnings("deprecation") public class DefaultTitle_19 extends AbstractTitle { - - @Override - public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) { - try { - final Player playerObj = ((BukkitPlayer) player).player; - playerObj.sendTitle(head, sub); - TaskManager.runTaskLater(new Runnable() { - @Override public void run() { - playerObj.sendTitle("", ""); - } - }, delay * 20); - } catch (Throwable ignored) { - AbstractTitle.TITLE_CLASS = new DefaultTitle_183(); - AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out); - } - } -} diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java index 99226ea31..8bfa3da59 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitVersion.java @@ -1,17 +1,7 @@ package com.github.intellectualsites.plotsquared.bukkit.util; public class BukkitVersion { + public static int[] v1_13_2 = {1, 13, 2}; + public static int[] v1_13_1 = {1, 13, 1}; public static int[] v1_13_0 = {1, 13, 0}; - public static int[] v1_12_1 = {1, 12, 1}; - public static int[] v1_12_0 = {1, 12, 0}; - public static int[] v1_11_0 = {1, 11, 0}; - public static int[] v1_10_2 = {1, 10, 2}; - public static int[] v1_10_0 = {1, 10, 0}; - public static int[] v1_9_4 = {1, 9, 4}; - public static int[] v1_9_0 = {1, 9, 0}; - public static int[] v1_8_3 = {1, 8, 3}; - public static int[] v1_8_0 = {1, 8, 0}; - public static int[] v1_7_6 = {1, 7, 6}; - public static int[] v1_7_0 = {1, 7, 0}; - public static int[] v1_6_0 = {1, 6, 0}; } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java index b82be5ca5..f0987b219 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java @@ -50,19 +50,7 @@ public class SendChunk { RefClass classChunk = getRefClass("{nms}.Chunk"); this.methodInitLighting = classChunk.getMethod("initLighting"); RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk"); - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) { - //this works for 1.9.4 and 1.10 - tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); - } else { - try { - tempMapChunk = classMapChunk - .getConstructor(classChunk.getRealClass(), boolean.class, int.class); - } catch (NoSuchMethodException ignored) { - tempMapChunk = classMapChunk - .getConstructor(classChunk.getRealClass(), boolean.class, int.class, int.class); - } - } + tempMapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class); this.mapChunk = tempMapChunk; RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer"); this.connection = classEntityPlayer.getField("playerConnection"); @@ -119,22 +107,9 @@ public class SendChunk { chunks.remove(chunk); Object con = this.connection.of(entity).get(); Object packet = null; - if (PlotSquared.get() - .checkVersion(PlotSquared.get().IMP.getServerVersion(), BukkitVersion.v1_9_4)) { - try { - packet = this.mapChunk.create(c, 65535); - } catch (Exception ignored) { - } - } else { - try { - packet = this.mapChunk.create(c, true, 65535); - } catch (ReflectiveOperationException | IllegalArgumentException e) { - try { - packet = this.mapChunk.create(c, true, 65535, 5); - } catch (ReflectiveOperationException | IllegalArgumentException e1) { - e1.printStackTrace(); - } - } + try { + packet = this.mapChunk.create(c, 65535); + } catch (Exception ignored) { } if (packet == null) { PlotSquared.debug("Error with PacketPlayOutMapChunk reflection."); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index 82b647b34..44edfd4b7 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -275,6 +275,7 @@ import java.util.zip.ZipInputStream; copyFile("zh-CN.yml", Settings.Paths.TRANSLATIONS); copyFile("it-IT.yml", Settings.Paths.TRANSLATIONS); copyFile("ko-KR.yml", Settings.Paths.TRANSLATIONS); + copyFile("fr-FR.yml", Settings.Paths.TRANSLATIONS); showDebug(); } catch (Throwable e) { e.printStackTrace(); diff --git a/Core/src/main/resources/fr-FR.yml b/Core/src/main/resources/fr-FR.yml new file mode 100644 index 000000000..4867aff98 --- /dev/null +++ b/Core/src/main/resources/fr-FR.yml @@ -0,0 +1,393 @@ +#Translated by Bobbber#5545 +#12.12.2018 +confirm: + expired_confirm: $2La confirmation a expiré, veuillez relancer la commande.! + failed_confirm: '$2Vous n''avez aucune action en attente à confirmer!' + requires_confirm: '$2Êtes-vous sûr de vouloir exécuter: $1%s$2?&-$2Ça ne peut pas être inversé! Si vous êtes certain: $1/plot confirm' +move: + move_success: $4Parcelle déplacée avec succès. + copy_success: $4Parcelle copiée avec succès. + requires_unowned: '$2L''emplacement spécifié est déjà occupé.' +set: + set_attribute: $4Réglé avec succès %s0 mis à %s1 +web: + generating_link: $1Parcelle en traitement... + generating_link_failed: $2Impossible de générer le lien de téléchargement! + save_failed: $2Échec de la sauvegarde + load_null: $2Veuillez utiliser $4/plot load $2pour obtenir une liste des schématics + load_failed: $2Impossible de charger le schématic + load_list: '$2Pour charger un schématic, utilisez $1/plot load #' + save_success: $1Enregistré avec succès! +compass: + compass_target: $4Parcelle ciblée avec la boussole, réussi. +cluster: + cluster_available_args: '$1Les sous-commandes suivantes sont disponibles: $4list$2, $4create$2, + $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, $4members$2, $4info$2, + $4tp$2, $4sethome' + cluster_list_heading: $2Il y a $1%s$2 clusters dans ce monde + cluster_list_element: $2 - $1%s&- + cluster_intersection: '$2La zone proposée chevauche avec: %s0' + cluster_outside: '$2La zone proposée est en dehors de la parcelle: %s0' + cluster_added: $4Cluster créé avec succès. + cluster_deleted: $4Cluster supprimé avec succès. + cluster_resized: $4Cluster redimensionné avec succès. + cluster_added_user: $4Utilisateur ajouté avec succès au cluster. + cannot_kick_player: $2Vous ne pouvez pas kick ce joueur + cluster_invited: '$1Vous avez été invité au cluster suivant: $2%s' + cluster_removed: '$1Vous avez été retiré du cluster: $2%s' + cluster_kicked_user: '$4Vous avez expulsé avec succès l''utilisateur' + invalid_cluster: '$1Nom de cluster non valide: $2%s' + cluster_not_added: '$2Ce joueur n''a pas été ajouté au parcelle de cluster' + cluster_cannot_leave: $1Vous devez supprimer ou transférer la propriété avant de partir + cluster_added_helper: '$4Ajout réussi d''un assistant au cluster' + cluster_removed_helper: '$4Suppression réussie d''un assistant du cluster' + cluster_regenerated: $4La régénération de cluster a démarré avec succès + cluster_teleporting: $4Téléportation... + cluster_info: '$1Cluster actuel: $2%id%&-$1Nom: $2%name%&-$1Propriétaire: $2%owner%&-$1Taille: + $2%size%&-$1Droits: $2%rights%' +border: + border: $2Vous êtes en dehors de la bordure de la map actuelle +unclaim: + unclaim_success: $4Vous avez réussi à canceller votre claim de plot. + unclaim_failed: $2Impossible de canceller votre claim de plot +worldedit masks: + worldedit_delayed: $2Veuillez patienter pendant que nous traitons votre action WorldEdit... + worldedit_run: '$2Toutes mes excuses pour le délais. Nous exécutons: %s' + require_selection_in_mask: '$2%s de votre sélection n''est pas dans votre masque de parcelle. Vous pouvez seulement éditer dans votre parcelle.' + worldedit_volume: $2Vous ne pouvez pas sélectionner un volume de %current%. Le volume maximum que vous pouvez modifier est %max%. + worldedit_iterations: '$2Vous ne pouvez pas itérer %current% fois. Le nombre maximum d''itérations autorisé est %max%.' + worldedit_unsafe: '$2L''accès à cette commande a été bloqué' + worldedit_bypass: $2&oPour contourner vos restrictions, utilisez $4/plot wea + worldedit_bypassed: $2Restriction actuellement contourné de WorldEdit. + worldedit_unmasked: $1Votre WorldEdit est maintenant illimité. + worldedit_restricted: $1Votre WorldEdit est maintenant limité. +gamemode: + gamemode_was_bypassed: $1Vous avez contourné le GameMode ($2{gamemode}$1) $1fixé pour $2{plot} +height limit: + height_limit: $1Ce plot a une limite de hauteur de $2{limit} +records: + record_play: $2%Joueur $2started playing record $1%name + notify_enter: $2%Joueur $2entré dans votre plot ($1%plot$2) + notify_leave: $2%Joueur $2quitté votre plot ($1%plot$2) +swap: + swap_overlap: $2Les zones proposées ne peuvent pas se chevaucher + swap_dimensions: $2Les zones proposées doivent avoir des dimensions comparables + swap_syntax: $2/plot swap + swap_success: $4Parcelles échangées avec succès + started_swap: '$2La tâche d''échange de parcelle est commencé. Vous serez averti quand elle sera terminée' +comment: + inbox_notification: '%s messages non lus. Utilisez /plot inbox' + not_valid_inbox_index: '$2Aucun commentaire à l''index %s' + inbox_item: $2 - $4%s + comment_syntax: $2Utilisez /plot comment [X;Z] <%s> + invalid_inbox: '$2Ce n''est pas une boîte de réception valide.&-$1Valeurs acceptées: %s' + no_perm_inbox: '$2Vous n''avez pas la permission pour cette boîte de réception' + no_perm_inbox_modify: '$2Vous n''êtes pas autorisé à modifier cette boîte de réception' + no_plot_inbox: $2Vous devez être présent ou fournir un argument de plot + comment_removed: $4Commentaire supprimé avec succès/s:n$2 - '$3%s$2' + comment_added: $4Un commentaire a été laissé + comment_header: $2&m---------&r $1Commentaires $2&m---------&r + inbox_empty: $2Sans commentaires +console: + not_console: $2Pour des raisons de sécurité, cette commande ne peut être exécutée que par la console. + is_console: $2Cette commande ne peut être exécutée que par un joueur. +inventory: + inventory_usage: '&cUsage: &6{usage}' + inventory_desc: '&cDescription: &6{desc}' + inventory_category: '&cCatégorie: &6{category}' +clipboard: + clipboard_set: $2Le plot actuel est maintenant copié dans votre presse-papiers, utilisez $1/plot paste$2 pour le coller + pasted: $4La sélection de plot a été collée avec succès. Il a été effacé de votre presse-papiers. + paste_failed: '$2Impossible de coller la sélection. Raison: $2%s' + no_clipboard: '$2Vous n''avez pas de choix dans votre presse-papiers' + clipboard_info: '$2Sélection actuelle - Plot ID: $1%id$2, Largeur: $1%width$2, nombre total de blocs: $1%total$2' +toggle: + toggle_enabled: '$2Paramètre activé: %s' + toggle_disabled: '$2Paramètre désactivé: %s' +blocked command: + command_blocked: '$2Cette commande n''est pas autorisée dans ce plot' +done: + done_already_done: $2Ce plot est déjà marquée comme étant terminée + done_not_done: '$2Ce plot n''est pas marquée comme étant terminée.' + done_insufficient_complexity: '$2Ce complot est trop simple. S''il vous plaît ajouter plus de détails avant d''utiliser cette commande.' + done_success: $1Marqué avec succès ce plot comme étant terminée. + done_removed: $1Vous pouvez maintenant continuer à construire dans ce plot. +ratings: + ratings_purged: $2Notes purgées pour ce plot + rating_not_valid: $2Vous devez spécifier un nombre entre 1 et 10 + rating_already_exists: $2Vous avez déjà évalué ce plot $2%s + rating_applied: $4Vous avez évalué ce plot avec succès $2%s + rating_not_your_own: $2Vous ne pouvez pas évaluer votre propre plot + rating_not_done: $2Vous ne pouvez évaluer que les parcelles finies. + rating_not_owned: '$2Vous ne pouvez pas évaluer un terrain qui n''est revendiqué par personne' +tutorial: + rate_this: $2Noter ce plot! + comment_this: '$2Laisser des commentaires sur ce plot: %s' +economy: + econ_disabled: '$2L''économie n''est pas activée' + cannot_afford_plot: '$2Vous ne pouvez pas vous permettre d''acheter ce plot. Il coute $1%s' + not_for_sale: '$2Ce plot n''est pas à vendre' + cannot_buy_own: $2Vous ne pouvez pas acheter votre propre plot + plot_sold: $4Votre plot; $1%s0$4, a été vendu à $1%s1$4 pour $1$%s2 + cannot_afford_merge: $2Vous ne pouvez pas vous permettre de fusionner ces plots. Il coute $1%s + added_balance: $1%s $2a été ajouté à votre solde + removed_balance: $1%s $2a été pris sur votre solde + removed_granted_plot: '$2Vous avez utilisé %s plot grant(s), il vous $2reste $1%s' +setup: + setup_init: '$1Usage: $2/plot setup ' + setup_step: '$3[$1Step %s0$3] $1%s1 $2- $1Attendant: $2%s2 $1Défaut: $2%s3' + setup_invalid_arg: '$2%s0 n''est pas un argument valable pour l''étape %s1. Pour annuler la configuration, utilisez: $1/plot setup cancel' + setup_valid_arg: $2valeur $1%s0 $2mis à %s1 + setup_finished: '$4Vous auriez dû être téléporté dans le monde créé. Sinon, vous devrez configurer le générateur manuellement à l''aide du fichier bukkit.yml ou du plug-in de gestion de monde votre choix.' + setup_world_taken: $2%s est déjà un monde + setup_missing_world: $2Vous devez spécifier un nom de monde ($1/plot setup &l$1 + $2)&-$1Commandes supplémentaires:&-$2 - $1/plot setup &-$2 - $1/plot + setup back&-$2 - $1/plot setup cancel + setup_missing_generator: $2Vous devez spécifier un générateur ($1/plot setup $l&r$2)&-$1Commandes supplémentaires:&-$2 - $1/plot setup &-$2 - $1/plot + setup back&-$2 - $1/plot setup cancel + setup_invalid_generator: '$2Générateur invalide. Options possibles: %s' +schematics: + schematic_too_large: $2Ce plot est trop grand pour cette action! + schematic_missing_arg: '$2Vous devez spécifier un argument. Valeurs possibles: $1test $2 , $1save$2 , $1paste $2, $1exportall' + schematic_invalid: '$2Ce n''est pas un schématic valide. Raison: $2%s' + schematic_valid: '$2C''est un schématic valide' + schematic_paste_failed: $2Impossible de coller le schématic + schematic_paste_success: $4Le schématic a été collé avec succès +titles: + title_entered_plot: '$1Plot: %world%;%x%;%z%' + title_entered_plot_sub: $4Propriété de %s + prefix_greeting: '$1%id%$2> ' + prefix_farewell: '$1%id%$2> ' +core: + task_start: Début de tâche... + prefix: $3[$1P2$3] $2 + enabled: $1%s0 est maintenant activé +reload: + reloaded_configs: $1Les traductions et les paramètres du monde ont été rechargés + reload_failed: $2Impossible de recharger les configurations de fichier +desc: + desc_set: $2Description des configurations du plot + desc_unset: $2Description du plot non défini + missing_desc: $2Vous devez spécifier une description +alias: + alias_set_to: $2Alias du plot défini sur $1%alias% + alias_removed: $2Alias du plot a été retiré + missing_alias: $2Vous devez spécifier un alias + alias_too_long: '$2L''alias doit être < 50 caractères de long' + alias_is_taken: $2Cet alias est déjà pris +position: + missing_position: '$2Vous devez spécifier une position. Valeurs possibles: $1none' + position_set: $1Home définie sur votre position actuelle + position_unset: '$1Home, position réinitialisée à l''emplacement par défaut' + home_argument: $2Utilisez /plot set home [none] + invalid_position: '$2Ce n''est pas une valeur de position valide' +cap: + entity_cap: '$2Vous n''êtes pas autorisé à générer plus de créatures' +time: + time_format: $1%hours%, %min%, %sec% +permission: + no_schematic_permission: '$2Vous ne disposez pas de l''autorisation nécessaire pour utiliser le schématic $1%s' + no_permission: '$2Il vous manque la permission: $1%s' + no_permission_event: '$2Il vous manque la permission: $1%s' + no_plot_perms: $2Vous devez être le propriétaire du plot pour effectuer cette action. + cant_claim_more_plots: $2Vous ne pouvez pas réclamer plus de plot. + cant_claim_more_clusters: $2Vous ne pouvez pas réclamer plus de clusters. + cant_transfer_more_plots: $2Vous ne pouvez pas envoyer plus de plot à cet utilisateur + cant_claim_more_plots_num: $2Vous ne pouvez pas réclamer plus que $1%s $2plots à la fois + you_be_denied: '$2Vous n''êtes pas autorisé à entrer dans ce plot' + merge_request_confirm: Demande de fusionnement de la part de %s +merge: + merge_not_valid: '$2Cette demande de fusion n''est plus valide.' + merge_accepted: $2La demande de fusion a été acceptée. + success_merge: $2Les plots ont été fusionnés! + merge_requested: $2Envoyé avec succès une demande de fusion + no_perm_merge: '$2Vous n''êtes pas propriétaire du plot: $1%plot%' + no_available_automerge: '$2Vous ne possédez aucun plot adjacent dans la direction spécifiée ou vous n''êtes pas autorisé à fusionner à la taille requise.' + unlink_required: $2Une dissociation est nécessaire pour faire ceci. + unlink_impossible: $2Vous pouvez seulement dissocier un méga-plot + unlink_success: $2Plot dissocié avec succès. +commandconfig: + not_valid_subcommand: '$2Ce n''est pas une sous-commande valide' + did_you_mean: '$2Vouliez-vous dire: $1%s' + name_little: $2%s0 Le nom est trop court, $1%s1$2<$1%s3 + no_commands: '$2Je suis désolé, mais vous n''êtes autorisé à utiliser aucune sous-commande.' + subcommand_set_options_header: '$2Valeurs possibles: ' + command_syntax: '$1Usage: $2%s' + flag_tutorial_usage: '$1Avoir un administrateur pour mettre le flag: $2%s' +errors: + invalid_player_wait: '$2Joueur non trouvé: $1%s$2, Réessayez bientôt.' + invalid_player: '$2Joueur non trouvé: $1%s$2.' + invalid_player_offline: '$2Le joueur doit être en ligne: $1%s.' + invalid_command_flag: '$2Commande de flag invalide: %s0' + error: '$2Une erreur est survenue: %s' + command_went_wrong: '$2Quelque chose s''est mal passé lors de l''exécution de cette commande...' + no_free_plots: '$2Il n''y a plus de plots gratuits disponibles' + not_in_plot: '$2Vous n''êtes pas dans un plot' + not_loaded: '$2Le plot n''a pas pu être chargée' + not_in_cluster: $2Vous devez être dans un cluster de plot pour effectuer cette action. + not_in_plot_world: '$2Vous n''êtes pas dans un plot' + plotworld_incompatible: $2Les deux mondes doivent être compatibles + not_valid_world: '$2Ce n''est pas un monde valide (sensible aux majuscules et minuscules)' + not_valid_plot_world: '$2Ce n''est pas un plot valide (sensible aux majuscules et minuscules)' + no_plots: '$2Vous n''avez pas de plots' + wait_for_timer: $2Un minuteur est lié au plot actuel ou à vous. Merci d'attendre la fin +paste: + debug_report_created: '$1Téléchargé un débogage complet vers: $1%url%' +purge: + purge_success: $4Purgé avec succès %s plots +trim: + trim_in_progress: Une tâche de trim du monde est déjà en cours! + not_valid_hybrid_plot_world: Le gestionnaire de plot hybride est requis pour effectuer cette action. +block list: + block_list_separater: '$1,$2 ' +biome: + need_biome: $2Vous devez spécifier un biome valide. + biome_set_to: $2Biome du plot mis à $2 +teleport: + teleported_to_plot: $1Vous avez été téléporté + teleported_to_road: $2Vous avez été téléporté sur la route + teleport_in_seconds: $1Téléportation dans %s secondes. Ne bougez pas... + teleport_failed: $2Téléportation annulée pour cause de mouvement ou de dommage +set block: + set_block_action_finished: $1La dernière action setblock est maintenant terminée. +unsafe: + debugallowunsafe_on: $2Actions dangereuses autorisées + debugallowunsafe_off: $2Actions dangereuses désactivées +debug: + debug_header: $1Informations de débogage&- + debug_section: $2>> $1&l%val% + debug_line: $2>> $1%var%$2:$1 %val%&- +invalid: + not_valid_data: '$2Ce n''est pas un identifiant de données valide.' + not_valid_block: '$2Ce n''est pas un bloc valide: %s' + not_allowed_block: '$2Ce bloc n''est pas autorisé: %s' + not_valid_number: '$2Ce n''est pas un nombre valide: %s' + not_valid_plot_id: $2Ce n''est pas un identifiant de plot valide. + plot_id_form: '$2L''identifiant de plot doit être sous la forme: $1X;Y $2e.g. $1-5;7' + not_your_plot: '$2Ce n''est pas votre plot.' + no_such_plot: '$2Il n''y a pas un tel plot' + player_has_not_been_on: '$2Ce joueur n''a pas été dans ce monde de plot' + found_no_plots: '$2Nous n''avons trouvé aucun plot avec votre requête de recherche' + found_no_plots_for_player: '$2Aucun plot trouvé pour le joueur: %s' +camera: + camera_started: $2Vous êtes entré en mode caméra pour le plot $1%s + camera_stopped: '$2Vous n''êtes plus en mode caméra' +need: + need_plot_number: $2Vous devez spécifier un numéro de plot ou un alias + need_block: $2Vous devez spécifier un bloc + need_plot_id: $2Vous devez spécifier un identifiant de plot. + need_plot_world: $2Vous devez spécifier une zone ou plot. + need_user: '$2Vous devez spécifier un nom d''utilisateur' +near: + plot_near: '$1Joueurs: %s0' +info: + none: Aucun + now: À présent + never: Jamais + unknown: Inconnu + everyone: Toutes les personnes + plot_unowned: $2Le plot actuel doit avoir un propriétaire pour effectuer cette action + plot_info_unclaimed: '$2Plot $1%s$2 n''est pas encore réclamé' + plot_info_header: $3&m---------&r $1INFO $3&m--------- + plot_info: '$1ID: $2%id%$1&-$1Alias: $2%alias%$1&-$1Propriétaire: $2%owner%$1&-$1Biome: + $2%biome%$1&-$1Can Construit: $2%build%$1&-$1Évaluation: $2%rating%&-$1Vu: $2%seen%&-$1De confiance: + $2%trusted%$1&-$1Membres: $2%members%$1&-$1Refusé: $2%denied%$1&-$1Flags: $2%flags%' + plot_info_footer: $3&m---------&r $1INFO $3&m--------- + plot_info_trusted: $1De confiance:$2 %trusted% + plot_info_members: $1Membres:$2 %members% + plot_info_denied: $1Refusé:$2 %denied% + plot_info_flags: $1Flags:$2 %flags% + plot_info_biome: $1Biome:$2 %biome% + plot_info_rating: $1Évaluation:$2 %rating% + plot_info_owner: $1Propriétaire:$2 %owner% + plot_info_id: $1ID:$2 %id% + plot_info_alias: $1Alias:$2 %alias% + plot_info_size: $1Taille:$2 %size% + plot_info_seen: $1Vu:$2 %seen% + plot_user_list: ' $1%user%$2,' + plot_flag_list: $1%s0:%s1$2 + info_syntax_console: $2/plot info X;Y +working: + generating_component: $1Début de génération des composants à partir de vos paramètres + clearing_plot: $2Effacement des items du plot. + clearing_done: $4Effacer terminé! Cela a pris %sms. + deleting_done: $4Supprimer terminé! Cela a pris %sms. + plot_not_claimed: $2Plot non réclamé + plot_is_claimed: $2Ce plot a déja été réclamé + claimed: $4Vous avez réclamé avec succès ce plot +list: + comment_list_header_paged: $2(Page $1%cur$2/$1%max$2) $1Liste de %amount% commentaires + clickable: ' (interactive)' + area_list_header_paged: $2(Page $1%cur$2/$1%max$2) $1Liste de %amount% zones + plot_list_header_paged: $2(Page $1%cur$2/$1%max$2) $1Liste de %amount% plots + plot_list_header: $1Liste de %word% plots + plot_list_item: $2>> $1%id$2:$1%world $2- $1%owner + plot_list_item_ordered: $2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner + plot_list_footer: $2>> $1%word% un total de $2%num% %plot% $1réclamé. +left: + left_plot: $2Tu as quitté le plot +chat: + plot_chat_spy_format: '$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%' + plot_chat_format: '$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%' + plot_chat_forced: $2Ce monde oblige tout le monde à utiliser le chat de plot. + plot_chat_on: $4Chat du plot activé. + plot_chat_off: $4Chat du plot désactivé. +deny: + denied_removed: $4Vous avez réussi à retirer ce joueur de la liste des joueurs interdits + denied_added: $4Vous avez réussi à ajouter ce joueur à la liste des joueurs interdits + denied_need_argument: $2Arguments manquants. $1/plot denied add $2or $1/plot + denied remove + was_not_denied: '$2Ce joueur n''est pas interdit sur ce plot' + you_got_denied: $4Le plot sur lequel vous étiez précédemmment vous a été refusé et vous avez été téléporté au spawn +kick: + you_got_kicked: $4Vous avez été expulsé! +rain: + need_on_off: '$2Vous devez spécifier une valeur. Valeurs possibles: $1on$2, $1off' + setting_updated: $4Vous avez mis à jour les paramètres avec succès +flag: + flag_key: '$2Key: %s' + flag_type: '$2Type: %s' + flag_desc: '$2Desc: %s' + not_valid_flag: '$2Ceci n''est pas un flag valide' + not_valid_flag_suggested: '$2Ce n''est pas un flag valide. Vouliez-vous dire: $1%s' + not_valid_value: $2Les valeurs du flag doivent être alphanumériques + flag_not_in_plot: '$2Ce plot n''a pas ce flag' + flag_not_removed: $2Ce flag ne peut pas etre retiré + flag_not_added: $2Ce flag ne peut pas etre ajouté + flag_removed: $4Flag retiré avec succès + flag_added: $4Flag ajouté avec succès +trusted: + trusted_added: $4Vous avez réussi à ajouter ce joueur à la liste des joueurs fiables pour ce plot + trusted_removed: $4Vous avez réussi à retirer ce joueur de la liste des joueurs fiables pour ce plot + was_not_added: $2Ce joueur fait partie de la liste des joueurs non-fiables + plot_removed_user: 'Le $1Plot %s dont vous avez été ajouté a été supprimé en raison de l''inactivité du propriétaire' +member: + removed_players: $2Suppression du joueur %s de ce plot. + already_owner: '$2Cet utilisateur est déjà propriétaire de ce plot: %s0' + already_added: '$2Cet utilisateur est déjà ajouté à cette catégorie: %s0' + member_added: $4Cet utilisateur peut maintenant construire pendant que le propriétaire du plot est en ligne + member_removed: $1Vous avez supprimé avec succès un utilisateur du plot + member_was_not_added: '$2Ce joueur n''a pas été ajouté en tant qu''utilisateur sur ce plot' + plot_max_members: '$2Vous n''êtes pas autorisé à ajouter d''autres joueurs à ce plot' +owner: + set_owner: $4You successfully set the plot owner + set_owner_cancelled: $2The setowner action was cancelled + now_owner: $4You are now owner of plot %s +signs: + owner_sign_line_1: '$1ID: $1%id%' + owner_sign_line_2: '$1Owner:' + owner_sign_line_3: $2%plr% + owner_sign_line_4: $3Claimed +help: + help_header: $3&m---------&r $1Plot² Help $3&m--------- + help_page_header: '$1Category: $2%category%$2,$1 Page: $2%current%$3/$2%max%$2' + help_footer: $3&m---------&r $1Plot² Help $3&m--------- + help_info_item: $1/plot help %category% $3- $2%category_desc% + help_item: $1%usage% [%alias%]&- $3- $2%desc%&- + direction: '$1Current direction: %dir%' +grants: + granted_plots: '$1Résultat: $2%s $1Ajout retiré' + granted_plot: $1Vous avez été ajouté %s0 au plot $2%s1 + granted_plot_failed: '$1L''ajout a échoué: $2%s' +'-': + custom_string: '-' \ No newline at end of file diff --git a/README.md b/README.md index 5d0cdf7d6..00fc1dc34 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,67 @@ -

- -

- ---- - -For the end user, PlotSquared is packed with a tonne of cool features. -It allows you to merge plots, and build together with your friends. -You can also change a lot of plot specific settings in the form of -flags. Such as: weather, time, game modes, pvp status. - -Whilst we provide a whole load of unique features, the biggest focus -is to provide a lag-free and smooth experience. - -## Links - -* [Download](https://github.com/IntellectualSites/PlotSquared/releases/tag/dev) -* [Jenkins](https://ci.athion.net/job/PlotSquared/) -* [Spigot Page](https://www.spigotmc.org/resources/plotsquared.1177/) -* [Discord](https://discord.gg/a6NZPV2) -* [WebChat/IRC]: #IntellectualCrafters on irc.esper.net -* [Discord](https://discord.gg/ngZCzbU) -* [Wiki](https://github.com/intellectualcrafters/plotsquared/wiki) - -### Developer Resources -* [JavaDocs] Link Temporarily Unavailable -* [[Git Mirror](https://incendo.org/git/sauilitired/PlotSquared/)] -* [[Build Server](http://ci.athion.net/job/PlotSquared/)] [[Alternative](https://incendo.org/ci/job/PlotSquared/)] -* [[Maven Repo](http://ci.athion.net/job/PlotSquared/ws/mvn/)] [[Alternative](https://incendo.org/ci/job/PlotSquared/ws/mvn/)] - -# Building -Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module. -If you prefer to use maven, a `pom.xml` file is provided for working with the Bukkit part of the plugin. - -# Contributing -If you feel like you can improve the plugin any way, then you are -more than welcome to contribute to PlotSquared. It would be highly -appreciated if you made sure to test your code before committing it, -as it will save us a lot of time and effort. - -### Code Style - -If you are planning to commit any changes to the project, -it would be highly appreciated if you were to follow the -project code style conventions. To make this easier we have -provided settings that can be imported into your IDE. - -**Eclipse:** -`Window > Preferences > Java > Code Style > Formatter` -Press `Import` and select `...path/to/project/code_style.xml` - -**IntelliJ:** -`File > Settings > Editor > Code Style`. Next to "Scheme" there is a cog wheel, press that and then -`Import Scheme > IntelliJ IDEA Code Style XML` and then select `..path/to/project/code_style.xml` - -## Suggestions -Suggestions are welcome! We have a separate issue tracker for suggestions, that can be found in [this](https://github.com/IntellectualSites/PlotSquaredSuggestions) repository. - -# Official Addons -* [Plot2Dynmap](http://www.spigotmc.org/resources/plot2dynmap.1292/) -* [AdvPlots](http://www.spigotmc.org/resources/advplots-%CE%B2.1500/) -* [PlotRankup](http://www.spigotmc.org/resources/plotrankup.1571/) -* [PlotZSux](https://www.spigotmc.org/resources/plotzsux.9563/) -* [IslandPlots](https://www.spigotmc.org/resources/islandplots.9421/) -* [BiomeGenerator](https://www.spigotmc.org/resources/biomegenerator.1663/) -* [PlotSquaredMG](https://www.spigotmc.org/resources/plotsquaredmg.8025/) -* [BasicPlots](https://www.spigotmc.org/resources/basicplots.6901/) -* [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/) - -[WebChat/IRC]: https://webchat.esper.net/?nick=&channels=IntellectualCrafters +

+ +

+ +--- + +For the end user, PlotSquared is packed with a tonne of cool features. +It allows you to merge plots, and build together with your friends. +You can also change a lot of plot specific settings in the form of +flags. Such as: weather, time, game modes, pvp status. + +Whilst we provide a whole load of unique features, the biggest focus +is to provide a lag-free and smooth experience. + +## Links + +* [Download](https://github.com/IntellectualSites/PlotSquared/releases/tag/dev) +* [Jenkins](https://ci.athion.net/job/PlotSquared/) +* [Spigot Page](https://www.spigotmc.org/resources/plotsquared.1177/) +* [Discord](https://discord.gg/ngZCzbU) +* [Wiki](https://github.com/intellectualcrafters/plotsquared/wiki) + +### Developer Resources +* [JavaDocs](http://empcraft.com/plotsquared/doc/) +* [[Git Mirror](https://incendo.org/git/sauilitired/PlotSquared/)] +* [[Build Server](http://ci.athion.net/job/PlotSquared/)] [[Alternative](https://incendo.org/ci/job/PlotSquared/)] +* [[Maven Repo](http://ci.athion.net/job/PlotSquared/ws/mvn/)] [[Alternative](https://incendo.org/ci/job/PlotSquared/ws/mvn/)] +* [API Documentation](https://github.com/IntellectualSites/PlotSquared/wiki/Developer-documentation-(WIP)) + +# Building +Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module. +If you prefer to use maven, a `pom.xml` file is provided for working with the Bukkit part of the plugin. + +# Contributing +If you feel like you can improve the plugin any way, then you are +more than welcome to contribute to PlotSquared. It would be highly +appreciated if you made sure to test your code before committing it, +as it will save us a lot of time and effort. + +### Code Style + +If you are planning to commit any changes to the project, +it would be highly appreciated if you were to follow the +project code style conventions. To make this easier we have +provided settings that can be imported into your IDE. + +**Eclipse:** +`Window > Preferences > Java > Code Style > Formatter` +Press `Import` and select `...path/to/project/code_style.xml` + +**IntelliJ:** +`File > Settings > Editor > Code Style`. Next to "Scheme" there is a cog wheel, press that and then +`Import Scheme > IntelliJ IDEA Code Style XML` and then select `..path/to/project/code_style.xml` + +## Suggestions +Suggestions are welcome! We have a separate issue tracker for suggestions, that can be found in [this](https://github.com/IntellectualSites/PlotSquaredSuggestions) repository. + +# Official Addons +* [Plot2Dynmap](http://www.spigotmc.org/resources/plot2dynmap.1292/) +* [AdvPlots](http://www.spigotmc.org/resources/advplots-%CE%B2.1500/) +* [PlotRankup](http://www.spigotmc.org/resources/plotrankup.1571/) +* [PlotZSux](https://www.spigotmc.org/resources/plotzsux.9563/) +* [IslandPlots](https://www.spigotmc.org/resources/islandplots.9421/) +* [BiomeGenerator](https://www.spigotmc.org/resources/biomegenerator.1663/) +* [PlotSquaredMG](https://www.spigotmc.org/resources/plotsquaredmg.8025/) +* [BasicPlots](https://www.spigotmc.org/resources/basicplots.6901/) +* [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/) \ No newline at end of file diff --git a/build.gradle b/build.gradle index 03fa6d0eb..4d4a3a3bc 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ buildscript { } plugins { + id 'maven-publish' id 'io.franzbecker.gradle-lombok' version '1.14' }