mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge remote-tracking branch 'origin/TFM-1.15' into TFM-1.15
This commit is contained in:
commit
c5d778896e
@ -58,7 +58,7 @@ public class EntityWiper extends FreedomService
|
||||
{
|
||||
for (Entity entity : world.getEntities())
|
||||
{
|
||||
if (!BLACKLIST.contains(entity.getType()) && !Groups.MOB_TYPES.contains(entity.getType()))
|
||||
if (!BLACKLIST.contains(entity.getType()) || !Groups.MOB_TYPES.contains(entity.getType()))
|
||||
{
|
||||
entity.remove();
|
||||
removed++;
|
||||
|
@ -1,46 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unloads chunks not currently in use", usage = "/<command>", aliases = "uc")
|
||||
public class Command_unloadchunks extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unloading unused chunks", false);
|
||||
|
||||
int numChunks = 0;
|
||||
|
||||
for (World world : server.getWorlds())
|
||||
{
|
||||
numChunks += unloadUnusedChunks(world);
|
||||
}
|
||||
|
||||
FUtil.playerMsg(sender, numChunks + " chunks unloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private int unloadUnusedChunks(World world)
|
||||
{
|
||||
int numChunks = 0;
|
||||
|
||||
for (Chunk loadedChunk : world.getLoadedChunks())
|
||||
{
|
||||
if (!world.isChunkInUse(loadedChunk.getX(), loadedChunk.getZ()) && world.unloadChunk(loadedChunk))
|
||||
{
|
||||
numChunks++;
|
||||
}
|
||||
}
|
||||
|
||||
return numChunks;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user