mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
2.8.7: Plot home sorting, critical world init fix, piston fix
This commit is contained in:
parent
e6fc6e070e
commit
0c3b084f73
@ -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.8.4</version>
|
<version>2.8.7</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -198,6 +198,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||||
|
PlotSquared.GEN_WORLD = world;
|
||||||
if (!PlotSquared.setupPlotWorld(world, id)) {
|
if (!PlotSquared.setupPlotWorld(world, id)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
|||||||
public class PlotSquared {
|
public class PlotSquared {
|
||||||
public static final String MAIN_PERMISSION = "plots.use";
|
public static final String MAIN_PERMISSION = "plots.use";
|
||||||
public static final String ADMIN_PERMISSION = "plots.admin";
|
public static final String ADMIN_PERMISSION = "plots.admin";
|
||||||
|
public static String GEN_WORLD = "__PLACEHOLDER__";
|
||||||
public static File styleFile;
|
public static File styleFile;
|
||||||
public static YamlConfiguration style;
|
public static YamlConfiguration style;
|
||||||
public static File configFile;
|
public static File configFile;
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -46,11 +48,11 @@ public class Home extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, String... args) {
|
public boolean execute(final PlotPlayer plr, String... args) {
|
||||||
final Plot[] plots = PlotSquared.getPlots(plr).toArray(new Plot[0]);
|
final ArrayList<Plot> plots = PlotSquared.sortPlots(PlotSquared.getPlots(plr), plr.getLocation().getWorld());
|
||||||
if (plots.length == 1) {
|
if (plots.size() == 1) {
|
||||||
MainUtil.teleportPlayer(plr, plr.getLocation(), plots[0]);
|
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
|
||||||
return true;
|
return true;
|
||||||
} else if (plots.length > 1) {
|
} else if (plots.size() > 1) {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
args = new String[] { "1" };
|
args = new String[] { "1" };
|
||||||
}
|
}
|
||||||
@ -72,11 +74,11 @@ public class Home extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
|
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((id > (plots.length)) || (id < 1)) {
|
if ((id > (plots.size())) || (id < 1)) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
|
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.teleportPlayer(plr, plr.getLocation(), plots[id - 1]);
|
MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(id - 1));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
MainUtil.sendMessage(plr, C.NO_PLOTS);
|
||||||
|
@ -55,7 +55,7 @@ public class Visit extends SubCommand {
|
|||||||
final UUID uuid = UUIDHandler.getUUID(username);
|
final UUID uuid = UUIDHandler.getUUID(username);
|
||||||
List<Plot> plots = null;
|
List<Plot> plots = null;
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
plots = getPlots(uuid);
|
plots = PlotSquared.sortPlots(getPlots(uuid), plr.getLocation().getWorld());
|
||||||
}
|
}
|
||||||
if ((uuid == null) || plots.isEmpty()) {
|
if ((uuid == null) || plots.isEmpty()) {
|
||||||
return sendMessage(plr, C.FOUND_NO_PLOTS);
|
return sendMessage(plr, C.FOUND_NO_PLOTS);
|
||||||
|
@ -347,7 +347,6 @@ public class FlagManager {
|
|||||||
split = flagstrings.get(i).split(":");
|
split = flagstrings.get(i).split(":");
|
||||||
}
|
}
|
||||||
if (split.length == 1) {
|
if (split.length == 1) {
|
||||||
System.out.print(split[0]);
|
|
||||||
flags[i] = new Flag(getFlag(split[0], true), "");
|
flags[i] = new Flag(getFlag(split[0], true), "");
|
||||||
} else {
|
} else {
|
||||||
flags[i] = new Flag(getFlag(split[0], true), split[1]);
|
flags[i] = new Flag(getFlag(split[0], true), split[1]);
|
||||||
|
@ -115,12 +115,14 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
if (LAST == 0) {
|
if (LAST == 0) {
|
||||||
LAST = System.currentTimeMillis();
|
LAST = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
AV = (System.currentTimeMillis() - LAST + AV) / 2;
|
long current = System.currentTimeMillis() - LAST;
|
||||||
if (AV < 1050) {
|
AV = Math.max(current, (current + AV * 5) / 6);
|
||||||
|
LAST = System.currentTimeMillis();
|
||||||
|
if (AV < 1500) {
|
||||||
try {
|
try {
|
||||||
final ChunkLoc loc = chunks.get(0);
|
final ChunkLoc loc = chunks.get(0);
|
||||||
PlotSquared.log("Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 256 chunks)");
|
PlotSquared.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
|
||||||
PlotSquared.log("Remaining regions: " + chunks.size());
|
PlotSquared.log(" - Remaining: " + chunks.size());
|
||||||
regenerateChunkChunk(world, loc);
|
regenerateChunkChunk(world, loc);
|
||||||
chunks.remove(0);
|
chunks.remove(0);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
@ -133,14 +135,16 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
ChunkManager.manager.unloadChunk(world, new ChunkLoc(x, z));
|
ChunkManager.manager.unloadChunk(world, new ChunkLoc(x, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.log("&d - Potentially skipping 256 chunks");
|
PlotSquared.log("&d - Potentially skipping 1024 chunks");
|
||||||
PlotSquared.log("&d - TODO: recommend chunkster if corrupt");
|
PlotSquared.log("&d - TODO: recommend chunkster if corrupt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.print("TPS LOW: " + (System.currentTimeMillis() - LAST) + " | " + AV);
|
double tps = (20000.0/Math.min(AV, current));
|
||||||
|
if (tps < 19) {
|
||||||
|
System.out.print("waiting for chunks to unload...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LAST = System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 20, 20);
|
}, 20, 20);
|
||||||
|
@ -32,6 +32,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.object.PlotGenerator;
|
import com.intellectualcrafters.plot.object.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.object.PlotLoc;
|
import com.intellectualcrafters.plot.object.PlotLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
@ -88,9 +89,6 @@ public class HybridGen extends PlotGenerator {
|
|||||||
* Initialize variables, and create plotworld object used in calculations
|
* Initialize variables, and create plotworld object used in calculations
|
||||||
*/
|
*/
|
||||||
public void init(PlotWorld plotworld) {
|
public void init(PlotWorld plotworld) {
|
||||||
if (this.plotworld == null) {
|
|
||||||
this.plotworld = (HybridPlotWorld) plotworld;
|
|
||||||
}
|
|
||||||
this.plotsize = this.plotworld.PLOT_WIDTH;
|
this.plotsize = this.plotworld.PLOT_WIDTH;
|
||||||
this.pathsize = this.plotworld.ROAD_WIDTH;
|
this.pathsize = this.plotworld.ROAD_WIDTH;
|
||||||
this.roadblock = this.plotworld.ROAD_BLOCK.id;
|
this.roadblock = this.plotworld.ROAD_BLOCK.id;
|
||||||
@ -198,24 +196,7 @@ public class HybridGen extends PlotGenerator {
|
|||||||
/**
|
/**
|
||||||
* Return the block populator
|
* Return the block populator
|
||||||
*/
|
*/
|
||||||
public List<BlockPopulator> getPopulators(final World world) {
|
public List<BlockPopulator> getPopulators(final String world) {
|
||||||
// disabling spawning for this world
|
|
||||||
if (!this.plotworld.MOB_SPAWNING) {
|
|
||||||
if (!this.plotworld.SPAWN_EGGS) {
|
|
||||||
world.setSpawnFlags(false, false);
|
|
||||||
}
|
|
||||||
world.setAmbientSpawnLimit(0);
|
|
||||||
world.setAnimalSpawnLimit(0);
|
|
||||||
world.setMonsterSpawnLimit(0);
|
|
||||||
world.setWaterAnimalSpawnLimit(0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
world.setSpawnFlags(true, true);
|
|
||||||
world.setAmbientSpawnLimit(-1);
|
|
||||||
world.setAnimalSpawnLimit(-1);
|
|
||||||
world.setMonsterSpawnLimit(-1);
|
|
||||||
world.setWaterAnimalSpawnLimit(-1);
|
|
||||||
}
|
|
||||||
// You can have as many populators as you would like, e.g. tree
|
// You can have as many populators as you would like, e.g. tree
|
||||||
// populator, ore populator
|
// populator, ore populator
|
||||||
return Arrays.asList((BlockPopulator) new HybridPop(this.plotworld));
|
return Arrays.asList((BlockPopulator) new HybridPop(this.plotworld));
|
||||||
|
@ -541,7 +541,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
if (!PlotSquared.isPlotWorld(world)) {
|
if (!PlotSquared.isPlotWorld(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (block.getType() != Material.PISTON_STICKY_BASE) {
|
if (block.getType() != Material.PISTON_STICKY_BASE && block.getType() != Material.PISTON_MOVING_PIECE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = MainUtil.getPlot(loc);
|
Plot plot = MainUtil.getPlot(loc);
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
@ -29,13 +32,32 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
|
|
||||||
public abstract class PlotGenerator extends ChunkGenerator {
|
public abstract class PlotGenerator extends ChunkGenerator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BlockPopulator> getDefaultPopulators(World world) {
|
public List<BlockPopulator> getDefaultPopulators(World world) {
|
||||||
PlotSquared.loadWorld(world.getName(), this);
|
PlotSquared.loadWorld(PlotSquared.GEN_WORLD, this);
|
||||||
return getPopulators(world);
|
// world = Bukkit.getWorld(PlotSquared.GEN_WORLD);
|
||||||
|
PlotWorld plotworld = PlotSquared.getPlotWorld(PlotSquared.GEN_WORLD);
|
||||||
|
if (!plotworld.MOB_SPAWNING) {
|
||||||
|
if (!plotworld.SPAWN_EGGS) {
|
||||||
|
world.setSpawnFlags(false, false);
|
||||||
|
}
|
||||||
|
world.setAmbientSpawnLimit(0);
|
||||||
|
world.setAnimalSpawnLimit(0);
|
||||||
|
world.setMonsterSpawnLimit(0);
|
||||||
|
world.setWaterAnimalSpawnLimit(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
world.setSpawnFlags(true, true);
|
||||||
|
world.setAmbientSpawnLimit(-1);
|
||||||
|
world.setAnimalSpawnLimit(-1);
|
||||||
|
world.setMonsterSpawnLimit(-1);
|
||||||
|
world.setWaterAnimalSpawnLimit(-1);
|
||||||
|
}
|
||||||
|
return getPopulators(PlotSquared.GEN_WORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract List<BlockPopulator> getPopulators(World world);
|
public abstract List<BlockPopulator> getPopulators(String world);
|
||||||
|
|
||||||
public abstract void init(PlotWorld plotworld);
|
public abstract void init(PlotWorld plotworld);
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.intellectualcrafters.plot.util.bukkit;
|
package com.intellectualcrafters.plot.util.bukkit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
@ -13,6 +16,7 @@ import com.intellectualcrafters.plot.object.BukkitOfflinePlayer;
|
|||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
|
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
|
||||||
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
|
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||||
|
|
||||||
@ -86,17 +90,7 @@ public class UUIDHandler {
|
|||||||
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching");
|
PlotSquared.log(C.PREFIX.s() + "&6Starting player data caching");
|
||||||
UUIDHandler.CACHED = true;
|
UUIDHandler.CACHED = true;
|
||||||
|
|
||||||
for (OfflinePlotPlayer op : uuidWrapper.getOfflinePlayers()) {
|
|
||||||
if (op.getLastPlayed() != 0) {
|
|
||||||
String name = op.getName();
|
|
||||||
StringWrapper wrap = new StringWrapper(name);
|
|
||||||
UUID uuid = uuidWrapper.getUUID(op);
|
|
||||||
add(wrap, uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// OLD UUID CACHING SYSTEM
|
// OLD UUID CACHING SYSTEM
|
||||||
/*
|
|
||||||
final HashSet<String> worlds = new HashSet<>();
|
final HashSet<String> worlds = new HashSet<>();
|
||||||
worlds.add(world);
|
worlds.add(world);
|
||||||
worlds.add("world");
|
worlds.add("world");
|
||||||
@ -139,7 +133,7 @@ public class UUIDHandler {
|
|||||||
final UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
final UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
try {
|
try {
|
||||||
final BukkitOfflinePlayer player = wrapper.getOfflinePlayer(uuid);
|
final OfflinePlotPlayer player = wrapper.getOfflinePlayer(uuid);
|
||||||
uuid = UUIDHandler.uuidWrapper.getUUID(player);
|
uuid = UUIDHandler.uuidWrapper.getUUID(player);
|
||||||
final StringWrapper name = new StringWrapper(player.getName());
|
final StringWrapper name = new StringWrapper(player.getName());
|
||||||
add(name, uuid);
|
add(name, uuid);
|
||||||
@ -152,8 +146,18 @@ public class UUIDHandler {
|
|||||||
final StringWrapper nameWrap = new StringWrapper(name);
|
final StringWrapper nameWrap = new StringWrapper(name);
|
||||||
add(nameWrap, uuid);
|
add(nameWrap, uuid);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
if (uuidMap.size() == 0) {
|
||||||
|
for (OfflinePlotPlayer op : uuidWrapper.getOfflinePlayers()) {
|
||||||
|
if (op.getLastPlayed() != 0) {
|
||||||
|
String name = op.getName();
|
||||||
|
StringWrapper wrap = new StringWrapper(name);
|
||||||
|
UUID uuid = uuidWrapper.getUUID(op);
|
||||||
|
add(wrap, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// add the Everyone '*' UUID
|
// add the Everyone '*' UUID
|
||||||
add(new StringWrapper("*"), DBFunc.everyone);
|
add(new StringWrapper("*"), DBFunc.everyone);
|
||||||
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
|
PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
|
||||||
|
Loading…
Reference in New Issue
Block a user