From b42553116c692460712b1fa470ded9813dc2d6c6 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 5 Jun 2019 21:17:34 -0400 Subject: [PATCH] Removal of many prefixes and deprecation of FaweLocation - Removed some prefixes to help make upstream merging a bit easier. - Replaced reflection code for titles with the regular bukkit api. - Removed FAWELocation and FAWEPlayer where it wasn't needed. - Deprecated FaweLocation since having it in the first place is very stupid. - FAWEPlayer should also be deprecated soon because the majority of that code is redundant. --- .../boydti/fawe/bukkit/favs/PatternUtil.java | 2 +- .../com/boydti/fawe/bukkit/BukkitPlayer.java | 14 +- .../main/java/com/boydti/fawe/FaweAPI.java | 2 +- .../com/boydti/fawe/command/Rollback.java | 8 +- .../jnbt/anvil/HeightMapMCAGenerator.java | 10 +- .../com/boydti/fawe/object/FaweLocation.java | 45 ++- .../com/boydti/fawe/object/FawePlayer.java | 12 +- .../com/boydti/fawe/object/FaweQueue.java | 5 +- .../object/schematic/visualizer/SchemVis.java | 18 +- .../java/com/boydti/fawe/util/WEManager.java | 11 +- .../com/boydti/fawe/wrappers/FakePlayer.java | 313 ------------------ .../java/com/sk89q/worldedit/WorldEdit.java | 18 +- .../worldedit/command/BiomeCommands.java | 2 +- .../worldedit/command/ChunkCommands.java | 20 +- .../sk89q/worldedit/command/HelpBuilder.java | 6 +- .../worldedit/command/OptionsCommands.java | 34 +- .../worldedit/command/RegionCommands.java | 36 +- .../worldedit/command/SelectionCommands.java | 62 ++-- .../worldedit/command/tool/AreaPickaxe.java | 5 +- .../extension/platform/CommandManager.java | 42 +-- .../sk89q/worldedit/math/BlockVector3.java | 3 +- 21 files changed, 161 insertions(+), 507 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/boydti/fawe/wrappers/FakePlayer.java diff --git a/favs/src/main/java/com/boydti/fawe/bukkit/favs/PatternUtil.java b/favs/src/main/java/com/boydti/fawe/bukkit/favs/PatternUtil.java index 81d4e6f9f..465fd64e7 100644 --- a/favs/src/main/java/com/boydti/fawe/bukkit/favs/PatternUtil.java +++ b/favs/src/main/java/com/boydti/fawe/bukkit/favs/PatternUtil.java @@ -23,7 +23,7 @@ public class PatternUtil { snipeData.sendMessage(ChatColor.GOLD + "Voxel: " + ChatColor.RED + arg); return pattern; } catch (InputParseException e) { - fp.sendMessage(BBC.getPrefix() + e.getMessage()); + fp.sendMessage(e.getMessage()); return null; } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java index 25eea21b9..7f97d3a52 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java @@ -66,21 +66,11 @@ public class BukkitPlayer extends FawePlayer { @Override public void resetTitle() { - sendTitle("",""); + parent.resetTitle(); } public void sendTitle(String title, String sub) { - try { - Method methodSendTitle = Player.class.getDeclaredMethod("sendTitle", String.class, String.class, int.class, int.class, int.class); - methodSendTitle.invoke(parent, ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20); - return; - } catch (Throwable ignore) { - try { - Method methodSendTitle = Player.class.getDeclaredMethod("sendTitle", String.class, String.class); - methodSendTitle.invoke(parent, ChatColor.GOLD + title, ChatColor.GOLD + sub); - return; - } catch (Throwable ignore2) {} - } + parent.sendTitle(ChatColor.GOLD + title, ChatColor.GOLD + sub, 0, 70, 20); if (console == null) { console = Bukkit.getConsoleSender(); Bukkit.getServer().dispatchCommand(console, "gamerule sendCommandFeedback false"); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java index a6b0275a1..6690bbdf6 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java @@ -373,7 +373,7 @@ public class FaweAPI { long value = aI - bI; return value == 0 ? 0 : value < 0 ? -1 : 1; }); - RegionWrapper bounds = new RegionWrapper(origin.x - radius, origin.x + radius, origin.z - radius, origin.z + radius); + RegionWrapper bounds = new RegionWrapper(origin.getX() - radius, origin.getX() + radius, origin.getZ() - radius, origin.getZ() + radius); RegionWrapper boundsPlus = new RegionWrapper(bounds.minX - 64, bounds.maxX + 512, bounds.minZ - 64, bounds.maxZ + 512); HashSet regionSet = Sets.newHashSet(bounds); ArrayList result = new ArrayList<>(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java b/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java index e09eeaac1..601075786 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java @@ -67,9 +67,9 @@ public class Rollback extends FaweCommand { long total = 0; player.sendMessage("&d=| Username | Bounds | Distance | Changes | Age |="); for (DiskStorageHistory edit : edits) { - DiskStorageHistory.DiskStorageSummary summary = edit.summarize(new RegionWrapper(origin.x, origin.x, origin.z, origin.z), !player.hasPermission("fawe.rollback.deep")); + DiskStorageHistory.DiskStorageSummary summary = edit.summarize(new RegionWrapper(origin.getX(), origin.getX(), origin.getZ(), origin.getZ()), !player.hasPermission("fawe.rollback.deep")); RegionWrapper region = new RegionWrapper(summary.minX, summary.maxX, summary.minZ, summary.maxZ); - int distance = region.distance(origin.x, origin.z); + int distance = region.distance(origin.getX(), origin.getZ()); String name = Fawe.imp().getName(edit.getUUID()); long seconds = (System.currentTimeMillis() - edit.getBDFile().lastModified()) / 1000; total += edit.getBDFile().length(); @@ -101,7 +101,7 @@ public class Rollback extends FaweCommand { BBC.NO_PERM.send(player, "fawe.rollback.perform"); return false; } - final List edits = (List) player.getMeta(FawePlayer.METADATA_KEYS.ROLLBACK); + final List edits = player.getMeta(FawePlayer.METADATA_KEYS.ROLLBACK); player.deleteMeta(FawePlayer.METADATA_KEYS.ROLLBACK); if (edits == null) { BBC.COMMAND_SYNTAX.send(player, "/frb info u: r: t: