diff --git a/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java b/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java index 00a5f57..b5d7dd2 100644 --- a/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java +++ b/src/main/java/xyz/nkomarn/Harbor/command/HarborCommand.java @@ -20,17 +20,17 @@ public class HarborCommand implements TabExecutor { final String prefix = Config.getString("messages.miscellaneous.chat-prefix"); if (args.length < 1 || !sender.hasPermission("harbor.admin")) { - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + "&7Harbor version " - + Harbor.version + " by TechToolbox (@nkomarn).")); + sender.sendMessage(ChatColor.translateAlternateColorCodes('&', String.format( + "%sHarbor version %s by TechToolbox (@nkomarn).", prefix, Harbor.version))); } else if (args[0].equalsIgnoreCase("reload")) { Harbor.getHarbor().reloadConfig(); sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix - + "&7Reloaded configuration.")); + + "Reloaded configuration.")); } else if (args[0].equalsIgnoreCase("forceskip")) { if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix - + "&7This command requires you to be a player.")); + + "This command requires you to be a player.")); return true; } @@ -39,14 +39,13 @@ public class HarborCommand implements TabExecutor { if (Checker.skippingWorlds.contains(world)) { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix - + "&7This world's time is already being accelerated.")); - return true; + + "This world's time is already being accelerated.")); + } else { + Checker.skippingWorlds.add(world); + new AccelerateNightTask(world).runTaskTimer(Harbor.getHarbor(), 0L, 1); + sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + + "Forcing night skip in your world.")); } - - Checker.skippingWorlds.add(world); - new AccelerateNightTask(world).runTaskTimer(Harbor.getHarbor(), 0L, 1); - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix - + "&7Forcing night skip in your world.")); } else { sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + Config.getString("messages.miscellaneous.unrecognized-command"))); diff --git a/src/main/java/xyz/nkomarn/Harbor/listener/BedListener.java b/src/main/java/xyz/nkomarn/Harbor/listener/BedListener.java index 477a96d..0f19ad8 100644 --- a/src/main/java/xyz/nkomarn/Harbor/listener/BedListener.java +++ b/src/main/java/xyz/nkomarn/Harbor/listener/BedListener.java @@ -22,6 +22,7 @@ public class BedListener implements Listener { public void onBedEnter(final PlayerBedEnterEvent event) { if (event.getBedEnterResult() != PlayerBedEnterEvent.BedEnterResult.OK) return; if (Checker.skippingWorlds.contains(event.getPlayer().getWorld())) return; + if (Checker.isVanished(event.getPlayer())) return; Bukkit.getScheduler().runTaskLater(Harbor.getHarbor(), () -> { final UUID playerUuid = event.getPlayer().getUniqueId(); @@ -39,6 +40,7 @@ public class BedListener implements Listener { @EventHandler(ignoreCancelled = true) public void onBedLeave(final PlayerBedLeaveEvent event) { if (Checker.skippingWorlds.contains(event.getPlayer().getWorld())) return; + if (Checker.isVanished(event.getPlayer())) return; Bukkit.getScheduler().runTaskLater(Harbor.getHarbor(), () -> { final UUID playerUuid = event.getPlayer().getUniqueId();