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

View File

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