Different way of checking spawn radius

This commit is contained in:
mathiascode 2020-03-18 00:31:47 +02:00
parent 7546fa0e1e
commit d3b171b5db
2 changed files with 8 additions and 8 deletions

View file

@ -2,15 +2,14 @@ package pw.kaboom.extras.commands;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
public final class CommandDestroyEntities implements CommandExecutor {
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
int entityCount = 0;
int worldCount = 0;
@ -24,6 +23,7 @@ public final class CommandDestroyEntities implements CommandExecutor {
}
worldCount++;
}
sender.sendMessage("Successfully destroyed " + entityCount + " entities in " + worldCount + " worlds");
return true;
}

View file

@ -61,12 +61,6 @@ public final class PlayerConnection implements Listener {
}
}
final Integer spawnRadius = Bukkit.getWorld("world").getGameRuleValue(GameRule.SPAWN_RADIUS);
if (spawnRadius > 100) {
Bukkit.getWorld("world").setGameRule(GameRule.SPAWN_RADIUS, 100);
}
try {
final PlayerProfile profile = event.getPlayerProfile();
@ -191,6 +185,12 @@ public final class PlayerConnection implements Listener {
world.setGameRule(GameRule.RANDOM_TICK_SPEED, 6);
}
final Integer spawnRadius = world.getGameRuleValue(GameRule.SPAWN_RADIUS);
if (spawnRadius > 100) {
world.setGameRule(GameRule.SPAWN_RADIUS, 100);
}
if (!world.isAutoSave()) {
world.setAutoSave(true);
}