mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
simplify config / multiple expiry tasks / block cache fix
This commit is contained in:
@ -71,6 +71,12 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
@ -87,13 +93,6 @@ import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
public static WorldEdit worldEdit;
|
||||
@ -136,7 +135,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
public void log(String message) {
|
||||
try {
|
||||
message = C.color(message);
|
||||
if (!Settings.CONSOLE_COLOR) {
|
||||
if (!Settings.CHAT.CONSOLE_COLOR) {
|
||||
message = ChatColor.stripColor(message);
|
||||
}
|
||||
this.getServer().getConsoleSender().sendMessage(message);
|
||||
@ -242,7 +241,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
case MINECART_MOB_SPAWNER:
|
||||
case MINECART_TNT:
|
||||
case BOAT: {
|
||||
if (!Settings.KILL_ROAD_VEHICLES) {
|
||||
if (!Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) {
|
||||
continue;
|
||||
}
|
||||
com.intellectualcrafters.plot.object.Location location = BukkitUtil.getLocation(entity.getLocation());
|
||||
@ -309,7 +308,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
case ZOMBIE:
|
||||
case SHULKER:
|
||||
default:
|
||||
if (!Settings.KILL_ROAD_MOBS) {
|
||||
if (!Settings.ENABLED_COMPONENTS.KILL_ROAD_MOBS) {
|
||||
continue;
|
||||
}
|
||||
Location location = entity.getLocation();
|
||||
@ -506,23 +505,23 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
public UUIDHandlerImplementation initUUIDHandler() {
|
||||
boolean checkVersion = PS.get().checkVersion(getServerVersion(), 1, 7, 6);
|
||||
UUIDWrapper wrapper;
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
if (Settings.UUID_LOWERCASE) {
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE) {
|
||||
wrapper = new LowerOfflineUUIDWrapper();
|
||||
} else {
|
||||
wrapper = new OfflineUUIDWrapper();
|
||||
}
|
||||
Settings.OFFLINE_MODE = true;
|
||||
Settings.UUID.OFFLINE = true;
|
||||
} else if (checkVersion) {
|
||||
wrapper = new DefaultUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = false;
|
||||
Settings.UUID.OFFLINE = false;
|
||||
} else {
|
||||
if (Settings.UUID_LOWERCASE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE) {
|
||||
wrapper = new LowerOfflineUUIDWrapper();
|
||||
} else {
|
||||
wrapper = new OfflineUUIDWrapper();
|
||||
}
|
||||
Settings.OFFLINE_MODE = true;
|
||||
Settings.UUID.OFFLINE = true;
|
||||
}
|
||||
if (!checkVersion) {
|
||||
PS.log(C.PREFIX + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||
@ -530,17 +529,17 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
} else {
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_19();
|
||||
if (wrapper instanceof DefaultUUIDWrapper || wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) {
|
||||
Settings.TWIN_MODE_UUID = true;
|
||||
Settings.UUID.NATIVE_UUID_PROVIDER = true;
|
||||
}
|
||||
}
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
PS.log(C.PREFIX
|
||||
+ " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
|
||||
+ "Bukkit");
|
||||
} else {
|
||||
PS.log(C.PREFIX + " &6PlotSquared is using online UUIDs");
|
||||
}
|
||||
if (Settings.USE_SQLUUIDHANDLER) {
|
||||
if (Settings.UUID.USE_SQLUUIDHANDLER) {
|
||||
return new SQLUUIDHandler(wrapper);
|
||||
} else {
|
||||
return new FileUUIDHandler(wrapper);
|
||||
@ -594,7 +593,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
World world = BukkitUtil.getWorld(worldName);
|
||||
if (world == null) {
|
||||
// create world
|
||||
ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldName);
|
||||
ConfigurationSection worldConfig = PS.get().worlds.getConfigurationSection("worlds." + worldName);
|
||||
String manager = worldConfig.getString("generator.plugin", "PlotSquared");
|
||||
SetupObject setup = new SetupObject();
|
||||
setup.plotManager = manager;
|
||||
@ -620,7 +619,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
PS.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
||||
} else if (gen != null) {
|
||||
PS.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
|
||||
} else if (PS.get().config.contains("worlds." + worldName)) {
|
||||
} else if (PS.get().worlds.contains("worlds." + worldName)) {
|
||||
PS.get().loadWorld(worldName, null);
|
||||
}
|
||||
}
|
||||
@ -661,7 +660,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
@Override
|
||||
public ChatManager<?> initChatManager() {
|
||||
if (Settings.FANCY_CHAT) {
|
||||
if (Settings.CHAT.INTERACTIVE) {
|
||||
return new BukkitChatManager();
|
||||
} else {
|
||||
return new BukkitPlainChatManager();
|
||||
|
@ -266,14 +266,14 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
|
||||
if (newWrapper instanceof OfflineUUIDWrapper) {
|
||||
PS.get().config.set("UUID.force-lowercase", false);
|
||||
PS.get().config.set("UUID.offline", true);
|
||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
||||
PS.get().worlds.set("UUID.offline", true);
|
||||
} else if (newWrapper instanceof DefaultUUIDWrapper) {
|
||||
PS.get().config.set("UUID.force-lowercase", false);
|
||||
PS.get().config.set("UUID.offline", false);
|
||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
||||
PS.get().worlds.set("UUID.offline", false);
|
||||
}
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
} catch (IOException ignored) {
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manual set!");
|
||||
}
|
||||
|
@ -25,21 +25,21 @@ public abstract class APlotMeConnector {
|
||||
|
||||
public void copyConfig(FileConfiguration plotConfig, String world, String actualWorldName) {
|
||||
int pathWidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
||||
PS.get().config.set("worlds." + actualWorldName + ".road.width", pathWidth);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth);
|
||||
int plotSize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
||||
PS.get().config.set("worlds." + actualWorldName + ".plot.size", plotSize);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize);
|
||||
String wallBlock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
||||
PS.get().config.set("worlds." + actualWorldName + ".wall.block", wallBlock);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock);
|
||||
String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
||||
PS.get().config.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
||||
String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
||||
PS.get().config.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
||||
String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
||||
PS.get().config.set("worlds." + actualWorldName + ".road.block", road);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.block", road);
|
||||
int height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
||||
PS.get().config.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PS.get().config.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PS.get().config.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
}
|
||||
|
||||
public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) {
|
||||
|
@ -40,7 +40,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
String con = plotConfig.getString("mySQLconn");
|
||||
return DriverManager.getConnection(con, user, password);
|
||||
} else {
|
||||
return new SQLite(dataFolder + File.separator + "plots.db").openConnection();
|
||||
return new SQLite(new File(dataFolder + File.separator + "plots.db")).openConnection();
|
||||
}
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
@ -64,7 +64,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
} else if (checkUUID2) {
|
||||
column = "ownerId";
|
||||
}
|
||||
boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.CONVERT_PLOTME;
|
||||
boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER;
|
||||
int missing = 0;
|
||||
while (resultSet.next()) {
|
||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
||||
@ -73,8 +73,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
if (!plots.containsKey(world)) {
|
||||
plots.put(world, new HashMap<PlotId, Plot>());
|
||||
if (merge) {
|
||||
int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
|
||||
int path = PS.get().config.getInt("worlds." + world + ".road.width");
|
||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
||||
plotWidth.put(world, plot);
|
||||
roadWidth.put(world, path);
|
||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
||||
|
@ -144,7 +144,7 @@ public class LikePlotMeConverter {
|
||||
sendMessage(" - " + dbPrefix + "Plots");
|
||||
final Set<String> worlds = getPlotMeWorlds(plotConfig);
|
||||
|
||||
if (Settings.CONVERT_PLOTME) {
|
||||
if (Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER) {
|
||||
sendMessage("Updating bukkit.yml");
|
||||
updateWorldYml("bukkit.yml");
|
||||
updateWorldYml("plugins/Multiverse-Core/worlds.yml");
|
||||
@ -153,7 +153,7 @@ public class LikePlotMeConverter {
|
||||
try {
|
||||
String actualWorldName = getWorld(world);
|
||||
connector.copyConfig(plotConfig, world, actualWorldName);
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
sendMessage("&c-- &lFailed to save configuration for world '" + world
|
||||
@ -166,7 +166,7 @@ public class LikePlotMeConverter {
|
||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||
plotCount += entry.getValue().size();
|
||||
}
|
||||
if (!Settings.CONVERT_PLOTME) {
|
||||
if (!Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -181,30 +181,30 @@ public class LikePlotMeConverter {
|
||||
String actualWorldName = getWorld(world);
|
||||
String plotMeWorldName = world.toLowerCase();
|
||||
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
||||
PS.get().config.set("worlds." + world + ".road.width", pathWidth);
|
||||
PS.get().worlds.set("worlds." + world + ".road.width", pathWidth);
|
||||
|
||||
int pathHeight = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", 64); //
|
||||
PS.get().config.set("worlds." + world + ".road.height", pathHeight);
|
||||
PS.get().config.set("worlds." + world + ".wall.height", pathHeight);
|
||||
PS.get().config.set("worlds." + world + ".plot.height", pathHeight);
|
||||
PS.get().worlds.set("worlds." + world + ".road.height", pathHeight);
|
||||
PS.get().worlds.set("worlds." + world + ".wall.height", pathHeight);
|
||||
PS.get().worlds.set("worlds." + world + ".plot.height", pathHeight);
|
||||
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
|
||||
PS.get().config.set("worlds." + world + ".plot.size", plotSize);
|
||||
PS.get().worlds.set("worlds." + world + ".plot.size", plotSize);
|
||||
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); //
|
||||
PS.get().config.set("worlds." + world + ".wall.block", wallblock);
|
||||
PS.get().worlds.set("worlds." + world + ".wall.block", wallblock);
|
||||
String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
||||
PS.get().config.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
||||
PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
||||
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
|
||||
PS.get().config.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
||||
PS.get().worlds.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
||||
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
||||
PS.get().config.set("worlds." + world + ".road.block", road);
|
||||
PS.get().worlds.set("worlds." + world + ".road.block", road);
|
||||
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
||||
if (height == 0) {
|
||||
height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64); //
|
||||
}
|
||||
PS.get().config.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PS.get().config.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PS.get().config.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
@ -267,7 +267,7 @@ public class LikePlotMeConverter {
|
||||
});
|
||||
sendMessage("Saving configuration...");
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
} catch (IOException ignored) {
|
||||
sendMessage(" - &cFailed to save configuration.");
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
} else {
|
||||
File file = new File(dataFolder + File.separator + "plotmecore.db");
|
||||
if (file.exists()) {
|
||||
return new SQLite(dataFolder + File.separator + "plotmecore.db").openConnection();
|
||||
return new SQLite(file).openConnection();
|
||||
}
|
||||
return new SQLite(dataFolder + File.separator + "plots.db").openConnection();
|
||||
return new SQLite(new File(dataFolder + File.separator + "plots.db")).openConnection();
|
||||
}
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
@ -67,15 +67,15 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
return null;
|
||||
}
|
||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
||||
boolean merge = !this.plugin.equals("plotme") && Settings.CONVERT_PLOTME;
|
||||
boolean merge = !this.plugin.equals("plotme") && Settings.ENABLED_COMPONENTS.PLOTME_CONVERTER;
|
||||
while (resultSet.next()) {
|
||||
int key = resultSet.getInt("plot_id");
|
||||
PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ"));
|
||||
String name = resultSet.getString("owner");
|
||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
||||
if (!plots.containsKey(world) && merge) {
|
||||
int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
|
||||
int path = PS.get().config.getInt("worlds." + world + ".road.width");
|
||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
||||
plotWidth.put(world, plot);
|
||||
roadWidth.put(world, path);
|
||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.plotsquared.bukkit.listeners;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
@ -10,6 +8,8 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashSet;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
@ -28,8 +28,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
public class ChunkListener implements Listener {
|
||||
|
||||
@ -39,7 +39,7 @@ public class ChunkListener implements Listener {
|
||||
|
||||
|
||||
public ChunkListener() {
|
||||
if (Settings.CHUNK_PROCESSOR_GC) {
|
||||
if (Settings.CHUNK_PROCESSOR.AUTO_TRIM) {
|
||||
try {
|
||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
@ -47,10 +47,10 @@ public class ChunkListener implements Listener {
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
} catch (Throwable ignored) {
|
||||
PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc");
|
||||
Settings.CHUNK_PROCESSOR_GC = false;
|
||||
Settings.CHUNK_PROCESSOR.AUTO_TRIM = false;
|
||||
}
|
||||
}
|
||||
if (!Settings.CHUNK_PROCESSOR_GC) {
|
||||
if (!Settings.CHUNK_PROCESSOR.AUTO_TRIM) {
|
||||
return;
|
||||
}
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
@ -139,7 +139,7 @@ public class ChunkListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
if (Settings.CHUNK_PROCESSOR_GC) {
|
||||
if (Settings.CHUNK_PROCESSOR.AUTO_TRIM) {
|
||||
Chunk chunk = event.getChunk();
|
||||
String world = chunk.getWorld().getName();
|
||||
if (PS.get().hasPlotArea(world)) {
|
||||
@ -171,7 +171,7 @@ public class ChunkListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Entity[] entities = chunk.getEntities();
|
||||
if (entities.length > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
|
||||
if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
|
||||
event.getEntity().remove();
|
||||
event.setCancelled(true);
|
||||
this.lastChunk = chunk;
|
||||
@ -182,7 +182,7 @@ public class ChunkListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
if (Settings.CHUNK_PROCESSOR_DISABLE_PHYSICS) {
|
||||
if (Settings.CHUNK_PROCESSOR.DISABLE_PHYSICS) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ public class ChunkListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Entity[] entities = chunk.getEntities();
|
||||
if (entities.length > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
|
||||
if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
|
||||
event.getEntity().remove();
|
||||
event.setCancelled(true);
|
||||
this.lastChunk = chunk;
|
||||
@ -254,7 +254,7 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
Entity[] entities = chunk.getEntities();
|
||||
BlockState[] tiles = chunk.getTileEntities();
|
||||
if (entities.length > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
|
||||
if (entities.length > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
|
||||
for (Entity ent : entities) {
|
||||
if (!(ent instanceof Player)) {
|
||||
ent.remove();
|
||||
@ -262,7 +262,7 @@ public class ChunkListener implements Listener {
|
||||
}
|
||||
PS.debug("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
|
||||
}
|
||||
if (tiles.length > Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES) {
|
||||
if (tiles.length > Settings.CHUNK_PROCESSOR.MAX_TILES) {
|
||||
if (unload) {
|
||||
PS.debug("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
|
||||
cleanChunk(chunk);
|
||||
|
@ -200,7 +200,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
event.setNewCurrent(0);
|
||||
return;
|
||||
}
|
||||
if (Settings.REDSTONE_DISABLER) {
|
||||
if (Settings.REDSTONE.DISABLE_OFFLINE) {
|
||||
if (UUIDHandler.getPlayer(plot.owner) == null) {
|
||||
boolean disable = true;
|
||||
for (UUID trusted : plot.getTrusted()) {
|
||||
@ -215,7 +215,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.REDSTONE_DISABLER_UNOCCUPIED) {
|
||||
if (Settings.REDSTONE.DISABLE_UNOCCUPIED) {
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
if (plot.equals(entry.getValue().getCurrentPlot())) {
|
||||
return;
|
||||
@ -350,7 +350,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (cmd == null) {
|
||||
if (split[0].equals("plotme") || split[0].equals("ap")) {
|
||||
Player player = event.getPlayer();
|
||||
if (Settings.USE_PLOTME_ALIAS) {
|
||||
if (Settings.PLOTME.ALIAS) {
|
||||
player.performCommand("plots " + StringMan.join(Arrays.copyOfRange(split, 1, split.length), " "));
|
||||
} else {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_USING_PLOTME);
|
||||
@ -647,7 +647,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_DESTROY_OTHER);
|
||||
event.setCancelled(true);
|
||||
} else if (Settings.DONE_RESTRICTS_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||
} else if (Settings.DONE.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||
event.setCancelled(true);
|
||||
@ -741,7 +741,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.PERMISSION_CACHING) {
|
||||
if (Settings.ENABLED_COMPONENTS.PERMISSION_CACHE) {
|
||||
pp.deleteMeta("perm");
|
||||
}
|
||||
}
|
||||
@ -1883,7 +1883,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
entity.remove();
|
||||
return;
|
||||
}
|
||||
if (Settings.KILL_ROAD_VEHICLES) {
|
||||
if (Settings.ENABLED_COMPONENTS.KILL_ROAD_VEHICLES) {
|
||||
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot));
|
||||
}
|
||||
}
|
||||
@ -2302,7 +2302,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (Settings.DONE_RESTRICTS_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||
} else if (Settings.DONE.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) {
|
||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||
event.setCancelled(true);
|
||||
|
@ -2,7 +2,7 @@ package com.plotsquared.bukkit.util;
|
||||
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.util.expiry.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
|
@ -55,10 +55,10 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
String world = object.world;
|
||||
int type = object.type;
|
||||
String worldPath = "worlds." + object.world;
|
||||
if (!PS.get().config.contains(worldPath)) {
|
||||
PS.get().config.createSection(worldPath);
|
||||
if (!PS.get().worlds.contains(worldPath)) {
|
||||
PS.get().worlds.createSection(worldPath);
|
||||
}
|
||||
ConfigurationSection worldSection = PS.get().config.getConfigurationSection(worldPath);
|
||||
ConfigurationSection worldSection = PS.get().worlds.getConfigurationSection(worldPath);
|
||||
switch (type) {
|
||||
case 2: {
|
||||
if (object.id != null) {
|
||||
@ -101,11 +101,11 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
for (ConfigurationNode step : steps) {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
PS.get().config.set("worlds." + world + ".generator.type", object.type);
|
||||
PS.get().config.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PS.get().config.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
PS.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
||||
PS.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PS.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
if (object.setupGenerator != null && !object.setupGenerator.equals(object.plotManager)) {
|
||||
PS.get().config.set("worlds." + world + ".generator.init", object.setupGenerator);
|
||||
PS.get().worlds.set("worlds." + world + ".generator.init", object.setupGenerator);
|
||||
}
|
||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||
if (gen != null && gen.isFull()) {
|
||||
@ -119,7 +119,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
PS.get().config.save(PS.get().configFile);
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
@ -82,7 +82,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (Settings.TWIN_MODE_UUID) {
|
||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
toAdd.put(new StringWrapper("*"), DBFunc.everyone);
|
||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||
@ -173,8 +173,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit");
|
||||
String name = (String) bukkit.get("lastKnownName");
|
||||
long last = (long) bukkit.get("lastPlayed");
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
if (Settings.UUID_LOWERCASE && !name.toLowerCase().equals(name)) {
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
||||
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
|
||||
} else {
|
||||
long most = (long) compound.get("UUIDMost");
|
||||
|
@ -8,6 +8,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.database.SQLite;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||
@ -41,7 +42,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
public SQLUUIDHandler(UUIDWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.sqlite = new SQLite("./plugins/PlotSquared/usercache.db");
|
||||
this.sqlite = new SQLite(MainUtil.getFile(PS.get().IMP.getDirectory(), "usercache.db"));
|
||||
try {
|
||||
this.sqlite.openConnection();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
@ -104,7 +105,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
public void run() {
|
||||
// If the file based UUID handler didn't cache it, then we can't cache offline mode
|
||||
// Also, trying to cache based on files again, is useless as that's what the file based uuid cacher does
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (whenDone != null) {
|
||||
whenDone.run();
|
||||
}
|
||||
|
Reference in New Issue
Block a user