mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-02 21:54:43 +02:00
Compare commits
2 Commits
fix/v6/gra
...
fix/snow-t
Author | SHA1 | Date | |
---|---|---|---|
59a8fe5d6f | |||
ec51a60d80 |
@ -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);
|
||||
|
@ -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))
|
||||
|
Reference in New Issue
Block a user