Implement CompatibleMaterial

This commit is contained in:
Daniel Ciepluch 2020-03-26 12:16:21 -04:00 committed by Brianna
parent de2c865ca9
commit 08fdf5ac50
67 changed files with 872 additions and 1115 deletions

View File

@ -1,7 +1,8 @@
package com.songoda.skyblock.api.island;
import com.google.common.base.Preconditions;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
public class IslandLevel {
@ -45,7 +46,7 @@ public class IslandLevel {
*/
public void setMaterialAmount(Material material, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
this.handle.getIsland().getLevel().setMaterialAmount(Materials.fromString(material.name()).name(), amount);
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(), amount);
}
/**
@ -53,7 +54,8 @@ public class IslandLevel {
*/
public void setMaterialAmount(Material material, byte data, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
this.handle.getIsland().getLevel().setMaterialAmount(Materials.requestMaterials(material.name(), data).name(),
//TODO: Add data support
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(),
amount);
}
@ -63,7 +65,7 @@ public class IslandLevel {
public long getMaterialAmount(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
Materials materials = Materials.fromString(material.name());
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
@ -79,7 +81,8 @@ public class IslandLevel {
public long getMaterialAmount(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
Materials materials = Materials.requestMaterials(material.name(), data);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
//TODO: data support
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
@ -94,7 +97,7 @@ public class IslandLevel {
*/
public long getMaterialPoints(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material points to null material");
return this.handle.getIsland().getLevel().getMaterialPoints(Materials.fromString(material.name()).name());
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).name());
}
/**
@ -103,7 +106,8 @@ public class IslandLevel {
public long getMaterialPoints(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material points to null material");
return this.handle.getIsland().getLevel()
.getMaterialPoints(Materials.requestMaterials(material.name(), data).name());
.getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).name());
//TODO: add data support
}
/**

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.api.structure;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import java.util.List;
@ -8,9 +8,9 @@ public interface Structure {
String getName();
Materials getMaterials();
CompatibleMaterial getMaterials();
void setMaterials(Materials materials);
void setMaterials(CompatibleMaterial materials);
String getOverworldFile();

View File

@ -9,6 +9,7 @@ import java.util.Map.Entry;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Material;

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.command.commands.admin;
import java.io.File;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -14,7 +15,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.version.Materials;
public class StackableCommand extends SubCommand {
@ -46,7 +47,7 @@ public class StackableCommand extends SubCommand {
return;
}
final Block block = player.getTargetBlock((Set<Material>) null, 6);
final Block block = player.getTargetBlock(null, 6);
if (block == null) {
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.None"));
@ -54,7 +55,7 @@ public class StackableCommand extends SubCommand {
}
final StackableManager stackableManager = skyblock.getStackableManager();
final Materials type = Materials.getMaterials(block.getType(), block.getData());
final CompatibleMaterial type = CompatibleMaterial.getMaterial(block.getType());
if (!stackableManager.isStackableMaterial(type)) {
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.Unstackable"));

View File

@ -1,12 +1,13 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.*;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Location;
import org.bukkit.Material;
@ -59,15 +60,14 @@ public class SetSpawnCommand extends SubCommand {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
if (location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR
|| location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Materials.LEGACY_PISTON_MOVING_PIECE.getPostMaterial()
|| location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Material.ICE
|| location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Material.LEGACY_PISTON_EXTENSION
|| location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Material.PISTON_HEAD) {
CompatibleMaterial toCompare = CompatibleMaterial.getMaterial(location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType());
if(toCompare == CompatibleMaterial.AIR
|| toCompare == CompatibleMaterial.MOVING_PISTON
|| toCompare == CompatibleMaterial.ICE
|| toCompare == CompatibleMaterial.PISTON_HEAD) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Block.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
@ -86,21 +86,21 @@ public class SetSpawnCommand extends SubCommand {
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
} else if (location.getBlock().getType() == Materials.NETHER_PORTAL.parseMaterial()
|| location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType() == Materials.NETHER_PORTAL.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(location.getBlock().getType()) == CompatibleMaterial.NETHER_PORTAL
|| CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType()) == CompatibleMaterial.NETHER_PORTAL) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Portal.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
} else {
Material type = location.getBlock().getType();
CompatibleMaterial type = CompatibleMaterial.getMaterial(location.getBlock().getType());
if (type.isSolid() && type.isOccluding()) {
location.getBlock().breakNaturally();
}
Material typeBelow = location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType();
CompatibleMaterial typeBelow = CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType());
if (typeBelow.isSolid() && type.isOccluding()) {
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().breakNaturally();
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.command.commands.island;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,7 +8,7 @@ import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
@ -35,13 +36,7 @@ public class ValueCommand extends SubCommand {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.Hand.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
Materials materials = null;
if (NMSUtil.getVersionNumber() < 13) {
materials = Materials.requestMaterials(player.getItemInHand().getType().name(), (byte) player.getItemInHand().getDurability());
} else {
materials = Materials.fromString(player.getItemInHand().getType().name());
}
CompatibleMaterial materials = CompatibleMaterial.getMaterial(player.getItemInHand().getType().name());
if (materials != null && levellingManager.hasWorth(materials)) {
long worth = levellingManager.getWorth(materials);

View File

@ -1,17 +1,18 @@
package com.songoda.skyblock.generator;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import java.util.List;
public class Generator {
private String name;
private Materials materials;
private CompatibleMaterial materials;
private List<GeneratorMaterial> generatorMaterials;
private boolean permission;
public Generator(String name, Materials materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
public Generator(String name, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, boolean permission) {
this.name = name;
this.materials = materials;
this.generatorMaterials = generatorMaterials;
@ -22,7 +23,7 @@ public class Generator {
return name;
}
public Materials getMaterials() {
public CompatibleMaterial getMaterials() {
return materials;
}

View File

@ -1,8 +1,9 @@
package com.songoda.skyblock.generator;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.block.Block;
@ -35,8 +36,8 @@ public class GeneratorManager {
if (configLoad.getString("Generators") == null)
return;
Materials[] oreMaterials = new Materials[]{Materials.COAL, Materials.CHARCOAL, Materials.DIAMOND,
Materials.IRON_INGOT, Materials.GOLD_INGOT, Materials.EMERALD};
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
Random rnd = new Random();
for (String generatorList : configLoad.getConfigurationSection("Generators").getKeys(false)) {
@ -46,7 +47,7 @@ public class GeneratorManager {
List<GeneratorMaterial> generatorMaterials = new ArrayList<>();
if (configLoad.getString("Generators." + generatorList + ".Materials") != null) {
for (String materialList : configLoad.getConfigurationSection("Generators." + generatorList + ".Materials").getKeys(false)) {
Materials materials = Materials.fromString(materialList);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialList);
if (materials != null) {
generatorMaterials.add(new GeneratorMaterial(materials, configLoad.getDouble(
"Generators." + generatorList + ".Materials." + materialList + ".Chance")));
@ -113,15 +114,16 @@ public class GeneratorManager {
@SuppressWarnings("deprecation")
public BlockState generateBlock(Generator generator, Block block) {
Materials materials = getRandomMaterials(generator);
CompatibleMaterial materials = getRandomMaterials(generator);
if (materials == null) return block.getState();
skyblock.getSoundManager().playSound(block.getLocation(), Sounds.FIZZ.bukkitSound(), 1.0F, 10.0F);
if (NMSUtil.getVersionNumber() > 12) {
block.setType(materials.parseMaterial());
block.setType(materials.getMaterial());
} else {
ItemStack is = materials.parseItem();
ItemStack is = materials.getItem();
block.setType(is.getType());
try {
@ -134,9 +136,9 @@ public class GeneratorManager {
return block.getState();
}
public Materials getRandomMaterials(Generator generator) {
public CompatibleMaterial getRandomMaterials(Generator generator) {
if (generator.getGeneratorMaterials() != null && generator.getGeneratorMaterials().stream().anyMatch(x -> x.getChance() > 0)) {
List<Materials> weightedList = new ArrayList<>();
List<CompatibleMaterial> weightedList = new ArrayList<>();
for (GeneratorMaterial generatorMaterial : generator.getGeneratorMaterials())
for (int i = 0; i < generatorMaterial.getChance() * 30; i++)
weightedList.add(generatorMaterial.getMaterials());
@ -145,12 +147,12 @@ public class GeneratorManager {
return weightedList.get(choice);
}
return Materials.COBBLESTONE;
return CompatibleMaterial.COBBLESTONE;
}
public void addGenerator(String name, List<GeneratorMaterial> generatorMaterials, boolean permission) {
Materials[] oreMaterials = new Materials[]{Materials.COAL, Materials.CHARCOAL, Materials.DIAMOND,
Materials.IRON_INGOT, Materials.GOLD_INGOT, Materials.EMERALD};
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
generatorStorage.add(new Generator(name, oreMaterials[new Random().nextInt(oreMaterials.length)],
generatorMaterials, permission));
}

View File

@ -1,18 +1,18 @@
package com.songoda.skyblock.generator;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
public class GeneratorMaterial {
private Materials materials;
private CompatibleMaterial materials;
private double chance;
public GeneratorMaterial(Materials materials, double chance) {
public GeneratorMaterial(CompatibleMaterial materials, double chance) {
this.materials = materials;
this.chance = chance;
}
public Materials getMaterials() {
public CompatibleMaterial getMaterials() {
return materials;
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.island;
import com.google.common.base.Preconditions;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.*;
import com.songoda.skyblock.ban.BanManager;
@ -26,7 +27,6 @@ import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.player.PlayerUtil;
import com.songoda.skyblock.utils.structure.SchematicUtil;
import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.SBiome;
import com.songoda.skyblock.utils.version.Sounds;
@ -192,7 +192,6 @@ public class IslandManager {
skyblock.getMessageManager().sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Creator.Error.MaxCreationMessage"));
return false;
}
}
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "locations.yml")).getFileConfiguration().getString("Location.Spawn") == null) {
@ -1171,13 +1170,13 @@ public class IslandManager {
public void removeSpawnProtection(org.bukkit.Location location) {
Block block = location.getBlock();
if (block.getType() == Materials.MOVING_PISTON.parseMaterial()) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MOVING_PISTON) {
block.setType(Material.AIR);
}
block = location.clone().add(0.0D, 1.0D, 0.0D).getBlock();
if (block.getType() == Materials.MOVING_PISTON.parseMaterial()) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MOVING_PISTON) {
block.setType(Material.AIR);
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Material;
import org.bukkit.World;
@ -44,7 +45,7 @@ public class ChunkDeleteSplitter extends BukkitRunnable {
final BlockInfo pair = it.next();
final Block block = pair.getWorld().getBlockAt(pair.getX(), pair.getY(), pair.getZ());
block.setType(Material.AIR);
block.setType(CompatibleMaterial.AIR.getBlockMaterial());
deleteAmount++;
it.remove();

View File

@ -10,6 +10,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.version.Materials;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -32,34 +34,33 @@ import com.songoda.skyblock.levelling.rework.calculator.impl.UltimateStackerCalc
import com.songoda.skyblock.levelling.rework.calculator.impl.WildStackerCalculator;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
public final class IslandLevelManager {
private static final Set<Materials> CHECKED_DOUBLE_TYPES;
private static final Set<CompatibleMaterial> CHECKED_DOUBLE_TYPES;
static {
CHECKED_DOUBLE_TYPES = EnumSet.noneOf(Materials.class);
CHECKED_DOUBLE_TYPES = EnumSet.noneOf(CompatibleMaterial.class);
CHECKED_DOUBLE_TYPES.add(Materials.SUNFLOWER);
CHECKED_DOUBLE_TYPES.add(Materials.LILAC);
CHECKED_DOUBLE_TYPES.add(Materials.LEGACY_DOUBLE_PLANT);
CHECKED_DOUBLE_TYPES.add(Materials.LARGE_FERN);
CHECKED_DOUBLE_TYPES.add(Materials.ROSE_BUSH);
CHECKED_DOUBLE_TYPES.add(Materials.PEONY);
CHECKED_DOUBLE_TYPES.add(Materials.TALL_GRASS);
CHECKED_DOUBLE_TYPES.add(CompatibleMaterial.SUNFLOWER);
CHECKED_DOUBLE_TYPES.add(CompatibleMaterial.LILAC);
CHECKED_DOUBLE_TYPES.add(CompatibleMaterial.LARGE_FERN);
CHECKED_DOUBLE_TYPES.add(CompatibleMaterial.ROSE_BUSH);
CHECKED_DOUBLE_TYPES.add(CompatibleMaterial.PEONY);
CHECKED_DOUBLE_TYPES.add(CompatibleMaterial.TALL_GRASS);
}
private final static int VERSION = NMSUtil.getVersionNumber();
private Map<Island, IslandScan> inScan;
private Map<Materials, Long> worth;
private Map<Materials, AmountMaterialPair> cachedPairs;
private Map<CompatibleMaterial, Long> worth;
private Map<CompatibleMaterial, AmountMaterialPair> cachedPairs;
public IslandLevelManager() {
this.inScan = new HashMap<>();
this.worth = new EnumMap<>(Materials.class);
this.cachedPairs = new EnumMap<>(Materials.class);
this.worth = new EnumMap<>(CompatibleMaterial.class);
this.cachedPairs = new EnumMap<>(CompatibleMaterial.class);
registerCalculators();
reloadWorth();
}
@ -68,10 +69,8 @@ public final class IslandLevelManager {
return CHECKED_DOUBLE_TYPES.contains(parseType(block));
}
@SuppressWarnings("deprecation")
private static Materials parseType(Block block) {
final Material blockType = block.getType();
return VERSION > 12 ? Materials.fromString(blockType.name()) : Materials.requestMaterials(blockType.name(), block.getData());
private static CompatibleMaterial parseType(Block block) {
return CompatibleMaterial.getBlockMaterial(block.getType());
}
public void startScan(Player attemptScanner, Island island) {
@ -129,19 +128,19 @@ public final class IslandLevelManager {
final ConfigurationSection current = materialSection.getConfigurationSection(key);
final Materials material = Materials.fromString(key);
final CompatibleMaterial material = CompatibleMaterial.getMaterial(key);
if (material == null || !material.isAvailable()) continue;
if (material == null) continue;
worth.put(material, current.getLong("Points"));
}
}
public void addWorth(Materials material, long points) {
public void addWorth(CompatibleMaterial material, long points) {
worth.put(material, points);
}
public void removeWorth(Materials material) {
public void removeWorth(CompatibleMaterial material) {
worth.remove(material);
}
@ -149,27 +148,27 @@ public final class IslandLevelManager {
final List<LevellingMaterial> materials = new ArrayList<>(worth.size());
for (Entry<Materials, Long> entry : worth.entrySet()) {
for (Entry<CompatibleMaterial, Long> entry : worth.entrySet()) {
materials.add(new LevellingMaterial(entry.getKey(), entry.getValue()));
}
return materials;
}
public Map<Materials, Long> getWorths() {
public Map<CompatibleMaterial, Long> getWorths() {
return worth;
}
public long getWorth(Materials material) {
public long getWorth(CompatibleMaterial material) {
return worth.getOrDefault(material, 0L);
}
public boolean hasWorth(Materials material) {
public boolean hasWorth(CompatibleMaterial material) {
return worth.containsKey(material);
}
private void registerCalculators() {
final Material spawner = Materials.SPAWNER.parseMaterial();
final CompatibleMaterial spawner = CompatibleMaterial.SPAWNER;
final PluginManager pm = Bukkit.getPluginManager();
if (pm.isPluginEnabled("EpicSpawners")) CalculatorRegistry.registerCalculator(new EpicSpawnerCalculator(), spawner);
@ -182,11 +181,11 @@ public final class IslandLevelManager {
AmountMaterialPair getAmountAndType(IslandScan scan, BlockInfo info) {
Block block = info.getWorld().getBlockAt(info.getX(), info.getY(), info.getZ());
Material blockType = block.getType();
CompatibleMaterial blockType = CompatibleMaterial.getBlockMaterial(block.getType());
if (blockType == Material.AIR) return EMPTY;
if (blockType == CompatibleMaterial.AIR) return EMPTY;
Materials finalType = parseType(block);
CompatibleMaterial finalType = parseType(block);
if (finalType == null) return EMPTY;
@ -197,18 +196,21 @@ public final class IslandLevelManager {
if (CHECKED_DOUBLE_TYPES.contains(finalType)) {
final Block belowBlock = block.getRelative(BlockFace.DOWN);
final Materials belowType = parseType(belowBlock);
final CompatibleMaterial belowType = parseType(belowBlock);
if (CHECKED_DOUBLE_TYPES.contains(belowType)) {
block = belowBlock;
blockType = belowType.parseMaterial();
blockType = belowType;
scan.getDoubleBlocks().add(belowBlock.getLocation());
} else {
scan.getDoubleBlocks().add(block.getRelative(BlockFace.UP).getLocation());
}
} else if (finalType == Materials.SPAWNER) {
finalType = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
} else if (finalType == CompatibleMaterial.SPAWNER) {
//finalType = Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
//finalType = CompatibleMaterial.getBlockMaterial(block.getType());
//finalType = CompatibleMaterial.getBlockMaterial(Materials.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType()).getPostMaterial());
//TODO: Brianna
}
final List<Calculator> calculators = CalculatorRegistry.getCalculators(blockType);

View File

@ -13,6 +13,7 @@ import java.util.Queue;
import java.util.Set;
import java.util.stream.Collectors;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Location;
@ -33,7 +34,6 @@ import com.songoda.skyblock.levelling.ChunkUtil;
import com.songoda.skyblock.levelling.rework.amount.AmountMaterialPair;
import com.songoda.skyblock.levelling.rework.amount.BlockAmount;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.utils.version.Materials;
public final class IslandScan extends BukkitRunnable {
@ -41,7 +41,7 @@ public final class IslandScan extends BukkitRunnable {
private final Set<Location> doubleBlocks;
private final Island island;
private final Map<Materials, BlockAmount> amounts;
private final Map<CompatibleMaterial, BlockAmount> amounts;
private final Configuration config;
private final int runEveryX;
@ -52,7 +52,7 @@ public final class IslandScan extends BukkitRunnable {
public IslandScan(Island island) {
if (island == null) throw new IllegalArgumentException("island cannot be null");
this.island = island;
this.amounts = new EnumMap<>(Materials.class);
this.amounts = new EnumMap<>(CompatibleMaterial.class);
this.config = SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration();
this.runEveryX = config.getInt("Command.Island.Level.Scanning.Progress.Display-Every-X-Scan");
this.doubleBlocks = new HashSet<>();
@ -86,7 +86,7 @@ public final class IslandScan extends BukkitRunnable {
final Map<String, Long> materials = new HashMap<>(amounts.size());
for (Entry<Materials, BlockAmount> entry : amounts.entrySet()) {
for (Entry<CompatibleMaterial, BlockAmount> entry : amounts.entrySet()) {
materials.put(entry.getKey().name(), entry.getValue().getAmount());
}

View File

@ -1,20 +1,21 @@
package com.songoda.skyblock.levelling.rework;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.inventory.ItemStack;
import com.songoda.skyblock.utils.version.Materials;
public final class LevellingMaterial {
private Materials materials;
private CompatibleMaterial materials;
private long points;
public LevellingMaterial(Materials materials, long points) {
public LevellingMaterial(CompatibleMaterial materials, long points) {
this.materials = materials;
this.points = points;
}
public Materials getMaterials() {
public CompatibleMaterial getMaterials() {
return materials;
}
@ -27,6 +28,6 @@ public final class LevellingMaterial {
}
public ItemStack getItemStack() {
return materials.parseItem();
return materials.getItem();
}
}

View File

@ -1,13 +1,14 @@
package com.songoda.skyblock.levelling.rework.amount;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
public class AmountMaterialPair {
private final long amount;
private final Materials material;
private final CompatibleMaterial material;
public AmountMaterialPair(Materials type, long amount) {
public AmountMaterialPair(CompatibleMaterial type, long amount) {
this.amount = amount;
this.material = type;
}
@ -16,7 +17,7 @@ public class AmountMaterialPair {
return amount;
}
public Materials getType() {
public CompatibleMaterial getType() {
return material;
}

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
public final class CalculatorRegistry {
@ -13,9 +14,9 @@ public final class CalculatorRegistry {
}
private static final Map<Material, List<Calculator>> calculators = new HashMap<>();
private static final Map<CompatibleMaterial, List<Calculator>> calculators = new HashMap<>();
public static void registerCalculator(Calculator calculator, Material to) {
public static void registerCalculator(Calculator calculator, CompatibleMaterial to) {
List<Calculator> list = calculators.get(to);
@ -27,7 +28,7 @@ public final class CalculatorRegistry {
list.add(calculator);
}
public static List<Calculator> getCalculators(Material type) {
public static List<Calculator> getCalculators(CompatibleMaterial type) {
return calculators.get(type);
}

View File

@ -3,6 +3,9 @@ package com.songoda.skyblock.limit.impl;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.version.Materials;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
@ -11,12 +14,12 @@ import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.limit.EnumLimitation;
import com.songoda.skyblock.utils.player.PlayerUtil;
import com.songoda.skyblock.utils.version.Materials;
public final class BlockLimitation extends EnumLimitation<Materials> {
public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
public BlockLimitation() {
super(Materials.class);
super(CompatibleMaterial.class);
}
@Override
@ -25,7 +28,7 @@ public final class BlockLimitation extends EnumLimitation<Materials> {
}
@Override
public boolean hasTooMuch(long currentAmount, Enum<Materials> type) {
public boolean hasTooMuch(long currentAmount, Enum<CompatibleMaterial> type) {
throw new UnsupportedOperationException("Not implemented. Use getBlockLimit and isBlockLimitExceeded instead.");
}
@ -41,7 +44,7 @@ public final class BlockLimitation extends EnumLimitation<Materials> {
for (String key : keys) {
final String enumName = key.toUpperCase(Locale.ENGLISH);
final Materials type = Materials.fromString(enumName);
final CompatibleMaterial type = CompatibleMaterial.getMaterial(enumName);
if (type == null) throw new IllegalArgumentException("Unable to parse Materials from '" + enumName + "' in the Section '" + loadFrom.getCurrentPath() + "'");
@ -74,6 +77,7 @@ public final class BlockLimitation extends EnumLimitation<Materials> {
final Island island = islandManager.getIslandAtLocation(block.getLocation());
final long totalPlaced;
//TODO: REdo for CompatibleMaterial
if (block.getType() == Materials.SPAWNER.parseMaterial()) {
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum();
} else {

View File

@ -7,6 +7,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.version.Materials;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -48,7 +50,7 @@ import com.songoda.skyblock.limit.impl.BlockLimitation;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
@ -91,9 +93,9 @@ public class Block implements Listener {
}
if (stackableManager != null && stackableManager.isStacked(blockLocation)) {
Stackable stackable = stackableManager.getStack(block.getLocation(), Materials.getMaterials(block.getType(), block.getData()));
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getBlockMaterial(block.getType()));
if (stackable != null) {
Material material = block.getType();
CompatibleMaterial material = CompatibleMaterial.getBlockMaterial(block.getType());
byte data = block.getData();
int droppedAmount = 0;
@ -102,14 +104,14 @@ public class Block implements Listener {
int count = stackable.getSize();
droppedAmount = count;
while (count > 64) {
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material, 64, data));
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material.getMaterial(), 64, data));
count -= 64;
}
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material, count, block.getData()));
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material.getMaterial(), count, block.getData()));
block.setType(Material.AIR);
stackable.setSize(0);
} else {
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5), new ItemStack(material, 1, data));
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5), new ItemStack(material.getMaterial(), 1, data));
stackable.takeOne();
droppedAmount = 1;
}
@ -122,17 +124,16 @@ public class Block implements Listener {
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
Materials materials = Materials.getMaterials(material, data);
if (materials != null) {
if (material != null) {
IslandLevel level = island.getLevel();
if (level.hasMaterial(materials.name())) {
long materialAmount = level.getMaterialAmount(materials.name());
if (level.hasMaterial(material.name())) {
long materialAmount = level.getMaterialAmount(material.name());
if (materialAmount - droppedAmount <= 0) {
level.removeMaterial(materials.name());
level.removeMaterial(material.name());
} else {
level.setMaterialAmount(materials.name(), materialAmount - droppedAmount);
level.setMaterialAmount(material.name(), materialAmount - droppedAmount);
}
}
}

View File

@ -1,10 +1,11 @@
package com.songoda.skyblock.listeners;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager;
@ -30,10 +31,10 @@ public class Bucket implements Listener {
Player player = event.getPlayer();
org.bukkit.block.Block block = event.getBlockClicked();
if (event.getBlockClicked().getType() == Material.WATER
|| event.getBlockClicked().getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial()
|| event.getBlockClicked().getType() == Material.LAVA
|| event.getBlockClicked().getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial()) {
CompatibleMaterial clickedBlock = CompatibleMaterial.getBlockMaterial(event.getBlockClicked().getType());
if (clickedBlock == CompatibleMaterial.WATER
|| clickedBlock == CompatibleMaterial.LAVA) {
if (skyblock.getWorldManager().isIslandWorld(block.getWorld())) {
if (!skyblock.getIslandManager().hasPermission(player, block.getLocation(), "Bucket")) {
event.setCancelled(true);

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -71,7 +72,6 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
@ -543,7 +543,7 @@ public class Entity implements Listener {
.getBoolean("Island.Block.Level.Enable"))
return;
Materials materials = Materials.getMaterials(block.getType(), block.getData());
CompatibleMaterial materials = CompatibleMaterial.getBlockMaterial(block.getType());
if (materials != null) {
IslandLevel level = island.getLevel();
@ -560,18 +560,7 @@ public class Entity implements Listener {
}
if (event.getTo() != null && event.getTo() != Material.AIR) {
materials = null;
if (NMSUtil.getVersionNumber() > 12) {
materials = Materials.fromString(event.getTo().name());
} else {
try {
materials = Materials.requestMaterials(event.getTo().name(), (byte) event.getClass().getMethod("getData").invoke(event));
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
| SecurityException e) {
e.printStackTrace();
}
}
materials = CompatibleMaterial.getBlockMaterial(event.getTo());;
if (materials != null) {
long materialAmount = 0;
@ -607,7 +596,7 @@ public class Entity implements Listener {
.getBoolean("Island.Block.Level.Enable")) {
for (org.bukkit.block.Block blockList : event.blockList()) {
@SuppressWarnings("deprecation")
Materials materials = Materials.getMaterials(blockList.getType(), blockList.getData());
CompatibleMaterial materials = CompatibleMaterial.getBlockMaterial(blockList.getType());
if (materials != null) {
IslandLevel level = island.getLevel();

View File

@ -8,6 +8,7 @@ import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.world.WorldManager;
import org.bukkit.Bukkit;

View File

@ -5,6 +5,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.event.EventHandler;
@ -21,7 +22,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager;
@ -107,7 +107,7 @@ public class Grow implements Listener {
e.printStackTrace();
}
} else {
Material type = block.getType();
CompatibleMaterial type = CompatibleMaterial.getBlockMaterial(block.getType());
if (block.getState().getData() instanceof Crops || type.name().equals("BEETROOT_BLOCK") || type.name().equals("CARROT") || type.name().equals("POTATO")
|| type.name().equals("WHEAT") || type.name().equals("CROPS")) {
try {
@ -130,7 +130,7 @@ public class Grow implements Listener {
WorldManager worldManager = skyblock.getWorldManager();
BlockState state = event.getNewState();
if (!worldManager.isIslandWorld(state.getWorld())) return;
if (state.getType() != Materials.PUMPKIN.parseMaterial() && state.getType() != Materials.MELON.parseMaterial()) return;
if (CompatibleMaterial.getBlockMaterial(state.getType()) != CompatibleMaterial.PUMPKIN && CompatibleMaterial.getBlockMaterial(state.getType()) != CompatibleMaterial.MELON) return;
IslandManager islandManager = skyblock.getIslandManager();
Island origin = islandManager.getIslandAtLocation(event.getBlock().getLocation());

View File

@ -2,11 +2,11 @@ package com.songoda.skyblock.listeners;
import java.io.File;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Beacon;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.configuration.file.FileConfiguration;
@ -43,12 +43,9 @@ import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.InventoryUtil;
import com.songoda.skyblock.utils.structure.StructureUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.world.WorldManager;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
public class Interact implements Listener {
@ -82,7 +79,7 @@ public class Interact implements Listener {
}
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
if (block.getType() == Material.DRAGON_EGG) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DRAGON_EGG) {
if (!islandManager.hasPermission(player, block.getLocation(), "DragonEggUse")) {
event.setCancelled(true);
@ -112,7 +109,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.CAULDRON) { // WildStacker stackables
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CAULDRON) { // WildStacker stackables
if (!islandManager.hasPermission(player, block.getLocation(), "Place") || !islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
event.setCancelled(true);
@ -126,7 +123,7 @@ public class Interact implements Listener {
}
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR) {
if (event.getItem() != null && event.getItem().getType() == Material.EGG) {
if (event.getItem() != null && CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.EGG) {
if (!skyblock.getIslandManager().hasPermission(player, "Projectile")) {
event.setCancelled(true);
@ -139,14 +136,14 @@ public class Interact implements Listener {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
final Materials blockType = Materials.getMaterials(event.getClickedBlock().getType(), event.getClickedBlock().getData());
final Materials heldType;
final CompatibleMaterial blockType = CompatibleMaterial.getBlockMaterial(event.getClickedBlock().getType());
final CompatibleMaterial heldType;
final ItemStack item = event.getItem();
if (item != null && item.getType() != Material.AIR) {
heldType = Materials.getMaterials(event.getItem().getType(), (byte) event.getItem().getDurability());
if (item != null && CompatibleMaterial.getMaterial(item.getType()) != CompatibleMaterial.AIR) {
heldType = CompatibleMaterial.getMaterial(event.getItem().getType());
} else {
heldType = Materials.AIR;
heldType = CompatibleMaterial.AIR;
}
if (stackableManager != null && stackableManager.isStackableMaterial(heldType) && blockType == heldType && !player.isSneaking() && islandManager
@ -171,7 +168,7 @@ public class Interact implements Listener {
long limit = limits.getBlockLimit(player, block);
if (limits.isBlockLimitExceeded(player, block, limit)) {
Materials material = Materials.getMaterials(block.getType(), block.getData());
CompatibleMaterial material = CompatibleMaterial.getBlockMaterial(block.getType());
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
@ -191,7 +188,7 @@ public class Interact implements Listener {
if (configLoad.getBoolean("Island.Stackable.Limit.Enable")) {
// Add block to stackable
Materials material = Materials.getMaterials(block.getType(), block.getData());
CompatibleMaterial material = CompatibleMaterial.getBlockMaterial(block.getType());
int maxStackSize = getStackLimit(player, material);
if (stackable == null) {
@ -234,7 +231,7 @@ public class Interact implements Listener {
long materialAmmount = 0;
IslandLevel level = island.getLevel();
Materials material = Materials.getMaterials(block.getType(), block.getData());
CompatibleMaterial material = CompatibleMaterial.getBlockMaterial(block.getType());
if (material == null) {
return;
@ -258,13 +255,13 @@ public class Interact implements Listener {
return;
}
if (event.getItem() != null && event.getItem().getType() == Materials.BONE_MEAL.parseMaterial() && !islandManager.hasPermission(player, block.getLocation(), "Place")) {
if (event.getItem() != null && CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.BONE_MEAL && !islandManager.hasPermission(player, block.getLocation(), "Place")) {
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
event.setCancelled(true);
return;
}
if (block.getType() == Materials.SWEET_BERRY_BUSH.parseMaterial()) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SWEET_BERRY_BUSH) {
if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
event.setCancelled(true);
@ -274,7 +271,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.ANVIL) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ANVIL) {
if (!islandManager.hasPermission(player, block.getLocation(), "Anvil")) {
event.setCancelled(true);
@ -284,13 +281,16 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.LEGACY_BED_BLOCK.parseMaterial() || block.getType() == Materials.WHITE_BED.parseMaterial() || block.getType() == Materials.ORANGE_BED
.parseMaterial()
|| block.getType() == Materials.MAGENTA_BED.parseMaterial() || block.getType() == Materials.LIGHT_BLUE_BED.parseMaterial() || block.getType() == Materials.YELLOW_BED.parseMaterial()
|| block.getType() == Materials.LIME_BED.parseMaterial() || block.getType() == Materials.PINK_BED.parseMaterial() || block.getType() == Materials.GRAY_BED.parseMaterial()
|| block.getType() == Materials.LIGHT_GRAY_BED.parseMaterial() || block.getType() == Materials.CYAN_BED.parseMaterial() || block.getType() == Materials.CYAN_BED.parseMaterial()
|| block.getType() == Materials.PURPLE_BED.parseMaterial() || block.getType() == Materials.BLUE_BED.parseMaterial() || block.getType() == Materials.BROWN_BED.parseMaterial()
|| block.getType() == Materials.GREEN_BED.parseMaterial() || block.getType() == Materials.RED_BED.parseMaterial() || block.getType() == Materials.BLACK_BED.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.WHITE_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ORANGE_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MAGENTA_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIGHT_BLUE_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.YELLOW_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIME_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.PINK_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.GRAY_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIGHT_GRAY_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CYAN_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CYAN_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.PURPLE_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BLUE_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BROWN_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.GREEN_BED || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.RED_BED
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BLACK_BED
) {
if (!islandManager.hasPermission(player, block.getLocation(), "Bed")) {
event.setCancelled(true);
@ -300,7 +300,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.BREWING_STAND) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BREWING_STAND) {
if (!islandManager.hasPermission(player, block.getLocation(), "Brewing")) {
event.setCancelled(true);
@ -310,18 +310,16 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || (NMSUtil.getVersionNumber() > 9 && (block.getType() == Materials.SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.BLACK_SHULKER_BOX.parseMaterial() || block.getType() == Materials.BLUE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.BROWN_SHULKER_BOX
.parseMaterial()
|| block.getType() == Materials.CYAN_SHULKER_BOX.parseMaterial() || block.getType() == Materials.GRAY_SHULKER_BOX.parseMaterial() || block.getType() == Materials.GREEN_SHULKER_BOX
.parseMaterial()
|| block.getType() == Materials.LIGHT_BLUE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.LIGHT_GRAY_SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.LIME_SHULKER_BOX.parseMaterial()
|| block.getType() == Materials.MAGENTA_SHULKER_BOX.parseMaterial() || block.getType() == Materials.ORANGE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.PINK_SHULKER_BOX
.parseMaterial()
|| block.getType() == Materials.PURPLE_SHULKER_BOX.parseMaterial() || block.getType() == Materials.RED_SHULKER_BOX.parseMaterial() || block.getType() == Materials.WHITE_SHULKER_BOX
.parseMaterial()
|| block.getType() == Materials.YELLOW_SHULKER_BOX.parseMaterial()))) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CHEST || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.TRAPPED_CHEST
|| (NMSUtil.getVersionNumber() > 9 && (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BLACK_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BLUE_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BROWN_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CYAN_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.GRAY_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.GREEN_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIGHT_BLUE_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIGHT_GRAY_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIME_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MAGENTA_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ORANGE_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.PINK_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.PURPLE_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.RED_SHULKER_BOX
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.WHITE_SHULKER_BOX || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.YELLOW_SHULKER_BOX))) {
if (!islandManager.hasPermission(player, block.getLocation(), "Storage")) {
event.setCancelled(true);
@ -331,7 +329,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.CRAFTING_TABLE.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CRAFTING_TABLE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Workbench")) {
event.setCancelled(true);
@ -341,8 +339,9 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.BIRCH_DOOR || block.getType() == Material.ACACIA_DOOR || block.getType() == Material.DARK_OAK_DOOR || block.getType() == Material.JUNGLE_DOOR
|| block.getType() == Material.SPRUCE_DOOR || block.getType() == Materials.LEGACY_WOODEN_DOOR.parseMaterial() || block.getType() == Materials.OAK_DOOR.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BIRCH_DOOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ACACIA_DOOR
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DARK_OAK_DOOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.JUNGLE_DOOR
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SPRUCE_DOOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.OAK_DOOR) {
if (!islandManager.hasPermission(player, block.getLocation(), "Door")) {
event.setCancelled(true);
@ -352,7 +351,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.ENCHANTING_TABLE.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ENCHANTING_TABLE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Enchant")) {
event.setCancelled(true);
@ -362,7 +361,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.FURNACE || block.getType() == Materials.LEGACY_BURNING_FURNACE.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.FURNACE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Furnace")) {
event.setCancelled(true);
@ -372,9 +371,9 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.STONE_BUTTON || block.getType() == Materials.OAK_BUTTON.parseMaterial() || block.getType() == Materials.SPRUCE_BUTTON.parseMaterial()
|| block.getType() == Materials.BIRCH_BUTTON.parseMaterial() || block.getType() == Materials.JUNGLE_BUTTON.parseMaterial() || block.getType() == Materials.ACACIA_BUTTON.parseMaterial()
|| block.getType() == Materials.DARK_OAK_BUTTON.parseMaterial() || block.getType() == Materials.LEVER.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.STONE_BUTTON || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.OAK_BUTTON || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SPRUCE_BUTTON
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BIRCH_BUTTON|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.JUNGLE_BUTTON || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ACACIA_BUTTON
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DARK_OAK_BUTTON || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LEVER) {
if (!islandManager.hasPermission(player, block.getLocation(), "LeverButton")) {
event.setCancelled(true);
@ -384,7 +383,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.JUKEBOX) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.JUKEBOX) {
if (!islandManager.hasPermission(player, block.getLocation(), "Jukebox")) {
event.setCancelled(true);
@ -394,14 +393,11 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.OAK_TRAPDOOR.parseMaterial() || block.getType() == Materials.SPRUCE_TRAPDOOR.parseMaterial() || block.getType() == Materials.BIRCH_TRAPDOOR
.parseMaterial()
|| block.getType() == Materials.JUNGLE_TRAPDOOR.parseMaterial() || block.getType() == Materials.ACACIA_TRAPDOOR.parseMaterial() || block.getType() == Materials.DARK_OAK_TRAPDOOR
.parseMaterial()
|| block.getType() == Material.NOTE_BLOCK || block.getType() == Material.HOPPER || block.getType() == Materials.COMPARATOR.parseMaterial()
|| block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_OFF.parseMaterial() || block.getType() == Materials.LEGACY_REDSTONE_COMPARATOR_ON.parseMaterial()
|| block.getType() == Materials.REPEATER.parseMaterial() || block.getType() == Materials.LEGACY_DIODE_BLOCK_OFF.parseMaterial()
|| block.getType() == Materials.LEGACY_DIODE_BLOCK_ON.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.OAK_TRAPDOOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SPRUCE_TRAPDOOR
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BIRCH_TRAPDOOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.JUNGLE_TRAPDOOR
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ACACIA_TRAPDOOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DARK_OAK_TRAPDOOR
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.NOTE_BLOCK || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.HOPPER
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.COMPARATOR || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.REPEATER) {
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
event.setCancelled(true);
@ -411,8 +407,8 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.OAK_FENCE_GATE.parseMaterial() || block.getType() == Material.ACACIA_FENCE_GATE || block.getType() == Material.BIRCH_FENCE_GATE
|| block.getType() == Material.DARK_OAK_FENCE_GATE || block.getType() == Material.JUNGLE_FENCE_GATE || block.getType() == Material.SPRUCE_FENCE_GATE) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.OAK_FENCE_GATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ACACIA_FENCE_GATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BIRCH_FENCE_GATE
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DARK_OAK_FENCE_GATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.JUNGLE_FENCE_GATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SPRUCE_FENCE_GATE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Gate")) {
event.setCancelled(true);
@ -422,7 +418,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.DROPPER || block.getType() == Material.DISPENSER) {
} else if ((CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DROPPER || (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DISPENSER))) {
if (!islandManager.hasPermission(player, block.getLocation(), "DropperDispenser")) {
event.setCancelled(true);
@ -432,7 +428,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.TNT) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.TNT) {
if (!islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
event.setCancelled(true);
@ -442,7 +438,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.LEGACY_CAKE_BLOCK.getPostMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CAKE) {
if (player.getFoodLevel() < 20 && !islandManager.hasPermission(player, block.getLocation(), "Cake")) {
event.setCancelled(true);
@ -452,7 +448,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Material.HOPPER) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.HOPPER) {
if (!islandManager.hasPermission(player, block.getLocation(), "Hopper")) {
event.setCancelled(true);
@ -462,37 +458,38 @@ public class Interact implements Listener {
return;
}
} else if ((player.getGameMode() == GameMode.SURVIVAL) && (block.getType() == Material.OBSIDIAN) && (event.getItem() != null) && (event.getItem().getType() != Material.AIR)
&& (event.getItem().getType() == Material.BUCKET)) {
} else if ((player.getGameMode() == GameMode.SURVIVAL)
&& (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.OBSIDIAN) && (event.getItem() != null) && (CompatibleMaterial.getMaterial(event.getItem().getType()) != CompatibleMaterial.AIR)
&& (CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.BUCKET)) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Block.Obsidian.Enable")
&& islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
int NMSVersion = NMSUtil.getVersionNumber();
boolean isInventoryFull = false;
if (NMSVersion > 8) {
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 5, 1, Material.BUCKET);
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 5, 1, CompatibleMaterial.BUCKET.getBlockMaterial());
} else {
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 0, 1, Material.BUCKET);
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 0, 1, CompatibleMaterial.BUCKET.getBlockMaterial());
}
soundManager.playSound(block.getLocation(), Sounds.FIZZ.bukkitSound(), 1.0F, 1.0F);
InventoryUtil.removeItem(player.getInventory(), 1, false, Material.BUCKET);
block.setType(Material.AIR);
InventoryUtil.removeItem(player.getInventory(), 1, false, CompatibleMaterial.BUCKET.getBlockMaterial());
block.setType(CompatibleMaterial.AIR.getBlockMaterial());
if (isInventoryFull) {
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(Material.LAVA_BUCKET));
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(CompatibleMaterial.LAVA_BUCKET.getBlockMaterial()));
} else {
if (NMSVersion > 8) {
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 5, 1, Material.LAVA_BUCKET);
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 5, 1, CompatibleMaterial.LAVA_BUCKET.getBlockMaterial());
} else {
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 0, 1, Material.LAVA_BUCKET);
isInventoryFull = InventoryUtil.isInventoryFull(player.getInventory(), 0, 1, CompatibleMaterial.LAVA_BUCKET.getBlockMaterial());
}
if (isInventoryFull) {
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(Material.LAVA_BUCKET));
player.getWorld().dropItemNaturally(player.getLocation(), new ItemStack(CompatibleMaterial.LAVA_BUCKET.getBlockMaterial()));
} else {
player.getInventory().addItem(new ItemStack(Material.LAVA_BUCKET));
player.getInventory().addItem(new ItemStack(CompatibleMaterial.LAVA_BUCKET.getBlockMaterial()));
}
}
@ -500,7 +497,7 @@ public class Interact implements Listener {
return;
}
} else if (block.getType() == Materials.END_PORTAL_FRAME.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.END_PORTAL_FRAME) {
if (skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Block.EndFrame.Enable")
&& islandManager.hasPermission(player, block.getLocation(), "Destroy")) {
@ -518,12 +515,12 @@ public class Interact implements Listener {
ItemStack is = event.getPlayer().getItemInHand();
boolean hasEye = ((block.getData() >> 2) & 1) == 1;
if (is == null || is.getType() == Material.AIR) {
if (is == null || CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.AIR) {
int size = 1;
if (stackableManager != null && stackableManager.isStacked(block.getLocation())) {
Stackable stackable = stackableManager.getStack(block.getLocation(), Materials.END_PORTAL_FRAME);
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.END_PORTAL_FRAME);
stackable.takeOne();
if (stackable.getSize() <= 1) {
@ -532,12 +529,12 @@ public class Interact implements Listener {
size = stackable.getSize();
} else {
block.setType(Material.AIR);
block.setType(CompatibleMaterial.AIR.getBlockMaterial());
}
player.getInventory().addItem(new ItemStack(Materials.END_PORTAL_FRAME.parseMaterial(), 1));
player.getInventory().addItem(new ItemStack(CompatibleMaterial.END_PORTAL_FRAME.getMaterial(), 1));
if (hasEye && size == 1) {
player.getInventory().addItem(new ItemStack(Materials.ENDER_EYE.parseMaterial(), 1));
player.getInventory().addItem(new ItemStack(CompatibleMaterial.ENDER_EYE.getMaterial(), 1));
}
player.updateInventory();
@ -545,7 +542,7 @@ public class Interact implements Listener {
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
Materials materials = Materials.END_PORTAL_FRAME;
CompatibleMaterial materials = CompatibleMaterial.END_PORTAL_FRAME;
IslandLevel level = island.getLevel();
if (level.hasMaterial(materials.name())) {
@ -567,8 +564,10 @@ public class Interact implements Listener {
}
}
if ((event.getItem() != null) && (event.getItem().getType() != Material.AIR) && !event.isCancelled()) {
if (event.getItem().getType() == Material.BUCKET || event.getItem().getType() == Material.WATER_BUCKET || event.getItem().getType() == Material.LAVA_BUCKET) {
if ((event.getItem() != null) && (CompatibleMaterial.getMaterial(event.getItem().getType()) != CompatibleMaterial.AIR) && !event.isCancelled()) {
if (CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.BUCKET
|| CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.WATER_BUCKET
|| CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.LAVA_BUCKET) {
if (!islandManager.hasPermission(player, block.getLocation(), "Bucket")) {
event.setCancelled(true);
@ -578,8 +577,8 @@ public class Interact implements Listener {
player.updateInventory();
}
} else if (event.getItem().getType() == Material.GLASS_BOTTLE) {
if (block.getType() == Material.WATER || block.getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial() || block.getType() == Material.CAULDRON) {
} else if (CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.GLASS_BOTTLE) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.WATER || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.CAULDRON) {
if (!islandManager.hasPermission(player, block.getLocation(), "WaterCollection")) {
event.setCancelled(true);
@ -600,7 +599,7 @@ public class Interact implements Listener {
player.updateInventory();
}
} else if (event.getItem().getType() == Material.ARMOR_STAND || event.getItem().getType().name().contains("BOAT") || event.getItem().getType().name().contains("MINECART")) {
} else if (CompatibleMaterial.getMaterial(event.getItem().getType()) == CompatibleMaterial.ARMOR_STAND || event.getItem().getType().name().contains("BOAT") || event.getItem().getType().name().contains("MINECART")) {
if (!islandManager.hasPermission(player, block.getLocation(), "EntityPlacement")) {
event.setCancelled(true);
@ -614,7 +613,7 @@ public class Interact implements Listener {
}
} else if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
// Note: Cast is necessary as it is ambiguous without it in 1.8
if (player.getTargetBlock(null, 5).getType() == Material.FIRE) {
if (CompatibleMaterial.getMaterial(player.getTargetBlock(null, 5).getType()) == CompatibleMaterial.FIRE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Fire")) {
event.setCancelled(true);
@ -624,9 +623,9 @@ public class Interact implements Listener {
}
}
} else if (event.getAction() == Action.PHYSICAL) {
if (block.getType() == Materials.TURTLE_EGG.parseMaterial()) {
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.TURTLE_EGG) {
event.setCancelled(true);
} else if (block.getType() == Materials.FARMLAND.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.FARMLAND) {
if (!islandManager.hasPermission(player, block.getLocation(), "Crop")) {
event.setCancelled(true);
@ -634,16 +633,16 @@ public class Interact implements Listener {
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
} else if (block.getType() == Materials.STONE_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.OAK_PRESSURE_PLATE.parseMaterial()
|| block.getType() == Materials.SPRUCE_PRESSURE_PLATE.parseMaterial()
|| block.getType() == Materials.BIRCH_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.JUNGLE_PRESSURE_PLATE.parseMaterial()
|| block.getType() == Materials.ACACIA_PRESSURE_PLATE.parseMaterial()
|| block.getType() == Materials.DARK_OAK_PRESSURE_PLATE.parseMaterial() || block.getType() == Materials.LIGHT_WEIGHTED_PRESSURE_PLATE.parseMaterial()
|| block.getType() == Materials.HEAVY_WEIGHTED_PRESSURE_PLATE.parseMaterial()) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.STONE_PRESSURE_PLATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.OAK_PRESSURE_PLATE
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.SPRUCE_PRESSURE_PLATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.BIRCH_PRESSURE_PLATE
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.JUNGLE_PRESSURE_PLATE || CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.ACACIA_PRESSURE_PLATE
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.DARK_OAK_PRESSURE_PLATE
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.LIGHT_WEIGHTED_PRESSURE_PLATE
|| CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.HEAVY_WEIGHTED_PRESSURE_PLATE) {
if (!islandManager.hasPermission(player, block.getLocation(), "PressurePlate")) {
event.setCancelled(true);
}
} else if (block.getType() == Material.TRIPWIRE) {
} else if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.TRIPWIRE) {
if (!islandManager.hasPermission(player, block.getLocation(), "Redstone")) {
event.setCancelled(true);
@ -655,7 +654,7 @@ public class Interact implements Listener {
}
}
private int getStackLimit(Player player, Materials materials) {
private int getStackLimit(Player player, CompatibleMaterial materials) {
String maxSizePermission = "fabledskyblock.stackable." + materials.name().toLowerCase() + ".maxsize.";
for (PermissionAttachmentInfo attachmentInfo : player.getEffectivePermissions()) {
@ -732,8 +731,8 @@ public class Interact implements Listener {
SoundManager soundManager = skyblock.getSoundManager();
if (skyblock.getWorldManager().isIslandWorld(entity.getWorld())) {
if ((is != null) && (is.getType() != Material.AIR)) {
if (is.getType() == Materials.LEAD.parseMaterial()) {
if ((is != null) && (CompatibleMaterial.getMaterial(is.getType()) != CompatibleMaterial.AIR)) {
if (CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.LEAD) {
if (!islandManager.hasPermission(player, entity.getLocation(), "Leash")) {
event.setCancelled(true);
@ -797,7 +796,7 @@ public class Interact implements Listener {
skyblock.getSoundManager().playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
} else if (entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
if (is.getType() == Material.BUCKET) {
if (CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BUCKET) {
if (!islandManager.hasPermission(player, entity.getLocation(), "Milking")) {
event.setCancelled(true);
@ -851,23 +850,27 @@ public class Interact implements Listener {
}
if (entity.getType() == EntityType.HORSE) {
if (!(is.getType() == Material.GOLDEN_APPLE || is.getType() == Material.GOLDEN_CARROT || is.getType() == Material.SUGAR || is.getType() == Material.WHEAT
|| is.getType() == Material.APPLE
|| is.getType() == Material.HAY_BLOCK)) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.GOLDEN_APPLE
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.GOLDEN_CARROT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.SUGAR
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.WHEAT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.APPLE
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.HAY_BLOCK)) {
return;
}
} else if (entity.getType() == EntityType.SHEEP || entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
if (!(is.getType() == Material.WHEAT)) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.WHEAT)) {
return;
}
} else if (entity.getType() == EntityType.PIG) {
if (!(is.getType() == Materials.CARROT.parseMaterial() || is.getType() == Materials.POTATO.parseMaterial())) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.CARROT || CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.POTATO)) {
return;
}
} else if (entity.getType() == EntityType.CHICKEN) {
if (!(is.getType() == Materials.WHEAT_SEEDS.parseMaterial() || is.getType() == Material.PUMPKIN_SEEDS || is.getType() == Material.MELON_SEEDS)) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.WHEAT_SEEDS
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.PUMPKIN_SEEDS || CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.MELON_SEEDS)) {
if (NMSUtil.getVersionNumber() > 8) {
if (!(is.getType() == Materials.BEETROOT_SEEDS.parseMaterial())) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BEETROOT_SEEDS)) {
return;
}
} else {
@ -875,19 +878,31 @@ public class Interact implements Listener {
}
}
} else if (entity.getType() == EntityType.WOLF) {
if (!(is.getType() == Material.BONE || is.getType() == Materials.PORKCHOP.parseMaterial() || is.getType() == Materials.BEEF.parseMaterial() || is.getType() == Materials.CHICKEN
.parseMaterial()
|| is.getType() == Material.RABBIT || is.getType() == Material.MUTTON || is.getType() == Material.ROTTEN_FLESH || is.getType() == Materials.COOKED_PORKCHOP.parseMaterial()
|| is.getType() == Material.COOKED_BEEF || is.getType() == Material.COOKED_CHICKEN || is.getType() == Material.COOKED_RABBIT || is.getType() == Material.COOKED_MUTTON)) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BONE
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.PORKCHOP
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.BEEF
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.CHICKEN
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.RABBIT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.MUTTON
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.ROTTEN_FLESH
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_PORKCHOP
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_BEEF
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_CHICKEN
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_RABBIT
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COOKED_MUTTON)) {
return;
}
} else if (entity.getType() == EntityType.OCELOT) {
if (!(is.getType() == Materials.COD.parseMaterial() || is.getType() == Materials.SALMON.parseMaterial() || is.getType() == Materials.TROPICAL_FISH.parseMaterial()
|| is.getType() == Materials.PUFFERFISH.parseMaterial())) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.COD
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.SALMON
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.TROPICAL_FISH
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.PUFFERFISH)) {
return;
}
} else if (entity.getType() == EntityType.RABBIT) {
if (!(is.getType() == Materials.DANDELION.parseMaterial() || is.getType() == Materials.CARROTS.parseMaterial() || is.getType() == Material.GOLDEN_CARROT)) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.DANDELION
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.CARROTS
|| CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.GOLDEN_CARROT)) {
return;
}
} else {
@ -895,12 +910,12 @@ public class Interact implements Listener {
if (NMSVersion > 10) {
if (entity.getType() == EntityType.LLAMA) {
if (!(is.getType() == Materials.HAY_BLOCK.parseMaterial())) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.HAY_BLOCK)) {
return;
}
} else if (NMSVersion > 12) {
if (entity.getType() == EntityType.TURTLE) {
if (!(is.getType() == Materials.SEAGRASS.parseMaterial())) {
if (!(CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.SEAGRASS)) {
return;
}
} else {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.listeners;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -9,7 +10,6 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager;
@ -53,15 +53,16 @@ public class Portal implements Listener {
Island island = islandManager.getIslandAtLocation(to.getLocation());
if (island == null) return;
if ((to.getType().equals(Materials.NETHER_PORTAL.parseMaterial()) || to.getType().equals(Materials.END_PORTAL.parseMaterial()))
CompatibleMaterial toMaterial = CompatibleMaterial.getMaterial(to.getType());
if( (toMaterial == CompatibleMaterial.NETHER_BRICK || toMaterial == CompatibleMaterial.END_PORTAL)
&& !islandManager.hasPermission(player, player.getLocation(), "Portal")) {
event.setTo(LocationUtil.getRandomLocation(event.getFrom().getWorld(), 5000, 5000, true, true));
messageManager.sendMessage(player,
fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
}
}
@EventHandler(priority = EventPriority.LOW)
@ -132,8 +133,8 @@ public class Portal implements Listener {
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
IslandWorld toWorld = IslandWorld.Normal;
if (block.getType().equals(Materials.NETHER_PORTAL.parseMaterial())) toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.Nether : IslandWorld.Normal;
else if (block.getType().equals(Materials.END_PORTAL.parseMaterial())) toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.End : IslandWorld.Normal;
if (CompatibleMaterial.getMaterial(block.getType()).equals(CompatibleMaterial.NETHER_PORTAL)) toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.Nether : IslandWorld.Normal;
else if (CompatibleMaterial.getMaterial(block.getType()).equals(CompatibleMaterial.END_PORTAL)) toWorld = fromWorld.equals(IslandWorld.Normal) ? IslandWorld.End : IslandWorld.Normal;
switch (toWorld) {
case Nether:

View File

@ -5,6 +5,7 @@ import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.world.WorldManager;
import com.songoda.ultimatestacker.events.SpawnerBreakEvent;
@ -40,7 +41,7 @@ public class UltimateStacker implements Listener {
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
Materials materials = Materials.getSpawner(event.getSpawnerType());
Materials materials = Materials.getSpawner(event.getSpawnerType()); //TODO: BRIANNA SPAWNERS
if (materials != null) {
IslandLevel level = island.getLevel();

View File

@ -6,6 +6,7 @@ import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.world.WorldManager;
@ -37,6 +38,7 @@ public class WildStacker implements Listener {
Island island = islandManager.getIslandAtLocation(location);
//TODO: Somehow play with this
Material material = event.getBarrel().getType();
byte data = (byte) event.getBarrel().getData();

View File

@ -4,6 +4,8 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
import org.bukkit.configuration.Configuration;
import com.google.common.collect.Sets;
@ -13,7 +15,7 @@ import com.songoda.skyblock.localization.type.Localization;
import com.songoda.skyblock.localization.type.impl.BlankLocalization;
import com.songoda.skyblock.localization.type.impl.EnumLocalization;
import com.songoda.skyblock.localization.type.impl.MaterialsLocalization;
import com.songoda.skyblock.utils.version.Materials;
import org.bukkit.configuration.file.FileConfiguration;
public final class LocalizationManager {
@ -23,7 +25,7 @@ public final class LocalizationManager {
public LocalizationManager() {
this.map = new HashMap<>();
registerLocalizationFor(Materials.class, new MaterialsLocalization("Materials"));
registerLocalizationFor(CompatibleMaterial.class, new MaterialsLocalization("Materials"));
registerLocalizationFor(IslandRole.class, new EnumLocalization<>("IslandRoles", IslandRole.class));
}

View File

@ -13,7 +13,7 @@ public abstract class Localization<T> {
public Localization(String keysPath, Class<T> type) {
this.type = Objects.requireNonNull(type, "type cannot be null");
this.keysPath = "ClassLocalization." + Objects.requireNonNull(keysPath, "keysPath canoot be null.");
this.keysPath = "ClassLocalization." + Objects.requireNonNull(keysPath, "keysPath cannot be null.");
this.values = Objects.requireNonNull(newValueMapInstance(type), "type cannot be null");
}

View File

@ -1,20 +1,21 @@
package com.songoda.skyblock.localization.type.impl;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
public class MaterialsLocalization extends EnumLocalization<Materials> {
public class MaterialsLocalization extends EnumLocalization<CompatibleMaterial> {
public MaterialsLocalization(String keysPath) {
super(keysPath, Materials.class);
super(keysPath, CompatibleMaterial.class);
}
@Override
public Materials parseEnum(String input) {
return Materials.fromString(input);
public CompatibleMaterial parseEnum(String input) {
return CompatibleMaterial.getMaterial(input);
}
@Override
public String getDefaultLocaleFor(Materials obj) {
public String getDefaultLocaleFor(CompatibleMaterial obj) {
return super.getDefaultLocaleFor(obj).replace("_", " ");
}

View File

@ -1,19 +1,19 @@
package com.songoda.skyblock.localization.type.impl;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
import com.songoda.skyblock.utils.version.Materials;
public class MaterialsToMaterialLocalization extends EnumLocalization<Material> {
public class MaterialsToMaterialLocalization extends EnumLocalization<CompatibleMaterial> {
public MaterialsToMaterialLocalization(String keysPath) {
super(keysPath, Material.class);
super(keysPath, CompatibleMaterial.class);
}
@Override
public Material parseEnum(String input) {
Materials material = Materials.fromString(input);
return material == null ? null : material.parseMaterial();
public CompatibleMaterial parseEnum(String input) {
return CompatibleMaterial.getMaterial(input);
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -15,7 +16,7 @@ import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -79,14 +80,14 @@ public class Bans {
ItemStack is = event.getItem();
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Bans.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Bans.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -161,14 +162,14 @@ public class Bans {
Set<UUID> islandBans = island.getBan().getBans();
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Bans.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Bans.Item.Information.Displayname"),
configLoad.getStringList("Menu.Bans.Item.Information.Lore"),
new Placeholder[]{new Placeholder("%bans", "" + islandBans.size())}, null, null), 4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Bans.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.biome.BiomeManager;
import com.songoda.skyblock.cooldown.Cooldown;
@ -13,7 +14,7 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.SBiome;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
@ -82,7 +83,7 @@ public class Biome {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
langConfig.getString("Menu.Biome.Item.Barrier.Displayname"))))) {
@ -90,7 +91,7 @@ public class Biome {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
langConfig.getString("Menu.Biome.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -159,11 +160,11 @@ public class Biome {
langConfig.getStringList("Menu.Biome.Item.Info.Lore"),
new Placeholder[]{new Placeholder("%biome_type", islandBiomeName)}, null, null), 4);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
langConfig.getString("Menu.Biome.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
ChatColor.translateAlternateColorCodes('&',
langConfig.getString("Menu.Biome.Item.Barrier.Displayname")),
null, null, null, null),

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
@ -9,7 +10,7 @@ import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.utils.world.WorldBorder;
import org.bukkit.Bukkit;
@ -71,7 +72,7 @@ public class Border {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -88,7 +89,7 @@ public class Border {
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
} else if ((is.getType() == Materials.LIGHT_BLUE_DYE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.LIGHT_BLUE_DYE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
@ -106,7 +107,7 @@ public class Border {
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
}
} else if ((is.getType() == Materials.LIME_DYE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.LIME_DYE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
@ -124,7 +125,7 @@ public class Border {
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
}
} else if ((is.getType() == Materials.RED_DYE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.RED_DYE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
@ -147,7 +148,7 @@ public class Border {
Island island = islandManager.getIsland(player);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Border.Item.Exit.Displayname"), null, null, null, null), 0);
WorldBorder.Color borderColor = island.getBorderColor();
@ -165,14 +166,14 @@ public class Border {
new Placeholder[]{new Placeholder("%toggle", borderToggle)}, null, null), 1);
if (borderColor == WorldBorder.Color.Blue) {
nInv.addItem(nInv.createItem(Materials.LIGHT_BLUE_DYE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Blue"))},
null, null), 2);
} else {
nInv.addItem(nInv.createItem(Materials.LIGHT_BLUE_DYE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
@ -181,7 +182,7 @@ public class Border {
}
if (borderColor == WorldBorder.Color.Green) {
nInv.addItem(nInv.createItem(Materials.LIME_DYE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
@ -189,7 +190,7 @@ public class Border {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green"))},
null, null), 3);
} else {
nInv.addItem(nInv.createItem(Materials.LIME_DYE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
@ -199,14 +200,14 @@ public class Border {
}
if (borderColor == WorldBorder.Color.Red) {
nInv.addItem(nInv.createItem(Materials.RED_DYE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
new Placeholder[]{new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Red"))},
null, null), 4);
} else {
nInv.addItem(nInv.createItem(Materials.RED_DYE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.menus;
import java.io.File;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -16,7 +17,7 @@ import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.utils.item.MenuClickRegistry;
import com.songoda.skyblock.utils.item.MenuClickRegistry.RegistryKey;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
public final class ControlPanel {
@ -31,11 +32,11 @@ public final class ControlPanel {
MenuClickRegistry.getInstance().register((executors) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Teleport.Displayname", Materials.OAK_DOOR), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Teleport.Displayname", CompatibleMaterial.OAK_DOOR), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island teleport"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Lock.Displayname", Materials.IRON_DOOR), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Lock.Displayname", CompatibleMaterial.IRON_DOOR), (inst, player, e) -> {
final Island island = SkyBlock.getInstance().getIslandManager().getIsland((Player) player);
@ -46,35 +47,35 @@ public final class ControlPanel {
}
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Barrier.Displayname", Materials.BLACK_STAINED_GLASS_PANE), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Barrier.Displayname", CompatibleMaterial.BLACK_STAINED_GLASS_PANE), (inst, player, e) -> {
inst.getSoundManager().playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
e.setWillClose(false);
e.setWillDestroy(false);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Level.Displayname", Materials.EXPERIENCE_BOTTLE), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Level.Displayname", CompatibleMaterial.EXPERIENCE_BOTTLE), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island level"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Settings.Displayname", Materials.NAME_TAG), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Settings.Displayname", CompatibleMaterial.NAME_TAG), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island settings"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Members.Displayname", Materials.ITEM_FRAME), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Members.Displayname", CompatibleMaterial.ITEM_FRAME), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island members"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Biome.Displayname", Materials.OAK_SAPLING), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Biome.Displayname", CompatibleMaterial.OAK_SAPLING), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island biome"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Weather.Displayname", Materials.CLOCK), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Weather.Displayname", CompatibleMaterial.CLOCK), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island weather"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Bans.Displayname", Materials.IRON_AXE), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Bans.Displayname", CompatibleMaterial.IRON_AXE), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island bans"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Visitors.Displayname", Materials.OAK_SIGN), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Visitors.Displayname", CompatibleMaterial.OAK_SIGN), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island visitors"), 1L);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Upgrades.Displayname", Materials.ANVIL), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Upgrades.Displayname", CompatibleMaterial.ANVIL), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island upgrades"), 1L);
});
@ -93,23 +94,23 @@ public final class ControlPanel {
});
// Teleport to island and open/close island
nInv.addItem(nInv.createItem(Materials.OAK_DOOR.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Teleport.Lore"), null, null, null), 1);
nInv.addItem(nInv.createItem(Materials.IRON_DOOR.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
nInv.addItem(nInv.createItem(CompatibleMaterial.IRON_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Lock.Lore"), null, null, null), 10);
// Glass panes barriers
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8,
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8,
9, 11, 14, 17);
// 4 Items at the left
nInv.addItem(nInv.createItem(new ItemStack(Materials.EXPERIENCE_BOTTLE.parseMaterial()), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.EXPERIENCE_BOTTLE.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Level.Lore"), null, null, null), 3);
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG), configLoad.getString("Menu.ControlPanel.Item.Settings.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Settings.Lore"), null, null, null), 4);
nInv.addItem(nInv.createItem(Materials.CLOCK.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
nInv.addItem(nInv.createItem(CompatibleMaterial.CLOCK.getItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Weather.Lore"), null, null, null), 12);
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Biome.Lore"), null, null, null), 13);
// 4 Items at the right
@ -117,9 +118,9 @@ public final class ControlPanel {
configLoad.getStringList("Menu.ControlPanel.Item.Members.Lore"), null, null, null), 16);
nInv.addItem(nInv.createItem(new ItemStack(Material.IRON_AXE), configLoad.getString("Menu.ControlPanel.Item.Bans.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Bans.Lore"), null, null, new ItemFlag[] { ItemFlag.HIDE_ATTRIBUTES }), 6);
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Visitors.Lore"), null, null, null), 7);
nInv.addItem(nInv.createItem(new ItemStack(Materials.ANVIL.parseMaterial()), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.ANVIL.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Upgrades.Lore"), null, null, null), 15);
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.ControlPanel.Title")));

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -16,7 +17,7 @@ import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -80,14 +81,14 @@ public class Coop {
ItemStack is = event.getItem();
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Coop.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Coop.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -193,14 +194,14 @@ public class Coop {
int playerMenuPage = playerData.getPage(), nextEndIndex = coopPlayers.size() - playerMenuPage * 36;
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Coop.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
configLoad.getString("Menu.Coop.Item.Information.Displayname"),
configLoad.getStringList("Menu.Coop.Item.Information.Lore"),
new Placeholder[]{new Placeholder("%coops", "" + coopPlayers.size())}, null, null), 4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Coop.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -101,7 +101,7 @@ public class Creator {
ItemStack is = event.getItem();
for (Structure structureList : skyblock.getStructureManager().getStructures()) {
if ((is.getType() == structureList.getMaterials().parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == structureList.getMaterials().getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Menu.Creator.Selector.Item.Island.Displayname")
@ -229,7 +229,7 @@ public class Creator {
}
}
nInv.addItem(nInv.createItem(structure.getMaterials().parseItem(),
nInv.addItem(nInv.createItem(structure.getMaterials().getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Creator.Selector.Item.Island.Displayname")
.replace("%displayname", structure.getDisplayname())),

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -14,7 +15,7 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.Visit;
import org.bukkit.Bukkit;
@ -116,12 +117,12 @@ public class Information {
PlayerData playerData13 = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Categories.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
} else if ((is.getType() == Materials.ITEM_FRAME.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.ITEM_FRAME.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Categories.Item.Members.Displayname"))))) {
@ -132,7 +133,7 @@ public class Information {
Bukkit.getServer().getScheduler().runTaskLater(skyblock,
() -> open(player), 1L);
} else if ((is.getType() == Materials.LEGACY_EMPTY_MAP.getPostMaterial())
} else if ((is.getType() == CompatibleMaterial.MAP.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -141,7 +142,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.PAINTING.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.PAINTING.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Categories.Item.Visitors.Displayname"))))) {
@ -156,14 +157,14 @@ public class Information {
}
});
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Information.Categories.Item.Exit.Displayname"), null, null, null,
null), 0, 4);
nInv.addItem(nInv.createItem(Materials.ITEM_FRAME.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.ITEM_FRAME.getItem(),
configLoad.getString("Menu.Information.Categories.Item.Members.Displayname"),
configLoad.getStringList("Menu.Information.Categories.Item.Members.Lore"), null, null,
null), 1);
nInv.addItem(nInv.createItem(Materials.PAINTING.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.PAINTING.getItem(),
configLoad.getString("Menu.Information.Categories.Item.Visitors.Displayname"),
configLoad.getStringList("Menu.Information.Categories.Item.Visitors.Lore"), null, null,
null), 3);
@ -203,7 +204,7 @@ public class Information {
"Menu.Information.Categories.Item.Information.Vote.Enabled.Signature.Disabled.Lore"));
}
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Information.Categories.Item.Information.Displayname"),
itemLore,
new Placeholder[]{new Placeholder("%level", "" + visit.getLevel().getLevel()),
@ -242,7 +243,7 @@ public class Information {
"Menu.Information.Categories.Item.Information.Vote.Disabled.Signature.Disabled.Lore"));
}
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Information.Categories.Item.Information.Displayname"),
itemLore,
new Placeholder[]{new Placeholder("%level", "" + visit.getLevel().getLevel()),
@ -269,7 +270,7 @@ public class Information {
PlayerData playerData1 = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Members.Item.Return.Displayname"))))) {
@ -280,7 +281,7 @@ public class Information {
Bukkit.getServer().getScheduler().runTaskLater(skyblock,
() -> open(player), 1L);
} else if ((is.getType() == Materials.PAINTING.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.PAINTING.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Members.Item.Statistics.Displayname"))))) {
@ -288,7 +289,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -335,7 +336,7 @@ public class Information {
displayedMembers.addAll(islandOperators);
displayedMembers.addAll(islandMembers);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Information.Members.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(
@ -353,7 +354,7 @@ public class Information {
new Placeholder("%operators", "" + islandOperators.size())},
null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Information.Members.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -430,7 +431,7 @@ public class Information {
PlayerData playerData12 = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Visitors.Item.Return.Displayname"))))) {
@ -441,7 +442,7 @@ public class Information {
Bukkit.getServer().getScheduler().runTaskLater(skyblock,
() -> open(player), 1L);
} else if ((is.getType() == Materials.PAINTING.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.PAINTING.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Visitors.Item.Statistics.Displayname"))))) {
@ -449,7 +450,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -490,7 +491,7 @@ public class Information {
List<UUID> displayedVisitors = new ArrayList<>();
displayedVisitors.addAll(islandManager.getVisitorsAtIsland(island));
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Information.Visitors.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
@ -498,7 +499,7 @@ public class Information {
configLoad.getStringList("Menu.Information.Visitors.Item.Statistics.Lore"),
new Placeholder[]{new Placeholder("%island_visitors", "" + displayedVisitors.size())},
null, null), 4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Information.Visitors.Item.Barrier.Displayname"), null, null,
null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -10,7 +11,7 @@ import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.Visit;
import org.bukkit.Bukkit;
@ -55,7 +56,7 @@ public class Leaderboard {
if (playerDataManager.hasPlayerData(player)) {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Leaderboard." + Viewer.Type.Browse.name()
@ -95,7 +96,7 @@ public class Leaderboard {
}
});
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Leaderboard." + viewer.getType().name() + ".Item.Exit.Displayname"),
null, null, null, null), 0, 4);
nInv.addItem(
@ -139,7 +140,7 @@ public class Leaderboard {
if (playerDataManager.hasPlayerData(player)) {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())) {
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Exit.Displayname")))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -215,11 +216,11 @@ public class Leaderboard {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Visitor.Vote")) {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Return.Displayname"), null, null,
null, null), 0, 8);
} else {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Exit.Displayname"), null, null,
null, null), 0, 8);
}

View File

@ -1,285 +0,0 @@
package com.songoda.skyblock.menus;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.cooldown.Cooldown;
import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.cooldown.CooldownPlayer;
import com.songoda.skyblock.cooldown.CooldownType;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerData;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.MaterialUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
public class Levelling {
private static Levelling instance;
public static Levelling getInstance() {
if (instance == null) {
instance = new Levelling();
}
return instance;
}
public void open(Player player) {
SkyBlock skyblock = SkyBlock.getInstance();
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
IslandLevelManager levellingManager = skyblock.getLevellingManager();
CooldownManager cooldownManager = skyblock.getCooldownManager();
MessageManager messageManager = skyblock.getMessageManager();
IslandManager islandManager = skyblock.getIslandManager();
SoundManager soundManager = skyblock.getSoundManager();
FileManager fileManager = skyblock.getFileManager();
if (!playerDataManager.hasPlayerData(player))
return;
PlayerData playerData = skyblock.getPlayerDataManager().getPlayerData(player);
FileConfiguration configLoad = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration();
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
if (islandManager.getIsland(player) == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Owner.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
player.closeInventory();
return;
}
if (!playerDataManager.hasPlayerData(player))
return;
ItemStack is = event.getItem();
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
} else if ((is.getType() == Material.PAINTING) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"))))) {
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Material.BARRIER) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"))))) {
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.FIREWORK_STAR.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"))))) {
Island island = islandManager.getIsland(player);
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
if (cooldownManager.hasPlayer(CooldownType.Levelling, offlinePlayer) && !player.hasPermission("fabledskyblock.bypass.cooldown")) {
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.Levelling, offlinePlayer);
Cooldown cooldown = cooldownPlayer.getCooldown();
long[] durationTime = NumberUtil.getDuration(cooldown.getTime());
if (cooldown.getTime() >= 3600) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Level.Cooldown.Message").replace("%time",
durationTime[1] + " " + configLoad.getString("Command.Island.Level.Cooldown.Word.Minute") + " " + durationTime[2] + " "
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute") + " " + durationTime[3] + " "
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
} else if (cooldown.getTime() >= 60) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Cooldown.Message").replace("%time", durationTime[2] + " "
+ configLoad.getString("Command.Island.Level.Cooldown.Word.Minute") + " " + durationTime[3] + " " + configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Cooldown.Message").replace("%time",
cooldown.getTime() + " " + configLoad.getString("Command.Island.Level.Cooldown.Word.Second")));
}
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
return;
}
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, () -> {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Level.Processing.Message"));
soundManager.playSound(player, Sounds.VILLAGER_YES.bukkitSound(), 1.0F, 1.0F);
cooldownManager.createPlayer(CooldownType.Levelling, Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
levellingManager.startScan(player, island);
});
} else if ((is.getType() == SkullUtil.createItemStack().getType()) && (is.hasItemMeta())) {
PlayerData playerData1 = skyblock.getPlayerDataManager().getPlayerData(player);
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Previous.Displayname")))) {
playerData1.setPage(playerData1.getPage() - 1);
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
} else if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Next.Displayname")))) {
playerData1.setPage(playerData1.getPage() + 1);
soundManager.playSound(player, Sounds.ARROW_HIT.bukkitSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
} else {
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
}
} else {
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
}
});
Island island = islandManager.getIsland(player);
IslandLevel level = island.getLevel();
Map<String, Long> testIslandMaterials = level.getMaterials();
List<String> testIslandMaterialKeysOrdered = testIslandMaterials.keySet().stream().sorted().collect(Collectors.toList());
LinkedHashMap<String, Long> islandMaterials = new LinkedHashMap<>();
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "levelling.yml"));
Config settingsConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
// Filter out ItemStacks that can't be displayed in the inventory
Inventory testInventory = Bukkit.createInventory(null, 9);
for (String materialName : testIslandMaterialKeysOrdered) {
if (mainConfig.getFileConfiguration().getString("Materials." + materialName + ".Points") == null ||
!settingsConfig.getFileConfiguration().getBoolean("Island.Levelling.IncludeEmptyPointsInList") &&
mainConfig.getFileConfiguration().getInt("Materials." + materialName + ".Points") <= 0)
continue;
long value = testIslandMaterials.get(materialName);
Materials materials = Materials.fromString(materialName);
ItemStack is = materials.parseItem();
if (is == null || is.getItemMeta() == null) continue;
is.setAmount(Math.min(Math.toIntExact(value), 64));
is.setType(MaterialUtil.correctMaterial(is.getType()));
testInventory.clear();
testInventory.setItem(0, is);
if (testInventory.getItem(0) != null) {
islandMaterials.put(materialName, value);
}
}
int playerMenuPage = playerData.getPage(), nextEndIndex = islandMaterials.size() - playerMenuPage * 36;
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(), configLoad.getString("Menu.Levelling.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(Materials.FIREWORK_STAR.parseItem(), configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"), configLoad.getStringList("Menu.Levelling.Item.Rescan.Lore"), null, null,
new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 3, 5);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING), configLoad.getString("Menu.Levelling.Item.Statistics.Displayname"), configLoad.getStringList("Menu.Levelling.Item.Statistics.Lore"),
new Placeholder[]{new Placeholder("%level_points", NumberUtil.formatNumberByDecimal(level.getPoints())), new Placeholder("%level", NumberUtil.formatNumberByDecimal(level.getLevel()))}, null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
if (playerMenuPage != 1) {
nInv.addItem(nInv.createItem(SkullUtil.create(
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=",
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ=="),
configLoad.getString("Menu.Levelling.Item.Previous.Displayname"), null, null, null, null), 1);
}
if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
nInv.addItem(nInv.createItem(SkullUtil.create(
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=",
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ=="),
configLoad.getString("Menu.Levelling.Item.Next.Displayname"), null, null, null, null), 7);
}
if (islandMaterials.size() == 0) {
nInv.addItem(nInv.createItem(new ItemStack(Material.BARRIER), configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"), null, null, null, null), 31);
} else {
int index = playerMenuPage * 36 - 36, endIndex = index >= islandMaterials.size() ? islandMaterials.size() - 1 : index + 36, inventorySlot = 17;
for (; index < endIndex; index++) {
if (islandMaterials.size() <= index)
break;
String material = (String) islandMaterials.keySet().toArray()[index];
Materials materials = Materials.fromString(material);
if (materials == null)
break;
long materialAmount = islandMaterials.get(material);
if (mainConfig.getFileConfiguration().getString("Materials." + material + ".Points") == null)
break;
int pointsMultiplier = mainConfig.getFileConfiguration().getInt("Materials." + material + ".Points");
if (!settingsConfig.getFileConfiguration().getBoolean("Island.Levelling.IncludeEmptyPointsInList") && pointsMultiplier == 0)
return;
inventorySlot++;
long pointsEarned = materialAmount * pointsMultiplier;
String name = skyblock.getLocalizationManager().getLocalizationFor(Materials.class).getLocale(materials);
if (materials == Materials.FARMLAND && NMSUtil.getVersionNumber() < 9)
materials = Materials.DIRT;
ItemStack is = materials.parseItem();
is.setAmount(Math.min(Math.toIntExact(materialAmount), 64));
is.setType(MaterialUtil.correctMaterial(is.getType()));
List<String> lore = configLoad.getStringList("Menu.Levelling.Item.Material.Lore");
lore.replaceAll(x -> x.replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned)).replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount)).replace("%material", name));
nInv.addItem(nInv.createItem(is, configLoad.getString("Menu.Levelling.Item.Material.Displayname").replace("%points", NumberUtil.formatNumberByDecimal(pointsEarned))
.replace("%blocks", NumberUtil.formatNumberByDecimal(materialAmount)).replace("%material", name), lore, null, null, null), inventorySlot);
}
}
nInv.setTitle(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Title")));
nInv.setRows(6);
Bukkit.getServer().getScheduler().runTask(skyblock, () -> nInv.open());
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
@ -14,7 +15,7 @@ import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -74,14 +75,14 @@ public class Members {
return;
}
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Members.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Members.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -318,7 +319,7 @@ public class Members {
int playerMenuPage = playerData.getPage(), nextEndIndex = displayedMembers.size() - playerMenuPage * 36;
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Members.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Members.Item.Type.Displayname"),
@ -342,7 +343,7 @@ public class Members {
new Placeholder[]{new Placeholder("%sort", StringUtil.capatilizeUppercaseLetters(sort.name()))},
null, null), 5);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Members.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
@ -14,7 +15,7 @@ import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -79,7 +80,7 @@ public class Ownership {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -90,7 +91,7 @@ public class Ownership {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Barrier.Displayname"))))) {
@ -98,7 +99,7 @@ public class Ownership {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.WRITABLE_BOOK.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.WRITABLE_BOOK.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Assign.Displayname"))))) {
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
@ -143,7 +144,7 @@ public class Ownership {
gui.setSlot(AbstractAnvilGUI.AnvilSlot.INPUT_LEFT, is1);
gui.open();
}, 1L);
} else if ((is.getType() == Materials.LEGACY_EMPTY_MAP.getPostMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.MAP.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Password.Displayname"))))) {
if (island.hasPassword()) {
@ -248,28 +249,28 @@ public class Ownership {
playerTexture = playerDataManager.getPlayerData(targetPlayer).getTexture();
}
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Ownership.Item.Exit.Displayname"), null, null, null, null), 0);
nInv.addItem(nInv.createItem(SkullUtil.create(playerTexture[0], playerTexture[1]),
configLoad.getString("Menu.Ownership.Item.Original.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Original.Lore"),
new Placeholder[]{new Placeholder("%player", originalOwnerName)}, null, null), 1);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Ownership.Item.Barrier.Displayname"), null, null, null, null),
2);
nInv.addItem(nInv.createItem(Materials.WRITABLE_BOOK.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.WRITABLE_BOOK.getItem(),
configLoad.getString("Menu.Ownership.Item.Assign.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Assign.Lore"), null, null, null), 3);
if (island.hasPassword()) {
if (playerDataManager.getPlayerData(player).getType() == Ownership.Visibility.Hidden) {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Hidden.Lore"), null, null, null), 4);
} else {
nInv.addItem(
nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Visible.Lore"),
new Placeholder[]{new Placeholder("%password", ownershipPassword)}, null, null),
@ -277,7 +278,7 @@ public class Ownership {
}
} else {
nInv.addItem(
nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Unset.Lore"), null, null, null),
4);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.Island;
@ -7,7 +8,7 @@ import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
@ -53,14 +54,14 @@ public class Rollback implements Listener {
List<String> itemLore = new ArrayList<>();
is = Materials.BLACK_STAINED_GLASS_PANE.parseItem();
is = CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem();
im = is.getItemMeta();
im.setDisplayName(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Rollback.Item.Barrier.Displayname")));
is.setItemMeta(im);
inv.setItem(1, is);
is = new ItemStack(Materials.WRITABLE_BOOK.parseMaterial());
is = new ItemStack(CompatibleMaterial.WRITABLE_BOOK.getMaterial());
im = is.getItemMeta();
im.setDisplayName(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Rollback.Item.Save.Displayname")));
@ -156,12 +157,12 @@ public class Rollback implements Listener {
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Rollback.Item.Info.Displayname"))))) {
soundManager.playSound(player, Sounds.CHICKEN_EGG_POP.bukkitSound(), 1.0F, 1.0F);
} else if ((event.getCurrentItem().getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Rollback.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
} else if ((event.getCurrentItem().getType() == Materials.WRITABLE_BOOK.parseMaterial())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.WRITABLE_BOOK.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Rollback.Item.Save.Displayname"))))) {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -10,7 +11,7 @@ import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.Visit;
import org.bukkit.Bukkit;
@ -76,7 +77,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes(
'&',
configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))))) {
@ -163,7 +164,7 @@ public class Settings {
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Operator, null), 1L);
} else if ((is.getType() == Materials.OAK_SAPLING.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_SAPLING.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Menu.Settings.Categories.Item.Owner.Displayname"))))) {
@ -186,7 +187,7 @@ public class Settings {
}
});
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
configLoad.getString("Menu.Settings.Categories.Item.Visitor.Displayname"),
configLoad.getStringList("Menu.Settings.Categories.Item.Visitor.Lore"), null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
@ -198,20 +199,20 @@ public class Settings {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Coop.Enable")) {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"), null, null, null,
null), 0);
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
configLoad.getString("Menu.Settings.Categories.Item.Coop.Displayname"),
configLoad.getStringList("Menu.Settings.Categories.Item.Coop.Lore"), null, null, null), 6);
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
configLoad.getString("Menu.Settings.Categories.Item.Owner.Displayname"),
configLoad.getStringList("Menu.Settings.Categories.Item.Owner.Lore"), null, null, null), 7);
} else {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
configLoad.getString("Menu.Settings.Categories.Item.Owner.Displayname"),
configLoad.getStringList("Menu.Settings.Categories.Item.Owner.Lore"), null, null, null), 6);
}
@ -259,7 +260,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Settings." + role.name() + ".Item.Return.Displayname"))))) {
@ -391,7 +392,7 @@ public class Settings {
}
if (config.getFileConfiguration().getBoolean("Island.Visitor.Welcome.Enable")) {
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Settings.Visitor.Item.Welcome.Displayname"),
configLoad.getStringList("Menu.Settings.Visitor.Item.Welcome.Lore"), null, null,
null), 5);
@ -404,33 +405,33 @@ public class Settings {
nInv.addItemStack(createItem(island, role, "ArmorStandUse", new ItemStack(Material.ARMOR_STAND)),
12);
nInv.addItemStack(createItem(island, role, "Beacon", new ItemStack(Material.BEACON)), 13);
nInv.addItemStack(createItem(island, role, "Bed", Materials.WHITE_BED.parseItem()), 14);
nInv.addItemStack(createItem(island, role, "Bed", CompatibleMaterial.WHITE_BED.getItem()), 14);
nInv.addItemStack(createItem(island, role, "AnimalBreeding", new ItemStack(Material.WHEAT)), 15);
nInv.addItemStack(createItem(island, role, "Brewing",
new ItemStack(Materials.LEGACY_BREWING_STAND.getPostMaterial())), 16);
new ItemStack(CompatibleMaterial.BREWING_STAND.getMaterial())), 16);
nInv.addItemStack(createItem(island, role, "Bucket", new ItemStack(Material.BUCKET)), 17);
nInv.addItemStack(createItem(island, role, "WaterCollection", new ItemStack(Material.POTION)), 18);
nInv.addItemStack(createItem(island, role, "Storage", new ItemStack(Material.CHEST)), 19);
nInv.addItemStack(createItem(island, role, "Workbench", Materials.CRAFTING_TABLE.parseItem()), 20);
nInv.addItemStack(createItem(island, role, "Crop", Materials.WHEAT_SEEDS.parseItem()), 21);
nInv.addItemStack(createItem(island, role, "Door", Materials.OAK_DOOR.parseItem()), 22);
nInv.addItemStack(createItem(island, role, "Gate", Materials.OAK_FENCE_GATE.parseItem()), 23);
nInv.addItemStack(createItem(island, role, "Workbench", CompatibleMaterial.CRAFTING_TABLE.getItem()), 20);
nInv.addItemStack(createItem(island, role, "Crop", CompatibleMaterial.WHEAT_SEEDS.getItem()), 21);
nInv.addItemStack(createItem(island, role, "Door", CompatibleMaterial.OAK_DOOR.getItem()), 22);
nInv.addItemStack(createItem(island, role, "Gate", CompatibleMaterial.OAK_FENCE_GATE.getItem()), 23);
nInv.addItemStack(createItem(island, role, "Projectile", new ItemStack(Material.ARROW)), 24);
nInv.addItemStack(createItem(island, role, "Enchant", Materials.ENCHANTING_TABLE.parseItem()), 25);
nInv.addItemStack(createItem(island, role, "Enchant", CompatibleMaterial.ENCHANTING_TABLE.getItem()), 25);
nInv.addItemStack(createItem(island, role, "Fire", new ItemStack(Material.FLINT_AND_STEEL)), 26);
nInv.addItemStack(createItem(island, role, "Furnace", new ItemStack(Material.FURNACE)), 27);
nInv.addItemStack(createItem(island, role, "HorseInventory", Materials.CHEST_MINECART.parseItem()),
nInv.addItemStack(createItem(island, role, "HorseInventory", CompatibleMaterial.CHEST_MINECART.getItem()),
28);
nInv.addItemStack(createItem(island, role, "MobRiding", new ItemStack(Material.SADDLE)), 29);
nInv.addItemStack(createItem(island, role, "MonsterHurting", Materials.BONE.parseItem()), 30);
nInv.addItemStack(createItem(island, role, "MobHurting", Materials.WOODEN_SWORD.parseItem()), 31);
nInv.addItemStack(createItem(island, role, "MobTaming", Materials.POPPY.parseItem()), 32);
nInv.addItemStack(createItem(island, role, "Leash", Materials.LEAD.parseItem()), 33);
nInv.addItemStack(createItem(island, role, "MonsterHurting", CompatibleMaterial.BONE.getItem()), 30);
nInv.addItemStack(createItem(island, role, "MobHurting", CompatibleMaterial.WOODEN_SWORD.getItem()), 31);
nInv.addItemStack(createItem(island, role, "MobTaming", CompatibleMaterial.POPPY.getItem()), 32);
nInv.addItemStack(createItem(island, role, "Leash", CompatibleMaterial.LEAD.getItem()), 33);
nInv.addItemStack(createItem(island, role, "LeverButton", new ItemStack(Material.LEVER)), 34);
nInv.addItemStack(createItem(island, role, "Milking", new ItemStack(Material.MILK_BUCKET)), 35);
nInv.addItemStack(createItem(island, role, "Jukebox", new ItemStack(Material.JUKEBOX)), 36);
nInv.addItemStack(
createItem(island, role, "PressurePlate", Materials.OAK_PRESSURE_PLATE.parseItem()), 37);
createItem(island, role, "PressurePlate", CompatibleMaterial.OAK_PRESSURE_PLATE.getItem()), 37);
nInv.addItemStack(createItem(island, role, "Redstone", new ItemStack(Material.REDSTONE)), 38);
nInv.addItemStack(createItem(island, role, "Shearing", new ItemStack(Material.SHEARS)), 39);
nInv.addItemStack(createItem(island, role, "Trading", new ItemStack(Material.EMERALD)), 40);
@ -450,7 +451,7 @@ public class Settings {
nInv.addItemStack(createItem(island, role, "EntityPlacement", new ItemStack(Material.ARMOR_STAND)),
52);
nInv.addItemStack(
createItem(island, role, "ExperienceOrbPickup", Materials.EXPERIENCE_BOTTLE.parseItem()),
createItem(island, role, "ExperienceOrbPickup", CompatibleMaterial.EXPERIENCE_BOTTLE.getItem()),
53);
nInv.setTitle(ChatColor.translateAlternateColorCodes('&',
@ -461,18 +462,18 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Coop.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 9);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
10);
nInv.addItemStack(createItem(island, role, "Ban", new ItemStack(Material.IRON_AXE)),
11);
nInv.addItemStack(createItem(island, role, "Unban", Materials.RED_DYE.parseItem()),
nInv.addItemStack(createItem(island, role, "Unban", CompatibleMaterial.RED_DYE.getItem()),
12);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
13);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
14);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
15);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
16);
@ -486,21 +487,21 @@ public class Settings {
nInv.addItemStack(createItem(island, role, "Border", new ItemStack(Material.BEACON)),
22);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 9);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
10);
nInv.addItemStack(createItem(island, role, "Ban", new ItemStack(Material.IRON_AXE)),
11);
nInv.addItemStack(createItem(island, role, "Unban", Materials.RED_DYE.parseItem()),
nInv.addItemStack(createItem(island, role, "Unban", CompatibleMaterial.RED_DYE.getItem()),
12);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
13);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
14);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
15);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
16);
@ -512,23 +513,23 @@ public class Settings {
createItem(island, role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Ban", new ItemStack(Material.IRON_AXE)),
12);
nInv.addItemStack(createItem(island, role, "Unban", Materials.RED_DYE.parseItem()),
nInv.addItemStack(createItem(island, role, "Unban", CompatibleMaterial.RED_DYE.getItem()),
13);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
14);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
15);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
16);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
@ -538,21 +539,21 @@ public class Settings {
nInv.addItemStack(createItem(island, role, "Border", new ItemStack(Material.BEACON)),
22);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Ban", new ItemStack(Material.IRON_AXE)),
12);
nInv.addItemStack(createItem(island, role, "Unban", Materials.RED_DYE.parseItem()),
nInv.addItemStack(createItem(island, role, "Unban", CompatibleMaterial.RED_DYE.getItem()),
13);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
14);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
15);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
16);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
@ -560,7 +561,7 @@ public class Settings {
createItem(island, role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
}
}
@ -569,14 +570,14 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Coop.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
12);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
13);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
14);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
15);
@ -590,17 +591,17 @@ public class Settings {
nInv.addItemStack(createItem(island, role, "Border", new ItemStack(Material.BEACON)),
22);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
12);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
13);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
14);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
15);
@ -612,21 +613,21 @@ public class Settings {
createItem(island, role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
}
nInv.setRows(3);
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
12);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
13);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
14);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 15);
@ -636,19 +637,19 @@ public class Settings {
nInv.addItemStack(createItem(island, role, "Border", new ItemStack(Material.BEACON)),
21);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 22);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 23);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 23);
nInv.setRows(3);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 9);
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
10);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
11);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
12);
nInv.addItemStack(createItem(island, role, "Island", Materials.OAK_SAPLING.parseItem()),
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
13);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 14);
@ -656,7 +657,7 @@ public class Settings {
createItem(island, role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
15);
nInv.addItemStack(createItem(island, role, "Biome", new ItemStack(Material.MAP)), 16);
nInv.addItemStack(createItem(island, role, "Weather", Materials.CLOCK.parseItem()), 17);
nInv.addItemStack(createItem(island, role, "Weather", CompatibleMaterial.CLOCK.getItem()), 17);
nInv.setRows(2);
}
@ -671,64 +672,64 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 9);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 16);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 9);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 17);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 17);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 9);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
@ -737,19 +738,19 @@ public class Settings {
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
@ -759,79 +760,79 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 9);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 16);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 16);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
14);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 15);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
16);
}
}
@ -841,58 +842,58 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 9);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
11);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 12);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 16);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 16);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
@ -901,17 +902,17 @@ public class Settings {
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
@ -921,71 +922,71 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
14);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 15);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 15);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(
createItem(island, role, "Damage", Materials.RED_DYE.parseItem()), 16);
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 10);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
Materials.PIG_SPAWN_EGG.parseItem()), 11);
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 11);
nInv.addItemStack(
createItem(island, role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
12);
nInv.addItemStack(
createItem(island, role, "Explosions", Materials.GUNPOWDER.parseItem()),
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", Materials.OAK_LEAVES.parseItem()),
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
15);
}
}
@ -997,7 +998,7 @@ public class Settings {
nInv.setRows(2);
}
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Settings." + role.name() + ".Item.Return.Displayname"), null, null,
null, null), 0, 8);
@ -1035,7 +1036,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Settings.Visitor.Panel.Welcome.Item.Return.Displayname"))))) {
@ -1224,7 +1225,7 @@ public class Settings {
List<String> itemLore = new ArrayList<>();
itemLore.add(
configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Message.Word.Empty"));
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Message.Displayname"),
itemLore, null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.ARROW),
@ -1234,7 +1235,7 @@ public class Settings {
"Menu.Settings.Visitor.Panel.Welcome.Item.Line.Remove.None.Lore"),
null, null, null), 3);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial(), welcomeMessage.size()),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial(), welcomeMessage.size()),
configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Message.Displayname"),
welcomeMessage, null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.ARROW),
@ -1245,7 +1246,7 @@ public class Settings {
null, null, null), 3);
}
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Return.Displayname"), null,
null, null, null), 0, 4);
@ -1286,7 +1287,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Settings.Visitor.Panel.Signature.Item.Return.Displayname"))))) {
@ -1477,7 +1478,7 @@ public class Settings {
List<String> itemLore = new ArrayList<>();
itemLore.add(
configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Message.Word.Empty"));
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Message.Displayname"),
itemLore, null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.ARROW),
@ -1487,7 +1488,7 @@ public class Settings {
"Menu.Settings.Visitor.Panel.Signature.Item.Line.Remove.None.Lore"),
null, null, null), 3);
} else {
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial(), signatureMessage.size()),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial(), signatureMessage.size()),
configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Message.Displayname"),
signatureMessage, null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.ARROW),
@ -1498,7 +1499,7 @@ public class Settings {
null, null, null), 3);
}
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Return.Displayname"), null,
null, null, null), 0, 4);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.IslandUpgradeEvent;
@ -16,7 +17,7 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
@ -203,7 +204,7 @@ public class Upgrade {
}
}
}
} else if ((is.getType() == Materials.WHEAT_SEEDS.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.WHEAT_SEEDS.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname"))))) {
if (island.hasUpgrade(com.songoda.skyblock.upgrade.Upgrade.Type.Crop)) {
@ -409,7 +410,7 @@ public class Upgrade {
event.setWillClose(false);
event.setWillDestroy(false);
}
} else if ((is.getType() == Materials.SPAWNER.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.SPAWNER.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname"))))) {
if (island.hasUpgrade(com.songoda.skyblock.upgrade.Upgrade.Type.Spawner)) {
@ -576,7 +577,7 @@ public class Upgrade {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (island.hasUpgrade(com.songoda.skyblock.upgrade.Upgrade.Type.Crop)) {
nInv.addItem(nInv.createItem(Materials.WHEAT_SEEDS.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimed.Lore"),
@ -587,7 +588,7 @@ public class Upgrade {
null, null), 3);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(Materials.WHEAT_SEEDS.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimable.Lore"),
@ -595,7 +596,7 @@ public class Upgrade {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
null, null), 3);
} else {
nInv.addItem(nInv.createItem(Materials.WHEAT_SEEDS.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Unclaimable.Lore"),
@ -744,7 +745,7 @@ public class Upgrade {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (island.hasUpgrade(com.songoda.skyblock.upgrade.Upgrade.Type.Spawner)) {
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimed.Lore"),
@ -755,7 +756,7 @@ public class Upgrade {
null, null), 8);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimable.Lore"),
@ -763,7 +764,7 @@ public class Upgrade {
new Placeholder("%cost", NumberUtil.formatNumberByDecimal(upgrade.getCost()))},
null, null), 8);
} else {
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Unclaimable.Lore"),

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -16,7 +17,7 @@ import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.player.OfflinePlayer;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import com.songoda.skyblock.visit.VisitManager;
import org.bukkit.Bukkit;
@ -66,14 +67,14 @@ public class Visit {
ItemStack is = event.getItem();
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visit.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visit.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -327,7 +328,7 @@ public class Visit {
nextEndIndex = visitIslands.size() - playerMenuPage * 36,
totalIslands = visitManager.getIslands().size();
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Visit.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.HOPPER),
configLoad.getString("Menu.Visit.Item.Type.Displayname"),
@ -349,7 +350,7 @@ public class Visit {
new Placeholder[]{new Placeholder("%sort", StringUtil.capatilizeUppercaseLetters(sort.name()))},
null, null), 5);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Visit.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
@ -12,7 +13,7 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -64,14 +65,14 @@ public class Visitors {
ItemStack is = event.getItem();
if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -156,7 +157,7 @@ public class Visitors {
Set<UUID> islandVisitors = islandManager.getVisitorsAtIsland(island);
Map<Integer, UUID> sortedIslandVisitors = new TreeMap<>();
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
@ -165,7 +166,7 @@ public class Visitors {
new Placeholder[]{new Placeholder("%visitors", "" + islandVisitors.size())}, null, null),
4);
nInv.addItem(
nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island;
@ -11,7 +12,7 @@ import com.songoda.skyblock.placeholder.Placeholder;
import com.songoda.skyblock.playerdata.PlayerDataManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -80,7 +81,7 @@ public class Weather {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Weather.Item.Barrier.Displayname"))))) {
@ -88,11 +89,11 @@ public class Weather {
event.setWillClose(false);
event.setWillDestroy(false);
} else if (is.getType() == Materials.BARRIER.parseMaterial()) {
} else if (is.getType() == CompatibleMaterial.BARRIER.getMaterial()) {
event.setWillClose(false);
event.setWillDestroy(false);
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
} else if ((is.getType() == Materials.SUNFLOWER.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.SUNFLOWER.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Weather.Item.Time.Displayname"))))) {
int islandTime = island.getTime();
@ -229,11 +230,11 @@ public class Weather {
new Placeholder("%time_name", timeName), new Placeholder("%time", "" + island.getTime()),
new Placeholder("%weather", island.getWeatherName())},
null, null), 0);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Weather.Item.Barrier.Displayname"), null, null, null, null), 1);
if (!island.isWeatherSynchronized()) {
nInv.addItem(nInv.createItem(Materials.SUNFLOWER.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.SUNFLOWER.getItem(),
configLoad.getString("Menu.Weather.Item.Time.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Time.Lore"),
new Placeholder[]{new Placeholder("%choice", timeChoice)}, null, null), 2);
@ -242,7 +243,7 @@ public class Weather {
configLoad.getStringList("Menu.Weather.Item.Weather.Lore"),
new Placeholder[]{new Placeholder("%choice", weatherChoice)}, null, null), 3);
} else {
nInv.addItem(nInv.createItem(Materials.BARRIER.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BARRIER.getItem(),
configLoad.getString("Menu.Weather.Item.Disabled.Time.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Disabled.Time.Lore"),
new Placeholder[]{new Placeholder("%choice", timeChoice)}, null, null), 2);

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus.admin;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -13,12 +14,10 @@ import com.songoda.skyblock.structure.StructureManager;
import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -63,16 +62,16 @@ public class Creator implements Listener {
if (playerData.getViewer() == null) {
List<Structure> structures = structureManager.getStructures();
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Exit.Displayname"), null, null, null, null), 0,
8);
nInv.addItem(
nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getItem()),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Browse.Item.Information.Lore"),
new Placeholder[]{new Placeholder("%structures", "" + structures.size())}, null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -95,7 +94,7 @@ public class Creator implements Listener {
}
if (structures.size() == 0) {
nInv.addItem(nInv.createItem(new ItemStack(Material.BARRIER),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.BARRIER.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Nothing.Displayname"), null, null, null,
null), 31);
} else {
@ -107,7 +106,7 @@ public class Creator implements Listener {
inventorySlot++;
Structure structure = structures.get(index);
nInv.addItem(nInv.createItem(structure.getMaterials().parseItem(),
nInv.addItem(nInv.createItem(structure.getMaterials().getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Structure.Displayname")
.replace("%structure", structure.getName())),
@ -121,7 +120,7 @@ public class Creator implements Listener {
} else {
Structure structure = structureManager.getStructure(((Creator.Viewer) playerData.getViewer()).getName());
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Creator.Options.Item.Return.Displayname"), null, null, null, null),
0, 8);
@ -132,7 +131,7 @@ public class Creator implements Listener {
displayName = ChatColor.translateAlternateColorCodes('&', structure.getDisplayname());
}
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.Displayname.Lore"),
new Placeholder[]{new Placeholder("%displayname", displayName)}, null, null), 1);
@ -161,7 +160,7 @@ public class Creator implements Listener {
}
}
nInv.addItem(nInv.createItem(new ItemStack(Material.ENCHANTED_BOOK),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.ENCHANTED_BOOK.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Description.Displayname"), descriptionLore,
null, null, null), 2);
@ -188,7 +187,7 @@ public class Creator implements Listener {
}
}
nInv.addItem(nInv.createItem(new ItemStack(Material.BOOK),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.BOOK.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Commands.Displayname"), commandsLore, null,
null, null), 3);
@ -200,7 +199,7 @@ public class Creator implements Listener {
permissionLore = configLoad.getStringList("Menu.Admin.Creator.Options.Item.Permission.Enable.Lore");
}
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Admin.Creator.Options.Item.Permission.Displayname"), permissionLore,
new Placeholder[]{new Placeholder("%permission", structure.getPermission())}, null, null), 4);
@ -226,19 +225,19 @@ public class Creator implements Listener {
endFileName = fileName;
}
nInv.addItem(nInv.createItem(new ItemStack(Material.PAPER),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.PAPER.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.File.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.File.Lore"),
new Placeholder[]{new Placeholder("%overworld_file", overworldFileName),
new Placeholder("%nether_file", netherFileName),
new Placeholder("%end_file", endFileName)},
null, null), 5);
nInv.addItem(nInv.createItem(new ItemStack(Material.DIAMOND),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.DIAMOND.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Item.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.Item.Lore"),
new Placeholder[]{new Placeholder("%material", structure.getMaterials().name())}, null, null),
6);
nInv.addItem(nInv.createItem(new ItemStack(Material.GOLD_NUGGET),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.GOLD_NUGGET.getMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.DeletionCost.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.DeletionCost.Lore"),
new Placeholder[]{new Placeholder("%cost", "" + structure.getDeletionCost())}, null, null), 7);
@ -257,7 +256,7 @@ public class Creator implements Listener {
Player player = (Player) event.getWhoClicked();
ItemStack is = event.getCurrentItem();
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR) {
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != CompatibleMaterial.AIR.getMaterial()) {
SkyBlock skyblock = SkyBlock.getInstance();
StructureManager structureManager = skyblock.getStructureManager();
@ -292,14 +291,14 @@ public class Creator implements Listener {
return;
}
if ((event.getCurrentItem().getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
if ((event.getCurrentItem().getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, Sounds.GLASS.bukkitSound(), 1.0F, 1.0F);
return;
} else if ((event.getCurrentItem().getType() == Materials.OAK_FENCE_GATE.parseMaterial())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Exit.Displayname")))) {
@ -318,7 +317,7 @@ public class Creator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == Materials.OAK_SIGN.parseMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Displayname"))))) {
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
@ -340,7 +339,7 @@ public class Creator implements Listener {
configLoad.getString("Island.Admin.Creator.Characters.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
structureManager.addStructure(event1.getName(), Materials.GRASS_BLOCK, null, null, null,
structureManager.addStructure(event1.getName(), CompatibleMaterial.GRASS_BLOCK, null, null, null,
null, false, new ArrayList<>(), new ArrayList<>(), 0.0D);
messageManager.sendMessage(player,
@ -375,7 +374,7 @@ public class Creator implements Listener {
}
});
is = new ItemStack(Material.NAME_TAG);
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Word.Enter"));
is.setItemMeta(im);
@ -384,13 +383,13 @@ public class Creator implements Listener {
gui.open();
return;
} else if ((event.getCurrentItem().getType() == Material.BARRIER) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.BARRIER.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Nothing.Displayname"))))) {
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
} else if ((event.getCurrentItem().getType() == Material.NAME_TAG) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.NAME_TAG.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -470,7 +469,7 @@ public class Creator implements Listener {
}
});
is = new ItemStack(Material.NAME_TAG);
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Word.Enter"));
@ -492,7 +491,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == Material.ENCHANTED_BOOK) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.ENCHANTED_BOOK.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Description.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -604,7 +603,7 @@ public class Creator implements Listener {
}
});
is = new ItemStack(Material.NAME_TAG);
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.Description.Word.Enter"));
@ -626,7 +625,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == Material.BOOK) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.BOOK.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Commands.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -738,7 +737,7 @@ public class Creator implements Listener {
}
});
is = new ItemStack(Material.NAME_TAG);
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.Commands.Word.Enter"));
@ -760,7 +759,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == Materials.LEGACY_EMPTY_MAP.getPostMaterial())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.MAP.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Permission.Displayname"))))) {
@ -818,7 +817,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == Material.PAPER) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.PAPER.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.File.Displayname"))))) {
if (event.getClick() == ClickType.LEFT || event.getClick() == ClickType.MIDDLE
@ -960,7 +959,7 @@ public class Creator implements Listener {
}
});
is = new ItemStack(Material.NAME_TAG);
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.File.Word.Enter"));
@ -983,7 +982,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == Material.DIAMOND) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.DIAMOND.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Item.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -1024,7 +1023,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == Material.GOLD_NUGGET) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.GOLD_NUGGET.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.DeletionCost.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -1115,7 +1114,7 @@ public class Creator implements Listener {
}
});
is = new ItemStack(Material.NAME_TAG);
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.DeletionCost.Word.Enter"));
@ -1145,14 +1144,8 @@ public class Creator implements Listener {
if (viewer.isItem()) {
if (structureManager.containsStructure(viewer.getName())) {
Structure structure = structureManager.getStructure(viewer.getName());
Materials materials = null;
if (NMSUtil.getVersionNumber() < 13) {
materials = Materials.requestMaterials(event.getCurrentItem().getType().name(),
(byte) event.getCurrentItem().getDurability());
} else {
materials = Materials.fromString(event.getCurrentItem().getType().name());
}
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
materials.getItem().setData(event.getCurrentItem().getData());
if (materials != null) {
structure.setMaterials(materials);
@ -1200,7 +1193,7 @@ public class Creator implements Listener {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
for (Structure structureList : structureManager.getStructures()) {
if (event.getCurrentItem().getType() == structureList.getMaterials().parseMaterial()
if (event.getCurrentItem().getType() == structureList.getMaterials().getMaterial()
&& ChatColor.stripColor(is.getItemMeta().getDisplayName())
.equals(structureList.getName())) {
if (event.getClick() == ClickType.LEFT) {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus.admin;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -12,7 +13,6 @@ import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.item.SkullUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
@ -61,16 +61,16 @@ public class Generator implements Listener {
if (playerData.getViewer() == null) {
List<com.songoda.skyblock.generator.Generator> generators = generatorManager.getGenerators();
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Generator.Browse.Item.Information.Lore"),
new Placeholder[]{new Placeholder("%generators", "" + generators.size())}, null, null),
4);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -105,7 +105,7 @@ public class Generator implements Listener {
inventorySlot++;
com.songoda.skyblock.generator.Generator generator = generators.get(index);
nInv.addItem(nInv.createItem(generator.getMaterials().parseItem(),
nInv.addItem(nInv.createItem(generator.getMaterials().getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Generator.Displayname")
.replace("%generator", generator.getName())),
@ -128,16 +128,16 @@ public class Generator implements Listener {
.getStringList("Menu.Admin.Generator.Generator.Item.Information.Permission.Enable.Lore");
}
nInv.addItem(nInv.createItem(Materials.LEGACY_EMPTY_MAP.getPostItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Information.Displayname"), permissionLore,
new Placeholder[]{new Placeholder("%name", generator.getName()),
new Placeholder("%materials", "" + generator.getGeneratorMaterials().size()),
new Placeholder("%permission", generator.getPermission())},
null, null), 4);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -157,7 +157,7 @@ public class Generator implements Listener {
inventorySlot++;
GeneratorMaterial generatorMaterial = generatorMaterials.get(index);
nInv.addItem(nInv.createItem(generatorMaterial.getMaterials().parseItem(),
nInv.addItem(nInv.createItem(generatorMaterial.getMaterials().getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Generator.Item.Material.Displayname")
.replace("%material", generatorMaterial.getMaterials().name())),
@ -225,7 +225,7 @@ public class Generator implements Listener {
return;
}
if ((event.getCurrentItem().getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
if ((event.getCurrentItem().getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
@ -236,7 +236,7 @@ public class Generator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == Materials.OAK_FENCE_GATE.parseMaterial())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Exit.Displayname")))) {
@ -255,7 +255,7 @@ public class Generator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == Materials.OAK_SIGN.parseMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Information.Displayname"))))) {
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
@ -320,7 +320,7 @@ public class Generator implements Listener {
gui.open();
return;
} else if ((event.getCurrentItem().getType() == Materials.LEGACY_EMPTY_MAP.getPostMaterial())
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.MAP.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
@ -423,8 +423,7 @@ public class Generator implements Listener {
if (generator.getGeneratorMaterials() != null) {
for (GeneratorMaterial generatorMaterialList : generator.getGeneratorMaterials()) {
if ((event.getCurrentItem().getType() == generatorMaterialList.getMaterials()
.parseMaterial())
if ((event.getCurrentItem().getType() == generatorMaterialList.getMaterials().getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -571,14 +570,8 @@ public class Generator implements Listener {
configLoad.getString("Island.Admin.Generator.Material.Limit.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
} else {
Materials materials;
if (NMSUtil.getVersionNumber() < 13) {
materials = Materials.requestMaterials(event.getCurrentItem().getType().name(),
(byte) event.getCurrentItem().getDurability());
} else {
materials = Materials.fromString(event.getCurrentItem().getType().name());
}
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
materials.getItem().setData(event.getCurrentItem().getData());
for (GeneratorMaterial generatorMaterialList : generator.getGeneratorMaterials()) {
if (generatorMaterialList.getMaterials() == materials) {
@ -636,7 +629,7 @@ public class Generator implements Listener {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
for (com.songoda.skyblock.generator.Generator generatorList : generatorManager.getGenerators()) {
if (event.getCurrentItem().getType() == generatorList.getMaterials().parseMaterial()
if (event.getCurrentItem().getType() == generatorList.getMaterials().getMaterial()
&& ChatColor.stripColor(is.getItemMeta().getDisplayName())
.equals(generatorList.getName())) {
if (event.getClick() == ClickType.LEFT) {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus.admin;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -7,7 +8,7 @@ import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -59,7 +60,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Settings.Categories.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -88,7 +89,7 @@ public class Settings {
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player, Type.Role, IslandRole.Coop), 1L);
} else if ((is.getType() == Materials.OAK_SAPLING.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.OAK_SAPLING.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Settings.Categories.Item.Owner.Displayname"))))) {
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
@ -97,7 +98,7 @@ public class Settings {
}
});
nInv.addItem(nInv.createItem(new ItemStack(Materials.OAK_SIGN.parseMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
configLoad.getString("Menu.Admin.Settings.Categories.Item.Visitor.Displayname"),
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Visitor.Lore"), null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
@ -110,22 +111,22 @@ public class Settings {
if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Coop.Enable")) {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Settings.Categories.Item.Exit.Displayname"), null, null, null,
null), 0);
nInv.addItem(nInv.createItem(new ItemStack(Material.NAME_TAG),
configLoad.getString("Menu.Admin.Settings.Categories.Item.Coop.Displayname"),
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Coop.Lore"), null, null, null),
6);
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
configLoad.getString("Menu.Admin.Settings.Categories.Item.Owner.Displayname"),
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Owner.Lore"), null, null, null),
7);
} else {
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Settings.Categories.Item.Exit.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(Materials.OAK_SAPLING.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
configLoad.getString("Menu.Admin.Settings.Categories.Item.Owner.Displayname"),
configLoad.getStringList("Menu.Admin.Settings.Categories.Item.Owner.Lore"), null, null, null),
6);
@ -149,7 +150,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta()) && (is
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta()) && (is
.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Settings.Visitor.Item.Return.Displayname")))
@ -211,32 +212,32 @@ public class Settings {
nInv.addItemStack(createItem(role, "Anvil", new ItemStack(Material.ANVIL)), 11);
nInv.addItemStack(createItem(role, "ArmorStandUse", new ItemStack(Material.ARMOR_STAND)), 12);
nInv.addItemStack(createItem(role, "Beacon", new ItemStack(Material.BEACON)), 13);
nInv.addItemStack(createItem(role, "Bed", Materials.WHITE_BED.parseItem()), 14);
nInv.addItemStack(createItem(role, "Bed", CompatibleMaterial.WHITE_BED.getItem()), 14);
nInv.addItemStack(createItem(role, "AnimalBreeding", new ItemStack(Material.WHEAT)), 15);
nInv.addItemStack(
createItem(role, "Brewing", new ItemStack(Materials.LEGACY_BREWING_STAND.getPostMaterial())),
createItem(role, "Brewing", new ItemStack(CompatibleMaterial.BREWING_STAND.getMaterial())),
16);
nInv.addItemStack(createItem(role, "Bucket", new ItemStack(Material.BUCKET)), 17);
nInv.addItemStack(createItem(role, "WaterCollection", new ItemStack(Material.POTION)), 18);
nInv.addItemStack(createItem(role, "Storage", new ItemStack(Material.CHEST)), 19);
nInv.addItemStack(createItem(role, "Workbench", Materials.CRAFTING_TABLE.parseItem()), 20);
nInv.addItemStack(createItem(role, "Crop", Materials.WHEAT_SEEDS.parseItem()), 21);
nInv.addItemStack(createItem(role, "Door", Materials.OAK_DOOR.parseItem()), 22);
nInv.addItemStack(createItem(role, "Gate", Materials.OAK_FENCE_GATE.parseItem()), 23);
nInv.addItemStack(createItem(role, "Workbench", CompatibleMaterial.CRAFTING_TABLE.getItem()), 20);
nInv.addItemStack(createItem(role, "Crop", CompatibleMaterial.WHEAT_SEEDS.getItem()), 21);
nInv.addItemStack(createItem(role, "Door", CompatibleMaterial.OAK_DOOR.getItem()), 22);
nInv.addItemStack(createItem(role, "Gate", CompatibleMaterial.OAK_FENCE_GATE.getItem()), 23);
nInv.addItemStack(createItem(role, "Projectile", new ItemStack(Material.ARROW)), 24);
nInv.addItemStack(createItem(role, "Enchant", Materials.ENCHANTING_TABLE.parseItem()), 25);
nInv.addItemStack(createItem(role, "Enchant", CompatibleMaterial.ENCHANTING_TABLE.getItem()), 25);
nInv.addItemStack(createItem(role, "Fire", new ItemStack(Material.FLINT_AND_STEEL)), 26);
nInv.addItemStack(createItem(role, "Furnace", new ItemStack(Material.FURNACE)), 27);
nInv.addItemStack(createItem(role, "HorseInventory", Materials.CHEST_MINECART.parseItem()), 28);
nInv.addItemStack(createItem(role, "HorseInventory", CompatibleMaterial.CHEST_MINECART.getItem()), 28);
nInv.addItemStack(createItem(role, "MobRiding", new ItemStack(Material.SADDLE)), 29);
nInv.addItemStack(createItem(role, "MonsterHurting", Materials.BONE.parseItem()), 30);
nInv.addItemStack(createItem(role, "MobHurting", Materials.WOODEN_SWORD.parseItem()), 31);
nInv.addItemStack(createItem(role, "MobTaming", Materials.POPPY.parseItem()), 32);
nInv.addItemStack(createItem(role, "Leash", Materials.LEAD.parseItem()), 33);
nInv.addItemStack(createItem(role, "MonsterHurting", CompatibleMaterial.BONE.getItem()), 30);
nInv.addItemStack(createItem(role, "MobHurting", CompatibleMaterial.WOODEN_SWORD.getItem()), 31);
nInv.addItemStack(createItem(role, "MobTaming", CompatibleMaterial.POPPY.getItem()), 32);
nInv.addItemStack(createItem(role, "Leash", CompatibleMaterial.LEAD.getItem()), 33);
nInv.addItemStack(createItem(role, "LeverButton", new ItemStack(Material.LEVER)), 34);
nInv.addItemStack(createItem(role, "Milking", new ItemStack(Material.MILK_BUCKET)), 35);
nInv.addItemStack(createItem(role, "Jukebox", new ItemStack(Material.JUKEBOX)), 36);
nInv.addItemStack(createItem(role, "PressurePlate", Materials.OAK_PRESSURE_PLATE.parseItem()), 37);
nInv.addItemStack(createItem(role, "PressurePlate", CompatibleMaterial.OAK_PRESSURE_PLATE.getItem()), 37);
nInv.addItemStack(createItem(role, "Redstone", new ItemStack(Material.REDSTONE)), 38);
nInv.addItemStack(createItem(role, "Shearing", new ItemStack(Material.SHEARS)), 39);
nInv.addItemStack(createItem(role, "Trading", new ItemStack(Material.EMERALD)), 40);
@ -252,20 +253,20 @@ public class Settings {
nInv.addItemStack(createItem(role, "Portal", new ItemStack(Material.ENDER_PEARL)), 50);
nInv.addItemStack(createItem(role, "Hopper", new ItemStack(Material.HOPPER)), 51);
nInv.addItemStack(createItem(role, "EntityPlacement", new ItemStack(Material.ARMOR_STAND)), 52);
nInv.addItemStack(createItem(role, "ExperienceOrbPickup", Materials.EXPERIENCE_BOTTLE.parseItem()), 53);
nInv.addItemStack(createItem(role, "ExperienceOrbPickup", CompatibleMaterial.EXPERIENCE_BOTTLE.getItem()), 53);
nInv.setRows(6);
} else if (role == IslandRole.Operator) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Visitor.Banning")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Coop.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 9);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 10);
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 11);
nInv.addItemStack(createItem(role, "Unban", Materials.RED_DYE.parseItem()), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 13);
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 13);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 14);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 15);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 15);
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 16);
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 17);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
@ -273,51 +274,51 @@ public class Settings {
21);
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 22);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
} else {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 9);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 10);
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 11);
nInv.addItemStack(createItem(role, "Unban", Materials.RED_DYE.parseItem()), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 13);
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 13);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 14);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 15);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 15);
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 16);
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 17);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 12);
nInv.addItemStack(createItem(role, "Unban", Materials.RED_DYE.parseItem()), 13);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 14);
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 13);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 14);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 15);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 16);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 16);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 22);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
} else {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
nInv.addItemStack(createItem(role, "Ban", new ItemStack(Material.IRON_AXE)), 12);
nInv.addItemStack(createItem(role, "Unban", Materials.RED_DYE.parseItem()), 13);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 14);
nInv.addItemStack(createItem(role, "Unban", CompatibleMaterial.RED_DYE.getItem()), 13);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 14);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 15);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 16);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 16);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
}
}
@ -325,11 +326,11 @@ public class Settings {
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Coop.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 12);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 13);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 14);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 14);
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 15);
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 16);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
@ -337,49 +338,49 @@ public class Settings {
21);
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 22);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
} else {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 12);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 13);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 14);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 14);
nInv.addItemStack(createItem(role, "Coop", new ItemStack(Material.NAME_TAG)), 15);
nInv.addItemStack(createItem(role, "CoopPlayers", new ItemStack(Material.BOOK)), 16);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
21);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 23);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 24);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 24);
}
nInv.setRows(3);
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 11);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 12);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 12);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 13);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 14);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 14);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 15);
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
16);
nInv.addItemStack(createItem(role, "Border", new ItemStack(Material.BEACON)), 21);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 22);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 23);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 23);
nInv.setRows(3);
} else {
nInv.addItemStack(createItem(role, "Invite", Materials.WRITABLE_BOOK.parseItem()), 9);
nInv.addItemStack(createItem(role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
nInv.addItemStack(createItem(role, "Kick", new ItemStack(Material.IRON_DOOR)), 10);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(Materials.OAK_SIGN.parseMaterial())), 11);
nInv.addItemStack(createItem(role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())), 11);
nInv.addItemStack(createItem(role, "Member", new ItemStack(Material.PAINTING)), 12);
nInv.addItemStack(createItem(role, "Island", Materials.OAK_SAPLING.parseItem()), 13);
nInv.addItemStack(createItem(role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()), 13);
nInv.addItemStack(createItem(role, "MainSpawn", new ItemStack(Material.EMERALD)), 14);
nInv.addItemStack(createItem(role, "VisitorSpawn", new ItemStack(Material.NETHER_STAR)),
15);
nInv.addItemStack(createItem(role, "Biome", new ItemStack(Material.MAP)), 16);
nInv.addItemStack(createItem(role, "Weather", Materials.CLOCK.parseItem()), 17);
nInv.addItemStack(createItem(role, "Weather", CompatibleMaterial.CLOCK.getItem()), 17);
nInv.setRows(2);
}
@ -391,57 +392,57 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 14);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 16);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 17);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 17);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 13);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
}
@ -450,53 +451,53 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 16);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 13);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 16);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 13);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 14);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 14);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 15);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 16);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 16);
}
}
}
@ -505,55 +506,55 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
10);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 11);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 11);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 12);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 14);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 16);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 17);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 14);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 16);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 14);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(
createItem(role, "KeepItemsOnDeath", new ItemStack(Material.ITEM_FRAME)), 16);
}
@ -562,50 +563,50 @@ public class Settings {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 14);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 14);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 15);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "Damage", Materials.RED_DYE.parseItem()), 16);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(createItem(role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
}
} else {
if (mainConfig.getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
10);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
11);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 12);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 12);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
nInv.addItemStack(createItem(role, "Hunger", new ItemStack(Material.COOKED_BEEF)), 16);
} else {
nInv.addItemStack(
createItem(role, "NaturalMobSpawning", Materials.PIG_SPAWN_EGG.parseItem()),
createItem(role, "NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG.getItem()),
11);
nInv.addItemStack(createItem(role, "MobGriefing", Materials.IRON_SHOVEL.parseItem()),
nInv.addItemStack(createItem(role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
12);
nInv.addItemStack(createItem(role, "Explosions", Materials.GUNPOWDER.parseItem()), 13);
nInv.addItemStack(createItem(role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()), 13);
nInv.addItemStack(
createItem(role, "FireSpread", new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(createItem(role, "LeafDecay", Materials.OAK_LEAVES.parseItem()), 15);
nInv.addItemStack(createItem(role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()), 15);
}
}
}
@ -614,7 +615,7 @@ public class Settings {
nInv.setRows(2);
}
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
configLoad.getString("Menu.Admin.Settings." + role.name() + ".Item.Return.Displayname"), null, null,
null, null), 0, 8);
nInv.setTitle(ChatColor.translateAlternateColorCodes('&',

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.menus.admin;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -12,7 +13,7 @@ import com.songoda.skyblock.upgrade.UpgradeManager;
import com.songoda.skyblock.utils.AbstractAnvilGUI;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
import org.bukkit.Bukkit;
@ -73,7 +74,7 @@ public class Upgrade {
ItemStack is = event.getItem();
com.songoda.skyblock.upgrade.Upgrade upgrade = null;
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Exit.Displayname"))))) {
soundManager.playSound(player, Sounds.CHEST_CLOSE.bukkitSound(), 1.0F, 1.0F);
@ -91,7 +92,7 @@ public class Upgrade {
.get(0);
viewer.setUpgrade(com.songoda.skyblock.upgrade.Upgrade.Type.Jump);
}
} else if ((is.getType() == Materials.WHEAT_SEEDS.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.WHEAT_SEEDS.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Crop.Displayname"))))) {
upgrade = upgradeManager.getUpgrades(com.songoda.skyblock.upgrade.Upgrade.Type.Crop)
@ -118,7 +119,7 @@ public class Upgrade {
soundManager.playSound(player, Sounds.WOOD_CLICK.bukkitSound(), 1.0F, 1.0F);
Bukkit.getServer().getScheduler().runTaskLater(skyblock, () -> open(player), 1L);
} else if ((is.getType() == Materials.SPAWNER.parseMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == CompatibleMaterial.SPAWNER.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Displayname"))))) {
@ -290,7 +291,7 @@ public class Upgrade {
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 2);
upgrade = upgradeManager.getUpgrades(com.songoda.skyblock.upgrade.Upgrade.Type.Crop).get(0);
nInv.addItem(nInv.createItem(Materials.WHEAT_SEEDS.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Crop.Lore"),
@ -334,7 +335,7 @@ public class Upgrade {
new Placeholder[]{new Placeholder("%tiers", "" + upgradeTiers)}, null, null), 6);
upgrade = upgradeManager.getUpgrades(com.songoda.skyblock.upgrade.Upgrade.Type.Spawner).get(0);
nInv.addItem(nInv.createItem(Materials.SPAWNER.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Lore"),
@ -343,7 +344,7 @@ public class Upgrade {
new Placeholder("%status", getStatus(upgrade))},
null, null), 7);
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Exit.Displayname")),
null, null, null, null), 0, 8);
@ -368,7 +369,7 @@ public class Upgrade {
PlayerData playerData = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == Materials.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Menu.Admin.Upgrade.Size.Item.Return.Displayname"))))) {
@ -491,7 +492,7 @@ public class Upgrade {
gui.open();
}, 1L);
}
} else if ((is.getType() == Materials.BLACK_STAINED_GLASS_PANE.parseMaterial())
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
@ -737,7 +738,7 @@ public class Upgrade {
}
});
nInv.addItem(nInv.createItem(Materials.OAK_FENCE_GATE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Size.Item.Return.Displayname")),
null, null, null, null), 0);
@ -746,7 +747,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Size.Item.Information.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Size.Item.Information.Lore"), null, null, null),
1);
nInv.addItem(nInv.createItem(Materials.BLACK_STAINED_GLASS_PANE.parseItem(),
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Upgrade.Size.Item.Barrier.Displayname")),
null, null, null, null), 2);

View File

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
@ -24,7 +25,7 @@ import com.songoda.skyblock.levelling.rework.IslandLevelManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.upgrade.Upgrade.Type;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.visit.VisitManager;
public class PlaceholderManager {
@ -343,7 +344,7 @@ public class PlaceholderManager {
configLoad.getString("Placeholder.fabledskyblock_island_level_block_count.Empty.Message"));
} else {
String materialName = placeholder.replace("fabledskyblock_island_level_block_count_", "").toUpperCase();
Materials materials = Materials.fromString(materialName);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialName);
if (materials == null) {
return ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Placeholder.fabledskyblock_island_level_block_count.Invalid.Message"));
@ -360,7 +361,7 @@ public class PlaceholderManager {
configLoad.getString("Placeholder.fabledskyblock_island_level_block_points.Empty.Message"));
} else {
String materialName = placeholder.replace("fabledskyblock_island_level_block_points_", "").toUpperCase();
Materials materials = Materials.fromString(materialName);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialName);
if (materials == null) {
return ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Placeholder.fabledskyblock_island_level_block_points.Invalid.Message"));
@ -373,7 +374,7 @@ public class PlaceholderManager {
}
} else if (placeholder.toLowerCase().startsWith("fabledskyblock_level_block_value_")) {
String materialName = placeholder.replace("fabledskyblock_level_block_value_", "").toUpperCase();
Materials materials = Materials.fromString(materialName);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialName);
if (materials == null) {
return ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Placeholder.fabledskyblock_level_block_value.Invalid.Message"));

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.stackable;
import java.io.File;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
@ -15,7 +16,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.utils.NumberUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.version.Sounds;
@ -24,12 +25,12 @@ public class Stackable {
private UUID uuid;
private Location location;
private Materials material;
private CompatibleMaterial material;
private int size = 2;
private ArmorStand display;
private int maxSize;
public Stackable(Location location, Materials material) {
public Stackable(Location location, CompatibleMaterial material) {
this.uuid = UUID.randomUUID();
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.material = material;
@ -38,7 +39,7 @@ public class Stackable {
this.save();
}
public Stackable(Location location, Materials material, int maxSize) {
public Stackable(Location location, CompatibleMaterial material, int maxSize) {
this.uuid = UUID.randomUUID();
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.material = material;
@ -48,7 +49,7 @@ public class Stackable {
this.save();
}
public Stackable(UUID uuid, Location location, Materials material, int size) {
public Stackable(UUID uuid, Location location, CompatibleMaterial material, int size) {
this.uuid = uuid;
this.location = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
this.material = material;
@ -68,11 +69,11 @@ public class Stackable {
this.location = location;
}
public Materials getMaterial() {
public CompatibleMaterial getMaterial() {
return this.material;
}
public void setMaterial(Materials material) {
public void setMaterial(CompatibleMaterial material) {
this.material = material;
this.save();
}
@ -144,7 +145,7 @@ public class Stackable {
as.setMarker(true);
}
as.setBasePlate(true);
as.setHelmet(material.parseItem());
as.setHelmet(material.getItem());
as.setCustomName(this.getCustomName());
as.setCustomNameVisible(true);
as.setMetadata("StackableArmorStand", new FixedMetadataValue(SkyBlock.getInstance(), ""));
@ -178,6 +179,6 @@ public class Stackable {
private String getCustomName() {
return ChatColor
.translateAlternateColorCodes('&', SkyBlock.getInstance().getFileManager().getConfig(new File(SkyBlock.getInstance().getDataFolder(), "language.yml")).getFileConfiguration().getString("Hologram.Stackable.Message"))
.replace("%block", SkyBlock.getInstance().getLocalizationManager().getLocalizationFor(Materials.class).getLocale(material)).replace("%amount", NumberUtil.formatNumber(this.size));
.replace("%block", SkyBlock.getInstance().getLocalizationManager().getLocalizationFor(CompatibleMaterial.class).getLocale(material)).replace("%amount", NumberUtil.formatNumber(this.size));
}
}

View File

@ -9,6 +9,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -17,14 +18,14 @@ import org.bukkit.configuration.file.FileConfiguration;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.utils.version.Materials;
public class StackableManager {
// ToDO: Should pobably be a GUI for this
private final SkyBlock skyblock;
private Set<Materials> stackableMaterials = EnumSet.noneOf(Materials.class);
private Set<CompatibleMaterial> stackableMaterials = EnumSet.noneOf(CompatibleMaterial.class);
private Map<Location, Stackable> stacks = new HashMap<>();
public StackableManager(SkyBlock skyblock) {
@ -41,7 +42,7 @@ public class StackableManager {
for (String stackableStr : stackableList) {
try {
this.stackableMaterials.add(Materials.fromString(stackableStr));
this.stackableMaterials.add(CompatibleMaterial.getBlockMaterial(stackableStr));
} catch (Exception ignored) {
}
}
@ -87,7 +88,7 @@ public class StackableManager {
if (block.getType() == Material.AIR) continue;
final Materials type = Materials.getMaterials(block.getType(), block.getData());
final CompatibleMaterial type = CompatibleMaterial.getMaterial(block.getType());
if (type == null) continue;
@ -107,11 +108,11 @@ public class StackableManager {
stackableMaterials.clear();
}
public Set<Materials> getStackableMaterials() {
public Set<CompatibleMaterial> getStackableMaterials() {
return Collections.unmodifiableSet(stackableMaterials);
}
public boolean isStackableMaterial(Materials material) {
public boolean isStackableMaterial(CompatibleMaterial material) {
return stackableMaterials.contains(material);
}
@ -123,7 +124,7 @@ public class StackableManager {
return stacks.containsKey(location);
}
public Stackable getStack(Location location, Materials material) {
public Stackable getStack(Location location, CompatibleMaterial material) {
Stackable stackable = stacks.get(location);
return stackable != null && stackable.getMaterial() == material ? stackable : null;
@ -138,7 +139,7 @@ public class StackableManager {
stacks.remove(stackable.getLocation());
}
public long getStackSizeOf(Location loc, Materials type) {
public long getStackSizeOf(Location loc, CompatibleMaterial type) {
final Stackable stack = getStack(loc, type);
return stack == null ? 0 : stack.getSize();

View File

@ -1,13 +1,14 @@
package com.songoda.skyblock.structure;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import java.util.ArrayList;
import java.util.List;
public class Structure implements com.songoda.skyblock.api.structure.Structure {
private Materials materials;
private CompatibleMaterial materials;
private String name;
private String overworldFile;
@ -22,7 +23,7 @@ public class Structure implements com.songoda.skyblock.api.structure.Structure {
private double deletionCost;
public Structure(String name, Materials materials, String overworldFile, String netherFile, String endFile,
public Structure(String name, CompatibleMaterial materials, String overworldFile, String netherFile, String endFile,
String displayName, boolean permission, List<String> description, List<String> commands,
double deletionCost) {
this.name = name;
@ -41,11 +42,11 @@ public class Structure implements com.songoda.skyblock.api.structure.Structure {
return name;
}
public Materials getMaterials() {
public CompatibleMaterial getMaterials() {
return materials;
}
public void setMaterials(Materials materials) {
public void setMaterials(CompatibleMaterial materials) {
this.materials = materials;
}

View File

@ -1,8 +1,9 @@
package com.songoda.skyblock.structure;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.utils.version.Materials;
import org.bukkit.configuration.file.FileConfiguration;
import java.io.File;
@ -19,16 +20,14 @@ public class StructureManager {
if (configLoad.getString("Structures") != null) {
for (String structureList : configLoad.getConfigurationSection("Structures").getKeys(false)) {
Materials materials = null;
CompatibleMaterial materials = null;
if (configLoad.getString("Structures." + structureList + ".Item.Material") == null) {
materials = Materials.GRASS_BLOCK;
materials = CompatibleMaterial.GRASS_BLOCK;
} else {
materials = Materials
.fromString(configLoad.getString("Structures." + structureList + ".Item.Material"));
materials = CompatibleMaterial.getMaterial(configLoad.getString("Structures." + structureList + ".Item.Material"));
if (materials == null) {
materials = Materials.GRASS_BLOCK;
materials = CompatibleMaterial.GRASS_BLOCK;
}
}
@ -90,7 +89,7 @@ public class StructureManager {
}
}
public void addStructure(String name, Materials materials, String overworldFile, String netherFile, String endFile,
public void addStructure(String name, CompatibleMaterial materials, String overworldFile, String netherFile, String endFile,
String displayName, boolean permission, List<String> description, List<String> commands,
double deletionCost) {
structureStorage.add(new Structure(name, materials, overworldFile, netherFile, endFile, displayName, permission,

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.utils.item;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@ -42,9 +43,9 @@ public final class ItemStackUtil {
// Other structures people make NEED to be saved from the version that they will be using so everything loads properly
if (itemStack.getType() == Material.AIR) {
if (NBTTagCompound.toString().equals("{id:\"minecraft:sugar_cane\",Count:1b}")) {
itemStack = new ItemStack(Materials.SUGAR_CANE.parseMaterial(), 1);
itemStack = new ItemStack(CompatibleMaterial.SUGAR_CANE.getMaterial(), 1);
} else if (NBTTagCompound.toString().equals("{id:\"minecraft:melon_slice\",Count:1b}")) {
itemStack = new ItemStack(Materials.MELON_SLICE.parseMaterial(), 1);
itemStack = new ItemStack(CompatibleMaterial.MELON_SLICE.getMaterial(), 1);
}
}
} catch (Exception e) {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.utils.item;
import com.songoda.skyblock.utils.version.Materials;
import org.bukkit.Material;

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -14,7 +15,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.utils.StringUtil;
import com.songoda.skyblock.utils.item.nInventoryUtil.ClickEvent;
import com.songoda.skyblock.utils.version.Materials;
public final class MenuClickRegistry {
@ -55,7 +56,7 @@ public final class MenuClickRegistry {
if (meta == null) return;
@SuppressWarnings("deprecation")
final MenuExecutor executor = executors.get(RegistryKey.fromName(meta.getDisplayName(), Materials.getMaterials(item.getType(), (byte) item.getDurability())));
final MenuExecutor executor = executors.get(RegistryKey.fromName(meta.getDisplayName(), CompatibleMaterial.getMaterial(item.getType())));
if (executor == null) return;
@ -80,9 +81,9 @@ public final class MenuClickRegistry {
private static final File path = new File(SkyBlock.getInstance().getDataFolder(), "language.yml");
private final String name;
private final Materials type;
private final CompatibleMaterial type;
private RegistryKey(String name, Materials type) {
private RegistryKey(String name, CompatibleMaterial type) {
this.name = name;
this.type = type;
}
@ -102,11 +103,11 @@ public final class MenuClickRegistry {
return Objects.equals(name, other.name) && type == other.type;
}
public static RegistryKey fromName(String name, Materials type) {
public static RegistryKey fromName(String name, CompatibleMaterial type) {
return new RegistryKey(name, type);
}
public static RegistryKey fromLanguageFile(String namePath, Materials type) {
public static RegistryKey fromLanguageFile(String namePath, CompatibleMaterial type) {
return new RegistryKey(StringUtil.color(SkyBlock.getInstance().getFileManager().getConfig(path).getFileConfiguration().getString(namePath)), type);
}
}

View File

@ -2,7 +2,7 @@ package com.songoda.skyblock.utils.item;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@ -72,7 +72,7 @@ public final class SkullUtil {
if (NMSUtil.getVersionNumber() > 12) {
is = new ItemStack(Material.valueOf("PLAYER_HEAD"));
} else {
is = Materials.LEGACY_SKULL_ITEM.getPostItem();
is = CompatibleMaterial.SKELETON_SKULL.getItem();
}
return is;

View File

@ -17,11 +17,17 @@ import com.songoda.skyblock.utils.world.entity.EntityUtil;
import java.io.FileInputStream;
import java.util.Base64;
import net.minecraft.server.v1_15_R1.ChunkSection;
import net.minecraft.server.v1_15_R1.IBlockData;
import net.minecraft.server.v1_15_R1.World;
import net.minecraft.server.v1_15_R1.WorldServer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
@ -161,8 +167,9 @@ public final class StructureUtil {
pitch = Float.valueOf(originLocationPositions[5]);
}
List<BlockData> blockData = new Gson().fromJson(storage.getBlocks(), new TypeToken<List<BlockData>>() {
}.getType());
List<BlockData> blockData = new Gson().fromJson(storage.getBlocks(), new TypeToken<List<BlockData>>() {}.getType());
//Dump this
for (BlockData blockDataList : blockData) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), () -> {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.utils.world;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
@ -8,7 +9,6 @@ import com.songoda.skyblock.island.IslandEnvironment;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.utils.math.VectorUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.world.block.BlockDegreesType;
import com.songoda.skyblock.world.WorldManager;
import org.bukkit.*;
@ -119,17 +119,17 @@ public final class LocationUtil {
final Block block = world.getBlockAt(blockX, y, blockZ).getRelative(BlockFace.UP);
if (isNether) {
if (y < 127 && (block.getType() == Material.LAVA || block.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial() || block.getType() == Material.AIR)) {
if (y < 127 && (block.getType() == Material.LAVA || block.getType() == CompatibleMaterial.LAVA.getMaterial() || block.getType() == Material.AIR)) {
maxY = y;
break;
}
} else {
if (block.getType() == Materials.OAK_LEAVES.parseMaterial() || block.getType() == Materials.ACACIA_LEAVES.parseMaterial()) {
if (block.getType() == CompatibleMaterial.OAK_LEAVES.getMaterial() || block.getType() == CompatibleMaterial.ACACIA_LEAVES.getMaterial()) {
break;
}
if (block.getType() == Material.AIR || block.getType() == Materials.LEGACY_STATIONARY_WATER.getPostMaterial() || block.getType() == Material.WATER
|| block.getType() == Materials.LEGACY_STATIONARY_LAVA.getPostMaterial() || block.getType() == Material.LAVA) {
if (block.getType() == Material.AIR || block.getType() == CompatibleMaterial.WATER.getMaterial() || block.getType() == Material.WATER
|| block.getType() == CompatibleMaterial.LAVA.getMaterial() || block.getType() == Material.LAVA) {
if (!followY) {
maxY = y;
followY = true;

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.utils.world.block;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.SkullType;
@ -28,8 +28,8 @@ public class BlockData {
private String commandBlockName = "";
private String entity = EntityType.COW.toString();
private String exitLocation = "";
private String flower = Materials.RED_DYE.parseMaterial().toString() + ":0";
private String playing = Materials.MUSIC_DISC_CHIRP.parseMaterial().toString();
private String flower = CompatibleMaterial.RED_DYE.getMaterial().toString() + ":0";
private String playing = CompatibleMaterial.MUSIC_DISC_CHIRP.getMaterial().toString();
private String[] signLines = {};
private String rotateFace = BlockFace.NORTH.toString();
private String skullOwner = "Notch";

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.utils.world.block;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.item.ItemStackUtil;
import com.songoda.skyblock.utils.item.MaterialUtil;
import com.songoda.skyblock.utils.version.Materials;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.*;
import org.bukkit.block.*;
@ -67,7 +67,7 @@ public final class BlockUtil {
for (int i = 0; i < furnace.getInventory().getSize(); i++) {
ItemStack is = furnace.getInventory().getItem(i);
if (is != null && is.getType() != Material.AIR) {
if (is != null && is.getType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.addItem(i, ItemStackUtil.serializeItemStack(is));
}
}
@ -79,7 +79,7 @@ public final class BlockUtil {
for (int i = 0; i < chest.getInventory().getSize(); i++) {
ItemStack is = chest.getInventory().getItem(i);
if (is != null && is.getType() != Material.AIR) {
if (is != null && is.getType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.addItem(i, ItemStackUtil.serializeItemStack(is));
}
}
@ -91,7 +91,7 @@ public final class BlockUtil {
for (int i = 0; i < dispenser.getInventory().getSize(); i++) {
ItemStack is = dispenser.getInventory().getItem(i);
if (is != null && is.getType() != Material.AIR) {
if (is != null && is.getType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.addItem(i, ItemStackUtil.serializeItemStack(is));
}
}
@ -103,7 +103,7 @@ public final class BlockUtil {
for (int i = 0; i < dropper.getInventory().getSize(); i++) {
ItemStack is = dropper.getInventory().getItem(i);
if (is != null && is.getType() != Material.AIR) {
if (is != null && is.getType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.addItem(i, ItemStackUtil.serializeItemStack(is));
}
}
@ -115,7 +115,7 @@ public final class BlockUtil {
for (int i = 0; i < hopper.getInventory().getSize(); i++) {
ItemStack is = hopper.getInventory().getItem(i);
if (is != null && is.getType() != Material.AIR) {
if (is != null && is.getType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.addItem(i, ItemStackUtil.serializeItemStack(is));
}
}
@ -188,7 +188,7 @@ public final class BlockUtil {
for (int i = 0; i < shulkerBox.getInventory().getSize(); i++) {
ItemStack is = shulkerBox.getInventory().getItem(i);
if (is != null && is.getType() != Material.AIR) {
if (is != null && is.getType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.addItem(i, ItemStackUtil.serializeItemStack(is));
}
}
@ -236,7 +236,7 @@ public final class BlockUtil {
} else {
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) materialData;
if (flowerPot.getContents() != null && flowerPot.getContents().getItemType() != Material.AIR) {
if (flowerPot.getContents() != null && flowerPot.getContents().getItemType() != CompatibleMaterial.AIR.getMaterial()) {
blockData.setFlower(flowerPot.getContents().getItemType().toString() + ":" + flowerPot.getContents().getData());
}
}
@ -491,7 +491,7 @@ public final class BlockUtil {
Block bottomBlock = block.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();
if (bottomBlock.getType() == Material.AIR && !topBlock.getType().name().equals("DOUBLE_PLANT")) {
bottomBlock.setType(Materials.LEGACY_DOUBLE_PLANT.getPostMaterial());
bottomBlock.setType(CompatibleMaterial.LARGE_FERN.getMaterial());
if (NMSVersion < 13) {
try {

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.utils.world.entity;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.skyblock.utils.item.ItemStackUtil;
import com.songoda.skyblock.utils.item.MaterialUtil;
import com.songoda.skyblock.utils.version.NMSUtil;
@ -379,8 +380,7 @@ public final class EntityUtil {
String[] materialData = entityData.getCarryBlock().split(":");
byte data = Byte.parseByte(materialData[1]);
Material material = MaterialUtil.getMaterial(NMSVersion, entityData.getVersion(),
materialData[0].toUpperCase(), data);
Material material = MaterialUtil.getMaterial(NMSVersion, entityData.getVersion(), materialData[0].toUpperCase(), data);
if (material != null) {
if (NMSVersion > 12) {

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.configuration.Configuration;
@ -14,7 +15,6 @@ import org.bukkit.generator.ChunkGenerator;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.utils.version.Materials;
public class VoidGenerator extends ChunkGenerator {
@ -33,9 +33,9 @@ public class VoidGenerator extends ChunkGenerator {
if (section.getBoolean("Liquid.Enable")) {
if (section.getBoolean("Liquid.Lava")) {
setBlock(chunkData, Materials.LEGACY_STATIONARY_LAVA.parseMaterial(), section.getInt("Liquid.Height"));
setBlock(chunkData, CompatibleMaterial.LAVA.getMaterial(), section.getInt("Liquid.Height"));
} else {
setBlock(chunkData, Materials.LEGACY_STATIONARY_WATER.parseMaterial(), section.getInt("Liquid.Height"));
setBlock(chunkData, CompatibleMaterial.WATER.getMaterial(), section.getInt("Liquid.Height"));
}
}

View File

@ -1,6 +1,5 @@
ClassLocalization:
Materials:
LEGACY_DOUBLE_PLANT: 'Sunflower'
IslandRoles:
Coop: 'Coop'
Visitor: 'Visitor'