Fix an issue preventing end portals from being made.

This commit is contained in:
Brianna 2020-09-01 15:10:52 -05:00
parent b830cd7637
commit 5333f87fe5
3 changed files with 15 additions and 15 deletions

View File

@ -50,7 +50,7 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
if (type == null)
throw new IllegalArgumentException("Unable to parse Materials from '" + enumName + "' in the Section '" + loadFrom.getCurrentPath() + "'");
getMap().put(type, loadFrom.getLong(key));
}
@ -67,7 +67,7 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
if (player.hasPermission("fabledskyblock.limit.block.*")) return -1;
CompatibleMaterial material = null;
if(ServerVersion.isServerVersion(ServerVersion.V1_8)) {
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (type.toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
@ -75,7 +75,7 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
break;
}
}
if(material == null) {
if (material == null) {
material = CompatibleMaterial.getMaterial(type);
}
@ -87,21 +87,21 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
}
public boolean isBlockLimitExceeded(Block block, long limit) {
return this.isBlockLimitExceeded(block.getType(), block.getLocation(), limit);
return this.isBlockLimitExceeded(CompatibleMaterial.getMaterial(block), block.getLocation(), limit);
}
public boolean isBlockLimitExceeded(Material type, Location loc, long limit) {
public boolean isBlockLimitExceeded(CompatibleMaterial type, Location loc, long limit) {
if (limit == -1) return false;
final IslandManager islandManager = SkyBlock.getInstance().getIslandManager();
final Island island = islandManager.getIslandAtLocation(loc);
final long totalPlaced;
if (type == CompatibleMaterial.SPAWNER.getBlockMaterial()) {
if (type == CompatibleMaterial.SPAWNER) {
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum();
} else {
CompatibleMaterial material = null;
if(ServerVersion.isServerVersion(ServerVersion.V1_8)) {
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (type.toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
@ -109,9 +109,7 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
break;
}
}
if(material == null) {
material = CompatibleMaterial.getMaterial(type);
}
if (material == null) material = type;
totalPlaced = island.getLevel().getMaterialAmount(material.name());
}

View File

@ -305,7 +305,9 @@ public class Block implements Listener {
long limit = limits.getBlockLimit(player, block.getType());
if (limits.isBlockLimitExceeded(block, limit)) {
ItemStack item = event.getItemInHand();
if (limits.isBlockLimitExceeded(block, limit) && CompatibleMaterial.getMaterial(item) != CompatibleMaterial.ENDER_EYE) {
CompatibleMaterial material = null;
if(ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) {

View File

@ -79,7 +79,7 @@ public class Interact implements Listener {
if (levellingManager.isScanning(island)) {
plugin.getMessageManager().sendMessage(player,
plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
plugin.getLanguage().getString("Command.Island.Level.Scanning.BlockPlacing.Message"));
event.setCancelled(true);
return;
}
@ -97,7 +97,7 @@ public class Interact implements Listener {
}
if (isObstructing) {
plugin.getMessageManager().sendMessage(player, plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.SpawnProtection.Place.Message"));
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.SpawnProtection.Place.Message"));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
event.setCancelled(true);
@ -109,10 +109,10 @@ public class Interact implements Listener {
long limit = limits.getBlockLimit(player, Material.WATER);
if (limits.isBlockLimitExceeded(event.getItem().getType(), block.getLocation(), limit)) {
if (limits.isBlockLimitExceeded(CompatibleMaterial.getMaterial(event.getItem()), block.getLocation(), limit)) {
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getItem().getType());
plugin.getMessageManager().sendMessage(player, plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
plugin.getMessageManager().sendMessage(player, plugin.getLanguage().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtil.formatNumber(limit)));
plugin.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);