diff --git a/plugin/src/main/java/com/denizenscript/denizen/Denizen.java b/plugin/src/main/java/com/denizenscript/denizen/Denizen.java index e9e1e9531f..26f2f1d96d 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/Denizen.java +++ b/plugin/src/main/java/com/denizenscript/denizen/Denizen.java @@ -487,7 +487,7 @@ public void onDisable() { getLogger().log(Level.INFO, " v" + getDescription().getVersion() + " disabled."); Bukkit.getServer().getScheduler().cancelTasks(this); HandlerList.unregisterAll(this); - saveSaves(false); + saveSaves(true); worldFlags.shutdown(); } @@ -536,9 +536,9 @@ public FileConfiguration getScoreboards() { /** * Immediately saves all non-core save data. - * @param canSleep 'true' if the system should sleep and lock the thread until saves are complete. 'false' is saves can happen in the future. + * @param lockUntilDone 'true' if the system should sleep and lock the thread until saves are complete. 'false' is saves can happen in the future. */ - public void saveSaves(boolean canSleep) { + public void saveSaves(boolean lockUntilDone) { // Save scoreboards to scoreboards.yml ScoreboardHelper._saveScoreboards(); // Save maps to maps.yml @@ -550,9 +550,9 @@ public void saveSaves(boolean canSleep) { catch (IOException ex) { Logger.getLogger(JavaPlugin.class.getName()).log(Level.SEVERE, "Could not save to " + scoreboardsConfigFile, ex); } - PlayerFlagHandler.saveAllNow(canSleep); + PlayerFlagHandler.saveAllNow(lockUntilDone); worldFlags.saveAll(); - RunLaterCommand.saveToFile(!canSleep); + RunLaterCommand.saveToFile(!lockUntilDone); } @Override diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java index 29802cab5c..8f27bdc0bc 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java @@ -2655,7 +2655,7 @@ else if (yaw < 315) { int index = 0; Location tstart = object.getBlockLocation(); double tstartY = tstart.getY(); - int radiusInt = (int) radius; + int radiusInt = (int) Math.ceil(radius); fullloop: for (int y = -radiusInt; y <= radiusInt; y++) { double newY = y + tstartY; @@ -2699,7 +2699,7 @@ else if (yaw < 315) { int index = 0; Location tstart = object.getBlockLocation(); double tstartY = tstart.getY(); - int radiusInt = (int) radius; + int radiusInt = (int) Math.ceil(radius); fullloop: for (int y = -radiusInt; y <= radiusInt; y++) { double newY = y + tstartY; diff --git a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java index 371bfadc09..adcdbcdaf8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java +++ b/plugin/src/main/java/com/denizenscript/denizen/tags/core/ServerTagBase.java @@ -2625,7 +2625,7 @@ public static void adjustServer(Mechanism mechanism) { // --> if (mechanism.matches("save")) { DenizenCore.saveAll(); - Denizen.getInstance().saveSaves(true); + Denizen.getInstance().saveSaves(false); } // <--[mechanism] diff --git a/plugin/src/main/java/com/denizenscript/denizen/utilities/LegacySavesUpdater.java b/plugin/src/main/java/com/denizenscript/denizen/utilities/LegacySavesUpdater.java index 170eef0702..cf224ee1b8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/utilities/LegacySavesUpdater.java +++ b/plugin/src/main/java/com/denizenscript/denizen/utilities/LegacySavesUpdater.java @@ -137,7 +137,7 @@ public void run() { } }.runTaskLater(Denizen.getInstance(), 3); } - Denizen.getInstance().saveSaves(true); + Denizen.getInstance().saveSaves(false); Debug.log("==== Done updating legacy saves (except NPCs) ===="); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/utilities/command/DenizenCommandHandler.java b/plugin/src/main/java/com/denizenscript/denizen/utilities/command/DenizenCommandHandler.java index 27a8336613..87e4abfcb0 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/utilities/command/DenizenCommandHandler.java +++ b/plugin/src/main/java/com/denizenscript/denizen/utilities/command/DenizenCommandHandler.java @@ -274,7 +274,7 @@ public void version(CommandContext args, CommandSender sender) throws CommandExc min = 1, max = 3, permission = "denizen.basic") public void save(CommandContext args, CommandSender sender) throws CommandException { DenizenCore.saveAll(); - Denizen.getInstance().saveSaves(true); + Denizen.getInstance().saveSaves(false); Messaging.send(sender, "Denizen save data saved to disk from memory."); } diff --git a/plugin/src/main/java/com/denizenscript/denizen/utilities/flags/PlayerFlagHandler.java b/plugin/src/main/java/com/denizenscript/denizen/utilities/flags/PlayerFlagHandler.java index 6e11c234dc..8a99b42601 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/utilities/flags/PlayerFlagHandler.java +++ b/plugin/src/main/java/com/denizenscript/denizen/utilities/flags/PlayerFlagHandler.java @@ -254,11 +254,11 @@ public void run() { } } - public static void saveAllNow(boolean canSleep) { + public static void saveAllNow(boolean lockUntilDone) { for (Map.Entry entry : playerFlagTrackerCache.entrySet()) { CachedPlayerFlag flags = entry.getValue(); if (flags.tracker.modified) { - if (!canSleep && flags.savingNow.get() || flags.loadingNow.get()) { + if (!lockUntilDone && flags.savingNow.get() || flags.loadingNow.get()) { continue; } while (flags.savingNow.get() || flags.loadingNow.get()) {