This commit is contained in:
NotMyFault 2021-05-21 19:14:13 +02:00
parent 93ff778de0
commit cde27899dd
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 27 additions and 22 deletions

View File

@ -30,10 +30,12 @@ import com.plotsquared.bukkit.BukkitPlatform;
import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.bukkit.player.BukkitPlayerManager;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Caption;
import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.util.BlockUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.PlayerManager;
@ -337,6 +339,7 @@ public class BukkitUtil extends WorldUtil {
final @NonNull Template... replacements
) {
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
PlotArea area = location.getPlotArea();
final World world = getWorld(location.getWorldName());
final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
// block.setType(Material.AIR);
@ -353,7 +356,7 @@ public class BukkitUtil extends WorldUtil {
if (PlotSquared.platform().serverVersion()[1] == 13) {
block.setType(Material.valueOf("WALL_SIGN"), false);
} else {
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
block.setType(Material.valueOf(area.signMaterial()), false);
}
if (!(block.getBlockData() instanceof WallSign)) {
throw new RuntimeException("Something went wrong generating a sign");
@ -459,12 +462,8 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(WaterMob.class);
allowedInterfaces.add(Ambient.class);
}
case "tameable" -> {
allowedInterfaces.add(Tameable.class);
}
case "vehicle" -> {
allowedInterfaces.add(Vehicle.class);
}
case "tameable" -> allowedInterfaces.add(Tameable.class);
case "vehicle" -> allowedInterfaces.add(Vehicle.class);
case "hostile" -> {
allowedInterfaces.add(Shulker.class);
allowedInterfaces.add(Monster.class);
@ -474,15 +473,9 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(Phantom.class);
allowedInterfaces.add(EnderCrystal.class);
}
case "hanging" -> {
allowedInterfaces.add(Hanging.class);
}
case "villager" -> {
allowedInterfaces.add(NPC.class);
}
case "projectile" -> {
allowedInterfaces.add(Projectile.class);
}
case "hanging" -> allowedInterfaces.add(Hanging.class);
case "villager" -> allowedInterfaces.add(NPC.class);
case "projectile" -> allowedInterfaces.add(Projectile.class);
case "other" -> {
allowedInterfaces.add(ArmorStand.class);
allowedInterfaces.add(FallingBlock.class);
@ -495,12 +488,8 @@ public class BukkitUtil extends WorldUtil {
allowedInterfaces.add(EnderSignal.class);
allowedInterfaces.add(Firework.class);
}
case "player" -> {
allowedInterfaces.add(Player.class);
}
default -> {
logger.error("Unknown entity category requested: {}", category);
}
case "player" -> allowedInterfaces.add(Player.class);
default -> logger.error("Unknown entity category requested: {}", category);
}
final Set<com.sk89q.worldedit.world.entity.EntityType> types = new HashSet<>();
outer:

View File

@ -154,6 +154,7 @@ public abstract class PlotArea {
private CuboidRegion region;
private ConcurrentHashMap<String, Object> meta;
private QuadMap<PlotCluster> clusters;
private String signMaterial = "OAK_WALL_SIGN";
public PlotArea(
final @NonNull String worldName, final @Nullable String id,
@ -324,6 +325,7 @@ public abstract class PlotArea {
this.mobSpawnerSpawning = config.getBoolean("mob_spawner_spawning");
this.autoMerge = config.getBoolean("plot.auto_merge");
this.allowSigns = config.getBoolean("plot.create_signs");
this.signMaterial = config.getString("plot.sign_material");
String biomeString = config.getString("plot.biome");
if (!biomeString.startsWith("minecraft:")) {
biomeString = "minecraft:" + biomeString;
@ -484,6 +486,7 @@ public abstract class PlotArea {
options.put("mob_spawner_spawning", this.isMobSpawnerSpawning());
options.put("plot.auto_merge", this.isAutoMerge());
options.put("plot.create_signs", this.allowSigns());
options.put("plot.sign_material", this.signMaterial());
options.put("plot.biome", "minecraft:forest");
options.put("schematic.on_claim", this.isSchematicOnClaim());
options.put("schematic.file", this.getSchematicFile());
@ -1160,6 +1163,15 @@ public abstract class PlotArea {
return allowSigns;
}
/**
* Get the plot sign material.
*
* @return the sign material.
*/
public String signMaterial() {
return signMaterial;
}
/**
* Get the value associated with the specified flag. This will look at
* the default values stored in {@link GlobalFlagContainer}.
@ -1278,6 +1290,10 @@ public abstract class PlotArea {
return this.spawnEggs;
}
public String getSignMaterial() {
return this.signMaterial;
}
public boolean isSpawnCustom() {
return this.spawnCustom;
}