From 58f95149d58998ae830393d0228b4b934125bced Mon Sep 17 00:00:00 2001 From: Leander <47365075+Le4nderS@users.noreply.github.com> Date: Wed, 7 Aug 2024 23:01:52 +0200 Subject: [PATCH] Feature/paper plugin 1 21 (#23) * T+- java 21 test, using custom java 21 t-- dependency and paper-plugin.yml. * Java 21 in compiler/ --------- Co-authored-by: ELgamer --- pom.xml | 59 ++++++++--------- .../terraplusminus/Terraplusminus.java | 29 ++++++-- .../commands/OffsetCommand.java | 40 ++++++----- .../terraplusminus/commands/TpllCommand.java | 66 +++++++++---------- .../terraplusminus/commands/WhereCommand.java | 62 ++++++++--------- .../gen/RealWorldGenerator.java | 27 +++++--- src/main/resources/paper-plugin.yml | 9 +++ src/main/resources/plugin.yml | 22 ------- 8 files changed, 159 insertions(+), 155 deletions(-) create mode 100644 src/main/resources/paper-plugin.yml delete mode 100644 src/main/resources/plugin.yml diff --git a/pom.xml b/pom.xml index 5689ef4..246f90f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.btegermany terraplusminus - 1.3.3 + 1.4.0 jar Terraplusminus @@ -25,8 +25,8 @@ maven-compiler-plugin 3.8.1 - 14 - 14 + 21 + 21 @@ -55,13 +55,9 @@ - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - papermc - https://papermc.io/repo/repository/maven-public/ + https://repo.papermc.io/repository/maven-public/ sonatype @@ -87,25 +83,40 @@ - com.google.code.gson - gson - 2.8.9 + io.papermc.paper + paper-api + 1.21-R0.1-SNAPSHOT + provided - org.spigotmc - spigot-api - 1.18-R0.1-SNAPSHOT + io.papermc + paperlib + 1.0.7 + compile + + + + org.projectlombok + lombok + 1.18.32 provided + + - com.github.SmylerMC + com.google.code.gson + gson + 2.8.9 + + + com.github.BTEUK terraminusminus - feature~bukkit-5907790da3-1 + 22449a34bf com.google.guava guava - 31.0.1-jre + 33.2.1-jre org.apache.commons @@ -117,16 +128,10 @@ jackson-databind 2.15.2 - - - org.projectlombok - lombok - 1.18.22 - io.netty netty-buffer - 4.1.72.Final + 4.1.111.Final compile @@ -140,12 +145,6 @@ commons-io 2.11.0 - - io.papermc - paperlib - 1.0.7 - compile - net.daporkchop.lib common diff --git a/src/main/java/de/btegermany/terraplusminus/Terraplusminus.java b/src/main/java/de/btegermany/terraplusminus/Terraplusminus.java index 35ff84d..3de3100 100644 --- a/src/main/java/de/btegermany/terraplusminus/Terraplusminus.java +++ b/src/main/java/de/btegermany/terraplusminus/Terraplusminus.java @@ -1,6 +1,7 @@ package de.btegermany.terraplusminus; +import com.mojang.brigadier.Command; import de.btegermany.terraplusminus.commands.OffsetCommand; import de.btegermany.terraplusminus.commands.TpllCommand; import de.btegermany.terraplusminus.commands.WhereCommand; @@ -12,18 +13,26 @@ import de.btegermany.terraplusminus.utils.FileBuilder; import de.btegermany.terraplusminus.utils.LinkedWorld; import de.btegermany.terraplusminus.utils.PlayerHashMapManagement; +import io.papermc.paper.command.brigadier.Commands; +import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager; +import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; import net.buildtheearth.terraminusminus.TerraConfig; import org.bukkit.Bukkit; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.configuration.serialization.ConfigurationSerialization; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.generator.ChunkGenerator; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; import java.io.*; +import java.util.List; import java.util.logging.Level; public final class Terraplusminus extends JavaPlugin implements Listener { @@ -36,7 +45,7 @@ public void onEnable() { PluginDescriptionFile pdf = this.getDescription(); String pluginVersion = pdf.getVersion(); - Bukkit.getLogger().log(Level.INFO, "\n╭━━━━╮\n" + + getLogger().log(Level.INFO, "\n╭━━━━╮\n" + "┃╭╮╭╮┃\n" + "╰╯┃┃┣┻━┳━┳━┳━━╮╭╮\n" + "╱╱┃┃┃┃━┫╭┫╭┫╭╮┣╯╰┳━━╮\n" + @@ -44,7 +53,8 @@ public void onEnable() { "╱╱╰╯╰━━┻╯╰╯╰╯╰╯╰╯\n" + "Version: " + pluginVersion); - // Config ------------------ + // Config ------------------] + ConfigurationSerialization.registerClass(ConfigurationSerializable.class); this.saveDefaultConfig(); config = getConfig(); this.updateConfig(); @@ -81,11 +91,7 @@ public void onEnable() { TerraConfig.reducedConsoleMessages = Terraplusminus.config.getBoolean("reduced_console_messages"); // Disables console log of fetching data - // Registering commands - getCommand("tpll").setExecutor(new TpllCommand()); - getCommand("where").setExecutor(new WhereCommand()); - getCommand("offset").setExecutor(new OffsetCommand()); - // -------------------------- + registerCommands(); Bukkit.getLogger().log(Level.INFO, "[T+-] Terraplusminus successfully enabled"); } @@ -245,4 +251,13 @@ private void updateConfig() { } } + private void registerCommands() { + LifecycleEventManager manager = this.getLifecycleManager(); + manager.registerEventHandler(LifecycleEvents.COMMANDS, event -> { + final Commands commands = event.registrar(); + commands.register("tpll", "Teleports you to longitude and latitude", List.of("tpc"), new TpllCommand()); + commands.register("where", "Gives you the longitude and latitude of your minecraft coordinates", new WhereCommand()); + commands.register("offset", "Displays the x,y and z offset of your world", new OffsetCommand()); + }); + } } \ No newline at end of file diff --git a/src/main/java/de/btegermany/terraplusminus/commands/OffsetCommand.java b/src/main/java/de/btegermany/terraplusminus/commands/OffsetCommand.java index 0a457f4..b5ea09d 100644 --- a/src/main/java/de/btegermany/terraplusminus/commands/OffsetCommand.java +++ b/src/main/java/de/btegermany/terraplusminus/commands/OffsetCommand.java @@ -2,36 +2,34 @@ import de.btegermany.terraplusminus.Terraplusminus; import de.btegermany.terraplusminus.utils.ConfigurationHelper; +import io.papermc.paper.command.brigadier.BasicCommand; +import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -public class OffsetCommand implements CommandExecutor { +public class OffsetCommand implements BasicCommand { @Override - public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) { - if (!command.getName().equalsIgnoreCase("offset")) { - return true; - } - Player player = (Player) commandSender; - if (!player.hasPermission("t+-.offset")) { - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7No permission for /offset"); - return true; - } - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Offsets:"); - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7 | X: §8" + Terraplusminus.config.getInt("terrain_offset.x")); - - if (!Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("MULTIVERSE") || !Terraplusminus.config.getBoolean("linked_worlds.enabled")) { - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7 | Y: §8" + Terraplusminus.config.getInt("terrain_offset.y")); - } else { - if (Terraplusminus.config.getBoolean("linked_worlds.enabled") && Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("MULTIVERSE")) { - ConfigurationHelper.getWorlds().forEach(world -> player.sendMessage(Terraplusminus.config.getString("prefix") + "§9 " + world.getWorldName() + "§7 | Y: §8" + world.getOffset())); + public void execute(@NotNull CommandSourceStack stack, @NotNull String[] args) { + if (stack.getSender() instanceof Player player) { + if (!player.hasPermission("t+-.offset")) { + player.sendMessage(Terraplusminus.config.getString("prefix") + "§7No permission for /offset"); + return; } - } + player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Offsets:"); + player.sendMessage(Terraplusminus.config.getString("prefix") + "§7 | X: §8" + Terraplusminus.config.getInt("terrain_offset.x")); - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7 | Z: §8" + Terraplusminus.config.getInt("terrain_offset.z")); + if (!Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("MULTIVERSE") || !Terraplusminus.config.getBoolean("linked_worlds.enabled")) { + player.sendMessage(Terraplusminus.config.getString("prefix") + "§7 | Y: §8" + Terraplusminus.config.getInt("terrain_offset.y")); + } else { + if (Terraplusminus.config.getBoolean("linked_worlds.enabled") && Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("MULTIVERSE")) { + ConfigurationHelper.getWorlds().forEach(world -> player.sendMessage(Terraplusminus.config.getString("prefix") + "§9 " + world.getWorldName() + "§7 | Y: §8" + world.getOffset())); + } + } - return true; + player.sendMessage(Terraplusminus.config.getString("prefix") + "§7 | Z: §8" + Terraplusminus.config.getInt("terrain_offset.z")); + } } } diff --git a/src/main/java/de/btegermany/terraplusminus/commands/TpllCommand.java b/src/main/java/de/btegermany/terraplusminus/commands/TpllCommand.java index 4d0cc87..62ecb81 100644 --- a/src/main/java/de/btegermany/terraplusminus/commands/TpllCommand.java +++ b/src/main/java/de/btegermany/terraplusminus/commands/TpllCommand.java @@ -8,15 +8,15 @@ import de.btegermany.terraplusminus.utils.ConfigurationHelper; import de.btegermany.terraplusminus.utils.LinkedWorld; import io.papermc.lib.PaperLib; +import io.papermc.paper.command.brigadier.BasicCommand; +import io.papermc.paper.command.brigadier.CommandSourceStack; import net.buildtheearth.terraminusminus.generator.EarthGeneratorSettings; import net.buildtheearth.terraminusminus.projection.GeographicProjection; import net.buildtheearth.terraminusminus.projection.OutOfProjectionBoundsException; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.generator.ChunkGenerator; import org.jetbrains.annotations.NotNull; @@ -24,19 +24,15 @@ import static org.bukkit.ChatColor.RED; -public class TpllCommand implements CommandExecutor { +public class TpllCommand implements BasicCommand { @Override - public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args) { + public void execute(@NotNull CommandSourceStack stack, @NotNull String[] args) { - Player player = (Player) commandSender; - if (!command.getName().equalsIgnoreCase("tpll")) { - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Usage: /tpll "); - return true; - } + Player player = (Player) stack.getSender(); if (!player.hasPermission("t+-.tpll")) { player.sendMessage(Terraplusminus.config.getString("prefix") + "§7No permission for /tpll"); - return true; + return; } @@ -60,7 +56,7 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command playerList.deleteCharAt(playerList.length() - 2); } player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Teleported §9" + playerList + "§7to" + String.join(" ", args).substring(2)); - return true; + return; } else if (args[0].equals("@p")) { // find nearest player but not the player itself Player nearestPlayer = null; @@ -75,7 +71,7 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Teleported §9" + nearestPlayer.getName() + " §7to" + String.join(" ", args).substring(2)); nearestPlayer.chat("/tpll " + String.join(" ", args).substring(2)); } - return true; + return; } else { Player target = null; //check if target player is online @@ -87,12 +83,12 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command if (target == null) { player.sendMessage(Terraplusminus.config.getString("prefix") + "§cNo player found with name §9" + args[0]); - return true; + return; } player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Teleported §9" + target.getName() + " §7to " + args[1] + " " + args[2]); target.chat("/tpll " + String.join(" ", args).replace(target.getName(), "")); - return true; + return; } } @@ -105,13 +101,13 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command } else { player.chat("/" + passthroughTpll + ":tpll " + String.join(" ", args)); } - return true; + return; } //If sender is not a player cancel the command. - if (!(commandSender instanceof Player)) { - commandSender.sendMessage("This command can only be used by players!"); - return true; + if (!(stack.getSender() instanceof Player)) { + stack.getSender().sendMessage("This command can only be used by players!"); + return; } // - @@ -132,8 +128,8 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command ChunkGenerator generator = tpWorld.getGenerator(); if (!(generator instanceof RealWorldGenerator)) { // after server reload the generator isnt instanceof RealWorldGenerator anymore - commandSender.sendMessage(Terraplusminus.config.getString("prefix") + RED + "The world generator must be set to Terraplusminus"); - return true; + stack.getSender().sendMessage(Terraplusminus.config.getString("prefix") + RED + "The world generator must be set to Terraplusminus"); + return; } RealWorldGenerator terraGenerator = (RealWorldGenerator) generator; EarthGeneratorSettings generatorSettings = terraGenerator.getSettings(); @@ -144,14 +140,14 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command try { mcCoordinates = projection.fromGeo(coordinates[0], coordinates[1]); } catch (OutOfProjectionBoundsException e) { - commandSender.sendMessage(RED + "Location is not within projection bounds"); - return true; + stack.getSender().sendMessage(RED + "Location is not within projection bounds"); + return; } if (minLat != 0 && maxLat != 0 && minLon != 0 && maxLon != 0 && !player.hasPermission("t+-.admin")) { if (coordinates[1] < minLat || coordinates[0] < minLon || coordinates[1] > maxLat || coordinates[0] > maxLon) { player.sendMessage(Terraplusminus.config.getString("prefix") + RED + "You cannot tpll to these coordinates, because this area is being worked on by another build team."); - return true; + return; } } @@ -167,44 +163,46 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command if (Terraplusminus.config.getBoolean("linked_worlds.enabled")) { if (Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("SERVER")) { //send player uuid and coordinates to bungee - return sendPluginMessageToBungeeBridge(true, player, coordinates); + sendPluginMessageToBungeeBridge(true, player, coordinates); + return; } else if (Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("MULTIVERSE")) { LinkedWorld nextServer = ConfigurationHelper.getNextServerName(player.getWorld().getName()); if (nextServer == null) { player.sendMessage(Terraplusminus.config.getString("prefix") + "§cYou cannot tpll to these coordinates, because the world is not high enough at the moment."); - return true; + return; } tpWorld = Bukkit.getWorld(nextServer.getWorldName()); height = height - yOffset + nextServer.getOffset(); player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Teleporting to " + coordinates[1] + ", " + coordinates[0] + " in another world. This may take a bit..."); //player.teleport(new Location(tpWorld, mcCoordinates[0] + xOffset, height, mcCoordinates[1] + zOffset, player.getLocation().getYaw(), player.getLocation().getPitch())); PaperLib.teleportAsync(player, new Location(tpWorld, mcCoordinates[0] + xOffset, height, mcCoordinates[1] + zOffset, player.getLocation().getYaw(), player.getLocation().getPitch())); - return true; + return; } } else { player.sendMessage(Terraplusminus.config.getString("prefix") + "§cYou cannot tpll to these coordinates, because the world is not high enough at the moment."); - return true; + return; } } else if (height <= player.getWorld().getMinHeight()) { if (Terraplusminus.config.getBoolean("linked_worlds.enabled")) { if (Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("SERVER")) { //send player uuid and coordinates to bungee - return sendPluginMessageToBungeeBridge(false, player, coordinates); + sendPluginMessageToBungeeBridge(false, player, coordinates); + return; } else if (Terraplusminus.config.getString("linked_worlds.method").equalsIgnoreCase("MULTIVERSE")) { LinkedWorld previousServer = ConfigurationHelper.getPreviousServerName(player.getWorld().getName()); if (previousServer == null) { player.sendMessage(Terraplusminus.config.getString("prefix") + "§cYou cannot tpll to these coordinates, because the world is not low enough at the moment."); - return true; + return; } tpWorld = Bukkit.getWorld(previousServer.getWorldName()); height = height - yOffset + previousServer.getOffset(); player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Teleporting to " + coordinates[1] + ", " + coordinates[0] + " in another world. This may take a bit..."); PaperLib.teleportAsync(player, new Location(tpWorld, mcCoordinates[0] + xOffset, height, mcCoordinates[1] + zOffset, player.getLocation().getYaw(), player.getLocation().getPitch())); - return true; + return; } } else { player.sendMessage(Terraplusminus.config.getString("prefix") + "§cYou cannot tpll to these coordinates, because the world is not low enough at the moment."); - return true; + return; } } Location location = new Location(tpWorld, mcCoordinates[0], height, mcCoordinates[1], player.getLocation().getYaw(), player.getLocation().getPitch()); @@ -227,10 +225,10 @@ public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command player.sendMessage(Terraplusminus.config.getString("prefix") + "§7Teleported to " + coordinates[1] + ", " + coordinates[0] + "."); } - return true; + return; } - return true; + return; } private static boolean sendPluginMessageToBungeeBridge(boolean isNextServer, Player player, double[] coordinates) { diff --git a/src/main/java/de/btegermany/terraplusminus/commands/WhereCommand.java b/src/main/java/de/btegermany/terraplusminus/commands/WhereCommand.java index 03b5f0f..13089c2 100644 --- a/src/main/java/de/btegermany/terraplusminus/commands/WhereCommand.java +++ b/src/main/java/de/btegermany/terraplusminus/commands/WhereCommand.java @@ -1,53 +1,49 @@ package de.btegermany.terraplusminus.commands; import de.btegermany.terraplusminus.Terraplusminus; +import io.papermc.paper.command.brigadier.BasicCommand; +import io.papermc.paper.command.brigadier.CommandSourceStack; import net.buildtheearth.terraminusminus.generator.EarthGeneratorSettings; import net.buildtheearth.terraminusminus.projection.OutOfProjectionBoundsException; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -public class WhereCommand implements CommandExecutor { +public class WhereCommand implements BasicCommand { private final EarthGeneratorSettings bteGeneratorSettings = EarthGeneratorSettings.parse(EarthGeneratorSettings.BTE_DEFAULT_SETTINGS); @Override - public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args) { - if (command.getName().equalsIgnoreCase("where")) { - if (!(commandSender instanceof Player)) { - commandSender.sendMessage("This command can only be used by players!"); - return true; - } - Player player = (Player) commandSender; - if (!player.hasPermission("t+-.where")) { - player.sendMessage(Terraplusminus.config.getString("prefix") + "§7No permission for /where"); - return true; - } - int xOffset = Terraplusminus.config.getInt("terrain_offset.x"); - int zOffset = Terraplusminus.config.getInt("terrain_offset.z"); + public void execute(@NotNull CommandSourceStack stack, @NotNull String[] args) { + if (!(stack.getSender() instanceof Player)) { + stack.getSender().sendMessage("This command can only be used by players!"); + return; + } + Player player = (Player) stack.getSender(); + if (!player.hasPermission("t+-.where")) { + player.sendMessage(Terraplusminus.config.getString("prefix") + "§7No permission for /where"); + return; + } + int xOffset = Terraplusminus.config.getInt("terrain_offset.x"); + int zOffset = Terraplusminus.config.getInt("terrain_offset.z"); - double[] mcCoordinates = new double[2]; - mcCoordinates[0] = player.getLocation().getX() - xOffset; - mcCoordinates[1] = player.getLocation().getZ() - zOffset; - System.out.println(mcCoordinates[0] + ", " + mcCoordinates[1]); - double[] coordinates = new double[0]; - try { - coordinates = bteGeneratorSettings.projection().toGeo(mcCoordinates[0], mcCoordinates[1]); - } catch (OutOfProjectionBoundsException e) { - e.printStackTrace(); - } - TextComponent message = new TextComponent(Terraplusminus.config.getString("prefix") + "§7Your coordinates are:"); - message.addExtra("\n§8" + coordinates[1] + ", " + coordinates[0] + "§7."); - message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://maps.google.com/maps?t=k&q=loc:" + coordinates[1] + "+" + coordinates[0])); - message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Click here to view in Google Maps.").create())); - player.spigot().sendMessage(message); + double[] mcCoordinates = new double[2]; + mcCoordinates[0] = player.getLocation().getX() - xOffset; + mcCoordinates[1] = player.getLocation().getZ() - zOffset; + System.out.println(mcCoordinates[0] + ", " + mcCoordinates[1]); + double[] coordinates = new double[0]; + try { + coordinates = bteGeneratorSettings.projection().toGeo(mcCoordinates[0], mcCoordinates[1]); + } catch (OutOfProjectionBoundsException e) { + e.printStackTrace(); } - return true; + TextComponent message = new TextComponent(Terraplusminus.config.getString("prefix") + "§7Your coordinates are:"); + message.addExtra("\n§8" + coordinates[1] + ", " + coordinates[0] + "§7."); + message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://maps.google.com/maps?t=k&q=loc:" + coordinates[1] + "+" + coordinates[0])); + message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Click here to view in Google Maps.").create())); + player.spigot().sendMessage(message); } } diff --git a/src/main/java/de/btegermany/terraplusminus/gen/RealWorldGenerator.java b/src/main/java/de/btegermany/terraplusminus/gen/RealWorldGenerator.java index ec1e71c..2615230 100644 --- a/src/main/java/de/btegermany/terraplusminus/gen/RealWorldGenerator.java +++ b/src/main/java/de/btegermany/terraplusminus/gen/RealWorldGenerator.java @@ -35,7 +35,18 @@ import static java.lang.Math.min; import static net.buildtheearth.terraminusminus.substitutes.ChunkPos.blockToCube; import static net.buildtheearth.terraminusminus.substitutes.ChunkPos.cubeToMinBlock; -import static org.bukkit.Material.*; +import static org.bukkit.Material.BRICKS; +import static org.bukkit.Material.DIRT; +import static org.bukkit.Material.DIRT_PATH; +import static org.bukkit.Material.FARMLAND; +import static org.bukkit.Material.GRASS_BLOCK; +import static org.bukkit.Material.GRAY_CONCRETE_POWDER; +import static org.bukkit.Material.MOSS_BLOCK; +import static org.bukkit.Material.MYCELIUM; +import static org.bukkit.Material.SNOW; +import static org.bukkit.Material.SNOW_BLOCK; +import static org.bukkit.Material.STONE; +import static org.bukkit.Material.WATER; public class RealWorldGenerator extends ChunkGenerator { @@ -119,14 +130,14 @@ public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, chunkData.setRegion( 0, minWorldY, 0, 16, maxWorldY, 16, - Material.STONE + STONE ); return; // All done, everything is underground } else { chunkData.setRegion( 0, minWorldY, 0, 0, cubeToMinBlock(minSurfaceCubeY), 0, - Material.STONE + STONE ); } @@ -137,13 +148,13 @@ public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int waterHeight = min(terraData.waterHeight(x, z) + this.yOffset, maxWorldY - 1); chunkData.setRegion( x, minWorldY, z, - x + 1, groundHeight + 1, z +1, - Material.STONE + x + 1, groundHeight + 1, z + 1, + STONE ); chunkData.setRegion( x, groundHeight + 1, z, - x + 1, waterHeight + 1, z +1, - Material.WATER + x + 1, waterHeight + 1, z + 1, + WATER ); } } @@ -244,7 +255,7 @@ public boolean canSpawn(@NotNull World world, int x, int z) { return switch (world.getEnvironment()) { case NETHER -> true; case THE_END -> - highest.getType() != Material.AIR && highest.getType() != Material.WATER && highest.getType() != Material.LAVA; + highest.getType() != Material.AIR && highest.getType() != WATER && highest.getType() != Material.LAVA; default -> highest.getType() == Material.SAND || highest.getType() == Material.GRAVEL; }; } diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml new file mode 100644 index 0000000..49b9d3b --- /dev/null +++ b/src/main/resources/paper-plugin.yml @@ -0,0 +1,9 @@ +name: Terraplusminus +version: '1.4.0' +main: de.btegermany.terraplusminus.Terraplusminus +description: A plugin which implements the terra-- api in a spigot plugin +api-version: '1.21' +prefix: T+- +authors: [ meysster, Nudlsupp, Nachwahl ] +website: https://bte-germany.de +load: STARTUP \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml deleted file mode 100644 index 154dfc0..0000000 --- a/src/main/resources/plugin.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Terraplusminus -version: 1.3.3 -main: de.btegermany.terraplusminus.Terraplusminus -api-version: 1.18 -prefix: T+- -authors: [ meysster, Nudlsupp, Nachwahl ] -description: A plugin which implements the terra-- api in a spigot plugin -website: https://bte-germany.de -load: STARTUP - -commands: - tpll: - description: Teleports you to longitude and latitude - usage: /tpll - aliases: [ tpc ] - where: - description: Gives you the longitude and latitude of your minecraft coordinates - usage: /where - offset: - description: Displays the x,y and z offset of your world - usage: /offset -