mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Optimize kill road mobs + fix plotme conversion for 0.17
This commit is contained in:
parent
7eeea0f10f
commit
326e5615a0
@ -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.12.5</version>
|
<version>2.12.6</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -5,23 +5,19 @@ import java.io.IOException;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.nio.file.Files;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.command.SimpleCommandMap;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -116,7 +112,10 @@ import com.intellectualcrafters.plot.listeners.TNTListener;
|
|||||||
import com.intellectualcrafters.plot.listeners.WorldEvents;
|
import com.intellectualcrafters.plot.listeners.WorldEvents;
|
||||||
import com.intellectualcrafters.plot.listeners.worldedit.WEListener;
|
import com.intellectualcrafters.plot.listeners.worldedit.WEListener;
|
||||||
import com.intellectualcrafters.plot.listeners.worldedit.WESubscriber;
|
import com.intellectualcrafters.plot.listeners.worldedit.WESubscriber;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.titles.AbstractTitle;
|
import com.intellectualcrafters.plot.titles.AbstractTitle;
|
||||||
import com.intellectualcrafters.plot.titles.DefaultTitle;
|
import com.intellectualcrafters.plot.titles.DefaultTitle;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
@ -351,8 +350,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
return new BukkitTaskManager();
|
return new BukkitTaskManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ArrayDeque<Entity> fastTickEntities;
|
||||||
|
private ArrayDeque<Entity> slowTickEntities;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runEntityTask() {
|
public void runEntityTask() {
|
||||||
|
// fastTickEntities = new ArrayDeque<>();
|
||||||
|
// slowTickEntities = new ArrayDeque<>();
|
||||||
log(C.PREFIX.s() + "KillAllEntities started.");
|
log(C.PREFIX.s() + "KillAllEntities started.");
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTaskRepeat(new Runnable() {
|
||||||
long ticked = 0l;
|
long ticked = 0l;
|
||||||
@ -368,21 +372,102 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
this.error = 0l;
|
this.error = 0l;
|
||||||
}
|
}
|
||||||
World world;
|
World world;
|
||||||
for (final String w : PS.get().getPlotWorlds()) {
|
for (final PlotWorld pw : PS.get().getPlotWorldObjects()) {
|
||||||
world = Bukkit.getWorld(w);
|
PlotManager manager = PS.get().getPlotManager(pw.worldname);
|
||||||
|
world = Bukkit.getWorld(pw.worldname);
|
||||||
try {
|
try {
|
||||||
if (world.getLoadedChunks().length < 1) {
|
for (Entity entity : world.getEntities()) {
|
||||||
continue;
|
switch (entity.getType()) {
|
||||||
}
|
case EGG:
|
||||||
for (final Chunk chunk : world.getLoadedChunks()) {
|
case ENDER_CRYSTAL:
|
||||||
final Entity[] entities = chunk.getEntities();
|
case COMPLEX_PART:
|
||||||
Entity entity;
|
case ARMOR_STAND:
|
||||||
for (int i = entities.length - 1; i >= 0; i--) {
|
case FISHING_HOOK:
|
||||||
if (!((entity = entities[i]) instanceof Player) && (MainUtil.getPlot(BukkitUtil.getLocation(entity)) == null)) {
|
case ENDER_SIGNAL:
|
||||||
|
case EXPERIENCE_ORB:
|
||||||
|
case LEASH_HITCH:
|
||||||
|
case FIREWORK:
|
||||||
|
case WEATHER:
|
||||||
|
case LIGHTNING:
|
||||||
|
case WITHER_SKULL:
|
||||||
|
case UNKNOWN:
|
||||||
|
case ITEM_FRAME:
|
||||||
|
case PAINTING:
|
||||||
|
case PLAYER: {
|
||||||
|
// non moving / unremovable
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case THROWN_EXP_BOTTLE:
|
||||||
|
case SPLASH_POTION:
|
||||||
|
case SNOWBALL:
|
||||||
|
case ENDER_PEARL:
|
||||||
|
case ARROW: {
|
||||||
|
// managed elsewhere | projectile
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case MINECART:
|
||||||
|
case MINECART_CHEST:
|
||||||
|
case MINECART_COMMAND:
|
||||||
|
case MINECART_FURNACE:
|
||||||
|
case MINECART_HOPPER:
|
||||||
|
case MINECART_MOB_SPAWNER:
|
||||||
|
case MINECART_TNT:
|
||||||
|
case BOAT: {
|
||||||
|
// vehicle
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case SMALL_FIREBALL:
|
||||||
|
case FIREBALL:
|
||||||
|
case DROPPED_ITEM: {
|
||||||
|
// dropped item
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case PRIMED_TNT:
|
||||||
|
case FALLING_BLOCK: {
|
||||||
|
// managed elsewhere
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
case BAT:
|
||||||
|
case BLAZE:
|
||||||
|
case CAVE_SPIDER:
|
||||||
|
case CHICKEN:
|
||||||
|
case COW:
|
||||||
|
case CREEPER:
|
||||||
|
case ENDERMAN:
|
||||||
|
case ENDERMITE:
|
||||||
|
case ENDER_DRAGON:
|
||||||
|
case GHAST:
|
||||||
|
case GIANT:
|
||||||
|
case GUARDIAN:
|
||||||
|
case HORSE:
|
||||||
|
case IRON_GOLEM:
|
||||||
|
case MAGMA_CUBE:
|
||||||
|
case MUSHROOM_COW:
|
||||||
|
case OCELOT:
|
||||||
|
case PIG:
|
||||||
|
case PIG_ZOMBIE:
|
||||||
|
case RABBIT:
|
||||||
|
case SHEEP:
|
||||||
|
case SILVERFISH:
|
||||||
|
case SKELETON:
|
||||||
|
case SLIME:
|
||||||
|
case SNOWMAN:
|
||||||
|
case SPIDER:
|
||||||
|
case SQUID:
|
||||||
|
case VILLAGER:
|
||||||
|
case WITCH:
|
||||||
|
case WITHER:
|
||||||
|
case WOLF:
|
||||||
|
case ZOMBIE:
|
||||||
|
default: {
|
||||||
|
Location loc = entity.getLocation();
|
||||||
|
if (manager.getPlotIdAbs(pw, loc.getBlockX(), 0, loc.getBlockZ()) == null) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
++this.error;
|
++this.error;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -138,8 +138,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
r.close();
|
r.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
try {
|
try {
|
||||||
MainUtil.sendConsoleMessage(" - " + plugin + "_denied");
|
MainUtil.sendConsoleMessage(" - " + plugin + "core_denied");
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "_denied`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_denied`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
|
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
@ -153,8 +153,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
plot.denied.add(denied);
|
plot.denied.add(denied);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainUtil.sendConsoleMessage(" - " + plugin + "_allowed");
|
MainUtil.sendConsoleMessage(" - " + plugin + "core_allowed");
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "_allowed`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_allowed`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
|
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
@ -171,7 +171,9 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
stmt.close();
|
stmt.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {}
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
||||||
|
|
||||||
for (Entry<Integer, Plot> entry : plots.entrySet()) {
|
for (Entry<Integer, Plot> entry : plots.entrySet()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user