From b19585c7c8846d4085329c7c13300a145577c6a2 Mon Sep 17 00:00:00 2001 From: add5tar Date: Sun, 13 Jul 2025 20:18:07 +1000 Subject: [PATCH] Update to Paper 1.21.7 and fix bugs --- README.md | 4 +-- pom.xml | 12 +++---- .../au/com/mineauz/buildtools/BTPlayer.java | 34 ++++++++----------- .../au/com/mineauz/buildtools/BTPlugin.java | 2 +- .../au/com/mineauz/buildtools/Events.java | 4 +-- .../au/com/mineauz/buildtools/Generator.java | 2 +- .../au/com/mineauz/buildtools/PlayerData.java | 16 ++++----- src/main/resources/config.yml | 4 +-- src/main/resources/plugin.yml | 6 ++-- 9 files changed, 39 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 710ed38..a14fd67 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,5 @@ BuildTools is based around simple block breaking and placing as opposed to a sel commands.

-Compiling currently requires the latest Bukkit, WorldGuard, GriefPrevention and PlotMe. The plugins -are required for stopping players from building in protected areas using this plugin.

\ No newline at end of file +Compiling currently requires the latest Paper API, WorldGuard, GriefPrevention and PlotMe. The plugins +are required for stopping players from building in protected areas using this plugin.

diff --git a/pom.xml b/pom.xml index 5517dc7..5e902c8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,15 +3,15 @@ 4.0.0 au.com.mineauz BuildTools - 1.19.2-SNAPSHOT + 1.21.7-SNAPSHOT BuildTools ${project.version}-${build.number} au.com.mineauz.buildtools.BTPlugin UTF-8 - 1.19 - 1.19.2-R0.1-SNAPSHOT + 1.21 + 1.21.7-R0.1-SNAPSHOT @@ -96,9 +96,9 @@ - org.spigotmc - spigot-api - ${spigot.version} + io.papermc.paper + paper-api + ${paper.version} provided diff --git a/src/main/java/au/com/mineauz/buildtools/BTPlayer.java b/src/main/java/au/com/mineauz/buildtools/BTPlayer.java index 257a58f..a6f0f5b 100644 --- a/src/main/java/au/com/mineauz/buildtools/BTPlayer.java +++ b/src/main/java/au/com/mineauz/buildtools/BTPlayer.java @@ -266,16 +266,13 @@ public void setValue(String value) { } @Override - public String getValue() { - String set = null; - if(tSettings.length > 0) - set = ""; - for(String s : tSettings) - set += s + " "; - return set; - } - }; - } + public String getValue() { + if (tSettings.length == 0) + return null; + return String.join(" ", tSettings); + } + }; + } public void setTSettings(String[] settings){ tSettings = settings; @@ -297,16 +294,13 @@ public void setValue(String value) { } @Override - public String getValue() { - String set = null; - if(pSettings.length > 0) - set = ""; - for(String s : pSettings) - set += s + " "; - return set; - } - }; - } + public String getValue() { + if (pSettings.length == 0) + return null; + return String.join(" ", pSettings); + } + }; + } public void setPSettings(String[] settings){ pSettings = settings; diff --git a/src/main/java/au/com/mineauz/buildtools/BTPlugin.java b/src/main/java/au/com/mineauz/buildtools/BTPlugin.java index e537a8b..11f21a0 100644 --- a/src/main/java/au/com/mineauz/buildtools/BTPlugin.java +++ b/src/main/java/au/com/mineauz/buildtools/BTPlugin.java @@ -102,7 +102,7 @@ public void onDisable(){ HandlerList.unregisterAll(this); - getLogger().info(" successfully disabled!"); + getLogger().info("Successfully disabled!"); } public PlayerData getPlayerData(){ diff --git a/src/main/java/au/com/mineauz/buildtools/Events.java b/src/main/java/au/com/mineauz/buildtools/Events.java index 48a0aba..9a1fab6 100644 --- a/src/main/java/au/com/mineauz/buildtools/Events.java +++ b/src/main/java/au/com/mineauz/buildtools/Events.java @@ -65,7 +65,7 @@ else if(!pl.canBuild() && pl.hasPoint(event.getBlock().getLocation())){ if(!pdata.getPlayerBlockLimits(pl).contains(event.getBlockPlaced().getType()) || pl.hasPermission("buildtools.bypassdisabledblocks")){ - Integer[] hl = pdata.getPlayerHightLimits(pl); + Integer[] hl = pdata.getPlayerHeightLimits(pl); if((event.getBlock().getLocation().getBlockY() <= hl[1] && event.getBlock().getLocation().getBlockY() >= hl[0]) || pl.hasPermission("buildtools.bypassheightlimit")){ @@ -149,7 +149,7 @@ else if(!pl.canBuild() && pl.hasPoint(event.getBlock().getLocation())){ if(!pdata.getPlayerBlockLimits(pl).contains(Material.AIR) || pl.hasPermission("buildtools.bypassdisabledblocks")){ - Integer[] hl = pdata.getPlayerHightLimits(pl); + Integer[] hl = pdata.getPlayerHeightLimits(pl); if((event.getBlock().getLocation().getBlockY() <= hl[1] && event.getBlock().getLocation().getBlockY() >= hl[0]) || pl.hasPermission("buildtools.bypassheightlimit")){ diff --git a/src/main/java/au/com/mineauz/buildtools/Generator.java b/src/main/java/au/com/mineauz/buildtools/Generator.java index 31f85bd..b2b0893 100644 --- a/src/main/java/au/com/mineauz/buildtools/Generator.java +++ b/src/main/java/au/com/mineauz/buildtools/Generator.java @@ -121,7 +121,7 @@ else if(copy != null){ } if(copy.isReplacing() || state.getBlock().getState().getType() == Material.AIR){ - Integer[] lim = BTPlugin.plugin.getPlayerData().getPlayerHightLimits(player); + Integer[] lim = BTPlugin.plugin.getPlayerData().getPlayerHeightLimits(player); if(state.getLocation().getBlockY() >= lim[0] && state.getLocation().getY() <= lim[1]){ BTUtils.placeBlock(player, state.getLocation(), state.getBlockData(), BuildMode.OVERWRITE, undo); } diff --git a/src/main/java/au/com/mineauz/buildtools/PlayerData.java b/src/main/java/au/com/mineauz/buildtools/PlayerData.java index b7f511e..38602f0 100644 --- a/src/main/java/au/com/mineauz/buildtools/PlayerData.java +++ b/src/main/java/au/com/mineauz/buildtools/PlayerData.java @@ -137,14 +137,14 @@ public void saveHeightLimits(){ plugin.saveConfig(); } - public Integer[] getPlayerHightLimits(BTPlayer player){ - for(String l : heightLimits.keySet()){ - if(player.hasPermission("buildtools.heightlimit." + l)){ - return heightLimits.get(l); - } - } - return getHeightLimits("default"); - } + public Integer[] getPlayerHeightLimits(BTPlayer player){ + for(String l : heightLimits.keySet()){ + if(player.hasPermission("buildtools.heightlimit." + l)){ + return heightLimits.get(l); + } + } + return getHeightLimits("default"); + } public void addVolumeLimit(String name, int limit) throws DuplicateLimitException{ name = name.toLowerCase(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 35b6911..ed92a0c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -7,7 +7,7 @@ maxVolume: # Height limits for players to use BuildTools, Min 0, Max 255. # More groups can be added to allow certain players to build higher/lower. # First item on list is minimum height, second is maximum. -# Permission for added groups: buildtools.hightlimit. +# Permission for added groups: buildtools.heightlimit. heightLimits: default: - -63 @@ -179,4 +179,4 @@ disabledBlocks: # (Bigger number = faster block generation but more lag, # smaller number = slower block gereation but less lag) # 10 milliseconds default. -generatorMaxDelay: 10 \ No newline at end of file +generatorMaxDelay: 10 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index eca6a9f..f6b6d6e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: ${project.name} main: ${mainClass} version: ${plugin.version} -api-version: ${spigot.api.version} +api-version: ${paper.api.version} author: _Razz_ softdepend: [GriefPrevention, WorldGuard, PlotMe] @@ -10,7 +10,7 @@ commands: description: The BuildTools base command. usage: Invalid command. Type "/buildtools help" for help permission: buildtools.command - permisison-message: You don't have permission to use this command + permission-message: You don't have permission to use this command aliases: [bt, btm] permissions: @@ -134,4 +134,4 @@ permissions: buildtools.pattern.random: default: true buildtools.pattern.wall: - default: true \ No newline at end of file + default: true