Compare commits

..

2 Commits

Author SHA1 Message Date
59a8fe5d6f powder snow is 1.17+ 2022-08-04 16:36:24 +02:00
ec51a60d80 replace usages of snow tag 2022-08-03 20:07:19 +02:00
9 changed files with 54 additions and 33 deletions

View File

@ -27,7 +27,6 @@ body:
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false
options:
- '1.19.2'
- '1.19.1'
- '1.19'
- '1.18.2'

View File

@ -656,15 +656,20 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
final @NonNull SQLiteUUIDService sqLiteUUIDService,
final @NonNull CacheUUIDService cacheUUIDService
) {
// Record all unique UUID's and put them into a queue
final Set<UUID> uuidSet = new HashSet<>();
// Load all uuids into a big chunky boi queue
final Queue<UUID> uuidQueue = new LinkedBlockingQueue<>();
PlotSquared.get().forEachPlotRaw(plot -> {
uuidSet.add(plot.getOwnerAbs());
uuidSet.addAll(plot.getMembers());
uuidSet.addAll(plot.getTrusted());
uuidSet.addAll(plot.getDenied());
final Set<UUID> uuids = new HashSet<>();
uuids.add(plot.getOwnerAbs());
uuids.addAll(plot.getMembers());
uuids.addAll(plot.getTrusted());
uuids.addAll(plot.getDenied());
for (final UUID uuid : uuids) {
if (!uuidQueue.contains(uuid)) {
uuidQueue.add(uuid);
}
}
});
final Queue<UUID> uuidQueue = new LinkedBlockingQueue<>(uuidSet);
LOGGER.info("(UUID) {} UUIDs will be cached", uuidQueue.size());

View File

@ -121,6 +121,23 @@ public class BlockEventListener implements Listener {
Material.TURTLE_EGG,
Material.TURTLE_SPAWN_EGG
);
private static final Set<Material> SNOW; // needed as Tag.SNOW isn't present in 1.16.5
static {
if (PlotSquared.platform().serverVersion()[1] < 17) {
SNOW = Set.of(
Material.SNOW,
Material.SNOW_BLOCK
);
} else {
SNOW = Set.of(
Material.SNOW,
Material.SNOW_BLOCK,
Material.POWDER_SNOW // only since 1.17
);
}
}
private final PlotAreaManager plotAreaManager;
private final WorldEdit worldEdit;
@ -529,7 +546,7 @@ public class BlockEventListener implements Listener {
event.setCancelled(true);
return;
}
if (Tag.SNOW.isTagged(event.getNewState().getType())) {
if (SNOW.contains(event.getNewState().getType())) {
if (!plot.getFlag(SnowFormFlag.class)) {
plot.debug("Snow could not form because snow-form = false");
event.setCancelled(true);
@ -561,7 +578,7 @@ public class BlockEventListener implements Listener {
return;
}
Class<? extends BooleanFlag<?>> flag;
if (Tag.SNOW.isTagged(event.getNewState().getType())) {
if (SNOW.contains(event.getNewState().getType())) {
flag = SnowFormFlag.class;
} else if (Tag.ICE.isTagged(event.getNewState().getType())) {
flag = IceFormFlag.class;
@ -678,7 +695,7 @@ public class BlockEventListener implements Listener {
}
return;
}
if (Tag.SNOW.isTagged(blockType)) {
if (SNOW.contains(blockType)) {
if (!plot.getFlag(SnowMeltFlag.class)) {
plot.debug("Snow could not melt because snow-melt = false");
event.setCancelled(true);
@ -692,7 +709,7 @@ public class BlockEventListener implements Listener {
}
return;
}
if (Tag.CORAL_BLOCKS.isTagged(blockType) || Tag.CORALS.isTagged(blockType) || Tag.WALL_CORALS.isTagged(blockType)) {
if (Tag.CORAL_BLOCKS.isTagged(blockType) || Tag.CORALS.isTagged(blockType)) {
if (!plot.getFlag(CoralDryFlag.class)) {
plot.debug("Coral could not dry because coral-dry = false");
event.setCancelled(true);

View File

@ -126,16 +126,16 @@ public class EntitySpawnListener implements Listener {
Plot plot = location.getOwnedPlotAbs();
EntityType type = entity.getType();
if (plot == null) {
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
}
return;
}
if (!area.isMobSpawning()) {
if (type == EntityType.PLAYER) {
return;
}
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
}
return;
}
if (type.isAlive()) {
event.setCancelled(true);
}

View File

@ -229,17 +229,17 @@ public class PaperListener implements Listener {
Plot plot = location.getOwnedPlotAbs();
if (plot == null) {
EntityType type = event.getType();
// PreCreatureSpawnEvent **should** not be called for DROPPED_ITEM, just for the sake of consistency
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
}
return;
}
if (!area.isMobSpawning()) {
if (type == EntityType.PLAYER) {
return;
}
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);
}
return;
}
if (type.isAlive()) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);

View File

@ -32,6 +32,7 @@ import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template;
import java.util.Collection;
@ -39,7 +40,6 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
@ -88,8 +88,8 @@ public class Grant extends Command {
Template.of("value", String.valueOf(uuids))
);
} else {
final UUID uuid = uuids.iterator().next();
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
final UUIDMapping uuid = uuids.toArray(new UUIDMapping[0])[0];
PlotPlayer<?> pp = PlotSquared.platform().playerManager().getPlayerIfExists(uuid.getUuid());
if (pp != null) {
try (final MetaDataAccess<Integer> access = pp.accessPersistentMetaData(
PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
@ -103,7 +103,7 @@ public class Grant extends Command {
}
}
} else {
DBFunc.getPersistentMeta(uuid, new RunnableVal<>() {
DBFunc.getPersistentMeta(uuid.getUuid(), new RunnableVal<>() {
@Override
public void run(Map<String, byte[]> value) {
final byte[] array = value.get("grantedPlots");
@ -128,7 +128,7 @@ public class Grant extends Command {
boolean replace = array != null;
String key = "grantedPlots";
byte[] rawData = Ints.toByteArray(amount);
DBFunc.addPersistentMeta(uuid, key, rawData, replace);
DBFunc.addPersistentMeta(uuid.getUuid(), key, rawData, replace);
player.sendMessage(
TranslatableCaption.of("grants.added"),
Template.of("grants", String.valueOf(amount))

View File

@ -164,7 +164,7 @@ public final class PlaceholderRegistry {
PlayerManager.getPlayerList(plot.getDenied(), player));
});
this.createPlaceholder("currentplot_creationdate", (player, plot) -> {
if (plot.getTimestamp() == 0 || !plot.hasOwner()) {
if (plot.getTimestamp() == 0) {
return legacyComponent(TranslatableCaption.of("info.unknown"), player);
}
long creationDate = plot.getTimestamp();

View File

@ -5,7 +5,7 @@ guice = "5.1.0"
spotbugs = "4.7.1"
# Plugins
worldedit = "7.2.12"
worldedit = "7.2.10"
placeholderapi = "2.11.2"
luckperms = "5.4"
essentialsx = "2.19.4"

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists