mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Tweaks
Use sign with plot schematic Tweak world unloading
This commit is contained in:
@ -200,7 +200,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
public void run() {
|
||||
unload();
|
||||
}
|
||||
}, 20);
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,19 +211,26 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
String name = world.getName();
|
||||
char char0 = name.charAt(0);
|
||||
if (!Character.isDigit(char0) && char0 != '-') continue;
|
||||
if (!world.getPlayers().isEmpty()) continue;
|
||||
|
||||
PlotId id = PlotId.fromString(name);
|
||||
if (id != null) {
|
||||
Plot plot = area.getOwnedPlot(id);
|
||||
if (plot != null) {
|
||||
List<PlotPlayer> players = plot.getPlayersInPlot();
|
||||
if (players.isEmpty() && PlotPlayer.wrap(plot.owner) == null) {
|
||||
for (Chunk chunk : world.getLoadedChunks()) {
|
||||
if (!chunk.unload(true, false)) return;
|
||||
if (System.currentTimeMillis() - start > 20) {
|
||||
return;
|
||||
}
|
||||
if (PlotPlayer.wrap(plot.owner) == null) {
|
||||
if (world.getKeepSpawnInMemory()) {
|
||||
world.setKeepSpawnInMemory(false);
|
||||
return;
|
||||
}
|
||||
Chunk[] chunks = world.getLoadedChunks();
|
||||
if (chunks.length == 0) {
|
||||
if (!Bukkit.unloadWorld(world, true)) {
|
||||
PS.debug("Failed to unload " + world.getName());
|
||||
}
|
||||
return;
|
||||
}
|
||||
Bukkit.unloadWorld(world, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,15 @@ public class BukkitUtil extends WorldUtil {
|
||||
World world = getWorld(worldName);
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
// block.setType(Material.AIR);
|
||||
block.setTypeIdAndData(Material.WALL_SIGN.getId(), (byte) 2, false);
|
||||
Material type = block.getType();
|
||||
if (type != Material.SIGN && type != Material.SIGN_POST) {
|
||||
int data = 2;
|
||||
if (world.getBlockAt(x, y, z + 1).getType().isSolid()) data = 2;
|
||||
else if (world.getBlockAt(x + 1, y, z).getType().isSolid()) data = 4;
|
||||
else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) data = 3;
|
||||
else if (world.getBlockAt(x - 1, y, z).getType().isSolid()) data = 5;
|
||||
block.setTypeIdAndData(Material.WALL_SIGN.getId(), (byte) data, false);
|
||||
}
|
||||
BlockState blockstate = block.getState();
|
||||
if (blockstate instanceof Sign) {
|
||||
final Sign sign = (Sign) blockstate;
|
||||
|
Reference in New Issue
Block a user