mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
.
This commit is contained in:
parent
d1e9ccb3e8
commit
430f4fca41
@ -300,7 +300,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
System.out.print("SET BLOCK MANAGER");
|
||||
return BlockManager.manager = new BukkitUtil();
|
||||
}
|
||||
|
||||
|
@ -721,7 +721,7 @@ public class PlotSquared {
|
||||
setupStyle();
|
||||
} catch (final Exception err) {
|
||||
Logger.add(LogLevel.DANGER, "Failed to save style.yml");
|
||||
System.out.println("failed to save style.yml");
|
||||
log("failed to save style.yml");
|
||||
}
|
||||
try {
|
||||
configFile = new File(IMP.getDirectory() + File.separator + "config" + File.separator + "settings.yml");
|
||||
@ -734,7 +734,7 @@ public class PlotSquared {
|
||||
setupConfig();
|
||||
} catch (final Exception err_trans) {
|
||||
Logger.add(LogLevel.DANGER, "Failed to save settings.yml");
|
||||
System.out.println("Failed to save settings.yml");
|
||||
log("Failed to save settings.yml");
|
||||
}
|
||||
try {
|
||||
storageFile = new File(IMP.getDirectory() + File.separator + "config" + File.separator + "storage.yml");
|
||||
@ -747,7 +747,7 @@ public class PlotSquared {
|
||||
setupStorage();
|
||||
} catch (final Exception err_trans) {
|
||||
Logger.add(LogLevel.DANGER, "Failed to save storage.yml");
|
||||
System.out.println("Failed to save storage.yml");
|
||||
log("Failed to save storage.yml");
|
||||
}
|
||||
try {
|
||||
style.save(styleFile);
|
||||
|
@ -92,7 +92,7 @@ public class DebugClear extends SubCommand {
|
||||
final Location pos1 = MainUtil.getPlotBottomLoc(loc.getWorld(), plot.id).add(1, 0, 1);
|
||||
final Location pos2 = MainUtil.getPlotTopLoc(loc.getWorld(), plot.id);
|
||||
if (MainUtil.runners.containsKey(plot)) {
|
||||
MainUtil.sendMessage(null, C.WAIT_FOR_TIMER);
|
||||
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
|
||||
return false;
|
||||
}
|
||||
MainUtil.runners.put(plot, 1);
|
||||
|
@ -84,7 +84,6 @@ public class MainCommand {
|
||||
}
|
||||
final List<String> help = new ArrayList<>();
|
||||
help.add(C.HELP_HEADER.s());
|
||||
System.out.print(C.HELP_HEADER.s());
|
||||
// HELP_CATEGORY("&cCategory: &6%category%&c, Page: %current%&c/&6%max%&c, Displaying: &6%dis%&c/&6%total%"),
|
||||
help.add(C.HELP_CATEGORY.s().replace("%category%", category == null ? "All" : category.toString()).replace("%current%", "" + (page + 1)).replace("%max%", "" + (totalPages + 1)).replace("%dis%", "" + (commands.size() % perPage)).replace("%total%", "" + commands.size()));
|
||||
SubCommand cmd;
|
||||
|
@ -128,7 +128,7 @@ public class Trim extends SubCommand {
|
||||
final ChunkLoc loc = new ChunkLoc(x, z);
|
||||
empty.add(loc);
|
||||
} catch (final Exception e) {
|
||||
System.out.print("INVALID MCA: " + name);
|
||||
PlotSquared.log("INVALID MCA: " + name);
|
||||
}
|
||||
} else {
|
||||
final Path path = Paths.get(file.getPath());
|
||||
@ -145,7 +145,7 @@ public class Trim extends SubCommand {
|
||||
final ChunkLoc loc = new ChunkLoc(x, z);
|
||||
empty.add(loc);
|
||||
} catch (final Exception e) {
|
||||
System.out.print("INVALID MCA: " + name);
|
||||
PlotSquared.log("INVALID MCA: " + name);
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
@ -180,7 +180,6 @@ public class Trim extends SubCommand {
|
||||
while ((System.currentTimeMillis() - start) < 50) {
|
||||
if (plots.size() == 0) {
|
||||
empty.addAll(chunks);
|
||||
System.out.print("DONE!");
|
||||
Trim.TASK = false;
|
||||
TaskManager.runTaskAsync(whenDone);
|
||||
PlotSquared.TASK.cancelTask(Trim.TASK_ID);
|
||||
|
@ -83,6 +83,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.setCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT, pos1.getZ()), new Location(world, pos2.getX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getZ() + 1), plotfloor);
|
||||
TaskManager.runTask(whenDone);
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
|
@ -87,7 +87,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
PlotSquared.log("&c - road schematics are disabled for this world.");
|
||||
this.ROAD_SCHEMATIC_ENABLED = false;
|
||||
}
|
||||
System.out.print("LOADED!");
|
||||
}
|
||||
|
||||
public void setupSchematics() {
|
||||
|
@ -9,13 +9,13 @@ public abstract class TaskManager {
|
||||
|
||||
public abstract int taskRepeat(final Runnable r, int interval);
|
||||
|
||||
public abstract int taskAsync(final Runnable r);
|
||||
public abstract void taskAsync(final Runnable r);
|
||||
|
||||
public abstract int task(final Runnable r);
|
||||
public abstract void task(final Runnable r);
|
||||
|
||||
public abstract int taskLater(final Runnable r, int delay);
|
||||
public abstract void taskLater(final Runnable r, int delay);
|
||||
|
||||
public abstract int taskLaterAsync(final Runnable r, int delay);
|
||||
public abstract void taskLaterAsync(final Runnable r, int delay);
|
||||
|
||||
public abstract void cancelTask(int task);
|
||||
|
||||
@ -26,31 +26,27 @@ public abstract class TaskManager {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int runTaskAsync(final Runnable r) {
|
||||
public static void runTaskAsync(final Runnable r) {
|
||||
if (r != null) {
|
||||
return PlotSquared.TASK.taskAsync(r);
|
||||
PlotSquared.TASK.taskAsync(r);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int runTask(final Runnable r) {
|
||||
public static void runTask(final Runnable r) {
|
||||
if (r != null) {
|
||||
return PlotSquared.TASK.task(r);
|
||||
PlotSquared.TASK.task(r);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int runTaskLater(final Runnable r, final int delay) {
|
||||
public static void runTaskLater(final Runnable r, final int delay) {
|
||||
if (r != null) {
|
||||
return PlotSquared.TASK.taskLater(r, delay);
|
||||
PlotSquared.TASK.taskLater(r, delay);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int runTaskLaterAsync(final Runnable r, final int delay) {
|
||||
public static void runTaskLaterAsync(final Runnable r, final int delay) {
|
||||
if (r != null) {
|
||||
return PlotSquared.TASK.taskLaterAsync(r, delay);
|
||||
PlotSquared.TASK.taskLaterAsync(r, delay);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.intellectualcrafters.plot.util.bukkit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.intellectualcrafters.plot.BukkitMain;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
@ -12,23 +13,23 @@ public class BukkitTaskManager extends TaskManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int taskAsync(final Runnable r) {
|
||||
return BukkitMain.THIS.getServer().getScheduler().runTaskAsynchronously(BukkitMain.THIS, r).getTaskId();
|
||||
public void taskAsync(final Runnable r) {
|
||||
BukkitMain.THIS.getServer().getScheduler().runTaskAsynchronously(BukkitMain.THIS, r).getTaskId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int task(final Runnable r) {
|
||||
return BukkitMain.THIS.getServer().getScheduler().runTask(BukkitMain.THIS, r).getTaskId();
|
||||
public void task(final Runnable r) {
|
||||
BukkitMain.THIS.getServer().getScheduler().runTask(BukkitMain.THIS, r).getTaskId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int taskLater(final Runnable r, final int delay) {
|
||||
return BukkitMain.THIS.getServer().getScheduler().runTaskLater(BukkitMain.THIS, r, delay).getTaskId();
|
||||
public void taskLater(final Runnable r, final int delay) {
|
||||
BukkitMain.THIS.getServer().getScheduler().runTaskLater(BukkitMain.THIS, r, delay).getTaskId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int taskLaterAsync(final Runnable r, final int delay) {
|
||||
return BukkitMain.THIS.getServer().getScheduler().runTaskLaterAsynchronously(BukkitMain.THIS, r, delay).getTaskId();
|
||||
public void taskLaterAsync(final Runnable r, final int delay) {
|
||||
BukkitTask runnable = BukkitMain.THIS.getServer().getScheduler().runTaskLaterAsynchronously(BukkitMain.THIS, r, delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,10 +151,10 @@ public class ChunkManager extends AChunkManager {
|
||||
final int relZ = newPos.getZ() - pos1.getZ();
|
||||
final RegionWrapper region = new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
||||
final World world = Bukkit.getWorld(pos1.getWorld());
|
||||
final Chunk c1 = world.getChunkAt(pos1.getX(), pos1.getZ());
|
||||
final Chunk c2 = world.getChunkAt(pos2.getX(), pos2.getZ());
|
||||
final Chunk c3 = world.getChunkAt((pos1.getX() + relX), (pos1.getZ() + relZ));
|
||||
final Chunk c4 = world.getChunkAt((pos2.getX() + relX), (pos2.getZ() + relZ));
|
||||
final Chunk c1 = world.getChunkAt(pos1.getX() >> 4, pos1.getZ() >> 4);
|
||||
final Chunk c2 = world.getChunkAt(pos2.getX() >> 4, pos2.getZ() >> 4);
|
||||
final Chunk c3 = world.getChunkAt((pos1.getX() + relX) >> 4, (pos1.getZ() + relZ) >> 4);
|
||||
final Chunk c4 = world.getChunkAt((pos2.getX() + relX) >> 4, (pos2.getZ() + relZ) >> 4);
|
||||
final int sx = pos1.getX();
|
||||
final int sz = pos1.getZ();
|
||||
final int ex = pos2.getX();
|
||||
@ -172,7 +172,7 @@ public class ChunkManager extends AChunkManager {
|
||||
// Load chunks
|
||||
for (int x = c1x; x <= c2x; x++) {
|
||||
for (int z = c1z; z <= c2z; z++) {
|
||||
final Chunk chunk = world.getChunkAt(x << 4, z << 4);
|
||||
final Chunk chunk = world.getChunkAt(x, z);
|
||||
toGenerate.add(chunk);
|
||||
}
|
||||
}
|
||||
@ -210,24 +210,24 @@ public class ChunkManager extends AChunkManager {
|
||||
public void run() {
|
||||
final long start = System.currentTimeMillis();
|
||||
while ((System.currentTimeMillis() - start) < 25) {
|
||||
final int x = mx.intValue();
|
||||
final int xv = mx.intValue();
|
||||
for (int z = sz; z <= ez; z++) {
|
||||
saveBlocks(world, maxY, x, z);
|
||||
saveBlocks(world, maxY, xv, z);
|
||||
for (int y = 1; y <= maxY; y++) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final Block block = world.getBlockAt(xv, y, z);
|
||||
final int id = block.getTypeId();
|
||||
final byte data = block.getData();
|
||||
SetBlockManager.setBlockManager.set(world, x + relX, y, z + relZ, id, data);
|
||||
SetBlockManager.setBlockManager.set(world, xv + relX, y, z + relZ, id, data);
|
||||
}
|
||||
}
|
||||
mx.increment();
|
||||
if (x == ex) { // done!
|
||||
if (xv == ex) { // done!
|
||||
restoreBlocks(world, relX, relZ);
|
||||
SetBlockManager.setBlockManager.update(chunks);
|
||||
for (final Chunk chunk : chunks) {
|
||||
chunk.unload(true, true);
|
||||
}
|
||||
TaskManager.runTaskLater(whenDone, 1);
|
||||
TaskManager.runTask(whenDone);
|
||||
Bukkit.getScheduler().cancelTask(tasks.get(currentIndex));
|
||||
tasks.remove(currentIndex);
|
||||
return;
|
||||
@ -256,8 +256,8 @@ public class ChunkManager extends AChunkManager {
|
||||
index.increment();
|
||||
final Plugin plugin = BukkitMain.THIS;
|
||||
final World world = Bukkit.getWorld(pos1.getWorld());
|
||||
final Chunk c1 = world.getChunkAt(pos1.getX(), pos1.getZ());
|
||||
final Chunk c2 = world.getChunkAt(pos2.getX(), pos2.getZ());
|
||||
final Chunk c1 = world.getChunkAt(pos1.getX() >> 4, pos1.getZ() >> 4);
|
||||
final Chunk c2 = world.getChunkAt(pos2.getX() >> 4, pos2.getZ() >> 4);
|
||||
final int sx = pos1.getX();
|
||||
final int sz = pos1.getZ();
|
||||
final int ex = pos2.getX();
|
||||
@ -266,6 +266,7 @@ public class ChunkManager extends AChunkManager {
|
||||
final int c1z = c1.getZ();
|
||||
final int c2x = c2.getX();
|
||||
final int c2z = c2.getZ();
|
||||
|
||||
final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
for (int x = c1x; x <= c2x; x++) {
|
||||
for (int z = c1z; z <= c2z; z++) {
|
||||
@ -407,7 +408,7 @@ public class ChunkManager extends AChunkManager {
|
||||
try {
|
||||
entity.spawn(world, x_offset, z_offset);
|
||||
} catch (final Exception e) {
|
||||
System.out.print("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
|
||||
PlotSquared.log("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -758,7 +759,7 @@ public class ChunkManager extends AChunkManager {
|
||||
|
||||
@Override
|
||||
public boolean loadChunk(String world, ChunkLoc loc) {
|
||||
return BukkitUtil.getWorld(world).getChunkAt(loc.x << 4, loc.z << 4).load(false);
|
||||
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,6 +49,8 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
|
||||
public class Metrics {
|
||||
/**
|
||||
* The current revision number
|
||||
@ -523,7 +525,7 @@ public class Metrics {
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
connection.setDoOutput(true);
|
||||
if (this.debug) {
|
||||
System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
||||
PlotSquared.log("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
||||
}
|
||||
// Write the data
|
||||
final OutputStream os = connection.getOutputStream();
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.object.BukkitOfflinePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
@ -81,7 +82,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
|
||||
return p.toArray(new Player[0]);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
System.out.print("Failed to resolve online players");
|
||||
PlotSquared.log("Failed to resolve online players");
|
||||
this.getOnline = null;
|
||||
return Bukkit.getOnlinePlayers().toArray(new Player[0]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user