Skip to content

Commit

Permalink
Fixes #3064
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyFault committed May 21, 2021
1 parent 93ff778 commit cde2789
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
33 changes: 11 additions & 22 deletions Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
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;
Expand Down Expand Up @@ -337,6 +339,7 @@ public void setSign(
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);
Expand All @@ -353,7 +356,7 @@ public void setSign(
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");
Expand Down Expand Up @@ -459,12 +462,8 @@ public void setFoodLevel(final @NonNull PlotPlayer<?> player, @NonNegative final
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);
Expand All @@ -474,15 +473,9 @@ public void setFoodLevel(final @NonNull PlotPlayer<?> player, @NonNegative final
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);
Expand All @@ -495,12 +488,8 @@ public void setFoodLevel(final @NonNull PlotPlayer<?> player, @NonNegative final
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:
Expand Down
16 changes: 16 additions & 0 deletions Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -324,6 +325,7 @@ public void loadDefaultConfiguration(ConfigurationSection config) {
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;
Expand Down Expand Up @@ -484,6 +486,7 @@ public void saveConfiguration(ConfigurationSection config) {
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());
Expand Down Expand Up @@ -1160,6 +1163,15 @@ public boolean 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
* the default values stored in {@link GlobalFlagContainer}.
Expand Down Expand Up @@ -1278,6 +1290,10 @@ public boolean isSpawnEggs() {
return this.spawnEggs;
}

public String getSignMaterial() {
return this.signMaterial;
}

public boolean isSpawnCustom() {
return this.spawnCustom;
}
Expand Down

0 comments on commit cde2789

Please # to comment.