mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Minor message changes and variable changes
This commit is contained in:
parent
427504fd7c
commit
6f5cb30734
@ -40,8 +40,6 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
@ -54,7 +52,6 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -114,22 +111,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
return Bukkit.getVersion();
|
return Bukkit.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
|
||||||
try {
|
|
||||||
PluginManager manager = Bukkit.getPluginManager();
|
|
||||||
System.out.println("[P2] Force loading WorldEdit");
|
|
||||||
Plugin plugin = manager.getPlugin("WorldEdit");
|
|
||||||
if (!manager.isPluginEnabled("WorldEdit")) {
|
|
||||||
manager.enablePlugin(WorldEditPlugin.getPlugin(WorldEditPlugin.class));
|
|
||||||
}
|
|
||||||
System.out.println("[P2] Testing platform capabilities");
|
|
||||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS);
|
|
||||||
} catch (final Throwable throwable) {
|
|
||||||
throw new IllegalStateException(
|
|
||||||
"Failed to force load WorldEdit. Road schematics will fail to generate", throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void onEnable() {
|
@Override public void onEnable() {
|
||||||
this.pluginName = getDescription().getName();
|
this.pluginName = getDescription().getName();
|
||||||
PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer);
|
PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer);
|
||||||
@ -146,7 +127,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads");
|
System.out.println("[P2] DOWNLOAD: https://papermc.io/downloads");
|
||||||
System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/");
|
System.out.println("[P2] GUIDE: https://www.spigotmc.org/threads/21726/");
|
||||||
System.out.println("[P2] NOTE: This is only a recommendation");
|
System.out.println("[P2] NOTE: This is only a recommendation");
|
||||||
System.out.println("[P2] both Spigot and CraftBukkit are still supported.");
|
System.out.println("[P2] Spigot is still supported.");
|
||||||
System.out
|
System.out
|
||||||
.println("[P2] ===============================================================");
|
.println("[P2] ===============================================================");
|
||||||
}
|
}
|
||||||
@ -158,6 +139,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
|
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
|
||||||
System.out
|
System.out
|
||||||
.println("Please check the download page for the link to the legacy versions.");
|
.println("Please check the download page for the link to the legacy versions.");
|
||||||
|
System.out.println("The server will now be shutdown to prevent any corruption.");
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -24,7 +25,8 @@ public class BukkitAugmentedGenerator extends BlockPopulator {
|
|||||||
return generator;
|
return generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void populate(World world, Random random, Chunk source) {
|
@Override
|
||||||
|
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk source) {
|
||||||
AugmentedUtils.generate(world.getName(), source.getX(), source.getZ(), null);
|
AugmentedUtils.generate(world.getName(), source.getX(), source.getZ(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,19 +123,19 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
|
|
||||||
GenChunk result = new GenChunk();
|
GenChunk result = new GenChunk();
|
||||||
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
|
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
|
||||||
if (result.getCd() != null) {
|
if (result.getChunkData() != null) {
|
||||||
for (int cx = 0; cx < 16; cx++) {
|
for (int cx = 0; cx < 16; cx++) {
|
||||||
for (int cz = 0; cz < 16; cz++) {
|
for (int cz = 0; cz < 16; cz++) {
|
||||||
biome.setBiome(cx, cz, Biome.PLAINS);
|
biome.setBiome(cx, cz, Biome.PLAINS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result.getCd();
|
return result.getChunkData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set the chunk location
|
// Set the chunk location
|
||||||
result.setChunk(new ChunkWrapper(world.getName(), x, z));
|
result.setChunk(new ChunkWrapper(world.getName(), x, z));
|
||||||
// Set the result data
|
// Set the result data
|
||||||
result.setCd(createChunkData(world));
|
result.setChunkData(createChunkData(world));
|
||||||
result.biomeGrid = biome;
|
result.biomeGrid = biome;
|
||||||
result.result = null;
|
result.result = null;
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// Return the result data
|
// Return the result data
|
||||||
return result.getCd();
|
return result.getChunkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generate(ChunkLoc loc, World world, ScopedLocalBlockQueue result) {
|
private void generate(ChunkLoc loc, World world, ScopedLocalBlockQueue result) {
|
||||||
|
@ -4,7 +4,12 @@ import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotWorld;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -61,11 +66,12 @@ import java.util.Random;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) {
|
@Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) {
|
||||||
World w = BukkitUtil.getWorld(world);
|
World world = BukkitUtil.getWorld(this.world);
|
||||||
Location min = result.getMin();
|
Location min = result.getMin();
|
||||||
int cx = min.getX() >> 4;
|
int chunkX = min.getX() >> 4;
|
||||||
int cz = min.getZ() >> 4;
|
int chunkZ = min.getZ() >> 4;
|
||||||
Random r = new Random(MathMan.pair((short) cx, (short) cz));
|
Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ));
|
||||||
|
try {
|
||||||
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
|
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
|
||||||
@Override public void setBiome(int x, int z, Biome biome) {
|
@Override public void setBiome(int x, int z, Biome biome) {
|
||||||
result.setBiome(x, z, biome.name());
|
result.setBiome(x, z, biome.name());
|
||||||
@ -75,13 +81,12 @@ import java.util.Random;
|
|||||||
return Biome.FOREST;
|
return Biome.FOREST;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
chunkGenerator.generateChunkData(world, random, chunkX, chunkZ, grid);
|
||||||
chunkGenerator.generateChunkData(w, r, cx, cz, grid);
|
|
||||||
return;
|
return;
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
for (BlockPopulator populator : chunkGenerator.getDefaultPopulators(w)) {
|
for (BlockPopulator populator : chunkGenerator.getDefaultPopulators(world)) {
|
||||||
populator.populate(w, r, w.getChunkAt(cx, cz));
|
populator.populate(world, random, world.getChunkAt(chunkX, chunkZ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -19,7 +20,8 @@ import java.util.Random;
|
|||||||
private final IndependentPlotGenerator plotGenerator;
|
private final IndependentPlotGenerator plotGenerator;
|
||||||
private LocalBlockQueue queue;
|
private LocalBlockQueue queue;
|
||||||
|
|
||||||
@Override public void populate(final World world, final Random random, final Chunk source) {
|
@Override public void populate(@NotNull final World world, @NotNull final Random random,
|
||||||
|
@NotNull final Chunk source) {
|
||||||
if (this.queue == null) {
|
if (this.queue == null) {
|
||||||
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
|
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
public String world;
|
public String world;
|
||||||
public int chunkX;
|
public int chunkX;
|
||||||
public int chunkZ;
|
public int chunkZ;
|
||||||
@Getter @Setter private ChunkData cd = null;
|
@Getter @Setter private ChunkData chunkData = null;
|
||||||
|
|
||||||
public GenChunk() {
|
public GenChunk() {
|
||||||
super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15));
|
super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15));
|
||||||
@ -88,7 +88,8 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
int maxX = Math.max(pos1.getX(), pos2.getX());
|
int maxX = Math.max(pos1.getX(), pos2.getX());
|
||||||
int maxY = Math.max(pos1.getY(), pos2.getY());
|
int maxY = Math.max(pos1.getY(), pos2.getY());
|
||||||
int maxZ = Math.max(pos1.getZ(), pos2.getZ());
|
int maxZ = Math.max(pos1.getZ(), pos2.getZ());
|
||||||
cd.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class));
|
chunkData
|
||||||
|
.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, block.to(Material.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean setBiome(int x, int z, String biome) {
|
@Override public boolean setBiome(int x, int z, String biome) {
|
||||||
@ -105,10 +106,10 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
|
|
||||||
@Override public boolean setBlock(int x, int y, int z, PlotBlock id) {
|
@Override public boolean setBlock(int x, int y, int z, PlotBlock id) {
|
||||||
if (this.result == null) {
|
if (this.result == null) {
|
||||||
this.cd.setBlock(x, y, z, id.to(Material.class));
|
this.chunkData.setBlock(x, y, z, id.to(Material.class));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this.cd.setBlock(x, y, z, id.to(Material.class));
|
this.chunkData.setBlock(x, y, z, id.to(Material.class));
|
||||||
this.storeCache(x, y, z, id);
|
this.storeCache(x, y, z, id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -125,10 +126,10 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
|
|
||||||
@Override public boolean setBlock(int x, int y, int z, BaseBlock id) {
|
@Override public boolean setBlock(int x, int y, int z, BaseBlock id) {
|
||||||
if (this.result == null) {
|
if (this.result == null) {
|
||||||
this.cd.setBlock(x, y, z, BukkitAdapter.adapt(id));
|
this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this.cd.setBlock(x, y, z, BukkitAdapter.adapt(id));
|
this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id));
|
||||||
this.storeCache(x, y, z, PlotBlock.get(id.getBlockType().getId()));
|
this.storeCache(x, y, z, PlotBlock.get(id.getBlockType().getId()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -136,7 +137,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
@Override public PlotBlock getBlock(int x, int y, int z) {
|
@Override public PlotBlock getBlock(int x, int y, int z) {
|
||||||
int i = MainUtil.CACHE_I[y][x][z];
|
int i = MainUtil.CACHE_I[y][x][z];
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return PlotBlock.get(cd.getType(x, y, z));
|
return PlotBlock.get(chunkData.getType(x, y, z));
|
||||||
}
|
}
|
||||||
PlotBlock[] array = result[i];
|
PlotBlock[] array = result[i];
|
||||||
if (array == null) {
|
if (array == null) {
|
||||||
@ -177,7 +178,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toReturn.cd = this.cd;
|
toReturn.chunkData = this.chunkData;
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.DelegateLocalBlo
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public class AugmentedUtils {
|
|||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean generate(final String world, final int cx, final int cz,
|
public static boolean generate(@NotNull final String world, final int cx, final int cz,
|
||||||
LocalBlockQueue queue) {
|
LocalBlockQueue queue) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -139,7 +139,11 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
return null;
|
return null;
|
||||||
case 1:
|
case 1:
|
||||||
PlotArea pa = this.plotAreas[0];
|
PlotArea pa = this.plotAreas[0];
|
||||||
return pa.contains(location) ? pa : null;
|
if (pa.contains(location)) {
|
||||||
|
return pa;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
|
Loading…
Reference in New Issue
Block a user