mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-31 01:23:44 +01:00 
			
		
		
		
	Fixes + options
- Fixed plot deletion not removing denied from DB - Fixed help not displaying all pages correctly - Added option for plot expiry clear interval
This commit is contained in:
		| @@ -8,7 +8,7 @@ | |||||||
| 	    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 	    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||||||
| 	</properties> | 	</properties> | ||||||
|     <artifactId>PlotSquared</artifactId> |     <artifactId>PlotSquared</artifactId> | ||||||
|     <version>2.11.0</version> |     <version>2.11.3</version> | ||||||
|     <name>PlotSquared</name> |     <name>PlotSquared</name> | ||||||
|     <packaging>jar</packaging> |     <packaging>jar</packaging> | ||||||
|     <build> |     <build> | ||||||
|   | |||||||
| @@ -848,6 +848,7 @@ public class PlotSquared { | |||||||
|         options.put("clear.check-disk", Settings.AUTO_CLEAR_CHECK_DISK); |         options.put("clear.check-disk", Settings.AUTO_CLEAR_CHECK_DISK); | ||||||
|         options.put("clear.on.ban", false); |         options.put("clear.on.ban", false); | ||||||
|         options.put("clear.fastmode", Settings.ENABLE_CLUSTERS); |         options.put("clear.fastmode", Settings.ENABLE_CLUSTERS); | ||||||
|  |         options.put("clear.auto.clear-interval-seconds", Settings.CLEAR_INTERVAL); | ||||||
|          |          | ||||||
|         // Schematics |         // Schematics | ||||||
|         options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); |         options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); | ||||||
| @@ -925,6 +926,8 @@ public class PlotSquared { | |||||||
|         Settings.AUTO_CLEAR_CHECK_DISK = config.getBoolean("clear.check-disk"); |         Settings.AUTO_CLEAR_CHECK_DISK = config.getBoolean("clear.check-disk"); | ||||||
|         Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled"); |         Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled"); | ||||||
|          |          | ||||||
|  |         Settings.CLEAR_INTERVAL = config.getInt("clear.auto.clear-interval-seconds"); | ||||||
|  |          | ||||||
|         // Schematics |         // Schematics | ||||||
|         Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); |         Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); | ||||||
|          |          | ||||||
|   | |||||||
| @@ -74,7 +74,7 @@ public class MainCommand { | |||||||
|         // final int totalPages = ((int) Math.ceil(12 * (commands.size()) / |         // final int totalPages = ((int) Math.ceil(12 * (commands.size()) / | ||||||
|         // 100)); |         // 100)); | ||||||
|         final int perPage = 5; |         final int perPage = 5; | ||||||
|         final int totalPages = (int) Math.ceil(commands.size() / perPage); |         final int totalPages = (commands.size() / perPage) + (commands.size() % perPage == 0 ? 0 : 1); | ||||||
|         if (page > totalPages) { |         if (page > totalPages) { | ||||||
|             page = totalPages; |             page = totalPages; | ||||||
|         } |         } | ||||||
| @@ -85,13 +85,19 @@ public class MainCommand { | |||||||
|         final List<String> help = new ArrayList<>(); |         final List<String> help = new ArrayList<>(); | ||||||
|         help.add(C.HELP_HEADER.s()); |         help.add(C.HELP_HEADER.s()); | ||||||
|         // HELP_CATEGORY("&cCategory: &6%category%&c, Page: %current%&c/&6%max%&c, Displaying: &6%dis%&c/&6%total%"), |         // HELP_CATEGORY("&cCategory: &6%category%&c, Page: %current%&c/&6%max%&c, Displaying: &6%dis%&c/&6%total%"), | ||||||
|         help.add(C.HELP_CATEGORY.s().replace("%category%", category == null ? "All" : category.toString()).replace("%current%", "" + (page + 1)).replace("%max%", "" + (totalPages + 1)).replace("%dis%", "" + (commands.size() % perPage)).replace("%total%", "" + commands.size())); |         help.add(C.HELP_CATEGORY.s().replace("%category%", category == null ? "All" : category.toString()).replace("%current%", "" + (page + 1)).replace("%max%", "" + (totalPages)).replace("%dis%", "" + (commands.size() % perPage)).replace("%total%", "" + commands.size())); | ||||||
|         SubCommand cmd; |         SubCommand cmd; | ||||||
|         final int start = page * perPage; |         final int start = page * perPage; | ||||||
|         for (int x = start; x < max; x++) { |         for (int x = start; x < max; x++) { | ||||||
|             cmd = commands.get(x); |             cmd = commands.get(x); | ||||||
|             String s = t(C.HELP_ITEM.s()); |             String s = t(C.HELP_ITEM.s()); | ||||||
|             s = s.replace("%alias%", cmd.alias.get(0)).replace("%usage%", cmd.usage.contains("plot") ? cmd.usage : "/plot " + cmd.usage).replace("%cmd%", cmd.cmd).replace("%desc%", cmd.description); |             if (cmd.alias.size() > 0) { | ||||||
|  |                 s = s.replace("%alias%", cmd.alias.get(0)); | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 s = s.replace("%alias%", ""); | ||||||
|  |             } | ||||||
|  |             s = s.replace("%usage%", cmd.usage.contains("plot") ? cmd.usage : "/plot " + cmd.usage).replace("%cmd%", cmd.cmd).replace("%desc%", cmd.description).replace("[]", ""); | ||||||
|             help.add(s); |             help.add(s); | ||||||
|         } |         } | ||||||
|         if (help.size() < 2) { |         if (help.size() < 2) { | ||||||
|   | |||||||
| @@ -142,6 +142,7 @@ public class Settings { | |||||||
|     public static int AUTO_CLEAR_DAYS = 360; |     public static int AUTO_CLEAR_DAYS = 360; | ||||||
|     public static boolean AUTO_CLEAR_CHECK_DISK = false; |     public static boolean AUTO_CLEAR_CHECK_DISK = false; | ||||||
|     public static int MIN_BLOCKS_CHANGED = -1; |     public static int MIN_BLOCKS_CHANGED = -1; | ||||||
|  |     public static int CLEAR_INTERVAL = 120; | ||||||
|     /** |     /** | ||||||
|      * API Location |      * API Location | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -676,6 +676,10 @@ public class SQLManager implements AbstractDB { | |||||||
|                     stmt.setInt(1, id); |                     stmt.setInt(1, id); | ||||||
|                     stmt.executeUpdate(); |                     stmt.executeUpdate(); | ||||||
|                     stmt.close(); |                     stmt.close(); | ||||||
|  |                     stmt = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_denied` WHERE `plot_plot_id` = ?"); | ||||||
|  |                     stmt.setInt(1, id); | ||||||
|  |                     stmt.executeUpdate(); | ||||||
|  |                     stmt.close(); | ||||||
|                     stmt = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ?"); |                     stmt = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ?"); | ||||||
|                     stmt.setString(1, world); |                     stmt.setString(1, world); | ||||||
|                     stmt.setInt(2, plot.hashCode()); |                     stmt.setInt(2, plot.hashCode()); | ||||||
|   | |||||||
| @@ -75,6 +75,7 @@ public abstract class HybridUtils { | |||||||
|             boolean c1 = MainUtil.isPlotArea(new Location(plotworld.worldname, x, 1, z)); |             boolean c1 = MainUtil.isPlotArea(new Location(plotworld.worldname, x, 1, z)); | ||||||
|             boolean c2 = MainUtil.isPlotArea(new Location(plotworld.worldname, ex, 1, ez)); |             boolean c2 = MainUtil.isPlotArea(new Location(plotworld.worldname, ex, 1, ez)); | ||||||
|             if (!c1 && !c2) { |             if (!c1 && !c2) { | ||||||
|  |                 System.out.print("FALSE!"); | ||||||
|                 return false; |                 return false; | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
| @@ -112,7 +113,8 @@ public abstract class HybridUtils { | |||||||
|                         } |                         } | ||||||
|                         boolean condition; |                         boolean condition; | ||||||
|                         if (toCheck) { |                         if (toCheck) { | ||||||
|                             condition = MainUtil.isPlotRoad(new Location(plotworld.worldname, x + X, 1, z + Z)); |                             condition = manager.getPlotId(plotworld, x + X, 1, z + Z) == null; | ||||||
|  | //                            condition = MainUtil.isPlotRoad(new Location(plotworld.worldname, x + X, 1, z + Z)); | ||||||
|                         } else { |                         } else { | ||||||
|                             final boolean gx = absX > plotworld.PATH_WIDTH_LOWER; |                             final boolean gx = absX > plotworld.PATH_WIDTH_LOWER; | ||||||
|                             final boolean gz = absZ > plotworld.PATH_WIDTH_LOWER; |                             final boolean gz = absZ > plotworld.PATH_WIDTH_LOWER; | ||||||
|   | |||||||
| @@ -65,7 +65,7 @@ public class ExpireManager { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void runTask() { |     public static void runTask() { | ||||||
|         ExpireManager.task = Bukkit.getScheduler().scheduleSyncRepeatingTask(BukkitMain.THIS, new Runnable() { |         ExpireManager.task = TaskManager.runTaskRepeat(new Runnable() { | ||||||
|             @Override |             @Override | ||||||
|             public void run() { |             public void run() { | ||||||
|                 for (final String world : PlotSquared.getPlotWorldsString()) { |                 for (final String world : PlotSquared.getPlotWorldsString()) { | ||||||
| @@ -131,7 +131,7 @@ public class ExpireManager { | |||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }, 2400, 2400); |         }, Settings.CLEAR_INTERVAL * 20); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static boolean isExpired(final UUID uuid) { |     public static boolean isExpired(final UUID uuid) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 boy0001
					boy0001