mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Refactor PS (and rename to PlotSquared)
This commit is contained in:
@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.nukkit.util.block.NukkitLocalQue
|
||||
import com.github.intellectualsites.plotsquared.nukkit.uuid.FileUUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -67,12 +67,12 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
try {
|
||||
this.name = getDescription().getName();
|
||||
getServer().getName();
|
||||
new PS(this, "Nukkit");
|
||||
new PlotSquared(this, "Nukkit");
|
||||
if (Settings.Enabled_Components.METRICS) {
|
||||
new Metrics(this).start();
|
||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
} else {
|
||||
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||
}
|
||||
Generator.addGenerator(NukkitHybridGen.class, getPluginName(), 1);
|
||||
if (Settings.Enabled_Components.WORLDS) {
|
||||
@ -88,7 +88,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
PlotAreaManager manager = PS.get().getPlotAreaManager();
|
||||
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||
if (manager instanceof SinglePlotAreaManager) {
|
||||
long start = System.currentTimeMillis();
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
|
||||
@ -127,7 +127,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override public void onDisable() {
|
||||
PS.get().disable();
|
||||
PlotSquared.get().disable();
|
||||
getServer().getScheduler().cancelAllTasks();
|
||||
}
|
||||
|
||||
@ -184,10 +184,10 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override public void runEntityTask() {
|
||||
PS.log(C.PREFIX + "KillAllEntities started.");
|
||||
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override public void run() {
|
||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea plotArea) {
|
||||
Level world = getServer().getLevelByName(plotArea.worldname);
|
||||
try {
|
||||
@ -232,15 +232,15 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override public void registerInventoryEvents() {
|
||||
PS.debug("Not implemented: registerPlotPlusEvents");
|
||||
PlotSquared.debug("Not implemented: registerPlotPlusEvents");
|
||||
}
|
||||
|
||||
@Override public void registerPlotPlusEvents() {
|
||||
PS.debug("Not implemented: registerPlotPlusEvents");
|
||||
PlotSquared.debug("Not implemented: registerPlotPlusEvents");
|
||||
}
|
||||
|
||||
@Override public void registerForceFieldEvents() {
|
||||
PS.debug("Not implemented: registerPlotPlusEvents");
|
||||
PlotSquared.debug("Not implemented: registerPlotPlusEvents");
|
||||
}
|
||||
|
||||
@Override public boolean initWorldEdit() {
|
||||
@ -287,7 +287,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
while (e.getCause() != null) {
|
||||
e = e.getCause();
|
||||
}
|
||||
synchronized (PS.class) {
|
||||
synchronized (PlotSquared.class) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override public void registerChunkProcessor() {
|
||||
PS.debug("Not implemented: registerChunkProcessor");
|
||||
PlotSquared.debug("Not implemented: registerChunkProcessor");
|
||||
}
|
||||
|
||||
@Override public void registerWorldEvents() {
|
||||
@ -336,7 +336,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
|
||||
@Override public void startMetrics() {
|
||||
new Metrics(this).start();
|
||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
}
|
||||
|
||||
@Override public void setGenerator(String worldName) {
|
||||
@ -344,7 +344,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
if (world == null) {
|
||||
// create world
|
||||
ConfigurationSection worldConfig =
|
||||
PS.get().worlds.getConfigurationSection("worlds." + worldName);
|
||||
PlotSquared.get().worlds.getConfigurationSection("worlds." + worldName);
|
||||
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
||||
SetupObject setup = new SetupObject();
|
||||
setup.plotManager = manager;
|
||||
@ -358,18 +358,18 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
||||
} else {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("world", world.getName());
|
||||
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||
map.put("plot-generator", PlotSquared.get().IMP.getDefaultGenerator());
|
||||
setGenerator(world, new NukkitPlotGenerator(map));
|
||||
}
|
||||
if (world != null) {
|
||||
try {
|
||||
Generator gen = world.getGenerator();
|
||||
if (gen instanceof NukkitPlotGenerator) {
|
||||
PS.get().loadWorld(worldName, (NukkitPlotGenerator) gen);
|
||||
PlotSquared.get().loadWorld(worldName, (NukkitPlotGenerator) gen);
|
||||
} else if (gen instanceof GeneratorWrapper) {
|
||||
PS.get().loadWorld(worldName, (GeneratorWrapper) gen);
|
||||
} else if (PS.get().worlds.contains("worlds." + worldName)) {
|
||||
PS.get().loadWorld(worldName, null);
|
||||
PlotSquared.get().loadWorld(worldName, (GeneratorWrapper) gen);
|
||||
} else if (PlotSquared.get().worlds.contains("worlds." + worldName)) {
|
||||
PlotSquared.get().loadWorld(worldName, null);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
@ -6,7 +6,7 @@ import cn.nukkit.event.level.ChunkLoadEvent;
|
||||
import cn.nukkit.level.Level;
|
||||
import cn.nukkit.level.format.FullChunk;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.NukkitMain;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -27,7 +27,7 @@ public class NukkitAugmentedGenerator implements Listener {
|
||||
return current;
|
||||
}
|
||||
if (generator == null) {
|
||||
NukkitMain plugin = ((NukkitMain) PS.get().IMP);
|
||||
NukkitMain plugin = ((NukkitMain) PlotSquared.get().IMP);
|
||||
generator = new NukkitAugmentedGenerator(plugin);
|
||||
}
|
||||
generators.put(level.getName(), generator);
|
||||
|
@ -6,7 +6,7 @@ import cn.nukkit.math.NukkitRandom;
|
||||
import cn.nukkit.math.Vector3;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.util.NukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.util.block.NukkitWrappedChunk;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
@ -42,7 +42,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
||||
"Generator: " + cg.getClass().getName() + " is already a NukkitPlotGenerator!");
|
||||
}
|
||||
this.full = false;
|
||||
PS.debug("NukkitPlotGenerator does not fully support: " + cg);
|
||||
PlotSquared.debug("NukkitPlotGenerator does not fully support: " + cg);
|
||||
this.platformGenerator = cg;
|
||||
this.plotGenerator = new IndependentPlotGenerator() {
|
||||
@Override public void processSetup(SetupObject setup) {
|
||||
@ -52,7 +52,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
||||
}
|
||||
|
||||
@Override public PlotManager getNewPlotManager() {
|
||||
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotManager();
|
||||
}
|
||||
|
||||
@Override public String getName() {
|
||||
@ -61,7 +61,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
||||
|
||||
@Override
|
||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||
return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,7 +125,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
||||
@Override
|
||||
public void init(cn.nukkit.level.ChunkManager chunkManager, NukkitRandom nukkitRandom) {
|
||||
if (this.chunkManager == null) {
|
||||
PS.get().loadWorld(world, this);
|
||||
PlotSquared.get().loadWorld(world, this);
|
||||
}
|
||||
this.chunkManager = chunkManager;
|
||||
if (getPlatformGenerator() != this) {
|
||||
@ -140,7 +140,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
||||
BaseFullChunk chunk = this.chunkManager.getChunk(cx, cz);
|
||||
// Load if improperly loaded
|
||||
if (!this.loaded) {
|
||||
PS.get().loadWorld(world, this);
|
||||
PlotSquared.get().loadWorld(world, this);
|
||||
this.loaded = true;
|
||||
}
|
||||
chunkSetter.init(chunk);
|
||||
@ -150,7 +150,7 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
|
||||
if (ChunkManager.preProcessChunk(chunkSetter)) {
|
||||
return;
|
||||
}
|
||||
PlotArea area = PS.get().getPlotArea(world, null);
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||
try {
|
||||
this.plotGenerator.generateChunk(this.chunkSetter, area, this.random);
|
||||
} catch (Throwable e) {
|
||||
|
@ -23,7 +23,7 @@ import cn.nukkit.metadata.MetadataValue;
|
||||
import cn.nukkit.plugin.Plugin;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.object.NukkitPlayer;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.util.NukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
@ -224,7 +224,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
EntityDamageByEntityEvent specific = (EntityDamageByEntityEvent) event;
|
||||
Entity damager = specific.getDamager();
|
||||
Location l = NukkitUtil.getLocation(damager);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Entity victim = event.getEntity();
|
||||
@ -244,7 +244,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Location l = NukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = NukkitUtil.getPlayer((Player) shooter);
|
||||
@ -257,7 +257,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||
EntityProjectile entity = (EntityProjectile) event.getEntity();
|
||||
Location loc = NukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(loc.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
|
||||
return true;
|
||||
}
|
||||
PlotArea area = loc.getPlotArea();
|
||||
@ -708,8 +708,8 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||
return;
|
||||
}
|
||||
if (PS.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getInventory().getItemInHand().getId() == PS.get().worldedit
|
||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getInventory().getItemInHand().getId() == PlotSquared.get().worldedit
|
||||
.getConfiguration().wandItem) {
|
||||
return;
|
||||
}
|
||||
@ -728,7 +728,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
final Plot finalPlot = area.getOwnedPlot(location);
|
||||
if (!entity.hasMetadata("plot")) {
|
||||
entity.setMetadata("plot", new MetadataValue((Plugin) PS.get().IMP) {
|
||||
entity.setMetadata("plot", new MetadataValue((Plugin) PlotSquared.get().IMP) {
|
||||
private Plot plot = finalPlot;
|
||||
|
||||
@Override public Object value() {
|
||||
@ -747,7 +747,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
Location location = NukkitUtil.getLocation(event.getPosition());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Iterator<Block> iterator = event.getBlockList().iterator();
|
||||
@ -787,7 +787,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityBlockForm(BlockFormEvent event) {
|
||||
String world = event.getBlock().getLevel().getName();
|
||||
if (!PS.get().hasPlotArea(world)) {
|
||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
||||
return;
|
||||
}
|
||||
if (NukkitUtil.getLocation(event.getBlock().getLocation()).getPlotArea() != null) {
|
||||
@ -937,7 +937,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
public void onEntityFall(EntityBlockChangeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
Location location = NukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(location.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -958,7 +958,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
kill(entity, event);
|
||||
}
|
||||
} else {
|
||||
entity.setMetadata("plot", new MetadataValue((Plugin) PS.get().IMP) {
|
||||
entity.setMetadata("plot", new MetadataValue((Plugin) PlotSquared.get().IMP) {
|
||||
private Plot plot = finalPlot;
|
||||
|
||||
@Override public Object value() {
|
||||
@ -1081,7 +1081,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
public void onPotionSplash(PotionCollideEvent event) {
|
||||
EntityPotion entity = event.getThrownPotion();
|
||||
Location l = NukkitUtil.getLocation(entity);
|
||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
||||
if (!PlotSquared.get().hasPlotArea(l.getWorld())) {
|
||||
return;
|
||||
}
|
||||
Entity shooter = entity.shootingEntity;
|
||||
|
@ -8,7 +8,7 @@ import cn.nukkit.event.level.LevelLoadEvent;
|
||||
import cn.nukkit.level.Level;
|
||||
import cn.nukkit.level.generator.Generator;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
|
||||
@ -34,13 +34,13 @@ public class WorldEvents implements Listener {
|
||||
try {
|
||||
Generator gen = level.getGenerator();
|
||||
if (gen instanceof GeneratorWrapper) {
|
||||
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||
} else {
|
||||
HashMap<String, Object> settings = new HashMap<>();
|
||||
settings.put("world", level.getName());
|
||||
settings.put("generator", gen);
|
||||
PS.get().loadWorld(name, new NukkitPlotGenerator(settings));
|
||||
for (PlotArea area : PS.get().getPlotAreas(name)) {
|
||||
PlotSquared.get().loadWorld(name, new NukkitPlotGenerator(settings));
|
||||
for (PlotArea area : PlotSquared.get().getPlotAreas(name)) {
|
||||
area.MAX_BUILD_HEIGHT = Math.min(127, area.MAX_BUILD_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import cn.nukkit.network.protocol.LevelEventPacket;
|
||||
import cn.nukkit.plugin.RegisteredListener;
|
||||
import cn.nukkit.utils.EventException;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.util.NukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
@ -62,7 +62,7 @@ public class NukkitPlayer extends PlotPlayer {
|
||||
new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||
for (RegisteredListener listener : listeners) {
|
||||
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
|
||||
if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@ -76,7 +76,7 @@ public class NukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
event = new PlayerTeleportEvent(player, to, from, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
for (RegisteredListener listener : listeners) {
|
||||
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
|
||||
if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util;
|
||||
import cn.nukkit.plugin.Plugin;
|
||||
import cn.nukkit.plugin.PluginDescription;
|
||||
import cn.nukkit.utils.LogLevel;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
|
||||
import java.io.*;
|
||||
@ -368,7 +368,7 @@ public class Metrics {
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
connection.setDoOutput(true);
|
||||
if (this.debug) {
|
||||
PS.debug("[Metrics] Prepared request for " + pluginName + " uncompressed="
|
||||
PlotSquared.debug("[Metrics] Prepared request for " + pluginName + " uncompressed="
|
||||
+ uncompressed.length + " compressed=" + compressed.length);
|
||||
}
|
||||
try {
|
||||
@ -381,7 +381,7 @@ public class Metrics {
|
||||
new InputStreamReader(connection.getInputStream()))) {
|
||||
response = reader.readLine();
|
||||
if (this.debug) {
|
||||
PS.debug("[Metrics] Response for " + pluginName + ": " + response);
|
||||
PlotSquared.debug("[Metrics] Response for " + pluginName + ": " + response);
|
||||
}
|
||||
}
|
||||
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.nukkit.util;
|
||||
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
|
||||
public class NukkitChunkManager extends ChunkManager {
|
||||
public NukkitChunkManager() {
|
||||
PS.debug("Not implemented: NukkitChunkManager");
|
||||
PlotSquared.debug("Not implemented: NukkitChunkManager");
|
||||
}
|
||||
|
||||
@Override public int[] countEntities(Plot plot) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.nukkit.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.PlotAnalysis;
|
||||
public class NukkitHybridUtils extends HybridUtils {
|
||||
|
||||
public NukkitHybridUtils() {
|
||||
PS.debug("Not implemented: NukkitHybridUtils");
|
||||
PlotSquared.debug("Not implemented: NukkitHybridUtils");
|
||||
}
|
||||
|
||||
@Override public void analyzeRegion(final String world, final RegionWrapper region,
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util;
|
||||
import cn.nukkit.inventory.PlayerInventory;
|
||||
import cn.nukkit.item.Item;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.object.NukkitPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack;
|
||||
@ -13,7 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
|
||||
public class NukkitInventoryUtil extends InventoryUtil {
|
||||
|
||||
public NukkitInventoryUtil() {
|
||||
PS.debug("Not implemented: NukkitInventoryUtil");
|
||||
PlotSquared.debug("Not implemented: NukkitInventoryUtil");
|
||||
}
|
||||
|
||||
public static Item getItem(PlotItemStack item) {
|
||||
|
@ -6,7 +6,7 @@ import com.github.intellectualsites.plotsquared.configuration.ConfigurationSecti
|
||||
import com.github.intellectualsites.plotsquared.nukkit.NukkitMain;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.util.block.NukkitHybridGen;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
@ -39,9 +39,9 @@ public class NukkitSetupUtils extends SetupUtils {
|
||||
String testWorld = "CheckingPlotSquaredGenerator";
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("world", testWorld);
|
||||
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||
map.put("plot-generator", PlotSquared.get().IMP.getDefaultGenerator());
|
||||
NukkitPlotGenerator gen = new NukkitPlotGenerator(map);
|
||||
SetupUtils.generators.put(PS.imp().getPluginName(), gen);
|
||||
SetupUtils.generators.put(PlotSquared.imp().getPluginName(), gen);
|
||||
}
|
||||
|
||||
@Override public String setupWorld(SetupObject object) {
|
||||
@ -50,10 +50,10 @@ public class NukkitSetupUtils extends SetupUtils {
|
||||
String world = object.world;
|
||||
int type = object.type;
|
||||
String worldPath = "worlds." + object.world;
|
||||
if (!PS.get().worlds.contains(worldPath)) {
|
||||
PS.get().worlds.createSection(worldPath);
|
||||
if (!PlotSquared.get().worlds.contains(worldPath)) {
|
||||
PlotSquared.get().worlds.createSection(worldPath);
|
||||
}
|
||||
ConfigurationSection worldSection = PS.get().worlds.getConfigurationSection(worldPath);
|
||||
ConfigurationSection worldSection = PlotSquared.get().worlds.getConfigurationSection(worldPath);
|
||||
switch (type) {
|
||||
case 2: {
|
||||
if (object.id != null) {
|
||||
@ -98,12 +98,12 @@ public class NukkitSetupUtils extends SetupUtils {
|
||||
for (ConfigurationNode step : steps) {
|
||||
worldSection.set(step.getConstant(), step.getValue());
|
||||
}
|
||||
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);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.type", object.type);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.terrain", object.terrain);
|
||||
PlotSquared.get().worlds.set("worlds." + world + ".generator.plugin", object.plotManager);
|
||||
if (object.setupGenerator != null && !object.setupGenerator
|
||||
.equals(object.plotManager)) {
|
||||
PS.get().worlds
|
||||
PlotSquared.get().worlds
|
||||
.set("worlds." + world + ".generator.init", object.setupGenerator);
|
||||
}
|
||||
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
|
||||
@ -118,14 +118,14 @@ public class NukkitSetupUtils extends SetupUtils {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
PS.get().worlds.save(PS.get().worldsFile);
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (object.setupGenerator != null) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("world", object.world);
|
||||
map.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||
map.put("plot-generator", PlotSquared.get().IMP.getDefaultGenerator());
|
||||
if (!plugin.getServer()
|
||||
.generateLevel(object.world, object.world.hashCode(), NukkitHybridGen.class, map)) {
|
||||
plugin.getServer().loadLevel(object.world);
|
||||
@ -169,7 +169,7 @@ public class NukkitSetupUtils extends SetupUtils {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return PS.imp().getPluginName();
|
||||
return PlotSquared.imp().getPluginName();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package com.github.intellectualsites.plotsquared.nukkit.util.block;
|
||||
import cn.nukkit.level.Level;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.NukkitMain;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -14,7 +14,7 @@ public class NukkitHybridGen extends NukkitPlotGenerator {
|
||||
|
||||
private static Map<String, Object> defaultSettings(Map<String, Object> existing) {
|
||||
if (!existing.containsKey("world")) {
|
||||
Map<Integer, Level> levels = ((NukkitMain) PS.get().IMP).getServer().getLevels();
|
||||
Map<Integer, Level> levels = ((NukkitMain) PlotSquared.get().IMP).getServer().getLevels();
|
||||
int max = -1;
|
||||
for (Map.Entry<Integer, Level> entry : levels.entrySet()) {
|
||||
int id = entry.getKey();
|
||||
@ -24,7 +24,7 @@ public class NukkitHybridGen extends NukkitPlotGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
existing.put("plot-generator", PS.get().IMP.getDefaultGenerator());
|
||||
existing.put("plot-generator", PlotSquared.get().IMP.getDefaultGenerator());
|
||||
return existing;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import cn.nukkit.level.format.FullChunk;
|
||||
import cn.nukkit.level.format.generic.BaseFullChunk;
|
||||
import cn.nukkit.math.Vector3;
|
||||
import com.github.intellectualsites.plotsquared.nukkit.NukkitMain;
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue;
|
||||
|
||||
@ -18,7 +18,7 @@ public class NukkitLocalQueue<T> extends BasicLocalBlockQueue<T> {
|
||||
|
||||
public NukkitLocalQueue(String world) {
|
||||
super(world);
|
||||
this.level = ((NukkitMain) PS.get().IMP).getServer().getLevelByName(world);
|
||||
this.level = ((NukkitMain) PlotSquared.get().IMP).getServer().getLevelByName(world);
|
||||
}
|
||||
|
||||
@Override public LocalChunk<T> getLocalChunk(int x, int z) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.nukkit.uuid;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PS;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
|
||||
@ -28,7 +28,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
final File container = new File("players");
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
PS.debug(C.PREFIX + "&6Starting player data caching for: " + container);
|
||||
PlotSquared.debug(C.PREFIX + "&6Starting player data caching for: " + container);
|
||||
HashBiMap<StringWrapper, UUID> toAdd =
|
||||
HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
for (File file : container.listFiles(new DatFileFilter())) {
|
||||
|
Reference in New Issue
Block a user