From f53b8e63d76c2f8c4ade46605b2f95d69912a310 Mon Sep 17 00:00:00 2001 From: xGinko Date: Fri, 17 Mar 2023 14:27:34 +0100 Subject: [PATCH] add warmup for unstuck command improve code update bStats optimize pom.xml --- NetherCeiling-1.12.2/pom.xml | 20 +-- .../xginko/netherceiling/NetherCeiling.java | 31 ++-- .../commands/NetherCeilingCommand.java | 34 +++++ .../netherceiling/commands/UnstuckCmd.java | 38 ----- .../netherceiling/NetherCeilingCmd.java | 73 ++++++++++ .../subcommands/ReloadSubCmd.java | 9 +- .../subcommands/VersionSubCmd.java | 5 +- .../commands/unstuck/UnstuckCmd.java | 129 +++++++++++++++++ .../xginko/netherceiling/config/Config.java | 6 +- .../netherceiling/config/LanguageCache.java | 8 +- .../netherceiling/utils/CeilingUtils.java | 24 +-- .../src/main/resources/lang/de_ch.yml | 4 + .../src/main/resources/lang/de_de.yml | 6 +- .../src/main/resources/lang/en_us.yml | 8 +- NetherCeiling-1.16.5/pom.xml | 20 +-- .../xginko/netherceiling/NetherCeiling.java | 31 ++-- .../commands/NetherCeilingCmd.java | 68 --------- .../commands/NetherCeilingCommand.java | 35 +++++ .../netherceiling/commands/UnstuckCmd.java | 37 ----- .../netherceiling}/NetherCeilingCmd.java | 44 +++--- .../subcommands/ReloadSubCmd.java | 8 +- .../subcommands/VersionSubCmd.java | 4 +- .../commands/unstuck/UnstuckCmd.java | 137 ++++++++++++++++++ .../xginko/netherceiling/config/Config.java | 6 +- .../netherceiling/config/LanguageCache.java | 8 +- .../netherceiling/utils/CeilingUtils.java | 25 ++-- .../src/main/resources/lang/de_ch.yml | 4 + .../src/main/resources/lang/de_de.yml | 6 +- .../src/main/resources/lang/en_us.yml | 8 +- NetherCeiling-1.19.3/pom.xml | 20 +-- .../xginko/netherceiling/NetherCeiling.java | 31 ++-- .../commands/NetherCeilingCommand.java | 35 +++++ .../netherceiling/commands/UnstuckCmd.java | 37 ----- .../netherceiling}/NetherCeilingCmd.java | 43 +++--- .../subcommands/ReloadSubCmd.java | 6 +- .../subcommands/VersionSubCmd.java | 2 +- .../commands/unstuck/UnstuckCmd.java | 137 ++++++++++++++++++ .../xginko/netherceiling/config/Config.java | 6 +- .../netherceiling/config/LanguageCache.java | 8 +- .../netherceiling/utils/CeilingUtils.java | 24 +-- .../src/main/resources/lang/de_ch.yml | 4 + .../src/main/resources/lang/de_de.yml | 6 +- .../src/main/resources/lang/en_us.yml | 8 +- 43 files changed, 831 insertions(+), 372 deletions(-) create mode 100644 NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java delete mode 100644 NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java create mode 100644 NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java rename NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/{ => netherceiling}/subcommands/ReloadSubCmd.java (73%) rename NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/{ => netherceiling}/subcommands/VersionSubCmd.java (85%) create mode 100644 NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java delete mode 100644 NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java create mode 100644 NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java delete mode 100644 NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java rename {NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands => NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling}/NetherCeilingCmd.java (56%) rename {NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands => NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling}/subcommands/ReloadSubCmd.java (83%) rename NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/{ => netherceiling}/subcommands/VersionSubCmd.java (94%) create mode 100644 NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java create mode 100644 NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java delete mode 100644 NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java rename {NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands => NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling}/NetherCeilingCmd.java (57%) rename {NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands => NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling}/subcommands/ReloadSubCmd.java (83%) rename NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/{ => netherceiling}/subcommands/VersionSubCmd.java (94%) create mode 100644 NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java diff --git a/NetherCeiling-1.12.2/pom.xml b/NetherCeiling-1.12.2/pom.xml index ebab3e4..8762228 100644 --- a/NetherCeiling-1.12.2/pom.xml +++ b/NetherCeiling-1.12.2/pom.xml @@ -6,7 +6,7 @@ me.xGinko NetherCeiling - 1.2.2--1.12.2 + 1.2.3--1.12.2 jar NetherCeiling @@ -48,6 +48,14 @@ false true + + + *:* + + META-INF/MANIFEST.MF + + + @@ -89,23 +97,17 @@ ConfigurationMaster-API v2.0.0-BETA-3 - + org.reflections reflections 0.10.2 - - - org.jetbrains - annotations - 23.1.0 - org.bstats bstats-bukkit - 3.0.0 + 3.0.1 compile diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/NetherCeiling.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/NetherCeiling.java index 00ad2c2..a6dda6c 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/NetherCeiling.java +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/NetherCeiling.java @@ -1,7 +1,6 @@ package me.xginko.netherceiling; -import me.xginko.netherceiling.commands.NetherCeilingCmd; -import me.xginko.netherceiling.commands.UnstuckCmd; +import me.xginko.netherceiling.commands.NetherCeilingCommand; import me.xginko.netherceiling.config.Config; import me.xginko.netherceiling.config.LanguageCache; import me.xginko.netherceiling.modules.NetherCeilingModule; @@ -18,7 +17,6 @@ import java.util.HashMap; import java.util.Set; import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import java.util.regex.Matcher; @@ -45,27 +43,22 @@ public void onEnable() { logger.info(" "); logger.info(" "); - // Load lang and config logger.info("Loading Translations"); reloadLang(); + logger.info("Loading Config"); - reloadNetherCeilingConfig(); + reloadConfiguration(); - // Register commands logger.info("Registering Commands"); - getCommand("netherceiling").setExecutor(new NetherCeilingCmd()); - getCommand("unstuck").setExecutor(new UnstuckCmd()); + NetherCeilingCommand.reloadCommands(); - // Metrics logger.info("Loading Metrics"); new Metrics(this, 17203); - // Resource-friendly TPS checker - ScheduledExecutorService schedulerTPS = Executors.newScheduledThreadPool(1); - schedulerTPS.scheduleAtFixedRate(() -> { - Thread thread = new Thread(() -> tps = getServer().getTPS()[0]); - thread.start(); - }, 2, 1, TimeUnit.SECONDS); + // Scheduled TPS checker + Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> { + new Thread(() -> tps = getServer().getTPS()[0]).start(); + }, 1, 1, TimeUnit.SECONDS); logger.info("Done."); } @@ -101,7 +94,13 @@ public static LanguageCache getLang(CommandSender commandSender) { } } - public void reloadNetherCeilingConfig() { + public void reloadPlugin() { + reloadLang(); + reloadConfiguration(); + NetherCeilingCommand.reloadCommands(); + } + + public void reloadConfiguration() { config = new Config(); NetherCeilingModule.reloadModules(); config.saveConfig(); diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java new file mode 100644 index 0000000..025bf30 --- /dev/null +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java @@ -0,0 +1,34 @@ +package me.xginko.netherceiling.commands; + +import me.xginko.netherceiling.NetherCeiling; +import me.xginko.netherceiling.commands.netherceiling.NetherCeilingCmd; +import me.xginko.netherceiling.commands.unstuck.UnstuckCmd; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandMap; +import org.bukkit.command.CommandSender; + +import java.util.HashSet; + +public interface NetherCeilingCommand extends CommandExecutor { + + String label(); + + HashSet commands = new HashSet<>(); + static void reloadCommands() { + commands.clear(); + + commands.add(new NetherCeilingCmd()); + commands.add(new UnstuckCmd()); + + NetherCeiling plugin = NetherCeiling.getInstance(); + CommandMap commandMap = plugin.getServer().getCommandMap(); + for (NetherCeilingCommand command : commands) { + plugin.getCommand(command.label()).unregister(commandMap); + plugin.getCommand(command.label()).setExecutor(command); + } + } + + @Override + boolean onCommand(CommandSender sender, Command command, String label, String[] args); +} diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java deleted file mode 100644 index 1bc83a6..0000000 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java +++ /dev/null @@ -1,38 +0,0 @@ -package me.xginko.netherceiling.commands; - -import me.xginko.netherceiling.NetherCeiling; -import org.bukkit.ChatColor; -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.jetbrains.annotations.NotNull; - -import static me.xginko.netherceiling.utils.CeilingUtils.teleportFromCeiling; - -public class UnstuckCmd implements CommandExecutor { - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (command.getName().equalsIgnoreCase("unstuck")) { - if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.RED+"Only players can execute this command."); - return true; - } - Player player = (Player) sender; - if (player.hasPermission("netherceiling.cmd.unstuck")) { - if ( - player.getWorld().getEnvironment().equals(World.Environment.NETHER) - && player.getLocation().getY() > NetherCeiling.getConfiguration().nether_ceiling_y - ) { - teleportFromCeiling(player); - } else { - player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).youre_not_on_the_ceiling)); - } - } else { - player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).noPermission)); - } - } - return true; - } -} diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java new file mode 100644 index 0000000..3797f45 --- /dev/null +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java @@ -0,0 +1,73 @@ +package me.xginko.netherceiling.commands.netherceiling; + +import me.xginko.netherceiling.commands.NetherCeilingCommand; +import me.xginko.netherceiling.commands.SubCommand; +import me.xginko.netherceiling.commands.netherceiling.subcommands.ReloadSubCmd; +import me.xginko.netherceiling.commands.netherceiling.subcommands.VersionSubCmd; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; + +import java.util.ArrayList; +import java.util.List; + +public class NetherCeilingCmd implements NetherCeilingCommand, TabCompleter { + + private final List subcommands = new ArrayList<>(); + private final List tabcompleters = new ArrayList<>(); + + public NetherCeilingCmd() { + subcommands.add(new ReloadSubCmd()); + subcommands.add(new VersionSubCmd()); + for (SubCommand subcommand : subcommands) { + tabcompleters.add(subcommand.getName()); + } + } + + @Override + public String label() { + return "netherceiling"; + } + + @Override + public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { + if (command.getName().equalsIgnoreCase(label()) && args.length > 0 && args.length <=2) { + return tabcompleters; + } + return null; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (command.getName().equalsIgnoreCase(label()) && args.length > 0) { + boolean cmdExists = false; + for (SubCommand subcommand : subcommands) { + if (args[0].equalsIgnoreCase(subcommand.getName())) { + subcommand.perform(sender, args); + cmdExists = true; + } + } + if (!cmdExists) showCommandOverviewTo(sender); + } else { + showCommandOverviewTo(sender); + } + return true; + } + + private void showCommandOverviewTo(CommandSender sender) { + if (!sender.hasPermission("netherceiling.cmd.*")) return; + sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); + sender.sendMessage(ChatColor.WHITE+"NetherCeiling Commands "); + sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); + sender.sendMessage(ChatColor.WHITE+"/unstuck"+ChatColor.DARK_GRAY+" - "+ChatColor.GRAY+"Teleport yourself down from the nether ceiling."); + for (SubCommand subcommand : subcommands) { + sender.sendMessage( + ChatColor.WHITE + subcommand.getSyntax() + + ChatColor.DARK_GRAY + " - " + + ChatColor.GRAY + subcommand.getDescription() + ); + } + sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); + } +} diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java similarity index 73% rename from NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java rename to NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java index b9c3116..5e3427a 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java @@ -1,6 +1,5 @@ -package me.xginko.netherceiling.commands.subcommands; +package me.xginko.netherceiling.commands.netherceiling.subcommands; -import org.jetbrains.annotations.NotNull; import me.xginko.netherceiling.NetherCeiling; import me.xginko.netherceiling.commands.SubCommand; import org.bukkit.ChatColor; @@ -22,12 +21,10 @@ public String getSyntax() { } @Override - public void perform(@NotNull CommandSender sender, String[] args) { + public void perform(CommandSender sender, String[] args) { if (sender.hasPermission("netherceiling.cmd.reload")) { sender.sendMessage(ChatColor.RED + "Reloading NetherCeiling config..."); - NetherCeiling plugin = NetherCeiling.getInstance(); - plugin.reloadLang(); - plugin.reloadNetherCeilingConfig(); + NetherCeiling.getInstance().reloadPlugin(); sender.sendMessage(ChatColor.GREEN + "Reload complete."); } else { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(sender).noPermission)); diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java similarity index 85% rename from NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java rename to NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java index 6c8ae95..8aea17e 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java @@ -1,6 +1,5 @@ -package me.xginko.netherceiling.commands.subcommands; +package me.xginko.netherceiling.commands.netherceiling.subcommands; -import org.jetbrains.annotations.NotNull; import me.xginko.netherceiling.NetherCeiling; import me.xginko.netherceiling.commands.SubCommand; import org.bukkit.ChatColor; @@ -22,7 +21,7 @@ public String getSyntax() { } @Override - public void perform(@NotNull CommandSender sender, String[] args) { + public void perform(CommandSender sender, String[] args) { if (sender.hasPermission("netherceiling.cmd.version")) { sender.sendMessage("\n"); sender.sendMessage( diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java new file mode 100644 index 0000000..cd852d2 --- /dev/null +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java @@ -0,0 +1,129 @@ +package me.xginko.netherceiling.commands.unstuck; + +import me.xginko.netherceiling.NetherCeiling; +import me.xginko.netherceiling.commands.NetherCeilingCommand; +import me.xginko.netherceiling.config.Config; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import java.util.HashMap; +import java.util.UUID; + +import static me.xginko.netherceiling.utils.CeilingUtils.teleportFromCeiling; + +public class UnstuckCmd implements NetherCeilingCommand, Listener { + + private final HashMap warmupTasks = new HashMap<>(); + private final NetherCeiling plugin; + private final Config config; + + public UnstuckCmd() { + this.plugin = NetherCeiling.getInstance(); + this.config = NetherCeiling.getConfiguration(); + if (config.warmup_is_enabled) plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @Override + public String label() { + return "unstuck"; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (command.getName().equalsIgnoreCase(label())) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED+"Only players can execute this command."); + return true; + } + Player player = (Player) sender; + if (player.hasPermission("netherceiling.cmd.unstuck")) { + if ( + player.getWorld().getEnvironment().equals(World.Environment.NETHER) + && player.getLocation().getY() > config.nether_ceiling_y + ) { + if (config.warmup_is_enabled) { + startTeleportWarmup(player); + } else { + teleportFromCeiling(player); + } + } else { + player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).youre_not_on_the_ceiling)); + } + } else { + player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).noPermission)); + } + } + return true; + } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + private void onMoveDuringWarmup(PlayerMoveEvent event) { + Player player = event.getPlayer(); + if (!player.hasPermission("netherceiling.cmd.unstuck")) return; + + if ( + warmupTasks.containsKey(player.getUniqueId()) + && !event.getTo().getBlock().getLocation().equals(event.getFrom().getBlock().getLocation()) + ){ + cancelTeleport(player.getUniqueId()); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).teleport_cancelled)); + } + } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + private void onPlayerTakesDamageDuringWarmup(EntityDamageByEntityEvent event) { + if (event.getEntity() instanceof Player) { + Player player = (Player) event.getEntity(); + if (!player.hasPermission("netherceiling.cmd.unstuck")) return; + + if (warmupTasks.containsKey(player.getUniqueId())){ + cancelTeleport(player.getUniqueId()); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).teleport_cancelled)); + } + } + } + + private void startTeleportWarmup(Player player) { + UUID playerUniqueId = player.getUniqueId(); + BukkitTask existingTask = warmupTasks.get(playerUniqueId); + if (existingTask != null) existingTask.cancel(); + BukkitTask newTask = new BukkitRunnable() { + int timeLeft = config.warmup_delay_in_ticks / 20; + @Override + public void run() { + if (timeLeft > 0) { + player.sendTitle( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).teleport_commencing_in) + .replace("%seconds%", String.valueOf(timeLeft)), + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.getLocale()).teleport_dont_move), + 0,30,0 + ); + timeLeft--; + } else { + teleportFromCeiling(player); + cancelTeleport(player.getUniqueId()); + cancel(); + } + } + }.runTaskTimer(plugin, 0L, 20L); + warmupTasks.put(playerUniqueId, newTask); + } + + private void cancelTeleport(UUID playerUniqueId) { + BukkitTask existingTask = warmupTasks.get(playerUniqueId); + if (existingTask != null) { + existingTask.cancel(); + warmupTasks.remove(playerUniqueId); + } + } +} diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/Config.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/Config.java index 8b0b01e..d311dcd 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/Config.java +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/Config.java @@ -16,9 +16,9 @@ public class Config { private final File configFile; public final String default_lang; private final Logger logger; - public final boolean auto_lang, safe_teleport_enabled; + public final boolean auto_lang, safe_teleport_enabled, warmup_is_enabled; public final double config_version; - public final int nether_ceiling_y, teleport_distance_in_blocks; + public final int nether_ceiling_y, teleport_distance_in_blocks, warmup_delay_in_ticks; public Config() { configFile = new File(NetherCeiling.getInstance().getDataFolder(), "config.yml"); @@ -51,6 +51,8 @@ public Config() { config.addSection("Teleport"); this.safe_teleport_enabled = getBoolean("teleport-from-nether-ceiling-settings.safely-teleport-players", true, "This option can also be enabled via permission: netherceiling.safeteleport.\nTeleports player downwards, creating a safe airpocket where they can then free themselves.\nChecks for air below feet and lava in any direction harmful to the player."); this.teleport_distance_in_blocks = getInt("teleport-from-nether-ceiling-settings.downwards-distance-in-blocks", 7, "The distance in blocks the player will be teleported downwards. Recommended to leave\nat 7 if using in combination with safe teleport, so players don't abuse the plugin\nto delete berdock."); + this.warmup_is_enabled = getBoolean("teleport-from-nether-ceiling-settings.unstuck-cmd.warmup.enable", true, "Enable a warmup for the /unstuck command"); + this.warmup_delay_in_ticks = getInt("teleport-from-nether-ceiling-settings.unstuck-cmd.warmup.delay-in-seconds", 8, "How long in seconds the player should have to wait") * 20; config.addSection("Portals"); config.addDefault("portals", null); diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/LanguageCache.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/LanguageCache.java index 5803e84..8c0930f 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/LanguageCache.java +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/config/LanguageCache.java @@ -15,7 +15,7 @@ public class LanguageCache { portals_cant_create_on_ceiling, portals_cant_use_on_ceiling, portals_cant_use_to_ceiling, building_disabled_on_ceiling, building_block_cant_be_placed, building_block_limit_reached, building_build_height_is_at, building_bed_respawn_set, vehicles_cant_ride_this_on_ceiling, potions_effect_removed, potions_effect_nerfed, - fastblocks_moving_on_block_is_limited; + fastblocks_moving_on_block_is_limited, teleport_commencing_in, teleport_dont_move, teleport_cancelled; public LanguageCache(String lang) { NetherCeiling plugin = NetherCeiling.getInstance(); @@ -54,12 +54,16 @@ public LanguageCache(String lang) { this.potions_effect_nerfed = getStringTranslation("potions.one-or-more-effects-nerfed", "&cOne or more effects have been nerfed because you're on the nether ceiling."); // Fast Blocks this.fastblocks_moving_on_block_is_limited = getStringTranslation("fast-blocks.moving-on-block-is-limited", "&cMoving on %fastblock% is restricted on the nether ceiling."); + // Teleport + this.teleport_commencing_in = getStringTranslation("teleport.commencing-in", "&bTeleport commencing in %seconds% seconds."); + this.teleport_dont_move = getStringTranslation("teleport.dont-move", "&3Don't move."); + this.teleport_cancelled = getStringTranslation("teleport.cancelled", "&3Teleport cancelled."); if (addedMissing) fileConfiguration.save(langFile); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { - NetherCeiling.getInstance().getLogger().warning("Translation file " + langFile + " is not formatted properly. Skipping it."); + NetherCeiling.getLog().warning("Translation file " + langFile + " is not formatted properly. Skipping it."); } } diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java index 80f74c6..f2e4c60 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java +++ b/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java @@ -4,6 +4,7 @@ import me.xginko.netherceiling.config.Config; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; @@ -12,24 +13,28 @@ public class CeilingUtils { public static void teleportFromCeiling(Player player) { Config config = NetherCeiling.getConfiguration(); + Location playerLocation = player.getLocation(); + Location teleportDestination = new Location( + player.getWorld(), + playerLocation.getBlockX(), + config.nether_ceiling_y-config.teleport_distance_in_blocks, + playerLocation.getBlockZ() + ); // Teleport Player Downwards - player.teleport(new Location( - player.getWorld(), playerLocation.getBlockX(), 127-config.teleport_distance_in_blocks, playerLocation.getBlockZ() - )); + player.teleport(teleportDestination.add(0.5, 0, 0.5)); // Center player + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMEN_TELEPORT, 1.0F, 1.0F); if (config.safe_teleport_enabled || player.hasPermission("netherceiling.safeteleport")) { - Location playerTeleportedLocation = player.getLocation(); - // Check block above for liquid or falling block - Block blockAboveHead = playerTeleportedLocation.getBlock().getRelative(BlockFace.UP, 2); + Block blockAboveHead = teleportDestination.getBlock().getRelative(BlockFace.UP, 2); if (blockAboveHead.isLiquid() || blockAboveHead.getType().hasGravity()) { blockAboveHead.setType(Material.NETHERRACK, false); } // Create air pocket for player - Block blockAtPlayerLegs = playerTeleportedLocation.getBlock(); + Block blockAtPlayerLegs = teleportDestination.getBlock(); if ( !blockAtPlayerLegs.getType().equals(Material.AIR) && !blockAtPlayerLegs.getType().equals(Material.PORTAL) @@ -65,11 +70,6 @@ public static void teleportFromCeiling(Player player) { ) { blockBelowFeet.setType(Material.NETHERRACK, false); } - - // Teleport player to the center of that block to avoid glitching out of the safe box - player.teleport(new Location( - player.getWorld(), blockAtPlayerLegs.getX()+0.5, blockAtPlayerLegs.getY(), blockAtPlayerLegs.getZ()+0.5 - )); } } diff --git a/NetherCeiling-1.12.2/src/main/resources/lang/de_ch.yml b/NetherCeiling-1.12.2/src/main/resources/lang/de_ch.yml index b7152be..1e6d100 100644 --- a/NetherCeiling-1.12.2/src/main/resources/lang/de_ch.yml +++ b/NetherCeiling-1.12.2/src/main/resources/lang/de_ch.yml @@ -24,3 +24,7 @@ vehicles: potions: one-or-more-effects-removed: "&cEi oder mehreri Effekte si entfernt worde, da du di uf dr Netherdecki befindisch." one-or-more-effects-nerfed: "&cEi oder mehreri Effekte si abgeschwächt worde, da du di uf dr Netherdecki befindisch." +teleport: + commencing-in: "&3Teleport in %seconds% Sekunden." + dont-move: "&3Nid bewegä." + cancelled: "&cTeleport abgebrochen." \ No newline at end of file diff --git a/NetherCeiling-1.12.2/src/main/resources/lang/de_de.yml b/NetherCeiling-1.12.2/src/main/resources/lang/de_de.yml index 84a6916..2325596 100644 --- a/NetherCeiling-1.12.2/src/main/resources/lang/de_de.yml +++ b/NetherCeiling-1.12.2/src/main/resources/lang/de_de.yml @@ -25,4 +25,8 @@ potions: one-or-more-effects-removed: "&cEin oder mehrere Effekte wurden entfernt, da du dich auf der Netherdecke befindest." one-or-more-effects-nerfed: "&cEin oder mehrere Effekte wurden abgeschwächt, da du dich auf der Netherdecke befindest." fast-blocks: - moving-on-block-is-limited: "&cAuf %fastblock% kann auf der Netherdecke nur bedingt schnell gereist werden." \ No newline at end of file + moving-on-block-is-limited: "&cAuf %fastblock% kann auf der Netherdecke nur bedingt schnell gereist werden." +teleport: + commencing-in: "&3Teleport erfolgt in %seconds% Sekunden." + dont-move: "&3Nicht bewegen." + cancelled: "&cTeleport abgebrochen." \ No newline at end of file diff --git a/NetherCeiling-1.12.2/src/main/resources/lang/en_us.yml b/NetherCeiling-1.12.2/src/main/resources/lang/en_us.yml index 5e2bff1..e381fec 100644 --- a/NetherCeiling-1.12.2/src/main/resources/lang/en_us.yml +++ b/NetherCeiling-1.12.2/src/main/resources/lang/en_us.yml @@ -4,7 +4,7 @@ TRANSLATION: LOCALE: en-us no-permission: "&cYou don't have permission to use this command." -not-on-ceiling: "&c&cYou are not on the nether ceiling." +not-on-ceiling: "&cYou are not on the nether ceiling." general: cant-be-on-ceiling: "&cAccess to the nether ceiling is disabled." cant-move-on-ceiling: "&cYou can't move on the nether ceiling." @@ -25,4 +25,8 @@ potions: one-or-more-effects-removed: "&cOne or more effects have been removed because you're on the nether ceiling." one-or-more-effects-nerfed: "&cOne or more effects have been nerfed because you're on the nether ceiling." fast-blocks: - moving-on-block-is-limited: "&cMoving on %fastblock% is restricted on the nether ceiling." \ No newline at end of file + moving-on-block-is-limited: "&cMoving on %fastblock% is restricted on the nether ceiling." +teleport: + commencing-in: "&3Teleport commencing in %seconds% seconds." + dont-move: "&3Don't move." + cancelled: "&cTeleport cancelled." \ No newline at end of file diff --git a/NetherCeiling-1.16.5/pom.xml b/NetherCeiling-1.16.5/pom.xml index 5a70c02..9be9eaf 100644 --- a/NetherCeiling-1.16.5/pom.xml +++ b/NetherCeiling-1.16.5/pom.xml @@ -6,7 +6,7 @@ me.xGinko NetherCeiling - 1.2.2--1.16.5 + 1.2.3--1.16.5 jar NetherCeiling @@ -48,6 +48,14 @@ false true + + + *:* + + META-INF/MANIFEST.MF + + + @@ -89,13 +97,7 @@ ConfigurationMaster-API v2.0.0-BETA-3 - - - org.jetbrains - annotations - 23.1.0 - - + org.reflections reflections @@ -105,7 +107,7 @@ org.bstats bstats-bukkit - 3.0.0 + 3.0.1 compile diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/NetherCeiling.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/NetherCeiling.java index 74f634a..2cf59c0 100644 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/NetherCeiling.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/NetherCeiling.java @@ -1,7 +1,6 @@ package me.xginko.netherceiling; -import me.xginko.netherceiling.commands.NetherCeilingCmd; -import me.xginko.netherceiling.commands.UnstuckCmd; +import me.xginko.netherceiling.commands.NetherCeilingCommand; import me.xginko.netherceiling.config.Config; import me.xginko.netherceiling.config.LanguageCache; import me.xginko.netherceiling.modules.NetherCeilingModule; @@ -19,7 +18,6 @@ import java.util.Locale; import java.util.Set; import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import java.util.regex.Matcher; @@ -46,27 +44,22 @@ public void onEnable() { logger.info(" "); logger.info(" "); - // Load lang and config logger.info("Loading Translations"); reloadLang(); + logger.info("Loading Config"); - reloadNetherCeilingConfig(); + reloadConfiguration(); - // Register commands logger.info("Registering Commands"); - getCommand("netherceiling").setExecutor(new NetherCeilingCmd()); - getCommand("unstuck").setExecutor(new UnstuckCmd()); + NetherCeilingCommand.reloadCommands(); - // Metrics logger.info("Loading Metrics"); new Metrics(this, 17203); - // Resource-friendly TPS checker - ScheduledExecutorService schedulerTPS = Executors.newScheduledThreadPool(1); - schedulerTPS.scheduleAtFixedRate(() -> { - Thread thread = new Thread(() -> tps = getServer().getTPS()[0]); - thread.start(); - }, 2, 1, TimeUnit.SECONDS); + // Scheduled TPS checker + Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> { + new Thread(() -> tps = getServer().getTPS()[0]).start(); + }, 1, 1, TimeUnit.SECONDS); logger.info("Done."); } @@ -105,7 +98,13 @@ public static LanguageCache getLang(CommandSender commandSender) { } } - public void reloadNetherCeilingConfig() { + public void reloadPlugin() { + reloadLang(); + reloadConfiguration(); + NetherCeilingCommand.reloadCommands(); + } + + public void reloadConfiguration() { config = new Config(); NetherCeilingModule.reloadModules(); config.saveConfig(); diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java deleted file mode 100644 index c746aa0..0000000 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java +++ /dev/null @@ -1,68 +0,0 @@ -package me.xginko.netherceiling.commands; - -import me.xginko.netherceiling.commands.subcommands.ReloadSubCmd; -import me.xginko.netherceiling.commands.subcommands.VersionSubCmd; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class NetherCeilingCmd implements CommandExecutor, TabCompleter { - - private final ArrayList subcommands = new ArrayList<>(); - private final List tabcompleters = new ArrayList<>(); - - public NetherCeilingCmd() { - subcommands.add(new ReloadSubCmd()); - subcommands.add(new VersionSubCmd()); - for (int i=0; i onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length > 0) { - return tabcompleters; - } - return null; - } - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length > 0) { - boolean cmdExists = false; - for (int i = 0; i < getSubcommands().size(); i++) { - if (args[0].equalsIgnoreCase(getSubcommands().get(i).getName())) { - getSubcommands().get(i).perform(sender, args); - cmdExists = true; - } - } - if (!cmdExists) showCommandOverviewTo(sender); - } else { - showCommandOverviewTo(sender); - } - return true; - } - - private void showCommandOverviewTo(CommandSender sender) { - sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); - sender.sendMessage(ChatColor.WHITE+"NetherCeiling Commands "); - sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); - sender.sendMessage(ChatColor.WHITE+"/unstuck"+ChatColor.DARK_GRAY+" - "+ChatColor.GRAY+"Teleport yourself down from the nether ceiling."); - for (int i=0; i < getSubcommands().size(); i++) { - sender.sendMessage( - ChatColor.WHITE+getSubcommands().get(i).getSyntax() - +ChatColor.DARK_GRAY+" - " - +ChatColor.GRAY+getSubcommands().get(i).getDescription() - ); - } - sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); - } - - public ArrayList getSubcommands() { return subcommands; } -} diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java new file mode 100644 index 0000000..14f56e4 --- /dev/null +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java @@ -0,0 +1,35 @@ +package me.xginko.netherceiling.commands; + +import me.xginko.netherceiling.NetherCeiling; +import me.xginko.netherceiling.commands.netherceiling.NetherCeilingCmd; +import me.xginko.netherceiling.commands.unstuck.UnstuckCmd; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandMap; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +import java.util.HashSet; + +public interface NetherCeilingCommand extends CommandExecutor { + + String label(); + + HashSet commands = new HashSet<>(); + static void reloadCommands() { + commands.clear(); + + commands.add(new NetherCeilingCmd()); + commands.add(new UnstuckCmd()); + + NetherCeiling plugin = NetherCeiling.getInstance(); + CommandMap commandMap = plugin.getServer().getCommandMap(); + for (NetherCeilingCommand command : commands) { + plugin.getCommand(command.label()).unregister(commandMap); + plugin.getCommand(command.label()).setExecutor(command); + } + } + + @Override + boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args); +} diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java deleted file mode 100644 index 2c4a762..0000000 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java +++ /dev/null @@ -1,37 +0,0 @@ -package me.xginko.netherceiling.commands; - -import me.xginko.netherceiling.NetherCeiling; -import org.bukkit.ChatColor; -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.jetbrains.annotations.NotNull; - -import static me.xginko.netherceiling.utils.CeilingUtils.teleportFromCeiling; - -public class UnstuckCmd implements CommandExecutor { - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (command.getName().equalsIgnoreCase("unstuck")) { - if (sender instanceof Player player) { - if (player.hasPermission("netherceiling.cmd.unstuck")) { - if ( - player.getWorld().getEnvironment().equals(World.Environment.NETHER) - && player.getLocation().getY() > NetherCeiling.getConfiguration().nether_ceiling_y - ) { - teleportFromCeiling(player); - } else { - player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).youre_not_on_the_ceiling)); - } - } else { - player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).noPermission)); - } - } else { - sender.sendMessage(ChatColor.RED+"Only players can execute this command."); - } - } - return true; - } -} diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java similarity index 56% rename from NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java rename to NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java index c746aa0..1a11637 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java @@ -1,10 +1,11 @@ -package me.xginko.netherceiling.commands; +package me.xginko.netherceiling.commands.netherceiling; -import me.xginko.netherceiling.commands.subcommands.ReloadSubCmd; -import me.xginko.netherceiling.commands.subcommands.VersionSubCmd; +import me.xginko.netherceiling.commands.NetherCeilingCommand; +import me.xginko.netherceiling.commands.SubCommand; +import me.xginko.netherceiling.commands.netherceiling.subcommands.ReloadSubCmd; +import me.xginko.netherceiling.commands.netherceiling.subcommands.VersionSubCmd; import org.bukkit.ChatColor; import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.jetbrains.annotations.NotNull; @@ -12,21 +13,27 @@ import java.util.ArrayList; import java.util.List; -public class NetherCeilingCmd implements CommandExecutor, TabCompleter { +public class NetherCeilingCmd implements NetherCeilingCommand, TabCompleter { - private final ArrayList subcommands = new ArrayList<>(); + private final List subcommands = new ArrayList<>(); private final List tabcompleters = new ArrayList<>(); public NetherCeilingCmd() { subcommands.add(new ReloadSubCmd()); subcommands.add(new VersionSubCmd()); - for (int i=0; i onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length > 0) { + if (command.getName().equalsIgnoreCase(label()) && args.length > 0 && args.length <=2) { return tabcompleters; } return null; @@ -34,11 +41,11 @@ public List onTabComplete(@NotNull CommandSender sender, @NotNull Comman @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length > 0) { + if (command.getName().equalsIgnoreCase(label()) && args.length > 0) { boolean cmdExists = false; - for (int i = 0; i < getSubcommands().size(); i++) { - if (args[0].equalsIgnoreCase(getSubcommands().get(i).getName())) { - getSubcommands().get(i).perform(sender, args); + for (SubCommand subcommand : subcommands) { + if (args[0].equalsIgnoreCase(subcommand.getName())) { + subcommand.perform(sender, args); cmdExists = true; } } @@ -50,19 +57,18 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command } private void showCommandOverviewTo(CommandSender sender) { + if (!sender.hasPermission("netherceiling.cmd.*")) return; sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); sender.sendMessage(ChatColor.WHITE+"NetherCeiling Commands "); sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); sender.sendMessage(ChatColor.WHITE+"/unstuck"+ChatColor.DARK_GRAY+" - "+ChatColor.GRAY+"Teleport yourself down from the nether ceiling."); - for (int i=0; i < getSubcommands().size(); i++) { + for (SubCommand subcommand : subcommands) { sender.sendMessage( - ChatColor.WHITE+getSubcommands().get(i).getSyntax() - +ChatColor.DARK_GRAY+" - " - +ChatColor.GRAY+getSubcommands().get(i).getDescription() + ChatColor.WHITE + subcommand.getSyntax() + + ChatColor.DARK_GRAY + " - " + + ChatColor.GRAY + subcommand.getDescription() ); } sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); } - - public ArrayList getSubcommands() { return subcommands; } } diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java similarity index 83% rename from NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java rename to NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java index b9c3116..e3de429 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java @@ -1,10 +1,10 @@ -package me.xginko.netherceiling.commands.subcommands; +package me.xginko.netherceiling.commands.netherceiling.subcommands; -import org.jetbrains.annotations.NotNull; import me.xginko.netherceiling.NetherCeiling; import me.xginko.netherceiling.commands.SubCommand; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; public class ReloadSubCmd extends SubCommand { @@ -25,9 +25,7 @@ public String getSyntax() { public void perform(@NotNull CommandSender sender, String[] args) { if (sender.hasPermission("netherceiling.cmd.reload")) { sender.sendMessage(ChatColor.RED + "Reloading NetherCeiling config..."); - NetherCeiling plugin = NetherCeiling.getInstance(); - plugin.reloadLang(); - plugin.reloadNetherCeilingConfig(); + NetherCeiling.getInstance().reloadPlugin(); sender.sendMessage(ChatColor.GREEN + "Reload complete."); } else { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(sender).noPermission)); diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java similarity index 94% rename from NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java rename to NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java index 6c8ae95..7445e50 100644 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java @@ -1,10 +1,10 @@ -package me.xginko.netherceiling.commands.subcommands; +package me.xginko.netherceiling.commands.netherceiling.subcommands; -import org.jetbrains.annotations.NotNull; import me.xginko.netherceiling.NetherCeiling; import me.xginko.netherceiling.commands.SubCommand; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; public class VersionSubCmd extends SubCommand { diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java new file mode 100644 index 0000000..147ccdb --- /dev/null +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java @@ -0,0 +1,137 @@ +package me.xginko.netherceiling.commands.unstuck; + +import me.xginko.netherceiling.NetherCeiling; +import me.xginko.netherceiling.commands.NetherCeilingCommand; +import me.xginko.netherceiling.config.Config; +import net.kyori.adventure.text.Component; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; +import org.jetbrains.annotations.NotNull; + +import java.util.HashMap; +import java.util.UUID; + +import static me.xginko.netherceiling.utils.CeilingUtils.teleportFromCeiling; + +public class UnstuckCmd implements NetherCeilingCommand, Listener { + + private final HashMap warmupTasks = new HashMap<>(); + private final NetherCeiling plugin; + private final Config config; + + public UnstuckCmd() { + this.plugin = NetherCeiling.getInstance(); + this.config = NetherCeiling.getConfiguration(); + if (config.warmup_is_enabled) plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @Override + public String label() { + return "unstuck"; + } + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { + if (command.getName().equalsIgnoreCase(label())) { + if (sender instanceof Player player) { + if (player.hasPermission("netherceiling.cmd.unstuck")) { + if ( + player.getWorld().getEnvironment().equals(World.Environment.NETHER) + && player.getLocation().getY() > config.nether_ceiling_y + ) { + if (config.warmup_is_enabled) { + startTeleportWarmup(player); + } else { + teleportFromCeiling(player); + } + } else { + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).youre_not_on_the_ceiling) + )); + } + } else { + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).noPermission)) + ); + } + } else { + sender.sendMessage(ChatColor.RED + "Only players can execute this command."); + } + } + return true; + } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + private void onMoveDuringWarmup(PlayerMoveEvent event) { + Player player = event.getPlayer(); + if (!player.hasPermission("netherceiling.cmd.unstuck")) return; + + if ( + warmupTasks.containsKey(player.getUniqueId()) + && !event.getTo().getBlock().getLocation().equals(event.getFrom().getBlock().getLocation()) + ){ + cancelTeleport(player.getUniqueId()); + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_cancelled) + )); + } + } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + private void onPlayerTakesDamageDuringWarmup(EntityDamageByEntityEvent event) { + if (event.getEntity() instanceof Player player) { + if (!player.hasPermission("netherceiling.cmd.unstuck")) return; + + if (warmupTasks.containsKey(player.getUniqueId())){ + cancelTeleport(player.getUniqueId()); + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_cancelled) + )); + } + } + } + + private void startTeleportWarmup(Player player) { + UUID playerUniqueId = player.getUniqueId(); + BukkitTask existingTask = warmupTasks.get(playerUniqueId); + if (existingTask != null) existingTask.cancel(); + BukkitTask newTask = new BukkitRunnable() { + int timeLeft = config.warmup_delay_in_ticks / 20; + @Override + public void run() { + if (timeLeft > 0) { + player.sendTitle( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_commencing_in) + .replace("%seconds%", String.valueOf(timeLeft)), + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_dont_move), + 0,30,0 + ); + timeLeft--; + } else { + teleportFromCeiling(player); + cancelTeleport(player.getUniqueId()); + cancel(); + } + } + }.runTaskTimer(plugin, 0L, 20L); + warmupTasks.put(playerUniqueId, newTask); + } + + private void cancelTeleport(UUID playerUniqueId) { + BukkitTask existingTask = warmupTasks.get(playerUniqueId); + if (existingTask != null) { + existingTask.cancel(); + warmupTasks.remove(playerUniqueId); + } + } +} diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/Config.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/Config.java index 0f67d12..aff8fd3 100644 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/Config.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/Config.java @@ -17,9 +17,9 @@ public class Config { private final File configFile; public final Locale default_lang; private final Logger logger; - public final boolean auto_lang, safe_teleport_enabled; + public final boolean auto_lang, safe_teleport_enabled, warmup_is_enabled; public final double config_version; - public final int nether_ceiling_y, teleport_distance_in_blocks; + public final int nether_ceiling_y, teleport_distance_in_blocks, warmup_delay_in_ticks; public Config() { configFile = new File(NetherCeiling.getInstance().getDataFolder(), "config.yml"); @@ -54,6 +54,8 @@ public Config() { config.addSection("Teleport"); this.safe_teleport_enabled = getBoolean("teleport-from-nether-ceiling-settings.safely-teleport-players", true, "This option can also be enabled via permission: netherceiling.safeteleport.\nTeleports player downwards, creating a safe airpocket where they can then free themselves.\nChecks for air below feet and lava in any direction harmful to the player."); this.teleport_distance_in_blocks = getInt("teleport-from-nether-ceiling-settings.downwards-distance-in-blocks", 7, "The distance in blocks the player will be teleported downwards. Recommended to leave\nat 7 if using in combination with safe teleport, so players don't abuse the plugin\nto delete berdock."); + this.warmup_is_enabled = getBoolean("teleport-from-nether-ceiling-settings.unstuck-cmd.warmup.enable", true, "Enable a warmup for the /unstuck command"); + this.warmup_delay_in_ticks = getInt("teleport-from-nether-ceiling-settings.unstuck-cmd.warmup.delay-in-seconds", 8, "How long in seconds the player should have to wait") * 20; config.addSection("Portals"); config.addDefault("portals", null); diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/LanguageCache.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/LanguageCache.java index 5803e84..8c0930f 100644 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/LanguageCache.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/config/LanguageCache.java @@ -15,7 +15,7 @@ public class LanguageCache { portals_cant_create_on_ceiling, portals_cant_use_on_ceiling, portals_cant_use_to_ceiling, building_disabled_on_ceiling, building_block_cant_be_placed, building_block_limit_reached, building_build_height_is_at, building_bed_respawn_set, vehicles_cant_ride_this_on_ceiling, potions_effect_removed, potions_effect_nerfed, - fastblocks_moving_on_block_is_limited; + fastblocks_moving_on_block_is_limited, teleport_commencing_in, teleport_dont_move, teleport_cancelled; public LanguageCache(String lang) { NetherCeiling plugin = NetherCeiling.getInstance(); @@ -54,12 +54,16 @@ public LanguageCache(String lang) { this.potions_effect_nerfed = getStringTranslation("potions.one-or-more-effects-nerfed", "&cOne or more effects have been nerfed because you're on the nether ceiling."); // Fast Blocks this.fastblocks_moving_on_block_is_limited = getStringTranslation("fast-blocks.moving-on-block-is-limited", "&cMoving on %fastblock% is restricted on the nether ceiling."); + // Teleport + this.teleport_commencing_in = getStringTranslation("teleport.commencing-in", "&bTeleport commencing in %seconds% seconds."); + this.teleport_dont_move = getStringTranslation("teleport.dont-move", "&3Don't move."); + this.teleport_cancelled = getStringTranslation("teleport.cancelled", "&3Teleport cancelled."); if (addedMissing) fileConfiguration.save(langFile); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { - NetherCeiling.getInstance().getLogger().warning("Translation file " + langFile + " is not formatted properly. Skipping it."); + NetherCeiling.getLog().warning("Translation file " + langFile + " is not formatted properly. Skipping it."); } } diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java index d584618..435d809 100644 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java +++ b/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java @@ -4,6 +4,7 @@ import me.xginko.netherceiling.config.Config; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; @@ -12,25 +13,28 @@ public class CeilingUtils { public static void teleportFromCeiling(Player player) { Config config = NetherCeiling.getConfiguration(); + Location playerLocation = player.getLocation(); + Location teleportDestination = new Location( + player.getWorld(), + playerLocation.getBlockX(), + config.nether_ceiling_y-config.teleport_distance_in_blocks, + playerLocation.getBlockZ() + ); // Teleport Player Downwards - player.teleport(new Location( - player.getWorld(), playerLocation.getBlockX(), config.nether_ceiling_y-config.teleport_distance_in_blocks, playerLocation.getBlockZ() - )); + player.teleport(teleportDestination.add(0.5, 0, 0.5)); // Center player + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 1.0F); if (config.safe_teleport_enabled || player.hasPermission("netherceiling.safeteleport")) { - Location playerTeleportedLocation = player.getLocation(); - // Check block above for liquid or falling block - Block blockAboveHead = playerTeleportedLocation.getBlock().getRelative(BlockFace.UP, 2); + Block blockAboveHead = teleportDestination.getBlock().getRelative(BlockFace.UP, 2); if (blockAboveHead.isLiquid() || blockAboveHead.getType().hasGravity()) { blockAboveHead.setType(Material.NETHERRACK, false); } - // Create air pocket for player - Block blockAtPlayerLegs = playerTeleportedLocation.getBlock(); + Block blockAtPlayerLegs = teleportDestination.getBlock(); if ( !blockAtPlayerLegs.getType().equals(Material.AIR) && !blockAtPlayerLegs.getType().equals(Material.NETHER_PORTAL) @@ -66,11 +70,6 @@ public static void teleportFromCeiling(Player player) { ) { blockBelowFeet.setType(Material.NETHERRACK, false); } - - // Teleport player to the center of that block to avoid glitching out of the safe box - player.teleport(new Location( - player.getWorld(), blockAtPlayerLegs.getX()+0.5, blockAtPlayerLegs.getY(), blockAtPlayerLegs.getZ()+0.5 - )); } } diff --git a/NetherCeiling-1.16.5/src/main/resources/lang/de_ch.yml b/NetherCeiling-1.16.5/src/main/resources/lang/de_ch.yml index b7152be..1e6d100 100644 --- a/NetherCeiling-1.16.5/src/main/resources/lang/de_ch.yml +++ b/NetherCeiling-1.16.5/src/main/resources/lang/de_ch.yml @@ -24,3 +24,7 @@ vehicles: potions: one-or-more-effects-removed: "&cEi oder mehreri Effekte si entfernt worde, da du di uf dr Netherdecki befindisch." one-or-more-effects-nerfed: "&cEi oder mehreri Effekte si abgeschwächt worde, da du di uf dr Netherdecki befindisch." +teleport: + commencing-in: "&3Teleport in %seconds% Sekunden." + dont-move: "&3Nid bewegä." + cancelled: "&cTeleport abgebrochen." \ No newline at end of file diff --git a/NetherCeiling-1.16.5/src/main/resources/lang/de_de.yml b/NetherCeiling-1.16.5/src/main/resources/lang/de_de.yml index 84a6916..2325596 100644 --- a/NetherCeiling-1.16.5/src/main/resources/lang/de_de.yml +++ b/NetherCeiling-1.16.5/src/main/resources/lang/de_de.yml @@ -25,4 +25,8 @@ potions: one-or-more-effects-removed: "&cEin oder mehrere Effekte wurden entfernt, da du dich auf der Netherdecke befindest." one-or-more-effects-nerfed: "&cEin oder mehrere Effekte wurden abgeschwächt, da du dich auf der Netherdecke befindest." fast-blocks: - moving-on-block-is-limited: "&cAuf %fastblock% kann auf der Netherdecke nur bedingt schnell gereist werden." \ No newline at end of file + moving-on-block-is-limited: "&cAuf %fastblock% kann auf der Netherdecke nur bedingt schnell gereist werden." +teleport: + commencing-in: "&3Teleport erfolgt in %seconds% Sekunden." + dont-move: "&3Nicht bewegen." + cancelled: "&cTeleport abgebrochen." \ No newline at end of file diff --git a/NetherCeiling-1.16.5/src/main/resources/lang/en_us.yml b/NetherCeiling-1.16.5/src/main/resources/lang/en_us.yml index 5e2bff1..e381fec 100644 --- a/NetherCeiling-1.16.5/src/main/resources/lang/en_us.yml +++ b/NetherCeiling-1.16.5/src/main/resources/lang/en_us.yml @@ -4,7 +4,7 @@ TRANSLATION: LOCALE: en-us no-permission: "&cYou don't have permission to use this command." -not-on-ceiling: "&c&cYou are not on the nether ceiling." +not-on-ceiling: "&cYou are not on the nether ceiling." general: cant-be-on-ceiling: "&cAccess to the nether ceiling is disabled." cant-move-on-ceiling: "&cYou can't move on the nether ceiling." @@ -25,4 +25,8 @@ potions: one-or-more-effects-removed: "&cOne or more effects have been removed because you're on the nether ceiling." one-or-more-effects-nerfed: "&cOne or more effects have been nerfed because you're on the nether ceiling." fast-blocks: - moving-on-block-is-limited: "&cMoving on %fastblock% is restricted on the nether ceiling." \ No newline at end of file + moving-on-block-is-limited: "&cMoving on %fastblock% is restricted on the nether ceiling." +teleport: + commencing-in: "&3Teleport commencing in %seconds% seconds." + dont-move: "&3Don't move." + cancelled: "&cTeleport cancelled." \ No newline at end of file diff --git a/NetherCeiling-1.19.3/pom.xml b/NetherCeiling-1.19.3/pom.xml index b7c7851..6750efe 100644 --- a/NetherCeiling-1.19.3/pom.xml +++ b/NetherCeiling-1.19.3/pom.xml @@ -6,7 +6,7 @@ me.xGinko NetherCeiling - 1.2.2--1.19.3 + 1.2.3--1.19.3 jar NetherCeiling @@ -48,6 +48,14 @@ false true + + + *:* + + META-INF/MANIFEST.MF + + + @@ -89,23 +97,17 @@ ConfigurationMaster-API v2.0.0-BETA-3 - + org.reflections reflections 0.10.2 - - - org.jetbrains - annotations - 23.1.0 - org.bstats bstats-bukkit - 3.0.0 + 3.0.1 compile diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/NetherCeiling.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/NetherCeiling.java index 74f634a..2cf59c0 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/NetherCeiling.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/NetherCeiling.java @@ -1,7 +1,6 @@ package me.xginko.netherceiling; -import me.xginko.netherceiling.commands.NetherCeilingCmd; -import me.xginko.netherceiling.commands.UnstuckCmd; +import me.xginko.netherceiling.commands.NetherCeilingCommand; import me.xginko.netherceiling.config.Config; import me.xginko.netherceiling.config.LanguageCache; import me.xginko.netherceiling.modules.NetherCeilingModule; @@ -19,7 +18,6 @@ import java.util.Locale; import java.util.Set; import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; import java.util.regex.Matcher; @@ -46,27 +44,22 @@ public void onEnable() { logger.info(" "); logger.info(" "); - // Load lang and config logger.info("Loading Translations"); reloadLang(); + logger.info("Loading Config"); - reloadNetherCeilingConfig(); + reloadConfiguration(); - // Register commands logger.info("Registering Commands"); - getCommand("netherceiling").setExecutor(new NetherCeilingCmd()); - getCommand("unstuck").setExecutor(new UnstuckCmd()); + NetherCeilingCommand.reloadCommands(); - // Metrics logger.info("Loading Metrics"); new Metrics(this, 17203); - // Resource-friendly TPS checker - ScheduledExecutorService schedulerTPS = Executors.newScheduledThreadPool(1); - schedulerTPS.scheduleAtFixedRate(() -> { - Thread thread = new Thread(() -> tps = getServer().getTPS()[0]); - thread.start(); - }, 2, 1, TimeUnit.SECONDS); + // Scheduled TPS checker + Executors.newScheduledThreadPool(1).scheduleAtFixedRate(() -> { + new Thread(() -> tps = getServer().getTPS()[0]).start(); + }, 1, 1, TimeUnit.SECONDS); logger.info("Done."); } @@ -105,7 +98,13 @@ public static LanguageCache getLang(CommandSender commandSender) { } } - public void reloadNetherCeilingConfig() { + public void reloadPlugin() { + reloadLang(); + reloadConfiguration(); + NetherCeilingCommand.reloadCommands(); + } + + public void reloadConfiguration() { config = new Config(); NetherCeilingModule.reloadModules(); config.saveConfig(); diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java new file mode 100644 index 0000000..14f56e4 --- /dev/null +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCommand.java @@ -0,0 +1,35 @@ +package me.xginko.netherceiling.commands; + +import me.xginko.netherceiling.NetherCeiling; +import me.xginko.netherceiling.commands.netherceiling.NetherCeilingCmd; +import me.xginko.netherceiling.commands.unstuck.UnstuckCmd; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandMap; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +import java.util.HashSet; + +public interface NetherCeilingCommand extends CommandExecutor { + + String label(); + + HashSet commands = new HashSet<>(); + static void reloadCommands() { + commands.clear(); + + commands.add(new NetherCeilingCmd()); + commands.add(new UnstuckCmd()); + + NetherCeiling plugin = NetherCeiling.getInstance(); + CommandMap commandMap = plugin.getServer().getCommandMap(); + for (NetherCeilingCommand command : commands) { + plugin.getCommand(command.label()).unregister(commandMap); + plugin.getCommand(command.label()).setExecutor(command); + } + } + + @Override + boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args); +} diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java deleted file mode 100644 index 2c4a762..0000000 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/UnstuckCmd.java +++ /dev/null @@ -1,37 +0,0 @@ -package me.xginko.netherceiling.commands; - -import me.xginko.netherceiling.NetherCeiling; -import org.bukkit.ChatColor; -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.jetbrains.annotations.NotNull; - -import static me.xginko.netherceiling.utils.CeilingUtils.teleportFromCeiling; - -public class UnstuckCmd implements CommandExecutor { - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (command.getName().equalsIgnoreCase("unstuck")) { - if (sender instanceof Player player) { - if (player.hasPermission("netherceiling.cmd.unstuck")) { - if ( - player.getWorld().getEnvironment().equals(World.Environment.NETHER) - && player.getLocation().getY() > NetherCeiling.getConfiguration().nether_ceiling_y - ) { - teleportFromCeiling(player); - } else { - player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).youre_not_on_the_ceiling)); - } - } else { - player.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).noPermission)); - } - } else { - sender.sendMessage(ChatColor.RED+"Only players can execute this command."); - } - } - return true; - } -} diff --git a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java similarity index 57% rename from NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java rename to NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java index c746aa0..ec54d5d 100644 --- a/NetherCeiling-1.12.2/src/main/java/me/xginko/netherceiling/commands/NetherCeilingCmd.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/NetherCeilingCmd.java @@ -1,10 +1,10 @@ -package me.xginko.netherceiling.commands; +package me.xginko.netherceiling.commands.netherceiling; -import me.xginko.netherceiling.commands.subcommands.ReloadSubCmd; -import me.xginko.netherceiling.commands.subcommands.VersionSubCmd; +import me.xginko.netherceiling.commands.NetherCeilingCommand; +import me.xginko.netherceiling.commands.SubCommand; +import me.xginko.netherceiling.commands.netherceiling.subcommands.*; import org.bukkit.ChatColor; import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.jetbrains.annotations.NotNull; @@ -12,21 +12,27 @@ import java.util.ArrayList; import java.util.List; -public class NetherCeilingCmd implements CommandExecutor, TabCompleter { +public class NetherCeilingCmd implements NetherCeilingCommand, TabCompleter { - private final ArrayList subcommands = new ArrayList<>(); + private final List subcommands = new ArrayList<>(); private final List tabcompleters = new ArrayList<>(); public NetherCeilingCmd() { subcommands.add(new ReloadSubCmd()); subcommands.add(new VersionSubCmd()); - for (int i=0; i onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length > 0) { + if (command.getName().equalsIgnoreCase(label()) && args.length > 0 && args.length <=2) { return tabcompleters; } return null; @@ -34,11 +40,11 @@ public List onTabComplete(@NotNull CommandSender sender, @NotNull Comman @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length > 0) { + if (command.getName().equalsIgnoreCase(label()) && args.length > 0) { boolean cmdExists = false; - for (int i = 0; i < getSubcommands().size(); i++) { - if (args[0].equalsIgnoreCase(getSubcommands().get(i).getName())) { - getSubcommands().get(i).perform(sender, args); + for (SubCommand subcommand : subcommands) { + if (args[0].equalsIgnoreCase(subcommand.getName())) { + subcommand.perform(sender, args); cmdExists = true; } } @@ -50,19 +56,18 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command } private void showCommandOverviewTo(CommandSender sender) { + if (!sender.hasPermission("netherceiling.cmd.*")) return; sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); sender.sendMessage(ChatColor.WHITE+"NetherCeiling Commands "); sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); sender.sendMessage(ChatColor.WHITE+"/unstuck"+ChatColor.DARK_GRAY+" - "+ChatColor.GRAY+"Teleport yourself down from the nether ceiling."); - for (int i=0; i < getSubcommands().size(); i++) { + for (SubCommand subcommand : subcommands) { sender.sendMessage( - ChatColor.WHITE+getSubcommands().get(i).getSyntax() - +ChatColor.DARK_GRAY+" - " - +ChatColor.GRAY+getSubcommands().get(i).getDescription() + ChatColor.WHITE + subcommand.getSyntax() + + ChatColor.DARK_GRAY + " - " + + ChatColor.GRAY + subcommand.getDescription() ); } sender.sendMessage(ChatColor.GRAY+"-----------------------------------------------------"); } - - public ArrayList getSubcommands() { return subcommands; } } diff --git a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java similarity index 83% rename from NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java rename to NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java index b9c3116..80d4d7f 100644 --- a/NetherCeiling-1.16.5/src/main/java/me/xginko/netherceiling/commands/subcommands/ReloadSubCmd.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/ReloadSubCmd.java @@ -1,4 +1,4 @@ -package me.xginko.netherceiling.commands.subcommands; +package me.xginko.netherceiling.commands.netherceiling.subcommands; import org.jetbrains.annotations.NotNull; import me.xginko.netherceiling.NetherCeiling; @@ -25,9 +25,7 @@ public String getSyntax() { public void perform(@NotNull CommandSender sender, String[] args) { if (sender.hasPermission("netherceiling.cmd.reload")) { sender.sendMessage(ChatColor.RED + "Reloading NetherCeiling config..."); - NetherCeiling plugin = NetherCeiling.getInstance(); - plugin.reloadLang(); - plugin.reloadNetherCeilingConfig(); + NetherCeiling.getInstance().reloadPlugin(); sender.sendMessage(ChatColor.GREEN + "Reload complete."); } else { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(sender).noPermission)); diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java similarity index 94% rename from NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java rename to NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java index 6c8ae95..7331449 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/subcommands/VersionSubCmd.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/netherceiling/subcommands/VersionSubCmd.java @@ -1,4 +1,4 @@ -package me.xginko.netherceiling.commands.subcommands; +package me.xginko.netherceiling.commands.netherceiling.subcommands; import org.jetbrains.annotations.NotNull; import me.xginko.netherceiling.NetherCeiling; diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java new file mode 100644 index 0000000..147ccdb --- /dev/null +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/commands/unstuck/UnstuckCmd.java @@ -0,0 +1,137 @@ +package me.xginko.netherceiling.commands.unstuck; + +import me.xginko.netherceiling.NetherCeiling; +import me.xginko.netherceiling.commands.NetherCeilingCommand; +import me.xginko.netherceiling.config.Config; +import net.kyori.adventure.text.Component; +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; +import org.jetbrains.annotations.NotNull; + +import java.util.HashMap; +import java.util.UUID; + +import static me.xginko.netherceiling.utils.CeilingUtils.teleportFromCeiling; + +public class UnstuckCmd implements NetherCeilingCommand, Listener { + + private final HashMap warmupTasks = new HashMap<>(); + private final NetherCeiling plugin; + private final Config config; + + public UnstuckCmd() { + this.plugin = NetherCeiling.getInstance(); + this.config = NetherCeiling.getConfiguration(); + if (config.warmup_is_enabled) plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + @Override + public String label() { + return "unstuck"; + } + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { + if (command.getName().equalsIgnoreCase(label())) { + if (sender instanceof Player player) { + if (player.hasPermission("netherceiling.cmd.unstuck")) { + if ( + player.getWorld().getEnvironment().equals(World.Environment.NETHER) + && player.getLocation().getY() > config.nether_ceiling_y + ) { + if (config.warmup_is_enabled) { + startTeleportWarmup(player); + } else { + teleportFromCeiling(player); + } + } else { + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).youre_not_on_the_ceiling) + )); + } + } else { + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).noPermission)) + ); + } + } else { + sender.sendMessage(ChatColor.RED + "Only players can execute this command."); + } + } + return true; + } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + private void onMoveDuringWarmup(PlayerMoveEvent event) { + Player player = event.getPlayer(); + if (!player.hasPermission("netherceiling.cmd.unstuck")) return; + + if ( + warmupTasks.containsKey(player.getUniqueId()) + && !event.getTo().getBlock().getLocation().equals(event.getFrom().getBlock().getLocation()) + ){ + cancelTeleport(player.getUniqueId()); + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_cancelled) + )); + } + } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + private void onPlayerTakesDamageDuringWarmup(EntityDamageByEntityEvent event) { + if (event.getEntity() instanceof Player player) { + if (!player.hasPermission("netherceiling.cmd.unstuck")) return; + + if (warmupTasks.containsKey(player.getUniqueId())){ + cancelTeleport(player.getUniqueId()); + player.sendMessage(Component.text( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_cancelled) + )); + } + } + } + + private void startTeleportWarmup(Player player) { + UUID playerUniqueId = player.getUniqueId(); + BukkitTask existingTask = warmupTasks.get(playerUniqueId); + if (existingTask != null) existingTask.cancel(); + BukkitTask newTask = new BukkitRunnable() { + int timeLeft = config.warmup_delay_in_ticks / 20; + @Override + public void run() { + if (timeLeft > 0) { + player.sendTitle( + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_commencing_in) + .replace("%seconds%", String.valueOf(timeLeft)), + ChatColor.translateAlternateColorCodes('&', NetherCeiling.getLang(player.locale()).teleport_dont_move), + 0,30,0 + ); + timeLeft--; + } else { + teleportFromCeiling(player); + cancelTeleport(player.getUniqueId()); + cancel(); + } + } + }.runTaskTimer(plugin, 0L, 20L); + warmupTasks.put(playerUniqueId, newTask); + } + + private void cancelTeleport(UUID playerUniqueId) { + BukkitTask existingTask = warmupTasks.get(playerUniqueId); + if (existingTask != null) { + existingTask.cancel(); + warmupTasks.remove(playerUniqueId); + } + } +} diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/Config.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/Config.java index 0f67d12..aff8fd3 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/Config.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/Config.java @@ -17,9 +17,9 @@ public class Config { private final File configFile; public final Locale default_lang; private final Logger logger; - public final boolean auto_lang, safe_teleport_enabled; + public final boolean auto_lang, safe_teleport_enabled, warmup_is_enabled; public final double config_version; - public final int nether_ceiling_y, teleport_distance_in_blocks; + public final int nether_ceiling_y, teleport_distance_in_blocks, warmup_delay_in_ticks; public Config() { configFile = new File(NetherCeiling.getInstance().getDataFolder(), "config.yml"); @@ -54,6 +54,8 @@ public Config() { config.addSection("Teleport"); this.safe_teleport_enabled = getBoolean("teleport-from-nether-ceiling-settings.safely-teleport-players", true, "This option can also be enabled via permission: netherceiling.safeteleport.\nTeleports player downwards, creating a safe airpocket where they can then free themselves.\nChecks for air below feet and lava in any direction harmful to the player."); this.teleport_distance_in_blocks = getInt("teleport-from-nether-ceiling-settings.downwards-distance-in-blocks", 7, "The distance in blocks the player will be teleported downwards. Recommended to leave\nat 7 if using in combination with safe teleport, so players don't abuse the plugin\nto delete berdock."); + this.warmup_is_enabled = getBoolean("teleport-from-nether-ceiling-settings.unstuck-cmd.warmup.enable", true, "Enable a warmup for the /unstuck command"); + this.warmup_delay_in_ticks = getInt("teleport-from-nether-ceiling-settings.unstuck-cmd.warmup.delay-in-seconds", 8, "How long in seconds the player should have to wait") * 20; config.addSection("Portals"); config.addDefault("portals", null); diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/LanguageCache.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/LanguageCache.java index 5803e84..8c0930f 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/LanguageCache.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/config/LanguageCache.java @@ -15,7 +15,7 @@ public class LanguageCache { portals_cant_create_on_ceiling, portals_cant_use_on_ceiling, portals_cant_use_to_ceiling, building_disabled_on_ceiling, building_block_cant_be_placed, building_block_limit_reached, building_build_height_is_at, building_bed_respawn_set, vehicles_cant_ride_this_on_ceiling, potions_effect_removed, potions_effect_nerfed, - fastblocks_moving_on_block_is_limited; + fastblocks_moving_on_block_is_limited, teleport_commencing_in, teleport_dont_move, teleport_cancelled; public LanguageCache(String lang) { NetherCeiling plugin = NetherCeiling.getInstance(); @@ -54,12 +54,16 @@ public LanguageCache(String lang) { this.potions_effect_nerfed = getStringTranslation("potions.one-or-more-effects-nerfed", "&cOne or more effects have been nerfed because you're on the nether ceiling."); // Fast Blocks this.fastblocks_moving_on_block_is_limited = getStringTranslation("fast-blocks.moving-on-block-is-limited", "&cMoving on %fastblock% is restricted on the nether ceiling."); + // Teleport + this.teleport_commencing_in = getStringTranslation("teleport.commencing-in", "&bTeleport commencing in %seconds% seconds."); + this.teleport_dont_move = getStringTranslation("teleport.dont-move", "&3Don't move."); + this.teleport_cancelled = getStringTranslation("teleport.cancelled", "&3Teleport cancelled."); if (addedMissing) fileConfiguration.save(langFile); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { - NetherCeiling.getInstance().getLogger().warning("Translation file " + langFile + " is not formatted properly. Skipping it."); + NetherCeiling.getLog().warning("Translation file " + langFile + " is not formatted properly. Skipping it."); } } diff --git a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java index e114866..435d809 100644 --- a/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java +++ b/NetherCeiling-1.19.3/src/main/java/me/xginko/netherceiling/utils/CeilingUtils.java @@ -4,6 +4,7 @@ import me.xginko.netherceiling.config.Config; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; @@ -12,24 +13,28 @@ public class CeilingUtils { public static void teleportFromCeiling(Player player) { Config config = NetherCeiling.getConfiguration(); + Location playerLocation = player.getLocation(); + Location teleportDestination = new Location( + player.getWorld(), + playerLocation.getBlockX(), + config.nether_ceiling_y-config.teleport_distance_in_blocks, + playerLocation.getBlockZ() + ); // Teleport Player Downwards - player.teleport(new Location( - player.getWorld(), playerLocation.getBlockX(), config.nether_ceiling_y-config.teleport_distance_in_blocks, playerLocation.getBlockZ() - )); + player.teleport(teleportDestination.add(0.5, 0, 0.5)); // Center player + player.playSound(player.getEyeLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 1.0F); if (config.safe_teleport_enabled || player.hasPermission("netherceiling.safeteleport")) { - Location playerTeleportedLocation = player.getLocation(); - // Check block above for liquid or falling block - Block blockAboveHead = playerTeleportedLocation.getBlock().getRelative(BlockFace.UP, 2); + Block blockAboveHead = teleportDestination.getBlock().getRelative(BlockFace.UP, 2); if (blockAboveHead.isLiquid() || blockAboveHead.getType().hasGravity()) { blockAboveHead.setType(Material.NETHERRACK, false); } // Create air pocket for player - Block blockAtPlayerLegs = playerTeleportedLocation.getBlock(); + Block blockAtPlayerLegs = teleportDestination.getBlock(); if ( !blockAtPlayerLegs.getType().equals(Material.AIR) && !blockAtPlayerLegs.getType().equals(Material.NETHER_PORTAL) @@ -65,11 +70,6 @@ public static void teleportFromCeiling(Player player) { ) { blockBelowFeet.setType(Material.NETHERRACK, false); } - - // Teleport player to the center of that block to avoid glitching out of the safe box - player.teleport(new Location( - player.getWorld(), blockAtPlayerLegs.getX()+0.5, blockAtPlayerLegs.getY(), blockAtPlayerLegs.getZ()+0.5 - )); } } diff --git a/NetherCeiling-1.19.3/src/main/resources/lang/de_ch.yml b/NetherCeiling-1.19.3/src/main/resources/lang/de_ch.yml index b7152be..1e6d100 100644 --- a/NetherCeiling-1.19.3/src/main/resources/lang/de_ch.yml +++ b/NetherCeiling-1.19.3/src/main/resources/lang/de_ch.yml @@ -24,3 +24,7 @@ vehicles: potions: one-or-more-effects-removed: "&cEi oder mehreri Effekte si entfernt worde, da du di uf dr Netherdecki befindisch." one-or-more-effects-nerfed: "&cEi oder mehreri Effekte si abgeschwächt worde, da du di uf dr Netherdecki befindisch." +teleport: + commencing-in: "&3Teleport in %seconds% Sekunden." + dont-move: "&3Nid bewegä." + cancelled: "&cTeleport abgebrochen." \ No newline at end of file diff --git a/NetherCeiling-1.19.3/src/main/resources/lang/de_de.yml b/NetherCeiling-1.19.3/src/main/resources/lang/de_de.yml index 84a6916..2325596 100644 --- a/NetherCeiling-1.19.3/src/main/resources/lang/de_de.yml +++ b/NetherCeiling-1.19.3/src/main/resources/lang/de_de.yml @@ -25,4 +25,8 @@ potions: one-or-more-effects-removed: "&cEin oder mehrere Effekte wurden entfernt, da du dich auf der Netherdecke befindest." one-or-more-effects-nerfed: "&cEin oder mehrere Effekte wurden abgeschwächt, da du dich auf der Netherdecke befindest." fast-blocks: - moving-on-block-is-limited: "&cAuf %fastblock% kann auf der Netherdecke nur bedingt schnell gereist werden." \ No newline at end of file + moving-on-block-is-limited: "&cAuf %fastblock% kann auf der Netherdecke nur bedingt schnell gereist werden." +teleport: + commencing-in: "&3Teleport erfolgt in %seconds% Sekunden." + dont-move: "&3Nicht bewegen." + cancelled: "&cTeleport abgebrochen." \ No newline at end of file diff --git a/NetherCeiling-1.19.3/src/main/resources/lang/en_us.yml b/NetherCeiling-1.19.3/src/main/resources/lang/en_us.yml index 5e2bff1..e381fec 100644 --- a/NetherCeiling-1.19.3/src/main/resources/lang/en_us.yml +++ b/NetherCeiling-1.19.3/src/main/resources/lang/en_us.yml @@ -4,7 +4,7 @@ TRANSLATION: LOCALE: en-us no-permission: "&cYou don't have permission to use this command." -not-on-ceiling: "&c&cYou are not on the nether ceiling." +not-on-ceiling: "&cYou are not on the nether ceiling." general: cant-be-on-ceiling: "&cAccess to the nether ceiling is disabled." cant-move-on-ceiling: "&cYou can't move on the nether ceiling." @@ -25,4 +25,8 @@ potions: one-or-more-effects-removed: "&cOne or more effects have been removed because you're on the nether ceiling." one-or-more-effects-nerfed: "&cOne or more effects have been nerfed because you're on the nether ceiling." fast-blocks: - moving-on-block-is-limited: "&cMoving on %fastblock% is restricted on the nether ceiling." \ No newline at end of file + moving-on-block-is-limited: "&cMoving on %fastblock% is restricted on the nether ceiling." +teleport: + commencing-in: "&3Teleport commencing in %seconds% seconds." + dont-move: "&3Don't move." + cancelled: "&cTeleport cancelled." \ No newline at end of file