@Override public boolean initPlotMeConverter() { TaskManager.runTaskLaterAsync( new Runnable() { @Override public void run() { if (!(new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector()))) { new LikePlotMeConverter("AthionPlots").run(new ClassicPlotMeConnector()); } } }, 20); return Bukkit.getPluginManager().getPlugin("PlotMe") != null || Bukkit.getPluginManager().getPlugin("AthionPlots") != null; }
@Override public void runEntityTask() { log(C.PREFIX.s() + "KillAllEntities started."); TaskManager.runTaskRepeat( new Runnable() { long ticked = 0l; long error = 0l; @Override public void run() { if (this.ticked > 36_000L) { this.ticked = 0l; if (this.error > 0) { log( C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + this.error); } this.error = 0l; } World world; for (final String w : PS.get().getPlotWorlds()) { world = Bukkit.getWorld(w); try { if (world.getLoadedChunks().length < 1) { continue; } for (final Chunk chunk : world.getLoadedChunks()) { final Entity[] entities = chunk.getEntities(); Entity entity; for (int i = entities.length - 1; i >= 0; i--) { if (!((entity = entities[i]) instanceof Player) && (MainUtil.getPlot(BukkitUtil.getLocation(entity)) == null)) { entity.remove(); } } } } catch (final Throwable e) { ++this.error; } finally { ++this.ticked; } } } }, 20); }
@Override public final ChunkGenerator getDefaultWorldGenerator(final String world, final String id) { WorldEvents.lastWorld = world; if (!PS.get().setupPlotWorld(world, id)) { return null; } HybridGen result = new HybridGen(world); TaskManager.runTaskLater( new Runnable() { @Override public void run() { if (WorldEvents.lastWorld != null && WorldEvents.lastWorld.equals(world)) { WorldEvents.lastWorld = null; } } }, 20); return result; }