mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-20 22:34:42 +02:00
Compare commits
1 Commits
fix/v6/plo
...
feature/v7
Author | SHA1 | Date | |
---|---|---|---|
86c54bf04c |
@ -80,8 +80,7 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
|||||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||||
}
|
}
|
||||||
|
|
||||||
//do not annotate with Override until we discontinue support for 1.4.4 (we no longer support 1.4.4)
|
//do not annotate with Override until we discontinue support for 1.4.4
|
||||||
@Override
|
|
||||||
public void setBiome(int x, int y, int z, @NonNull Biome biome) {
|
public void setBiome(int x, int y, int z, @NonNull Biome biome) {
|
||||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||||
|
|
||||||
|
@ -37,6 +37,10 @@ dependencies {
|
|||||||
// Logging
|
// Logging
|
||||||
compileOnlyApi(libs.log4j)
|
compileOnlyApi(libs.log4j)
|
||||||
|
|
||||||
|
// Records are cool. Builders are cooler
|
||||||
|
compileOnly(libs.recordBuilderProcessor)
|
||||||
|
annotationProcessor(libs.recordBuilderProcessor)
|
||||||
|
|
||||||
// Other libraries
|
// Other libraries
|
||||||
api(libs.prtree)
|
api(libs.prtree)
|
||||||
api(libs.aopalliance)
|
api(libs.aopalliance)
|
||||||
|
@ -889,8 +889,8 @@ public class PlotSquared {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
|
LOGGER.info("| generator: {}>{}", baseGenerator, areaGen);
|
||||||
LOGGER.info("| plot world: {}", pa.getClass().getCanonicalName());
|
LOGGER.info("| plot world: {}", pa);
|
||||||
LOGGER.info("| manager: {}", pa.getPlotManager().getClass().getCanonicalName());
|
LOGGER.info("| manager: {}", pa);
|
||||||
LOGGER.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
LOGGER.info("Note: Area created for cluster '{}' (invalid or old configuration?)", name);
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
@ -906,13 +906,6 @@ public class PlotSquared {
|
|||||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||||
}
|
}
|
||||||
PlotArea pa = areaGen.getPlotGenerator().getNewPlotArea(world, null, null, null);
|
PlotArea pa = areaGen.getPlotGenerator().getNewPlotArea(world, null, null, null);
|
||||||
LOGGER.info("- generator: {}>{}", baseGenerator, areaGen);
|
|
||||||
LOGGER.info("- plot world: {}", pa.getClass().getCanonicalName());
|
|
||||||
LOGGER.info("- plot area manager: {}", pa.getPlotManager().getClass().getCanonicalName());
|
|
||||||
if (!this.worldConfiguration.contains(path)) {
|
|
||||||
this.worldConfiguration.createSection(path);
|
|
||||||
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
|
||||||
}
|
|
||||||
pa.saveConfiguration(worldSection);
|
pa.saveConfiguration(worldSection);
|
||||||
pa.loadDefaultConfiguration(worldSection);
|
pa.loadDefaultConfiguration(worldSection);
|
||||||
try {
|
try {
|
||||||
@ -920,6 +913,9 @@ public class PlotSquared {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
LOGGER.info("- generator: {}>{}", baseGenerator, areaGen);
|
||||||
|
LOGGER.info("- plot world: {}", pa);
|
||||||
|
LOGGER.info("- plot area manager: {}", pa.getPlotManager());
|
||||||
areaGen.getPlotGenerator().initialize(pa);
|
areaGen.getPlotGenerator().initialize(pa);
|
||||||
areaGen.augment(pa);
|
areaGen.augment(pa);
|
||||||
addPlotArea(pa);
|
addPlotArea(pa);
|
||||||
|
@ -32,7 +32,6 @@ import com.plotsquared.core.configuration.caption.Caption;
|
|||||||
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
import com.plotsquared.core.configuration.caption.CaptionHolder;
|
||||||
import com.plotsquared.core.configuration.caption.Templates;
|
import com.plotsquared.core.configuration.caption.Templates;
|
||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
import com.plotsquared.core.database.DBFunc;
|
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
@ -40,7 +39,6 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
import com.plotsquared.core.plot.flag.implementations.PriceFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ServerPlotFlag;
|
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.util.EconHandler;
|
import com.plotsquared.core.util.EconHandler;
|
||||||
import com.plotsquared.core.util.MathMan;
|
import com.plotsquared.core.util.MathMan;
|
||||||
@ -420,7 +418,7 @@ public class ListCmd extends SubCommand {
|
|||||||
Caption color;
|
Caption color;
|
||||||
if (plot.getOwner() == null) {
|
if (plot.getOwner() == null) {
|
||||||
color = TranslatableCaption.of("info.plot_list_no_owner");
|
color = TranslatableCaption.of("info.plot_list_no_owner");
|
||||||
} else if (plot.isOwner(player.getUUID()) || plot.getOwner().equals(DBFunc.EVERYONE)) {
|
} else if (plot.isOwner(player.getUUID())) {
|
||||||
color = TranslatableCaption.of("info.plot_list_owned_by");
|
color = TranslatableCaption.of("info.plot_list_owned_by");
|
||||||
} else if (plot.isAdded(player.getUUID())) {
|
} else if (plot.isAdded(player.getUUID())) {
|
||||||
color = TranslatableCaption.of("info.plot_list_added_to");
|
color = TranslatableCaption.of("info.plot_list_added_to");
|
||||||
@ -458,60 +456,37 @@ public class ListCmd extends SubCommand {
|
|||||||
String prefix = "";
|
String prefix = "";
|
||||||
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
|
String online = TranslatableCaption.of("info.plot_list_player_online").getComponent(player);
|
||||||
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
|
String offline = TranslatableCaption.of("info.plot_list_player_offline").getComponent(player);
|
||||||
String unknown = TranslatableCaption.of("info.plot_list_player_unknown").getComponent(player);
|
|
||||||
String server = TranslatableCaption.of("info.plot_list_player_server").getComponent(player);
|
|
||||||
String everyone = TranslatableCaption.of("info.plot_list_player_everyone").getComponent(player);
|
|
||||||
TextComponent.Builder builder = Component.text();
|
TextComponent.Builder builder = Component.text();
|
||||||
if (plot.getFlag(ServerPlotFlag.class)) {
|
try {
|
||||||
Template serverTemplate = Template.of(
|
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
||||||
"info.server",
|
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||||
TranslatableCaption.of("info.server").getComponent(player)
|
for (final UUIDMapping uuidMapping : names) {
|
||||||
);
|
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
|
||||||
builder.append(MINI_MESSAGE.parse(server, serverTemplate));
|
Template prefixTemplate = Template.of("prefix", prefix);
|
||||||
} else {
|
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
||||||
try {
|
if (pp != null) {
|
||||||
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate));
|
||||||
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
} else {
|
||||||
for (final UUIDMapping uuidMapping : names) {
|
builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate));
|
||||||
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuidMapping.getUuid());
|
|
||||||
Template prefixTemplate = Template.of("prefix", prefix);
|
|
||||||
Template playerTemplate = Template.of("player", uuidMapping.getUsername());
|
|
||||||
if (pp != null) {
|
|
||||||
builder.append(MINI_MESSAGE.parse(online, prefixTemplate, playerTemplate));
|
|
||||||
} else if (uuidMapping.getUsername().equalsIgnoreCase("unknown")) {
|
|
||||||
Template unknownTemplate = Template.of(
|
|
||||||
"info.unknown",
|
|
||||||
TranslatableCaption.of("info.unknown").getComponent(player)
|
|
||||||
);
|
|
||||||
builder.append(MINI_MESSAGE.parse(unknown, unknownTemplate));
|
|
||||||
} else if (uuidMapping.getUuid().equals(DBFunc.EVERYONE)) {
|
|
||||||
Template everyoneTemplate = Template.of(
|
|
||||||
"info.everyone",
|
|
||||||
TranslatableCaption.of("info.everyone").getComponent(player)
|
|
||||||
);
|
|
||||||
builder.append(MINI_MESSAGE.parse(everyone, everyoneTemplate));
|
|
||||||
} else {
|
|
||||||
builder.append(MINI_MESSAGE.parse(offline, prefixTemplate, playerTemplate));
|
|
||||||
}
|
|
||||||
prefix = ", ";
|
|
||||||
}
|
}
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
prefix = ", ";
|
||||||
final StringBuilder playerBuilder = new StringBuilder();
|
|
||||||
final Iterator<UUID> uuidIterator = plot.getOwners().iterator();
|
|
||||||
while (uuidIterator.hasNext()) {
|
|
||||||
final UUID uuid = uuidIterator.next();
|
|
||||||
playerBuilder.append(uuid);
|
|
||||||
if (uuidIterator.hasNext()) {
|
|
||||||
playerBuilder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.sendMessage(
|
|
||||||
TranslatableCaption.of("errors.invalid_player"),
|
|
||||||
Templates.of("value", playerBuilder.toString())
|
|
||||||
);
|
|
||||||
} catch (TimeoutException e) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
|
||||||
}
|
}
|
||||||
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
|
final StringBuilder playerBuilder = new StringBuilder();
|
||||||
|
final Iterator<UUID> uuidIterator = plot.getOwners().iterator();
|
||||||
|
while (uuidIterator.hasNext()) {
|
||||||
|
final UUID uuid = uuidIterator.next();
|
||||||
|
playerBuilder.append(uuid);
|
||||||
|
if (uuidIterator.hasNext()) {
|
||||||
|
playerBuilder.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.invalid_player"),
|
||||||
|
Templates.of("value", playerBuilder.toString())
|
||||||
|
);
|
||||||
|
} catch (TimeoutException e) {
|
||||||
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
}
|
}
|
||||||
Template players = Template.of("players", builder.asComponent());
|
Template players = Template.of("players", builder.asComponent());
|
||||||
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
||||||
|
@ -41,7 +41,7 @@ import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
|||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
||||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
import com.plotsquared.core.queue.BlockArrayCacheScopedQueueCoordinator;
|
import com.plotsquared.core.queue.ChunkQueueCoordinator;
|
||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import com.plotsquared.core.queue.QueueCoordinator;
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
import com.plotsquared.core.util.ChunkManager;
|
import com.plotsquared.core.util.ChunkManager;
|
||||||
@ -83,7 +83,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public class HybridUtils {
|
public class HybridUtils {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridUtils.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + HybridUtils.class.getSimpleName());
|
||||||
private static final BlockState AIR = BlockTypes.AIR.getDefaultState();
|
|
||||||
|
|
||||||
public static HybridUtils manager;
|
public static HybridUtils manager;
|
||||||
public static Set<BlockVector2> regions;
|
public static Set<BlockVector2> regions;
|
||||||
@ -137,11 +136,6 @@ public class HybridUtils {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
final PlotArea area = this.plotAreaManager.getPlotArea(world, null);
|
|
||||||
if (!(area instanceof HybridPlotWorld hpw)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final BlockVector3 bot = region.getMinimumPoint();
|
final BlockVector3 bot = region.getMinimumPoint();
|
||||||
final BlockVector3 top = region.getMaximumPoint();
|
final BlockVector3 top = region.getMaximumPoint();
|
||||||
|
|
||||||
@ -158,28 +152,37 @@ public class HybridUtils {
|
|||||||
final int height = area.getMaxGenHeight() - area.getMinGenHeight() + 1;
|
final int height = area.getMaxGenHeight() - area.getMinGenHeight() + 1;
|
||||||
final int minHeight = area.getMinGenHeight();
|
final int minHeight = area.getMinGenHeight();
|
||||||
|
|
||||||
|
final PlotArea area = this.plotAreaManager.getPlotArea(world, null);
|
||||||
|
|
||||||
|
if (!(area instanceof HybridPlotWorld hpw)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChunkQueueCoordinator chunk = new ChunkQueueCoordinator(worldUtil.getWeWorld(world), bot, top, false);
|
||||||
|
hpw.getGenerator().generateChunk(chunk, hpw);
|
||||||
|
|
||||||
|
final BlockState airBlock = BlockTypes.AIR.getDefaultState();
|
||||||
|
final BlockState[][][] oldBlocks = chunk.getBlocks();
|
||||||
final BlockState[][][] newBlocks = new BlockState[height][width][length];
|
final BlockState[][][] newBlocks = new BlockState[height][width][length];
|
||||||
|
for (final BlockState[][] newBlock : newBlocks) {
|
||||||
|
for (final BlockState[] blockStates : newBlock) {
|
||||||
|
Arrays.fill(blockStates, airBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final BlockState[][] oldBlock : oldBlocks) {
|
||||||
|
for (final BlockState[] blockStates : oldBlock) {
|
||||||
|
Arrays.fill(blockStates, airBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BlockArrayCacheScopedQueueCoordinator oldBlockQueue = new BlockArrayCacheScopedQueueCoordinator(
|
System.gc();
|
||||||
Location.at("", region.getMinimumPoint().withY(hpw.getMinGenHeight())),
|
System.gc();
|
||||||
Location.at("", region.getMaximumPoint().withY(hpw.getMaxGenHeight()))
|
|
||||||
);
|
|
||||||
|
|
||||||
region.getChunks().forEach(chunkPos -> {
|
|
||||||
int relChunkX = chunkPos.getX() - cbx;
|
|
||||||
int relChunkZ = chunkPos.getZ() - cbz;
|
|
||||||
oldBlockQueue.setOffsetX(relChunkX << 4);
|
|
||||||
oldBlockQueue.setOffsetZ(relChunkZ << 4);
|
|
||||||
hpw.getGenerator().generateChunk(oldBlockQueue, hpw);
|
|
||||||
});
|
|
||||||
|
|
||||||
final BlockState[][][] oldBlocks = oldBlockQueue.getBlockStates();
|
|
||||||
|
|
||||||
QueueCoordinator queue = area.getQueue();
|
QueueCoordinator queue = area.getQueue();
|
||||||
queue.addReadChunks(region.getChunks());
|
queue.addReadChunks(region.getChunks());
|
||||||
queue.setChunkConsumer(chunkPos -> {
|
queue.setChunkConsumer(blockVector2 -> {
|
||||||
int X = chunkPos.getX();
|
int X = blockVector2.getX();
|
||||||
int Z = chunkPos.getZ();
|
int Z = blockVector2.getZ();
|
||||||
int minX;
|
int minX;
|
||||||
if (X == cbx) {
|
if (X == cbx) {
|
||||||
minX = bx & 15;
|
minX = bx & 15;
|
||||||
@ -217,9 +220,6 @@ public class HybridUtils {
|
|||||||
for (int yIndex = 0; yIndex < height; yIndex++) {
|
for (int yIndex = 0; yIndex < height; yIndex++) {
|
||||||
int y = yIndex + minHeight;
|
int y = yIndex + minHeight;
|
||||||
BlockState block = queue.getBlock(xx, y, zz);
|
BlockState block = queue.getBlock(xx, y, zz);
|
||||||
if (block == null) {
|
|
||||||
block = AIR;
|
|
||||||
}
|
|
||||||
int xr = xb + x;
|
int xr = xb + x;
|
||||||
int zr = zb + z;
|
int zr = zb + z;
|
||||||
newBlocks[yIndex][xr][zr] = block;
|
newBlocks[yIndex][xr][zr] = block;
|
||||||
@ -240,10 +240,10 @@ public class HybridUtils {
|
|||||||
for (int z = 0; z < length; z++) {
|
for (int z = 0; z < length; z++) {
|
||||||
Set<BlockType> types = new HashSet<>();
|
Set<BlockType> types = new HashSet<>();
|
||||||
for (int yIndex = 0; yIndex < height; yIndex++) {
|
for (int yIndex = 0; yIndex < height; yIndex++) {
|
||||||
BlockState old = oldBlocks[yIndex][x][z]; // Nullable
|
BlockState old = oldBlocks[yIndex][x][z];
|
||||||
try {
|
try {
|
||||||
BlockState now = newBlocks[yIndex][x][z]; // Not null
|
BlockState now = newBlocks[yIndex][x][z];
|
||||||
if (!now.equals(old) && !(old == null && now.getBlockType().equals(BlockTypes.AIR))) {
|
if (!old.equals(now)) {
|
||||||
changes[i]++;
|
changes[i]++;
|
||||||
}
|
}
|
||||||
if (now.getBlockType().getMaterial().isAir()) {
|
if (now.getBlockType().getMaterial().isAir()) {
|
||||||
@ -301,6 +301,8 @@ public class HybridUtils {
|
|||||||
analysis.data_sd = (int) (MathMan.getSD(data, analysis.data) * 100);
|
analysis.data_sd = (int) (MathMan.getSD(data, analysis.data) * 100);
|
||||||
analysis.air_sd = (int) (MathMan.getSD(air, analysis.air) * 100);
|
analysis.air_sd = (int) (MathMan.getSD(air, analysis.air) * 100);
|
||||||
analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety) * 100);
|
analysis.variety_sd = (int) (MathMan.getSD(variety, analysis.variety) * 100);
|
||||||
|
System.gc();
|
||||||
|
System.gc();
|
||||||
whenDone.value = analysis;
|
whenDone.value = analysis;
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.plotsquared.core.player;
|
||||||
|
|
||||||
|
public enum PlotRole {
|
||||||
|
OWNER,
|
||||||
|
HELPER,
|
||||||
|
TRUSTED,
|
||||||
|
DENIED,
|
||||||
|
}
|
@ -290,14 +290,14 @@ public class Plot {
|
|||||||
* @param area the plot's PlotArea
|
* @param area the plot's PlotArea
|
||||||
* @param merged an array giving merged plots
|
* @param merged an array giving merged plots
|
||||||
* @param timestamp when the plot was created
|
* @param timestamp when the plot was created
|
||||||
* @param temp value representing whatever DBManager needs to to. Do not touch tbh.
|
* @param temp value representing whatever DBManager needs it to. Do not touch tbh.
|
||||||
*/
|
*/
|
||||||
public Plot(
|
public Plot(
|
||||||
@NonNull PlotId id,
|
@NonNull PlotId id,
|
||||||
UUID owner,
|
UUID owner,
|
||||||
HashSet<UUID> trusted,
|
Set<UUID> trusted,
|
||||||
HashSet<UUID> members,
|
Set<UUID> members,
|
||||||
HashSet<UUID> denied,
|
Set<UUID> denied,
|
||||||
String alias,
|
String alias,
|
||||||
BlockLoc position,
|
BlockLoc position,
|
||||||
Collection<PlotFlag<?, ?>> flags,
|
Collection<PlotFlag<?, ?>> flags,
|
||||||
@ -310,9 +310,9 @@ public class Plot {
|
|||||||
this.area = area;
|
this.area = area;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.settings = new PlotSettings();
|
this.settings = new PlotSettings();
|
||||||
this.members = members;
|
this.members = new HashSet<>(members);
|
||||||
this.trusted = trusted;
|
this.trusted = new HashSet<>(trusted);
|
||||||
this.denied = denied;
|
this.denied = new HashSet<>(denied);
|
||||||
this.settings.setAlias(alias);
|
this.settings.setAlias(alias);
|
||||||
this.settings.setPosition(position);
|
this.settings.setPosition(position);
|
||||||
this.settings.setMerged(merged);
|
this.settings.setMerged(merged);
|
||||||
@ -321,9 +321,7 @@ public class Plot {
|
|||||||
if (area != null) {
|
if (area != null) {
|
||||||
this.flagContainer.setParentContainer(area.getFlagContainer());
|
this.flagContainer.setParentContainer(area.getFlagContainer());
|
||||||
if (flags != null) {
|
if (flags != null) {
|
||||||
for (PlotFlag<?, ?> flag : flags) {
|
flags.forEach(this.flagContainer::addFlag);
|
||||||
this.flagContainer.addFlag(flag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.platform().injector().injectMembers(this);
|
PlotSquared.platform().injector().injectMembers(this);
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.plotsquared.core.plot;
|
||||||
|
|
||||||
|
import com.plotsquared.core.repository.PlotRepository;
|
||||||
|
import com.plotsquared.core.repository.PlotRoleRepository;
|
||||||
|
import com.plotsquared.core.repository.PlotSettingsRepository;
|
||||||
|
import com.plotsquared.core.repository.dbo.PlotSettingsDBOBuilder;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public final class PlotService {
|
||||||
|
|
||||||
|
private static final String PLOT_SETTINGS_DEFAULT_POSITION = "default";
|
||||||
|
|
||||||
|
private final PlotRepository plotRepository;
|
||||||
|
private final PlotSettingsRepository plotSettingsRepository;
|
||||||
|
private final PlotRoleRepository plotRoleRepository;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PlotService(
|
||||||
|
final @NonNull PlotRepository plotRepository,
|
||||||
|
final @NonNull PlotSettingsRepository plotSettingsRepository,
|
||||||
|
final @NonNull PlotRoleRepository plotRoleRepository
|
||||||
|
) {
|
||||||
|
this.plotRepository = plotRepository;
|
||||||
|
this.plotSettingsRepository = plotSettingsRepository;
|
||||||
|
this.plotRoleRepository = plotRoleRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list containing all the plots in the given {@code plotArea}.
|
||||||
|
*
|
||||||
|
* @param plotArea the area
|
||||||
|
* @return all plots in the area
|
||||||
|
*/
|
||||||
|
public @NonNull Collection<Plot> getPlotsInArea(final @NonNull PlotArea plotArea) {
|
||||||
|
return this.plotRepository.getPlotsInArea(plotArea.getId())
|
||||||
|
.map(plotDBO -> {
|
||||||
|
final var settings = this.plotSettingsRepository.findById(plotDBO)
|
||||||
|
.orElseGet(() -> PlotSettingsDBOBuilder.builder()
|
||||||
|
.plot(plotDBO)
|
||||||
|
.position(PLOT_SETTINGS_DEFAULT_POSITION)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
return plotDBO.toPlot(
|
||||||
|
plotArea,
|
||||||
|
settings,
|
||||||
|
this.plotRoleRepository.findAllFor(plotDBO),
|
||||||
|
List.of()
|
||||||
|
);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
@ -75,9 +75,9 @@ public class ExpiryTask {
|
|||||||
plots = plots != null ? plots : getPlotsToCheck();
|
plots = plots != null ? plots : getPlotsToCheck();
|
||||||
int diff = settings.REQUIRED_PLOTS;
|
int diff = settings.REQUIRED_PLOTS;
|
||||||
boolean min = true;
|
boolean min = true;
|
||||||
if (plots.size() > settings.REQUIRED_PLOTS) {
|
if (settings.REQUIRED_PLOTS - plots.size() < settings.REQUIRED_PLOTS) {
|
||||||
min = false;
|
min = false;
|
||||||
diff = plots.size() - settings.REQUIRED_PLOTS;
|
diff = settings.REQUIRED_PLOTS - plots.size();
|
||||||
}
|
}
|
||||||
List<Long> entireList =
|
List<Long> entireList =
|
||||||
plots.stream().map(plot -> ExpireManager.IMP.getAge(plot, settings.DELETE_IF_OWNER_IS_UNKNOWN))
|
plots.stream().map(plot -> ExpireManager.IMP.getAge(plot, settings.DELETE_IF_OWNER_IS_UNKNOWN))
|
||||||
|
@ -1,175 +0,0 @@
|
|||||||
/*
|
|
||||||
* _____ _ _ _____ _
|
|
||||||
* | __ \| | | | / ____| | |
|
|
||||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
|
||||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
|
||||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
|
||||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
|
||||||
* | |
|
|
||||||
* |_|
|
|
||||||
* PlotSquared plot management system for Minecraft
|
|
||||||
* Copyright (C) 2014 - 2022 IntellectualSites
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.plotsquared.core.queue;
|
|
||||||
|
|
||||||
import com.plotsquared.core.location.Location;
|
|
||||||
import com.plotsquared.core.util.AnnotationHelper;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link QueueCoordinator} that caches all blocks set to it in a given array of form BlockState[][][]. An offset can be
|
|
||||||
* applied to blocks set to it, and the scope limited. This should have blocks set to it one chunk at a time, based on the
|
|
||||||
* result of {@link BlockArrayCacheScopedQueueCoordinator#getMin()} and {@link BlockArrayCacheScopedQueueCoordinator#getMax()}.
|
|
||||||
* The min and max points of this queue are offset according to the minimum point given in the constructor, and the offsets set
|
|
||||||
* in {@link BlockArrayCacheScopedQueueCoordinator#setOffsetX(int)} and
|
|
||||||
* {@link BlockArrayCacheScopedQueueCoordinator#setOffsetZ(int)}
|
|
||||||
*/
|
|
||||||
@AnnotationHelper.ApiDescription(info = "Internal use only. Subject to change at any time and created for specific use cases.")
|
|
||||||
public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinator {
|
|
||||||
|
|
||||||
private final BlockState[][][] blockStates;
|
|
||||||
private final int height;
|
|
||||||
private final int width;
|
|
||||||
private final int length;
|
|
||||||
private final int minY;
|
|
||||||
private final int maxY;
|
|
||||||
private final int scopeMinX;
|
|
||||||
private final int scopeMinZ;
|
|
||||||
private final int scopeMaxX;
|
|
||||||
private final int scopeMaxZ;
|
|
||||||
private int offsetX = 0;
|
|
||||||
private int offsetZ = 0;
|
|
||||||
/**
|
|
||||||
* Construct a new instance
|
|
||||||
*
|
|
||||||
* @param min Inclusive location of the minimum point to limit the scope to.
|
|
||||||
* @param max Inclusive location of the maximum point to limit the scope to.
|
|
||||||
* @since TODO
|
|
||||||
*/
|
|
||||||
public BlockArrayCacheScopedQueueCoordinator(Location min, Location max) {
|
|
||||||
super(null, min, max);
|
|
||||||
this.width = max.getX() - min.getX() + 1;
|
|
||||||
this.length = max.getZ() - min.getZ() + 1;
|
|
||||||
this.minY = min.getY();
|
|
||||||
this.maxY = max.getY();
|
|
||||||
this.height = maxY - minY + 1;
|
|
||||||
|
|
||||||
this.scopeMinX = min.getX() & 15;
|
|
||||||
this.scopeMinZ = min.getZ() & 15;
|
|
||||||
this.scopeMaxX = scopeMinX + width;
|
|
||||||
this.scopeMaxZ = scopeMinZ + length;
|
|
||||||
this.blockStates = new BlockState[height][width][length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockState[][][] getBlockStates() {
|
|
||||||
return blockStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(int x, final int y, int z, final @NonNull BlockState id) {
|
|
||||||
x += offsetX;
|
|
||||||
z += offsetZ;
|
|
||||||
if (x >= scopeMinX && x < scopeMaxX && y >= minY && y <= maxY && z >= scopeMinZ && z < scopeMaxZ) {
|
|
||||||
blockStates[y - minY][x - scopeMinX][z - scopeMinZ] = id;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(final int x, final int y, final int z, @NonNull final Pattern pattern) {
|
|
||||||
int rx = x + offsetX;
|
|
||||||
int rz = z + offsetZ;
|
|
||||||
if (rx >= scopeMinX && rx < scopeMaxX && y >= minY && y <= maxY && rz >= scopeMinZ && rz < scopeMaxZ) {
|
|
||||||
BlockState state = pattern
|
|
||||||
.applyBlock(super.getMin().getBlockVector3().add(BlockVector3.at(x, y, z)))
|
|
||||||
.toImmutableState();
|
|
||||||
blockStates[y - minY][rx - scopeMinX][rz - scopeMinZ] = state;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NonNull Location getMin() {
|
|
||||||
return super.getMin().add(offsetX - scopeMinX, 0, offsetZ - scopeMinZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NonNull Location getMax() {
|
|
||||||
return getMin().add(15, 0, 15).withY(maxY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBlock(int x, int y, int z, final @NonNull BaseBlock id) {
|
|
||||||
x += offsetX;
|
|
||||||
z += offsetZ;
|
|
||||||
if (x >= scopeMinX && x < scopeMaxX && y >= minY && y <= maxY && z >= scopeMinZ && z < scopeMaxZ) {
|
|
||||||
blockStates[y - minY][x][z] = id.toImmutableState();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable BlockState getBlock(final int x, final int y, final int z) {
|
|
||||||
if (x >= 0 && x < width && y >= minY && y <= maxY && z >= 0 && z < length) {
|
|
||||||
return blockStates[y - minY][x][z];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOffsetX(final int offsetX) {
|
|
||||||
this.offsetX = offsetX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOffsetZ(final int offsetZ) {
|
|
||||||
this.offsetZ = offsetZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
return height * width * length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBiome(final int x, final int z, @NonNull final BiomeType biome) {
|
|
||||||
//do nothing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setBiome(final int x, final int y, final int z, @NonNull final BiomeType biome) {
|
|
||||||
//do nothing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillBiome(final BiomeType biome) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setTile(final int x, final int y, final int z, @NonNull final CompoundTag tag) {
|
|
||||||
//do nothing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.plotsquared.core.repository;
|
||||||
|
|
||||||
|
import com.plotsquared.core.plot.PlotId;
|
||||||
|
import com.plotsquared.core.repository.dbo.PlotDBO;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link Repository} storing {@link PlotDBO plots} identified by their respective {@link PlotId}.
|
||||||
|
*/
|
||||||
|
public interface PlotRepository extends Repository<PlotDBO, Integer> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all plots in the given {@code area}.
|
||||||
|
*
|
||||||
|
* @param area the plot area
|
||||||
|
* @return a stream with all plots in the given area.
|
||||||
|
*/
|
||||||
|
@NonNull Stream<PlotDBO> getPlotsInArea(@NonNull String area);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.plotsquared.core.repository;
|
||||||
|
|
||||||
|
import com.plotsquared.core.repository.dbo.PlotDBO;
|
||||||
|
import com.plotsquared.core.repository.dbo.PlotRoleDBO;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PlotRoleRepository extends Repository<PlotRoleDBO, PlotRoleDBO.Key> {
|
||||||
|
|
||||||
|
List<PlotRoleDBO> findAllFor(@NonNull PlotDBO plotDBO);
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.plotsquared.core.repository;
|
||||||
|
|
||||||
|
import com.plotsquared.core.repository.dbo.PlotDBO;
|
||||||
|
import com.plotsquared.core.repository.dbo.PlotSettingsDBO;
|
||||||
|
|
||||||
|
public interface PlotSettingsRepository extends Repository<PlotSettingsDBO, PlotDBO> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.plotsquared.core.repository;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic object repository.
|
||||||
|
*
|
||||||
|
* @param <T> the type of object stored in the repository.
|
||||||
|
* @param <U> the type used to identify objects stored in the repository.
|
||||||
|
*/
|
||||||
|
public interface Repository<@NonNull T, @NonNull U> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the given object.
|
||||||
|
*
|
||||||
|
* @param object {@code the object}.
|
||||||
|
*/
|
||||||
|
void save(T object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the object by its {@code id}.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
*/
|
||||||
|
@NonNull Optional<T> findById(U id);
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.plotsquared.core.repository.dbo;
|
||||||
|
|
||||||
|
import com.plotsquared.core.location.BlockLoc;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.PlotId;
|
||||||
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
|
import io.soabase.recordbuilder.core.RecordBuilder;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@RecordBuilder
|
||||||
|
public record PlotDBO(
|
||||||
|
@Nullable Integer id,
|
||||||
|
int plotIdX,
|
||||||
|
int plotIdZ,
|
||||||
|
@NonNull String world,
|
||||||
|
@NonNull UUID owner,
|
||||||
|
@NonNull Instant timestamp
|
||||||
|
) {
|
||||||
|
|
||||||
|
public @NonNull Plot toPlot(
|
||||||
|
final @NonNull PlotArea plotArea,
|
||||||
|
final @NonNull PlotSettingsDBO plotSettingsDBO,
|
||||||
|
final @NonNull Collection<PlotRoleDBO> plotRoles,
|
||||||
|
final @NonNull Collection<PlotFlag<?, ?>> flags
|
||||||
|
) {
|
||||||
|
final PlotId plotId = PlotId.of(this.plotIdX(), this.plotIdZ());
|
||||||
|
final int id = Objects.requireNonNull(id(), "id may not be null");
|
||||||
|
|
||||||
|
final Set<UUID> trusted = new HashSet<>();
|
||||||
|
final Set<UUID> members = new HashSet<>();
|
||||||
|
final Set<UUID> denied = new HashSet<>();
|
||||||
|
for (final PlotRoleDBO plotRole : plotRoles) {
|
||||||
|
switch (plotRole.plotRole()) {
|
||||||
|
case TRUSTED -> trusted.add(plotRole.userId());
|
||||||
|
case HELPER -> members.add(plotRole.userId());
|
||||||
|
case DENIED -> denied.add(plotRole.userId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Plot(
|
||||||
|
plotId,
|
||||||
|
this.owner(),
|
||||||
|
Collections.unmodifiableSet(trusted),
|
||||||
|
Collections.unmodifiableSet(members),
|
||||||
|
Collections.unmodifiableSet(denied),
|
||||||
|
plotSettingsDBO.alias(),
|
||||||
|
BlockLoc.fromString(plotSettingsDBO.position()),
|
||||||
|
flags,
|
||||||
|
plotArea,
|
||||||
|
plotSettingsDBO.unwrapMerged(),
|
||||||
|
this.timestamp().toEpochMilli(),
|
||||||
|
id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.plotsquared.core.repository.dbo;
|
||||||
|
|
||||||
|
import com.plotsquared.core.player.PlotRole;
|
||||||
|
import io.soabase.recordbuilder.core.RecordBuilder;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@RecordBuilder
|
||||||
|
public record PlotRoleDBO(
|
||||||
|
@NonNull PlotDBO plot,
|
||||||
|
@NonNull UUID userId,
|
||||||
|
@NonNull PlotRole plotRole
|
||||||
|
) {
|
||||||
|
|
||||||
|
public @NonNull Key key() {
|
||||||
|
return new Key(this.plot(), this.userId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public record Key(@NonNull PlotDBO plot, @NonNull UUID userId) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.plotsquared.core.repository.dbo;
|
||||||
|
|
||||||
|
import io.soabase.recordbuilder.core.RecordBuilder;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
@RecordBuilder
|
||||||
|
public record PlotSettingsDBO(
|
||||||
|
@NonNull PlotDBO plot,
|
||||||
|
@Nullable String alias,
|
||||||
|
Integer merged,
|
||||||
|
@NonNull String position
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unwraps {@link #merged()} into an array indicating whether the plot is merged in
|
||||||
|
* any given cardinal direction. The indices of the array correspond to the ordinals of
|
||||||
|
* {@link com.plotsquared.core.location.Direction}.
|
||||||
|
*
|
||||||
|
* @return unwrapped merged status
|
||||||
|
*/
|
||||||
|
public boolean@NonNull [] unwrapMerged() {
|
||||||
|
final boolean[] merged = new boolean[4];
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
merged[3 - i] = (this.merged() & 1 << i) != 0;
|
||||||
|
}
|
||||||
|
return merged;
|
||||||
|
}
|
||||||
|
}
|
@ -381,9 +381,6 @@
|
|||||||
"info.plot_list_default": "<gold><plot></gold>",
|
"info.plot_list_default": "<gold><plot></gold>",
|
||||||
"info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_aqua>Online</dark_aqua>\"><gold><player></gold></hover>",
|
"info.plot_list_player_online": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_aqua>Online</dark_aqua>\"><gold><player></gold></hover>",
|
||||||
"info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_gray>Offline</dark_gray>\"><gold><player></gold></hover>",
|
"info.plot_list_player_offline": "<dark_aqua><prefix></dark_aqua><hover:show_text:\"<dark_gray>Offline</dark_gray>\"><gold><player></gold></hover>",
|
||||||
"info.plot_list_player_unknown": "<hover:show_text:\"<red>The owner of this plot is unknown</red>\"><white><info.unknown></white></hover>",
|
|
||||||
"info.plot_list_player_server": "<hover:show_text:\"<red>The plot is owned by the server</red>\"><white><info.server></white></hover>",
|
|
||||||
"info.plot_list_player_everyone": "<hover:show_text:\"<blue>The plot is owned by everyone</blue>\"><white><info.everyone></white></hover>",
|
|
||||||
"info.area_info_format": "<header>\n<reset><gold>Name: </gold><gray><name></gray>\n<gold>Type: </gold><gray><type></gray>\n<gold>Terrain: </gold><gray><terrain></gray>\n<gold>Usage: </gold><gray><usage>%</gray>\n<gold>Claimed: </gold><gray><claimed></gray>\n<gold>Clusters: </gold><gray><clusters></gray>\n<gold>Region: </gold><gray><region></gray>\n<gold>Generator: </gold><gray><generator></gray>\n<footer>",
|
"info.area_info_format": "<header>\n<reset><gold>Name: </gold><gray><name></gray>\n<gold>Type: </gold><gray><type></gray>\n<gold>Terrain: </gold><gray><terrain></gray>\n<gold>Usage: </gold><gray><usage>%</gray>\n<gold>Claimed: </gold><gray><claimed></gray>\n<gold>Clusters: </gold><gray><clusters></gray>\n<gold>Region: </gold><gray><region></gray>\n<gold>Generator: </gold><gray><generator></gray>\n<footer>",
|
||||||
"info.area_list_tooltip": "<gold>Claimed=</gold><gray><claimed></gray>\n<gold>Usage=</gold><gray><usage></gray>\n<gold>Clusters=</gold><gray><clusters></gray>\n<gold>Region=</gold><gray><region></gray>\n<gold>Generator=</gold><gray><generator></gray>",
|
"info.area_list_tooltip": "<gold>Claimed=</gold><gray><claimed></gray>\n<gold>Usage=</gold><gray><usage></gray>\n<gold>Clusters=</gold><gray><clusters></gray>\n<gold>Region=</gold><gray><region></gray>\n<gold>Generator=</gold><gray><generator></gray>",
|
||||||
"info.area_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:<command_info>><hover:show_text:\"<hover_info>\"><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
|
"info.area_list_item": "<click:run_command:<command_tp>><hover:show_text:\"<command_tp>\"><dark_gray>[</dark_gray><gold><number></gold><dark_gray>]</dark_gray></hover></click> <click:run_command:<command_info>><hover:show_text:\"<hover_info>\"><gold><area_name></gold></hover></click><gray> - </gray><gray><area_type>:<area_terrain></gray>",
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
create table if not exists ${prefix}plot(
|
||||||
|
id int(11) not null auto_increment,
|
||||||
|
plot_id_x int(11) not null,
|
||||||
|
plot_id_z int(11) not null,
|
||||||
|
world varchar(45) not null,
|
||||||
|
owner varchar(40) not null,
|
||||||
|
timestamp timestamp not null default current_timestamp,
|
||||||
|
primary key (id)
|
||||||
|
) engine=InnoDB default charset=utf8 auto_increment=0;
|
||||||
|
|
||||||
|
-- TODO: Migrating existing data to this table.
|
||||||
|
create table if not exists ${prefix}plot_role(
|
||||||
|
plot_id int(11) not null,
|
||||||
|
user_id varchar(45) not null,
|
||||||
|
role enum('helper', 'trusted', 'denied') not null,
|
||||||
|
foreign key (plot_id) references ${prefix}plot(id) on delete cascade,
|
||||||
|
primary key (plot_id, user_id)
|
||||||
|
) engine=InnoDB default charset=utf8 auto_increment=0;
|
||||||
|
|
||||||
|
create table if not exists ${prefix}plot_comments(
|
||||||
|
world varchar(45) not null,
|
||||||
|
comment varchar(45) not null,
|
||||||
|
inbox varchar(45) not null,
|
||||||
|
timestamp int(11) not null,
|
||||||
|
sender varchar(45) not null
|
||||||
|
) engine=InnoDB default charset=utf8 auto_increment=0;
|
||||||
|
|
||||||
|
-- TODO: Look into what to do with this one...
|
||||||
|
-- Most data is now found in flags.
|
||||||
|
create table if not exists ${prefix}plot_settings(
|
||||||
|
plot_plot_id int(11) not null,
|
||||||
|
biome varchar(45) default 'FOREST', -- Unused. Moved to flags.
|
||||||
|
rain int(1) default 0, -- Unused. Moved to flags.
|
||||||
|
custom_time tinyint(1) default 0, -- Unused. Moved to flags.
|
||||||
|
time int(11) default 8000, -- Unused. Moved to flags.
|
||||||
|
deny_entry tinyint(1) default 0, -- Unused. Moved to flags.
|
||||||
|
alias varchar(50) default null,
|
||||||
|
merged int(11) default null,
|
||||||
|
position varchar(50) not null default 'default',
|
||||||
|
foreign key (plot_plot_id) references ${prefix}plot(id) on delete cascade,
|
||||||
|
primary key (plot_plot_id)
|
||||||
|
) engine=InnoDB default charset=utf8;
|
||||||
|
|
||||||
|
-- TODO: Look into adding foreign keys to this.
|
||||||
|
create table if not exists ${prefix}plot_rating(
|
||||||
|
plot_plot_id int(11) not null,
|
||||||
|
rating int(2) not null,
|
||||||
|
player varchar(45) not null
|
||||||
|
) engine=InnoDB default charset=utf8;
|
||||||
|
|
||||||
|
-- TODO: Drop the key and make the player ID the key instead.
|
||||||
|
create table if not exists ${prefix}player_meta(
|
||||||
|
meta_id int(11) not null auto_increment,
|
||||||
|
uuid varchar(45) not null,
|
||||||
|
key varchar(32) not null,
|
||||||
|
value blob not null,
|
||||||
|
primary key (meta_id)
|
||||||
|
) engine=InnoDB default charset=utf8 auto_increment=0;
|
||||||
|
|
||||||
|
-- TODO: Drop the ID and make (plot_id, flag) the new primary key.
|
||||||
|
create table if not exists ${prefix}plot_flags(
|
||||||
|
id int(11) not null auto_increment primary key,
|
||||||
|
plot_id int(11) not null,
|
||||||
|
flag varchar(64),
|
||||||
|
value varchar(512),
|
||||||
|
foreign key (plot_id) references ${prefix}plot(id) on delete cascade,
|
||||||
|
unique (plot_id, flag)
|
||||||
|
) engine=InnoDB default charset=utf8 auto_increment=0;
|
@ -36,6 +36,7 @@ paperlib = "1.0.7"
|
|||||||
squirrelid = "0.3.1"
|
squirrelid = "0.3.1"
|
||||||
serverlib = "2.3.1"
|
serverlib = "2.3.1"
|
||||||
http4j = "1.3"
|
http4j = "1.3"
|
||||||
|
record-builder-processor = "33"
|
||||||
|
|
||||||
# Gradle plugins
|
# Gradle plugins
|
||||||
shadow = "7.1.2"
|
shadow = "7.1.2"
|
||||||
@ -86,6 +87,7 @@ arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitek
|
|||||||
http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" }
|
http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" }
|
||||||
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
|
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
|
||||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||||
|
recordBuilderProcessor = { group = "io.soabase.record-builder", name = "record-builder-processor", version.ref = "record-builder-processor" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||||
|
Reference in New Issue
Block a user