Clamp /searchcontainer radius (#117)
Default max is 10 because that's the default server view distance.
This commit is contained in:
		@@ -76,6 +76,10 @@ public class SearchContainerCommand implements TabExecutor {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Clamp radius.
 | 
			
		||||
        int configMax = plugin.getConfig().getInt("settings.command.searchcontainer.max-radius", 10);
 | 
			
		||||
        radius = Math.max(0, Math.min(radius, configMax));
 | 
			
		||||
 | 
			
		||||
        World world = senderPlayer.getWorld();
 | 
			
		||||
        Chunk centerChunk = senderPlayer.getLocation().getChunk();
 | 
			
		||||
        StringBuilder locations = new StringBuilder();
 | 
			
		||||
 
 | 
			
		||||
@@ -71,6 +71,7 @@ public record ConfigUpdater(OpenInv plugin) {
 | 
			
		||||
    private void updateConfig5To6() {
 | 
			
		||||
        plugin.getServer().getScheduler().runTask(plugin, () -> {
 | 
			
		||||
            plugin.getConfig().set("settings.command.open.no-args-opens-self", false);
 | 
			
		||||
            plugin.getConfig().set("settings.command.searchcontainer.max-radius", 10);
 | 
			
		||||
            plugin.getConfig().set("config-version", 6);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user