Replace usages of now incompatible CompatibleMaterial with XMaterial

This commit is contained in:
Christian Koop 2023-08-15 18:48:40 +02:00
parent c44a684ecd
commit f47354980b
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
161 changed files with 1251 additions and 1150 deletions

View File

@ -2,13 +2,13 @@ package com.songoda.skyblock;
import com.craftaro.core.SongodaCore;
import com.craftaro.core.SongodaPlugin;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerProject;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.configuration.Config;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.hooks.HologramManager;
import com.craftaro.core.hooks.LogManager;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.api.SkyBlockAPI;
import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.bank.BankManager;
@ -172,7 +172,7 @@ public class SkyBlock extends SongodaPlugin {
}
// Run Songoda Updater
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
SongodaCore.registerPlugin(this, 17, XMaterial.GRASS_BLOCK);
// Load Economy
this.economyManager = new EconomyManager(this);

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.api.island;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.google.common.base.Preconditions;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.Location;
@ -46,7 +47,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(CompatibleMaterial.getMaterial(material.name()).name(), amount);
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).get().name(), amount);
}
/**
@ -55,7 +56,7 @@ public class IslandLevel {
public void setMaterialAmount(Material material, byte data, int amount) {
Preconditions.checkArgument(material != null, "Cannot set material amount to null material");
//TODO: Add data support
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).name(),
this.handle.getIsland().getLevel().setMaterialAmount(CompatibleMaterial.getMaterial(material.name()).get().name(),
amount);
}
@ -65,7 +66,7 @@ public class IslandLevel {
public long getMaterialAmount(Material material) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
XMaterial materials = CompatibleMaterial.getMaterial(material.name()).get();
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
if (level.getMaterials().containsKey(materials.name())) {
@ -81,7 +82,7 @@ public class IslandLevel {
public long getMaterialAmount(Material material, byte data) {
Preconditions.checkArgument(material != null, "Cannot get material amount to null material");
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material.name());
XMaterial materials = CompatibleMaterial.getMaterial(material.name()).get();
//TODO: data support
com.songoda.skyblock.island.IslandLevel level = this.handle.getIsland().getLevel();
@ -97,7 +98,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(CompatibleMaterial.getMaterial(material.name()).name());
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).get().name());
}
/**
@ -105,8 +106,7 @@ 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(CompatibleMaterial.getMaterial(material.name()).name());
return this.handle.getIsland().getLevel().getMaterialPoints(CompatibleMaterial.getMaterial(material.name()).get().name());
//TODO: add data support
}

View File

@ -29,6 +29,6 @@ public class LevellingManager {
public void registerCalculator(Calculator calculator, Material material) {
Preconditions.checkArgument(calculator != null, "Cannot use a null calculator");
Preconditions.checkArgument(material != null, "Cannot use a null material");
CalculatorRegistry.registerCalculator(calculator, CompatibleMaterial.getMaterial(material));
CalculatorRegistry.registerCalculator(calculator, CompatibleMaterial.getMaterial(material).get());
}
}

View File

@ -1,15 +1,15 @@
package com.songoda.skyblock.api.structure;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import java.util.List;
public interface Structure {
String getName();
CompatibleMaterial getMaterial();
XMaterial getMaterial();
void setMaterial(CompatibleMaterial material);
void setMaterial(XMaterial material);
String getOverworldFile();

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.blockscanner;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.google.common.collect.Lists;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
@ -23,6 +24,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
@ -271,16 +273,17 @@ public final class BlockScanner extends BukkitRunnable {
for (int x = initX; x <= lastX; x++) {
for (int z = initZ; z <= lastZ; z++) {
for (int y = scanY; y < world.getMaxHeight(); y++) {
final CompatibleMaterial type = CompatibleMaterial.getBlockMaterial(
final Optional<XMaterial> type = CompatibleMaterial.getMaterial(
ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
? shot.getSnapshot().getBlockType(x, y, z) :
MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z)));
if (type == null) {
if (!type.isPresent()) {
continue;
} else if (type == CompatibleMaterial.AIR && this.ignoreAir) {
} else if (CompatibleMaterial.isAir(type.get()) && this.ignoreAir) {
continue;
} else if (type == CompatibleMaterial.WATER && this.ignoreLiquids) {
} else if (type.get() == XMaterial.WATER && this.ignoreLiquids) {
continue;
}

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.challenge.challenge;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.config.FileManager;
@ -25,6 +26,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.regex.Pattern;
public class Challenge {
@ -196,9 +198,9 @@ public class Challenge {
// The id
String id = index == -1 ? value : value.substring(0, index);
// Check if it's a Minecraft item
CompatibleMaterial m = CompatibleMaterial.getMaterial(id);
Optional<XMaterial> m = CompatibleMaterial.getMaterial(id);
//Material m = Material.matchMaterial(id);
if (m == null) {
if (!m.isPresent()) {
throw new IllegalArgumentException("\"" + id + "\" isn't a correct Minecraft Material (value = \"" + value + "\")");
}
int amount = 1;
@ -211,7 +213,7 @@ public class Challenge {
"\"" + strAmount + "\" isn't a correct number (value = \"" + value + "\")");
}
}
ItemStack item = m.getItem();
ItemStack item = m.get().parseItem();
item.setAmount(amount);
return item;
}
@ -222,7 +224,7 @@ public class Challenge {
if (obj instanceof ItemStack) {
// Check if player has specific item in his inventory
ItemStack is = (ItemStack) obj;
CompatibleMaterial material = CompatibleMaterial.getMaterial(is);
XMaterial material = CompatibleMaterial.getMaterial(is.getType()).get();
if (ignoreLore) {
return findSimilar(p, material) >= is.getAmount();
}
@ -231,10 +233,10 @@ public class Challenge {
return false;
}
private int findSimilar(Player p, CompatibleMaterial material) {
private int findSimilar(Player p, XMaterial material) {
int amountFound = 0;
for (ItemStack item : p.getInventory().getContents()) {
if (CompatibleMaterial.getMaterial(item) == material) {
if (material.isSimilar(item)) {
amountFound += item.getAmount();
}
}
@ -253,7 +255,7 @@ public class Challenge {
if (jis == null) {
continue;
}
if (ignoreLore ? CompatibleMaterial.getMaterial(jis) == CompatibleMaterial.getMaterial(is) : jis.isSimilar(is)) {
if (ignoreLore ? CompatibleMaterial.getMaterial(is.getType()).get().isSimilar(jis) : jis.isSimilar(is)) {
if (jis.getAmount() <= toRemove) {
toRemove -= jis.getAmount();
p.getInventory().removeItem(jis);

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.challenge.challenge;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
@ -9,6 +10,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.Set;
public class ChallengeCategory {
@ -61,11 +63,11 @@ public class ChallengeCategory {
List<String> lore = show ? toColor(config.getStringList(key + ".item.lore")) : new ArrayList<>();
try {
// If an Exception occurs, we don't handle it here but in parent class
CompatibleMaterial compatibleMaterial = CompatibleMaterial.getMaterial(strItem);
if (compatibleMaterial == null) {
Optional<XMaterial> compatibleMaterial = CompatibleMaterial.getMaterial(strItem);
if (!compatibleMaterial.isPresent()) {
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
}
ItemChallenge ic = new ItemChallenge(show, row, col, compatibleMaterial, amount, lore);
ItemChallenge ic = new ItemChallenge(show, row, col, compatibleMaterial.get(), amount, lore);
Challenge c = new Challenge(this, id, name, maxTimes, showInChat, require, reward, ic);
this.challenges.put(id, c);
} catch (IllegalArgumentException ex) {

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.challenge.challenge;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
@ -14,13 +14,13 @@ public class ItemChallenge {
private final boolean show;
private final int row;
private final int col;
private final CompatibleMaterial type;
private final XMaterial type;
private final int amount;
private final List<String> lore;
private final String itemTitle;
public ItemChallenge(boolean show, int row, int col, CompatibleMaterial type, int amount, List<String> lore) {
public ItemChallenge(boolean show, int row, int col, XMaterial type, int amount, List<String> lore) {
this.show = show;
this.row = row;
this.col = col;
@ -34,7 +34,7 @@ public class ItemChallenge {
public ItemStack createItem(UUID player, int amount) {
FileConfiguration langConfigLoad = SkyBlock.getPlugin(SkyBlock.class).getLanguage();
ItemStack is = this.type.getItem();
ItemStack is = this.type.parseItem();
is.setAmount(this.amount);
// Air
ItemMeta im = is.getItemMeta();
@ -73,7 +73,7 @@ public class ItemChallenge {
return this.col;
}
public CompatibleMaterial getType() {
public XMaterial getType() {
return this.type;
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.challenge.defaultinv;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -12,6 +13,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class DefaultInventory {
private final Item defaultItem = new Item(new ItemStack(Material.AIR));
@ -37,13 +39,13 @@ public class DefaultInventory {
String name = plugin.formatText(configLoad.getString(k + ".name"));
List<String> lore = toColor(configLoad.getStringList(k + ".lore"));
int redirect = configLoad.getInt(k + ".redirect");
CompatibleMaterial material = CompatibleMaterial.getMaterial(strItem);
if (material == null || material == CompatibleMaterial.AIR) {
Optional<XMaterial> material = CompatibleMaterial.getMaterial(strItem);
if (!material.isPresent() || CompatibleMaterial.isAir(material.get())) {
Bukkit.getLogger().warning("Item " + strItem + " is not a Material");
continue;
}
ItemStack is = material.getItem();
ItemStack is = material.get().parseItem();
is.setAmount(amount);
ItemMeta im = is.getItemMeta();
im.setDisplayName(name);

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.command.commands.admin;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.message.MessageManager;
@ -55,7 +56,7 @@ public class StackableCommand extends SubCommand {
}
final StackableManager stackableManager = this.plugin.getStackableManager();
final CompatibleMaterial type = CompatibleMaterial.getMaterial(block.getType());
final XMaterial type = CompatibleMaterial.getMaterial(block.getType()).get();
if (!stackableManager.isStackableMaterial(type)) {
messageManager.sendMessage(player, messageConfig.getString("Command.Island.Admin.Stackable.Target.Unstackable"));

View File

@ -56,21 +56,20 @@ public class OwnerCommand extends SubCommand {
if (island == null) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Owner.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else if (args.length == 0) {
if (island.hasRole(IslandRole.OWNER, player.getUniqueId())) {
playerData.setType(Ownership.Visibility.HIDDEN);
Ownership.getInstance().open(player);
soundManager.playSound(player, XSound.BLOCK_CHEST_OPEN.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_CHEST_OPEN);
return;
}
} else if (args.length == 1) {
if (island.hasRole(IslandRole.OWNER, player.getUniqueId())) {
if (playerData.getConfirmationTime() > 0) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Confirmation.Pending.Message"));
soundManager.playSound(player, XSound.ENTITY_IRON_GOLEM_ATTACK.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Confirmation.Pending.Message"));
soundManager.playSound(player, XSound.ENTITY_IRON_GOLEM_ATTACK);
} else {
UUID targetPlayerUUID;
String targetPlayerName;
@ -89,17 +88,13 @@ public class OwnerCommand extends SubCommand {
if (targetPlayerUUID == null || (!island.hasRole(IslandRole.MEMBER, targetPlayerUUID)
&& !island.hasRole(IslandRole.OPERATOR, targetPlayerUUID)
&& !island.hasRole(IslandRole.OWNER, targetPlayerUUID))) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Member.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Member.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else if (targetPlayerUUID.equals(player.getUniqueId())) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Yourself.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else if (cooldownManager.hasPlayer(CooldownType.OWNERSHIP,
Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()))) {
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.OWNERSHIP,
Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Yourself.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else if (cooldownManager.hasPlayer(CooldownType.OWNERSHIP, Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()))) {
CooldownPlayer cooldownPlayer = cooldownManager.getCooldownPlayer(CooldownType.OWNERSHIP, Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
Cooldown cooldown = cooldownPlayer.getCooldown();
long[] durationTime = NumberUtil.getDuration(cooldown.getTime());
@ -126,7 +121,7 @@ public class OwnerCommand extends SubCommand {
+ configLoad.getString("Command.Island.Ownership.Cooldown.Word.Second")));
}
soundManager.playSound(player, XSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.ENTITY_VILLAGER_NO);
return;
} else {
@ -203,7 +198,7 @@ public class OwnerCommand extends SubCommand {
.replace("%time", "" + confirmationTime));
}
soundManager.playSound(player, XSound.ENTITY_VILLAGER_YES.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.ENTITY_VILLAGER_YES);
}
}
} else {
@ -217,13 +212,13 @@ public class OwnerCommand extends SubCommand {
all.sendMessage(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Command.Island.Ownership.Assigned.Broadcast.Message")
.replace("%player", player.getName())));
soundManager.playSound(all, XSound.BLOCK_ANVIL_USE.getSound(), 1.0F, 1.0F);
soundManager.playSound(all, XSound.BLOCK_ANVIL_USE);
}
}
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Assigned.Sender.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_USE.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_USE);
islandManager.giveOwnership(island, player);
@ -232,19 +227,19 @@ public class OwnerCommand extends SubCommand {
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Password.Incorrect.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Ownership.Password.Unset.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
}
return;
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Ownership.Invalid.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.command.commands.island;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.command.SubCommand;
@ -19,6 +20,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.Optional;
public class SetSpawnCommand extends SubCommand {
public SetSpawnCommand(SkyBlock plugin) {
@ -100,12 +102,12 @@ public class SetSpawnCommand extends SubCommand {
if (fileManager.getConfig(new File(this.plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Spawn.Protection")) {
CompatibleMaterial toCompare = CompatibleMaterial.getMaterial(location.clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType());
Optional<XMaterial> 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) {
if (toCompare.isPresent() && CompatibleMaterial.isAir(toCompare.get())
|| toCompare.get() == XMaterial.MOVING_PISTON
|| toCompare.get() == XMaterial.ICE
|| toCompare.get() == XMaterial.PISTON_HEAD) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Block.Message"));
@ -125,22 +127,22 @@ public class SetSpawnCommand extends SubCommand {
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return;
} else if (CompatibleMaterial.getMaterial(location.getBlock().getType()) == CompatibleMaterial.NETHER_PORTAL
} else if (CompatibleMaterial.getMaterial(location.getBlock().getType()).get() == XMaterial.NETHER_PORTAL
|| CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock()
.getType()) == CompatibleMaterial.NETHER_PORTAL) {
.getType()).get() == XMaterial.NETHER_PORTAL) {
messageManager.sendMessage(player,
configLoad.getString("Command.Island.SetSpawn.Protection.Portal.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return;
} else {
CompatibleMaterial type = CompatibleMaterial.getMaterial(location.getBlock().getType());
if (type.isSolid() && type.isOccluding()) {
Optional<XMaterial> type = CompatibleMaterial.getMaterial(location.getBlock().getType());
if (type.isPresent() && type.get().parseMaterial().isSolid() && type.get().parseMaterial().isOccluding()) {
location.getBlock().breakNaturally();
}
CompatibleMaterial typeBelow = CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType());
if (typeBelow.isSolid() && type.isOccluding()) {
Optional<XMaterial> typeBelow = CompatibleMaterial.getMaterial(location.clone().add(0.0D, 1.0D, 0.0D).getBlock().getType());
if (typeBelow.isPresent() && typeBelow.get().parseMaterial().isSolid() && type.get().parseMaterial().isOccluding()) {
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().breakNaturally();
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.command.commands.island;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.NumberUtils;
import com.songoda.skyblock.SkyBlock;
@ -16,6 +17,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.Optional;
public class ValueCommand extends SubCommand {
public ValueCommand(SkyBlock plugin) {
@ -37,14 +39,14 @@ public class ValueCommand extends SubCommand {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Value.Hand.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else {
CompatibleMaterial materials = CompatibleMaterial.getMaterial(player.getItemInHand().getType().name());
Optional<XMaterial> materials = CompatibleMaterial.getMaterial(player.getItemInHand().getType().name());
if (materials != null && levellingManager.hasWorth(materials)) {
double worth = levellingManager.getWorth(materials);
if (materials.isPresent() && levellingManager.hasWorth(materials.get())) {
double worth = levellingManager.getWorth(materials.get());
double level = worth / (double) this.plugin.getConfiguration().getInt("Island.Levelling.Division");
messageManager.sendMessage(player,
configLoad.getString("Command.Island.Value.Value.Message").replace("%material", WordUtils.capitalizeFully(materials.name().toLowerCase().replace("_", " ")))
configLoad.getString("Command.Island.Value.Value.Message").replace("%material", WordUtils.capitalizeFully(materials.get().name().toLowerCase().replace("_", " ")))
.replace("%points", "" + worth).replace("%level", NumberUtils.formatNumber(level)));
soundManager.playSound(player, XSound.ENTITY_VILLAGER_YES);
} else {

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.generator;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.island.IslandWorld;
import java.util.List;
@ -8,12 +8,12 @@ import java.util.List;
public class Generator {
private final String name;
private final IslandWorld isWorld;
private final CompatibleMaterial materials;
private final XMaterial materials;
private final List<GeneratorMaterial> generatorMaterials;
private final long level;
private boolean permission;
public Generator(String name, IslandWorld isWorld, CompatibleMaterial materials, List<GeneratorMaterial> generatorMaterials, long level, boolean permission) {
public Generator(String name, IslandWorld isWorld, XMaterial materials, List<GeneratorMaterial> generatorMaterials, long level, boolean permission) {
this.name = name;
this.isWorld = isWorld;
this.materials = materials;
@ -30,7 +30,7 @@ public class Generator {
return this.isWorld;
}
public CompatibleMaterial getMaterials() {
public XMaterial getMaterials() {
return this.materials;
}

View File

@ -2,6 +2,8 @@ package com.songoda.skyblock.generator;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.IslandWorld;
@ -15,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Random;
public class GeneratorManager {
@ -40,20 +43,20 @@ 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)) {
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialList);
if (materials != null) {
generatorMaterials.add(new GeneratorMaterial(materials, configLoad.getDouble(
Optional<XMaterial> materials = CompatibleMaterial.getMaterial(materialList);
if (materials.isPresent()) {
generatorMaterials.add(new GeneratorMaterial(materials.get(), configLoad.getDouble(
"Generators." + generatorList + ".Materials." + materialList + ".Chance")));
}
}
}
Random rnd = new Random();
CompatibleMaterial icon;
XMaterial icon;
if (!generatorMaterials.isEmpty()) {
icon = generatorMaterials.get(rnd.nextInt(generatorMaterials.size())).getMaterials();
} else {
icon = CompatibleMaterial.STONE;
icon = XMaterial.STONE;
}
this.generatorStorage.add(new Generator(configLoad.getString("Generators." + generatorList + ".Name"),
@ -120,7 +123,7 @@ public class GeneratorManager {
@SuppressWarnings("deprecation")
public BlockState generateBlock(Generator generator, Block block) {
CompatibleMaterial materials = getRandomMaterials(generator);
XMaterial materials = getRandomMaterials(generator);
if (materials == null) {
return block.getState();
}
@ -129,9 +132,9 @@ public class GeneratorManager {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) {
block.setType(materials.getMaterial());
XBlock.setType(block, materials);
} else {
ItemStack is = materials.getItem();
ItemStack is = materials.parseItem();
block.setType(is.getType());
try {
@ -145,9 +148,9 @@ public class GeneratorManager {
return block.getState();
}
public CompatibleMaterial getRandomMaterials(Generator generator) {
public XMaterial getRandomMaterials(Generator generator) {
if (generator.getGeneratorMaterials() != null && generator.getGeneratorMaterials().stream().anyMatch(x -> x.getChance() > 0)) {
List<CompatibleMaterial> weightedList = new ArrayList<>();
List<XMaterial> weightedList = new ArrayList<>();
for (GeneratorMaterial generatorMaterial : generator.getGeneratorMaterials()) {
for (int i = 0; i < generatorMaterial.getChance() * 30; i++) {
weightedList.add(generatorMaterial.getMaterials());
@ -158,12 +161,12 @@ public class GeneratorManager {
return weightedList.get(choice);
}
return CompatibleMaterial.COBBLESTONE;
return XMaterial.COBBLESTONE;
}
public void addGenerator(String name, IslandWorld isWorld, List<GeneratorMaterial> generatorMaterials, int level, boolean permission) {
CompatibleMaterial[] oreMaterials = new CompatibleMaterial[]{CompatibleMaterial.COAL, CompatibleMaterial.CHARCOAL, CompatibleMaterial.DIAMOND,
CompatibleMaterial.IRON_INGOT, CompatibleMaterial.GOLD_INGOT, CompatibleMaterial.EMERALD};
XMaterial[] oreMaterials = new XMaterial[]{XMaterial.COAL, XMaterial.CHARCOAL, XMaterial.DIAMOND,
XMaterial.IRON_INGOT, XMaterial.GOLD_INGOT, XMaterial.EMERALD};
this.generatorStorage.add(new Generator(name, isWorld, oreMaterials[new Random().nextInt(oreMaterials.length)],
generatorMaterials, level, permission));
}

View File

@ -1,17 +1,17 @@
package com.songoda.skyblock.generator;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
public class GeneratorMaterial {
private final CompatibleMaterial materials;
private final XMaterial materials;
private double chance;
public GeneratorMaterial(CompatibleMaterial materials, double chance) {
public GeneratorMaterial(XMaterial materials, double chance) {
this.materials = materials;
this.chance = chance;
}
public CompatibleMaterial getMaterials() {
public XMaterial getMaterials() {
return this.materials;
}

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.gui;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -46,14 +46,14 @@ public class GuiSignatureEditor extends Gui {
public void paint() {
List<String> signatureMessage = this.island.getMessage(IslandMessage.SIGNATURE);
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(2, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Return.Displayname"))),
(event) -> this.guiManager.showGUI(event.player, this.returnGui));
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(6, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Return.Displayname"))),
(event) -> this.guiManager.showGUI(event.player, this.returnGui));
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(3, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Line.Add.Displayname")),
TextUtils.formatText(this.configLoad.getStringList(
signatureMessage.size() == this.mainConfig.getFileConfiguration().getInt("Island.Visitor.Signature.Lines")
@ -84,11 +84,11 @@ public class GuiSignatureEditor extends Gui {
List<String> itemLore = new ArrayList<>();
itemLore.add(this.configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Message.Word.Empty"));
setItem(4, GuiUtils.createButtonItem(CompatibleMaterial.OAK_SIGN,
setItem(4, GuiUtils.createButtonItem(XMaterial.OAK_SIGN,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Message.Displayname")),
TextUtils.formatText(signatureMessage.isEmpty() ? itemLore : signatureMessage)));
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Line.Remove.Displayname")),
TextUtils.formatText(this.configLoad.getStringList(
signatureMessage.isEmpty()

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.gui;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -45,14 +45,14 @@ public class GuiWelcomeEditor extends Gui {
public void paint() {
List<String> welcomeMessage = this.island.getMessage(IslandMessage.WELCOME);
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(2, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Return.Displayname"))),
(event) -> this.guiManager.showGUI(event.player, this.returnGui));
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(6, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Return.Displayname"))),
(event) -> this.guiManager.showGUI(event.player, this.returnGui));
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(3, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Line.Add.Displayname")),
TextUtils.formatText(this.configLoad.getStringList(
welcomeMessage.size() == this.mainConfig.getFileConfiguration().getInt("Island.Visitor.Welcome.Lines")
@ -84,11 +84,11 @@ public class GuiWelcomeEditor extends Gui {
List<String> itemLore = new ArrayList<>();
itemLore.add(this.configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Message.Word.Empty"));
setItem(4, GuiUtils.createButtonItem(CompatibleMaterial.OAK_SIGN,
setItem(4, GuiUtils.createButtonItem(XMaterial.OAK_SIGN,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Message.Displayname")),
TextUtils.formatText(welcomeMessage.isEmpty() ? itemLore : welcomeMessage)));
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Line.Remove.Displayname")),
TextUtils.formatText(this.configLoad.getStringList(
welcomeMessage.isEmpty()

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.gui.bank;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -29,7 +29,7 @@ public class GuiBank extends Gui {
this.admin = admin;
this.languageLoad = this.plugin.getLanguage();
if (island != null) {
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setDefaultItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
setTitle(TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Title")));
paint();
}
@ -49,35 +49,35 @@ public class GuiBank extends Gui {
this.inventory.clear();
}
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setDefaultItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
setActionForRange(0, 0, 1, 8, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.BOOK, // Transaction log
setButton(4, GuiUtils.createButtonItem(XMaterial.BOOK, // Transaction log
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Log.Displayname"))), (event) ->
this.guiManager.showGUI(event.player, new GuiBankTransaction(this.plugin, this.island, this, this.admin)));
setButton(10, GuiUtils.createButtonItem(CompatibleMaterial.GREEN_DYE, // Deposit
setButton(10, GuiUtils.createButtonItem(XMaterial.GREEN_DYE, // Deposit
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Deposit.Displayname"))), (event) ->
this.guiManager.showGUI(event.player, new GuiBankSelector(this.plugin, this.island, this, GuiBankSelector.Type.DEPOSIT, this.admin)));
setItem(13, GuiUtils.createButtonItem(CompatibleMaterial.GOLD_INGOT, // Balance
setItem(13, GuiUtils.createButtonItem(XMaterial.GOLD_INGOT, // Balance
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Balance.Displayname")),
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Balance.Lore")
.replace("%balance", String.valueOf(this.island.getBankBalance())))));
setButton(16, GuiUtils.createButtonItem(CompatibleMaterial.RED_DYE, // Withdraw
setButton(16, GuiUtils.createButtonItem(XMaterial.RED_DYE, // Withdraw
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Withdraw.Displayname"))), (event) ->
this.guiManager.showGUI(event.player, new GuiBankSelector(this.plugin, this.island, this, GuiBankSelector.Type.WITHDRAW, this.admin)));
}

View File

@ -1,10 +1,10 @@
package com.songoda.skyblock.gui.bank;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.NumberUtils;
import com.craftaro.core.utils.TextUtils;
@ -42,7 +42,7 @@ public class GuiBankSelector extends Gui {
this.returnGui = returnGui;
this.admin = admin;
this.languageLoad = this.plugin.getLanguage();
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setDefaultItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
setTitle(TextUtils.formatText(this.languageLoad.getString("Menu.Input.Title")));
paint();
}
@ -53,16 +53,16 @@ public class GuiBankSelector extends Gui {
this.inventory.clear();
}
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setDefaultItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
setActionForRange(0, 0, 1, 8, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Input.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Input.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
@ -81,7 +81,7 @@ public class GuiBankSelector extends Gui {
}
final String finalAction = action;
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.GOLD_BLOCK, // All
setButton(2, GuiUtils.createButtonItem(XMaterial.GOLD_BLOCK, // All
TextUtils.formatText(this.languageLoad.getString("Menu.Input.Item.All.Displayname")),
TextUtils.formatText(this.languageLoad.getString("Menu.Input.Item.All.Lore")
.replace("%action%", this.languageLoad.getString("Menu.Bank.Words." + action)))), (event -> {
@ -131,7 +131,7 @@ public class GuiBankSelector extends Gui {
this.guiManager.showGUI(event.player, this.returnGui);
}));
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.PAPER, // Custom
setButton(6, GuiUtils.createButtonItem(XMaterial.PAPER, // Custom
TextUtils.formatText(this.languageLoad.getString("Menu.Input.Item.Custom.Displayname")),
TextUtils.formatText(this.languageLoad.getString("Menu.Input.Item.Custom.Lore")
.replace("%action%", this.languageLoad.getString("Menu.Bank.Words." + action)))), (event) -> {

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.gui.bank;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -55,19 +55,19 @@ public class GuiBankTransaction extends Gui {
setActionForRange(0, 0, 1, 8, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
});
setItem(4, GuiUtils.createButtonItem(CompatibleMaterial.PAINTING, // Info
setItem(4, GuiUtils.createButtonItem(XMaterial.PAINTING, // Info
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Transactions.Info.Displayname")),
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Transactions.Info.Lore")
.replace("%totalTransactions", String.valueOf(this.transactions)))));
@ -76,7 +76,7 @@ public class GuiBankTransaction extends Gui {
this.pages = (int) Math.max(1, Math.ceil((double) this.transactions / 36d));
if (this.page != 1) {
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 2, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Last.Displayname"))),
(event) -> {
this.page--;
@ -85,7 +85,7 @@ public class GuiBankTransaction extends Gui {
}
if (this.page != this.pages) {
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 6, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Next.Displayname"))),
(event) -> {
this.page++;
@ -110,7 +110,7 @@ public class GuiBankTransaction extends Gui {
SimpleDateFormat formatDate = new SimpleDateFormat(this.languageLoad.getString("Menu.Bank.Item.Transactions.DateTimeFormat", "dd/MM/yyyy HH:mm:ss"));
switch (transaction.action) {
case WITHDRAW:
is = CompatibleMaterial.RED_DYE.getItem();
is = XMaterial.RED_DYE.parseItem();
im = is.getItemMeta();
if (im != null) {
@ -139,7 +139,7 @@ public class GuiBankTransaction extends Gui {
}
break;
case DEPOSIT:
is = CompatibleMaterial.GREEN_DYE.getItem();
is = XMaterial.GREEN_DYE.parseItem();
im = is.getItemMeta();
if (im != null) {
@ -170,7 +170,7 @@ public class GuiBankTransaction extends Gui {
setItem(i, is);
}
} else {
setItem(31, CompatibleMaterial.BARRIER.getItem());
setItem(31, XMaterial.BARRIER.parseItem());
}
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.gui.biome;
import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
@ -10,6 +11,8 @@ import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.Optional;
public class BiomeIcon {
public final CompatibleBiome biome;
public final ItemStack displayItem;
@ -21,17 +24,16 @@ public class BiomeIcon {
public BiomeIcon(SkyBlock plugin, CompatibleBiome biome) {
this.biome = biome;
FileConfiguration biomeConfig = plugin.getBiomes();
CompatibleMaterial tempMat = CompatibleMaterial.getMaterial(biomeConfig.getString("Biomes." + biome.name() + ".DisplayItem.Material"));
if (tempMat == null) {
tempMat = CompatibleMaterial.STONE;
Optional<XMaterial> tempMat = CompatibleMaterial.getMaterial(biomeConfig.getString("Biomes." + biome.name() + ".DisplayItem.Material"));
if (!tempMat.isPresent()) {
tempMat = Optional.of(XMaterial.STONE);
}
byte tempData = (byte) biomeConfig.getInt("Biomes." + biome.name() + ".DisplayItem.Data", 0);
CompatibleMaterial displayMaterial = CompatibleMaterial.getMaterial(tempMat.getMaterial(), tempData);
if (displayMaterial == null) {
displayMaterial = CompatibleMaterial.STONE;
if (!tempMat.isPresent()) {
tempMat = Optional.ofNullable(XMaterial.STONE);
}
this.displayItem = displayMaterial.getItem();
this.displayItem = tempMat.get().parseItem();
ItemMeta im = this.displayItem.getItemMeta();
if (im != null) {
im.setDisplayName(ChatColor.translateAlternateColorCodes('&', biomeConfig.getString("Biomes." + biome.name() + ".DisplayName", biome.name())));

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.gui.biome;
import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -63,13 +63,13 @@ public class GuiBiome extends Gui {
}
setActionForRange(0, 0, 5, 9, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Biome.Item.Exit.Displayname"))), (event) -> {
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Biome.Item.Exit.Displayname"))), (event) -> {
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
@ -80,11 +80,11 @@ public class GuiBiome extends Gui {
i.set(TextUtils.formatText(i.next().replace("%biome_type", this.island.getBiomeName())));
}
setItem(4, GuiUtils.createButtonItem(CompatibleMaterial.PAINTING, // Info
setItem(4, GuiUtils.createButtonItem(XMaterial.PAINTING, // Info
TextUtils.formatText(this.languageLoad.getString("Menu.Biome.Item.Info.Displayname")), lore));
for (int i = 9; i < 18; i++) {
setItem(i, CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setItem(i, XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
}
List<BiomeIcon> biomes = new ArrayList<>();
@ -121,7 +121,7 @@ public class GuiBiome extends Gui {
this.pages = (int) Math.max(1, Math.ceil((double) biomes.size() / 27d));
if (this.page != 1) {
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 2, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Biome.Item.Last.Displayname"))),
(event) -> {
this.page--;
@ -130,7 +130,7 @@ public class GuiBiome extends Gui {
}
if (this.page != this.pages) {
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 6, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Biome.Item.Next.Displayname"))),
(event) -> {
this.page++;
@ -201,7 +201,7 @@ public class GuiBiome extends Gui {
});
}
} else {
setItem(31, CompatibleMaterial.BARRIER.getItem()); // TODO
setItem(31, XMaterial.BARRIER.parseItem()); // TODO
}
}
}

View File

@ -1,9 +1,9 @@
package com.songoda.skyblock.gui.coop;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.TextUtils;
@ -57,16 +57,16 @@ public class GuiCoop extends Gui {
}
setActionForRange(0, 0, 1, 8, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Exit.Displayname"))), (event) -> {
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE.);
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
List<String> addButtonLore = this.languageLoad.getStringList("Menu.Coop.Item.Information.Lore");
Collections.replaceAll(addButtonLore, "%coops", "" + coopPlayers.size());
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.PAINTING, // Add new
setButton(4, GuiUtils.createButtonItem(XMaterial.PAINTING, // Add new
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Information.Displayname")),
TextUtils.formatText(addButtonLore)),
(event) -> {
@ -89,18 +89,18 @@ public class GuiCoop extends Gui {
}
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Exit.Displayname"))), (event) -> {
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
for (int i = 9; i < 18; ++i) {
setItem(i, CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setItem(i, XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
}
if (coopPlayers.isEmpty()) {
ItemStack empty = CompatibleMaterial.BARRIER.getItem();
ItemStack empty = XMaterial.BARRIER.parseItem();
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Nothing.Displayname")));
empty.setItemMeta(emptyMeta);
@ -110,7 +110,7 @@ public class GuiCoop extends Gui {
this.pages = (int) Math.max(1, Math.ceil((double) coopPlayers.size() / 36d));
if (this.page != 1) {
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 2, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Previous.Displayname"))),
(event) -> {
this.page--;
@ -119,7 +119,7 @@ public class GuiCoop extends Gui {
}
if (this.page != this.pages) {
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 6, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Next.Displayname"))),
(event) -> {
this.page++;

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.gui.coop;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -28,7 +28,7 @@ public class GuiCoopChoose extends Gui {
this.island = island;
this.languageLoad = plugin.getFileManager()
.getConfig(new File(plugin.getDataFolder(), "language.yml")).getFileConfiguration();
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setDefaultItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
setTitle(TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Word.Normal") + " / " + this.languageLoad.getString("Menu.Coop.Item.Word.Temp")));
paint();
}
@ -40,28 +40,28 @@ public class GuiCoopChoose extends Gui {
this.inventory.clear();
}
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setDefaultItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
setActionForRange(0, 4, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Exit.Displayname"))), (event) -> {
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Exit.Displayname"))), (event) -> {
soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
});
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.OBSIDIAN, // Normal
setButton(3, GuiUtils.createButtonItem(XMaterial.OBSIDIAN, // Normal
TextUtils.formatText("&r" + this.languageLoad.getString("Menu.Coop.Item.Word.Normal"))),
(event) -> {
Bukkit.getServer().dispatchCommand(event.player,
"island coop " + this.targetPlayer + " " + this.languageLoad.getString("Menu.Coop.Item.Word.Normal"));
this.guiManager.showGUI(event.player, new GuiCoop(this.plugin, this.island, null));
});
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.GLASS, // Temp
setButton(5, GuiUtils.createButtonItem(XMaterial.GLASS, // Temp
TextUtils.formatText("&r" + this.languageLoad.getString("Menu.Coop.Item.Word.Temp"))),
(event) -> {
Bukkit.getServer().dispatchCommand(event.player,

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.gui.permissions;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -48,13 +48,13 @@ public class GuiAdminPermissions extends Gui {
}
setActionForRange(0, 0, 5, 9, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
@ -67,7 +67,7 @@ public class GuiAdminPermissions extends Gui {
this.pages = (int) Math.max(1, Math.ceil(itemCount / 36));
if (this.page != 1) {
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 2, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Categories.Item.Last.Displayname"))),
(event) -> {
this.page--;
@ -76,7 +76,7 @@ public class GuiAdminPermissions extends Gui {
}
if (this.page != this.pages) {
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 6, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.configLoad.getString("Menu.Settings.Categories.Item.Next.Displayname"))),
(event) -> {
this.page++;

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.gui.permissions;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -59,7 +59,7 @@ public class GuiPermissions extends Gui {
}
setActionForRange(0, 0, 5, 9, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
@ -67,14 +67,14 @@ public class GuiPermissions extends Gui {
if (this.role == IslandRole.VISITOR) {
if (this.configLoad.getBoolean("Island.Visitor.Welcome.Enable")) {
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.MAP,
setButton(5, GuiUtils.createButtonItem(XMaterial.MAP,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Visitor.Item.Welcome.Displayname")),
TextUtils.formatText(this.languageLoad.getStringList("Menu.Settings.Visitor.Item.Welcome.Lore"))),
(event) -> this.guiManager.showGUI(event.player, new GuiWelcomeEditor(this.plugin, this, this.island)));
}
if (this.configLoad.getBoolean("Island.Visitor.Signature.Enable")) {
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.PAPER,
setButton(3, GuiUtils.createButtonItem(XMaterial.PAPER,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Visitor.Item.Signature.Displayname")),
TextUtils.formatText(this.languageLoad.getStringList("Menu.Settings.Visitor.Item.Signature.Lore"))),
(event) -> this.guiManager.showGUI(event.player, new GuiSignatureEditor(this.plugin, this, this.island)));
@ -103,7 +103,7 @@ public class GuiPermissions extends Gui {
.replace("%visitors", String.valueOf(this.plugin.getIslandManager().getVisitorsAtIsland(this.island).size())));
}
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.PAINTING,
setButton(4, GuiUtils.createButtonItem(XMaterial.PAINTING,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Visitor.Item.Statistics.Displayname")),
welcomeFinal),
(event -> {
@ -125,7 +125,7 @@ public class GuiPermissions extends Gui {
}));
}
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
this.guiManager.showGUI(event.player, this.returnGui);
@ -144,7 +144,7 @@ public class GuiPermissions extends Gui {
this.pages = (int) Math.max(1, Math.ceil(itemCount / 36));
if (this.page != 1) {
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 2, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Categories.Item.Last.Displayname"))),
(event) -> {
this.page--;
@ -153,7 +153,7 @@ public class GuiPermissions extends Gui {
}
if (this.page != this.pages) {
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 6, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Settings.Categories.Item.Next.Displayname"))),
(event) -> {
this.page++;
@ -187,7 +187,7 @@ public class GuiPermissions extends Gui {
});
}
} else {
setItem(31, CompatibleMaterial.BARRIER.getItem()); // TODO
setItem(31, XMaterial.BARRIER.parseItem()); // TODO
}
}

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.gui.permissions;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
@ -29,21 +29,21 @@ public class GuiPermissionsSelector extends Gui {
setTitle(ChatColor.translateAlternateColorCodes('&',
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Title"))));
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.OAK_SIGN,
setButton(2, GuiUtils.createButtonItem(XMaterial.OAK_SIGN,
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Visitor.Displayname")),
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Visitor.Lore"))), (event) ->
this.guiManager.showGUI(event.player, island == null ?
new GuiAdminPermissions(plugin, IslandRole.VISITOR, this) :
new GuiPermissions(plugin, player, island, IslandRole.VISITOR, this)));
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.PAINTING,
setButton(3, GuiUtils.createButtonItem(XMaterial.PAINTING,
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Member.Displayname")),
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Member.Lore"))), (event) ->
this.guiManager.showGUI(event.player, island == null ?
new GuiAdminPermissions(plugin, IslandRole.MEMBER, this) :
new GuiPermissions(plugin, player, island, IslandRole.MEMBER, this)));
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.ITEM_FRAME,
setButton(4, GuiUtils.createButtonItem(XMaterial.ITEM_FRAME,
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Operator.Displayname")),
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Operator.Lore"))), (event) ->
this.guiManager.showGUI(event.player, island == null ?
@ -53,14 +53,14 @@ public class GuiPermissionsSelector extends Gui {
boolean isCoop = plugin.getConfiguration()
.getBoolean("Island.Coop.Enable");
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE,
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Exit.Displayname"))), (event) -> {
plugin.getSoundManager().playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
if (isCoop) {
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.NAME_TAG,
setButton(6, GuiUtils.createButtonItem(XMaterial.NAME_TAG,
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Coop.Displayname")),
TextUtils.formatText(configLoad.getStringList("Menu.Settings.Categories.Item.Coop.Lore"))), (event) ->
this.guiManager.showGUI(event.player, island == null ?
@ -68,7 +68,7 @@ public class GuiPermissionsSelector extends Gui {
new GuiPermissions(plugin, player, island, IslandRole.COOP, this)));
}
setButton(isCoop ? 7 : 8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_SAPLING.getItem(),
setButton(isCoop ? 7 : 8, GuiUtils.createButtonItem(XMaterial.OAK_SAPLING.parseItem(),
TextUtils.formatText(configLoad.getString("Menu." + admin + "Settings.Categories.Item.Owner.Displayname")),
TextUtils.formatText(configLoad.getStringList("Menu." + admin + "Settings.Categories.Item.Owner.Lore"))), (event) ->
this.guiManager.showGUI(event.player, island == null ?

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.gui.wip;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.TextUtils;
@ -47,31 +47,31 @@ public class GuiBans extends Gui {
}
setActionForRange(0, 0, 1, 8, null);
setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(0, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Bans.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, // Exit
setButton(8, GuiUtils.createButtonItem(XMaterial.OAK_FENCE_GATE, // Exit
TextUtils.formatText(this.languageLoad.getString("Menu.Bans.Item.Exit.Displayname"))), (event) -> {
this.soundManager.playSound(event.player, XSound.BLOCK_CHEST_CLOSE);
event.player.closeInventory();
});
for (int i = 9; i < 18; i++) {
setItem(i, CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
setItem(i, XMaterial.BLACK_STAINED_GLASS_PANE.parseItem());
}
List<UUID> bans = new ArrayList<>(this.island.getBan().getBans());
if (bans.isEmpty()) {
setItem(31, CompatibleMaterial.BARRIER.getItem());
setItem(31, XMaterial.BARRIER.parseItem());
} else {
this.pages = (int) Math.max(1, Math.ceil((double) bans.size() / 36d));
if (this.page != 1) {
setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 2, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Last.Displayname"))),
(event) -> {
this.page--;
@ -80,7 +80,7 @@ public class GuiBans extends Gui {
}
if (this.page != this.pages) {
setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton(5, 6, GuiUtils.createButtonItem(XMaterial.ARROW,
TextUtils.formatText(this.languageLoad.getString("Menu.Bank.Item.Next.Displayname"))),
(event) -> {
this.page++;

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.island;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.google.common.base.Strings;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager.Config;
@ -108,7 +108,7 @@ public class IslandLevel {
switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER.name();
material = XMaterial.REPEATER.name();
break;
}
}
@ -220,7 +220,7 @@ public class IslandLevel {
switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER.name();
material = XMaterial.REPEATER.name();
break;
}
}
@ -236,7 +236,7 @@ public class IslandLevel {
switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER.name();
material = XMaterial.REPEATER.name();
break;
}
}
@ -248,7 +248,7 @@ public class IslandLevel {
switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER.name();
material = XMaterial.REPEATER.name();
break;
}
}

View File

@ -6,6 +6,7 @@ import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.world.SWorldBorder;
import com.eatthepath.uuid.FastUUID;
@ -1403,13 +1404,13 @@ public class IslandManager {
public void removeSpawnProtection(org.bukkit.Location location) {
Block block = location.getBlock();
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MOVING_PISTON) {
if (CompatibleMaterial.getMaterial(block.getType()).orElse(null) == XMaterial.MOVING_PISTON) {
block.setType(Material.AIR);
}
block = location.clone().add(0.0D, 1.0D, 0.0D).getBlock();
if (CompatibleMaterial.getMaterial(block.getType()) == CompatibleMaterial.MOVING_PISTON) {
if (CompatibleMaterial.getMaterial(block.getType()).orElse(null) == XMaterial.MOVING_PISTON) {
block.setType(Material.AIR);
}
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.island.removal;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.blockscanner.BlockInfo;
import com.songoda.skyblock.blockscanner.BlockScanner;
@ -42,7 +43,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(CompatibleMaterial.AIR.getBlockMaterial());
XBlock.setType(block, XMaterial.AIR);
deleteAmount++;
it.remove();

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.island.reward;
import com.craftaro.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@ -36,7 +37,7 @@ public class LevelReward {
.replace("%player%", player.getName())
.trim();
plugin.getServer().dispatchCommand(plugin.getConsole(), cmd);
plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
}
}
}

View File

@ -2,6 +2,8 @@ package com.songoda.skyblock.levelling;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.blockscanner.BlockInfo;
import com.songoda.skyblock.island.Island;
@ -14,6 +16,7 @@ import com.songoda.skyblock.levelling.calculator.impl.EpicSpawnerCalculator;
import com.songoda.skyblock.levelling.calculator.impl.UltimateStackerCalculator;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.MaterialUtils;
import com.songoda.skyblock.utils.version.CompatibleSpawners;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -31,18 +34,19 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
public final class IslandLevelManager {
private final Map<Island, QueuedIslandScan> inScan;
private final Map<CompatibleMaterial, Double> worth;
private final Map<CompatibleMaterial, AmountMaterialPair> cachedPairs;
private final Map<XMaterial, Double> worth;
private final Map<XMaterial, AmountMaterialPair> cachedPairs;
private final SkyBlock plugin;
public IslandLevelManager(SkyBlock plugin) {
this.plugin = plugin;
this.inScan = new HashMap<>();
this.worth = new EnumMap<>(CompatibleMaterial.class);
this.cachedPairs = new EnumMap<>(CompatibleMaterial.class);
this.worth = new EnumMap<>(XMaterial.class);
this.cachedPairs = new EnumMap<>(XMaterial.class);
registerCalculators();
reloadWorth();
}
@ -122,49 +126,48 @@ public final class IslandLevelManager {
final ConfigurationSection current = materialSection.getConfigurationSection(key);
final CompatibleMaterial material = CompatibleMaterial.getMaterial(key);
final Optional<XMaterial> material = CompatibleMaterial.getMaterial(key);
if (material == null) {
if (!material.isPresent()) {
continue;
}
this.worth.put(material, current.getDouble("Points", 0.0));
this.worth.put(material.get(), current.getDouble("Points", 0.0));
}
}
public void addWorth(CompatibleMaterial material, double points) {
public void addWorth(XMaterial material, double points) {
this.worth.put(material, points);
}
public void removeWorth(CompatibleMaterial material) {
public void removeWorth(XMaterial material) {
this.worth.remove(material);
}
public List<LevellingMaterial> getWorthsAsLevelingMaterials() {
final List<LevellingMaterial> materials = new ArrayList<>(this.worth.size());
for (Entry<CompatibleMaterial, Double> entry : this.worth.entrySet()) {
for (Entry<XMaterial, Double> entry : this.worth.entrySet()) {
materials.add(new LevellingMaterial(entry.getKey(), entry.getValue()));
}
return materials;
}
public Map<CompatibleMaterial, Double> getWorths() {
public Map<XMaterial, Double> getWorths() {
return this.worth;
}
public double getWorth(CompatibleMaterial material) {
public double getWorth(XMaterial material) {
return this.worth.getOrDefault(material, 0d);
}
public boolean hasWorth(CompatibleMaterial material) {
public boolean hasWorth(XMaterial material) {
return this.worth.containsKey(material);
}
private void registerCalculators() {
final CompatibleMaterial spawner = CompatibleMaterial.SPAWNER;
final XMaterial spawner = XMaterial.SPAWNER;
final PluginManager pm = Bukkit.getPluginManager();
if (pm.isPluginEnabled("EpicSpawners")) {
@ -180,15 +183,15 @@ public final class IslandLevelManager {
AmountMaterialPair getAmountAndType(IslandScan scan, BlockInfo info) {
Block block = info.getWorld().getBlockAt(info.getX(), info.getY(), info.getZ());
CompatibleMaterial blockType = CompatibleMaterial.getBlockMaterial(block.getType());
Optional<XMaterial> blockType = CompatibleMaterial.getMaterial(block.getType());
if (blockType == CompatibleMaterial.AIR) {
if (!blockType.isPresent() || CompatibleMaterial.isAir(blockType.get())) {
return EMPTY;
}
CompatibleMaterial compMaterial = CompatibleMaterial.getMaterial(block);
Optional<XMaterial> compMaterial = CompatibleMaterial.getMaterial(block.getType());
if (compMaterial == null) {
if (!compMaterial.isPresent()) {
return EMPTY;
}
@ -198,28 +201,28 @@ public final class IslandLevelManager {
return EMPTY;
}
if (compMaterial.isTall()) {
if (MaterialUtils.isTall(compMaterial.orElse(XMaterial.STONE))) {
final Block belowBlock = block.getRelative(BlockFace.DOWN);
final CompatibleMaterial belowMaterial = CompatibleMaterial.getMaterial(belowBlock);
final XMaterial belowMaterial = CompatibleMaterial.getMaterial(belowBlock.getType()).get();
if (belowMaterial.isTall()) {
if (MaterialUtils.isTall(belowMaterial)) {
block = belowBlock;
blockType = belowMaterial;
blockType = Optional.of(belowMaterial);
scan.getDoubleBlocks().add(belowBlock.getLocation());
} else {
scan.getDoubleBlocks().add(block.getRelative(BlockFace.UP).getLocation());
}
}
final List<Calculator> calculators = CalculatorRegistry.getCalculators(blockType);
final List<Calculator> calculators = CalculatorRegistry.getCalculators(blockType.get());
final StackableManager stackableManager = this.plugin.getStackableManager();
final long stackSize = stackableManager == null ? 0 : stackableManager.getStackSizeOf(blockLocation, compMaterial);
final long stackSize = stackableManager == null ? 0 : stackableManager.getStackSizeOf(blockLocation, compMaterial.get());
if (calculators == null) {
if (stackSize > 1) {
return new AmountMaterialPair(compMaterial, stackSize);
return new AmountMaterialPair(compMaterial.get(), stackSize);
}
AmountMaterialPair cachedPair = this.cachedPairs.get(compMaterial);
@ -228,8 +231,8 @@ public final class IslandLevelManager {
return cachedPair;
}
cachedPair = new AmountMaterialPair(compMaterial, 1);
this.cachedPairs.put(compMaterial, cachedPair);
cachedPair = new AmountMaterialPair(compMaterial.get(), 1);
this.cachedPairs.put(compMaterial.get(), cachedPair);
return cachedPair;
}
@ -244,7 +247,7 @@ public final class IslandLevelManager {
amount = 1;
}
return new AmountMaterialPair(compMaterial, amount + stackSize);
return new AmountMaterialPair(compMaterial.get(), amount + stackSize);
}
public void updateLevel(Island island, Location location) {
@ -269,24 +272,24 @@ public final class IslandLevelManager {
private void updateLevelLocation(Island island, Location location) {
Block block = location.getBlock();
CompatibleMaterial material = null;
XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER;
material = XMaterial.REPEATER;
break;
}
}
if (material == null) {
material = CompatibleMaterial.getMaterial(block);
material = CompatibleMaterial.getMaterial(block.getType()).orElse(null);
}
if (material == null || material == CompatibleMaterial.AIR) {
if (material == null || material == XMaterial.AIR) {
return;
}
if (material == CompatibleMaterial.SPAWNER) {
if (material == XMaterial.SPAWNER) {
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners") ||
Bukkit.getPluginManager().isPluginEnabled("UltimateStacker") ||
Bukkit.getPluginManager().isPluginEnabled("WildStacker")) {
@ -296,7 +299,7 @@ public final class IslandLevelManager {
CompatibleSpawners spawner = CompatibleSpawners.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
if (spawner != null) {
material = CompatibleMaterial.getBlockMaterial(spawner.getMaterial());
material = CompatibleMaterial.getMaterial(spawner.getMaterial()).orElse(null);
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.levelling;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.blockscanner.BlockInfo;
import com.songoda.skyblock.blockscanner.BlockScanner;
@ -30,7 +30,7 @@ public final class IslandScan extends BukkitRunnable {
private final Set<Location> doubleBlocks;
private final Island island;
private final IslandWorld world;
private final Map<CompatibleMaterial, BlockAmount> amounts;
private final Map<XMaterial, BlockAmount> amounts;
private final SkyBlock plugin;
private int totalScanned;
@ -45,7 +45,7 @@ public final class IslandScan extends BukkitRunnable {
this.plugin = plugin;
this.island = island;
this.world = world;
this.amounts = new EnumMap<>(CompatibleMaterial.class);
this.amounts = new EnumMap<>(XMaterial.class);
this.doubleBlocks = new HashSet<>();
}
@ -130,7 +130,7 @@ public final class IslandScan extends BukkitRunnable {
return this.doubleBlocks;
}
public Map<CompatibleMaterial, BlockAmount> getAmounts() {
public Map<XMaterial, BlockAmount> getAmounts() {
return Collections.unmodifiableMap(this.amounts);
}

View File

@ -1,18 +1,18 @@
package com.songoda.skyblock.levelling;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.inventory.ItemStack;
public final class LevellingMaterial {
private final CompatibleMaterial materials;
private final XMaterial materials;
private double points;
public LevellingMaterial(CompatibleMaterial materials, double points) {
public LevellingMaterial(XMaterial materials, double points) {
this.materials = materials;
this.points = points;
}
public CompatibleMaterial getMaterials() {
public XMaterial getMaterials() {
return this.materials;
}
@ -25,6 +25,6 @@ public final class LevellingMaterial {
}
public ItemStack getItemStack() {
return this.materials.getItem();
return this.materials.parseItem();
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.levelling;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.IslandLevelChangeEvent;
import com.songoda.skyblock.island.Island;
@ -30,7 +30,7 @@ public class QueuedIslandScan {
private int executions;
private final int runEveryX;
private final Map<CompatibleMaterial, BlockAmount> amounts = new EnumMap<>(CompatibleMaterial.class);
private final Map<XMaterial, BlockAmount> amounts = new EnumMap<>(XMaterial.class);
private int totalScanned;
private int blocksSize;
@ -50,7 +50,7 @@ public class QueuedIslandScan {
this.totalScanned += this.currentScan.getTotalScanned();
this.blocksSize += this.currentScan.getBlocksSize();
for (Map.Entry<CompatibleMaterial, BlockAmount> entry : this.currentScan.getAmounts().entrySet()) {
for (Map.Entry<XMaterial, BlockAmount> entry : this.currentScan.getAmounts().entrySet()) {
if (this.amounts.containsKey(entry.getKey())) {
this.amounts.get(entry.getKey()).increaseAmount(entry.getValue().getAmount());
} else {
@ -76,7 +76,7 @@ public class QueuedIslandScan {
public void finalizeScan() {
final Map<String, Long> materials = new HashMap<>(this.amounts.size());
for (Map.Entry<CompatibleMaterial, BlockAmount> entry : this.amounts.entrySet()) {
for (Map.Entry<XMaterial, BlockAmount> entry : this.amounts.entrySet()) {
materials.put(entry.getKey().name(), entry.getValue().getAmount());
}

View File

@ -1,13 +1,13 @@
package com.songoda.skyblock.levelling.amount;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
public class AmountMaterialPair {
private final long amount;
private final CompatibleMaterial material;
private final XMaterial material;
public AmountMaterialPair(CompatibleMaterial type, long amount) {
public AmountMaterialPair(XMaterial type, long amount) {
this.amount = amount;
this.material = type;
}
@ -16,7 +16,7 @@ public class AmountMaterialPair {
return this.amount;
}
public CompatibleMaterial getType() {
public XMaterial getType() {
return this.material;
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.levelling.calculator;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import java.util.ArrayList;
import java.util.HashMap;
@ -8,14 +8,14 @@ import java.util.List;
import java.util.Map;
public final class CalculatorRegistry {
private static final Map<CompatibleMaterial, List<Calculator>> CALCULATORS = new HashMap<>();
private static final Map<XMaterial, List<Calculator>> CALCULATORS = new HashMap<>();
public static void registerCalculator(Calculator calculator, CompatibleMaterial to) {
public static void registerCalculator(Calculator calculator, XMaterial to) {
List<Calculator> list = CALCULATORS.computeIfAbsent(to, key -> new ArrayList<>());
list.add(calculator);
}
public static List<Calculator> getCalculators(CompatibleMaterial type) {
public static List<Calculator> getCalculators(XMaterial type) {
return CALCULATORS.get(type);
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.limit.impl;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
@ -15,12 +16,13 @@ import org.bukkit.entity.Player;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
public final class BlockLimitation extends EnumLimitation<XMaterial> {
public BlockLimitation() {
super(CompatibleMaterial.class);
super(XMaterial.class);
}
@Override
@ -29,7 +31,7 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
}
@Override
public boolean hasTooMuch(long currentAmount, Enum<CompatibleMaterial> type) {
public boolean hasTooMuch(long currentAmount, Enum<XMaterial> type) {
throw new UnsupportedOperationException("Not implemented. Use getBlockLimit and isBlockLimitExceeded instead.");
}
@ -46,13 +48,13 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
for (String key : keys) {
final String enumName = key.toUpperCase(Locale.ENGLISH);
CompatibleMaterial type = CompatibleMaterial.getMaterial(enumName);
Optional<XMaterial> type = CompatibleMaterial.getMaterial(enumName);
if (type == null) {
if (!type.isPresent()) {
throw new IllegalArgumentException("Unable to parse Materials from '" + enumName + "' in the Section '" + loadFrom.getCurrentPath() + "'");
}
getMap().put(type, loadFrom.getLong(key));
getMap().put(type.get(), loadFrom.getLong(key));
}
}
@ -70,21 +72,21 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
return -1;
}
CompatibleMaterial material = null;
XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (type.toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER;
material = XMaterial.REPEATER;
break;
}
}
if (material == null) {
material = CompatibleMaterial.getMaterial(type);
}
if (material == null) {
return -1;
Optional<XMaterial> material1 = CompatibleMaterial.getMaterial(type);
if (!material1.isPresent()) {
return -1;
}
material = material1.get();
}
final String name = material.name().toLowerCase();
@ -93,10 +95,10 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
}
public boolean isBlockLimitExceeded(Block block, long limit) {
return this.isBlockLimitExceeded(CompatibleMaterial.getMaterial(block), block.getLocation(), limit);
return this.isBlockLimitExceeded(CompatibleMaterial.getMaterial(block.getType()).get(), block.getLocation(), limit);
}
public boolean isBlockLimitExceeded(CompatibleMaterial type, Location loc, long limit) {
public boolean isBlockLimitExceeded(XMaterial type, Location loc, long limit) {
if (limit == -1) {
return false;
}
@ -105,15 +107,15 @@ public final class BlockLimitation extends EnumLimitation<CompatibleMaterial> {
final Island island = islandManager.getIslandAtLocation(loc);
final long totalPlaced;
if (type == CompatibleMaterial.SPAWNER) {
if (type == XMaterial.SPAWNER) {
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum();
} else {
CompatibleMaterial material = null;
XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (type.toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER;
material = XMaterial.REPEATER;
break;
}
}

View File

@ -3,6 +3,8 @@ package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.hooks.LogManager;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.NumberUtils;
import com.google.common.collect.Lists;
@ -20,6 +22,7 @@ import com.songoda.skyblock.limit.impl.BlockLimitation;
import com.songoda.skyblock.permission.PermissionManager;
import com.songoda.skyblock.stackable.Stackable;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.utils.MaterialUtils;
import com.songoda.skyblock.utils.version.CompatibleSpawners;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.world.WorldManager;
@ -109,19 +112,19 @@ public class BlockListeners implements Listener {
}
if (stackableManager != null && stackableManager.isStacked(blockLocation)) {
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block));
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block.getType()).get());
if (stackable != null) {
CompatibleMaterial material = null;
XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER;
material = XMaterial.REPEATER;
break;
}
}
if (material == null) {
material = CompatibleMaterial.getMaterial(block);
material = CompatibleMaterial.getMaterial(block.getType()).get();
}
byte data = block.getData();
@ -131,14 +134,14 @@ public class BlockListeners implements Listener {
int count = stackable.getSize();
droppedAmount = count;
while (count > 64) {
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material.getMaterial(), 64, data));
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material.parseMaterial(), 64, data));
count -= 64;
}
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material.getMaterial(), count, block.getData()));
dropLoc.getWorld().dropItemNaturally(dropLoc, new ItemStack(material.parseMaterial(), count, block.getData()));
block.setType(Material.AIR);
stackable.setSize(0);
} else {
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5), new ItemStack(material.getMaterial(), 1, data));
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5), new ItemStack(material.parseMaterial(), 1, data));
stackable.takeOne();
droppedAmount = 1;
}
@ -190,37 +193,36 @@ public class BlockListeners implements Listener {
return;
}
CompatibleMaterial material = null;
XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER;
material = XMaterial.REPEATER;
break;
}
}
if (material == null) {
material = CompatibleMaterial.getMaterial(block);
material = CompatibleMaterial.getMaterial(block.getType()).get();
}
if (material == null) {
return;
}
if (material.isTall()) {
if (MaterialUtils.isTall(material)) {
final org.bukkit.block.Block belowBlock = block.getRelative(BlockFace.DOWN);
if (CompatibleMaterial.getMaterial(belowBlock).isTall()) {
if (MaterialUtils.isTall(CompatibleMaterial.getMaterial(belowBlock.getType()).orElse(XMaterial.STONE))) {
block = belowBlock;
}
}
if (block.getType() == CompatibleMaterial.SPAWNER.getBlockMaterial()) {
if (block.getType() == XMaterial.SPAWNER.parseMaterial()) {
CompatibleSpawners spawner = CompatibleSpawners.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
if (spawner != null) {
material = CompatibleMaterial.getBlockMaterial(spawner.getMaterial());
material = CompatibleMaterial.getMaterial(spawner.getMaterial()).get();
}
}
@ -356,18 +358,18 @@ public class BlockListeners implements Listener {
ItemStack item = event.getItemInHand();
if (limits.isBlockLimitExceeded(block, limit) && CompatibleMaterial.getMaterial(item) != CompatibleMaterial.ENDER_EYE) {
CompatibleMaterial material = null;
if (limits.isBlockLimitExceeded(block, limit) && !XMaterial.ENDER_EYE.isSimilar(item)) {
XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
material = CompatibleMaterial.REPEATER;
material = XMaterial.REPEATER;
break;
}
}
if (material == null) {
material = CompatibleMaterial.getMaterial(block);
material = CompatibleMaterial.getMaterial(block.getType()).get();
}
this.plugin.getMessageManager().sendMessage(player, this.plugin.getLanguage().getString("Island.Limit.Block.Exceeded.Message")
@ -382,19 +384,19 @@ public class BlockListeners implements Listener {
return;
}
if (event.getBlock().getType() == CompatibleMaterial.END_PORTAL_FRAME.getMaterial()
&& event.getPlayer().getItemInHand().getType() == CompatibleMaterial.ENDER_EYE.getMaterial()) {
if (event.getBlock().getType() == XMaterial.END_PORTAL_FRAME.parseMaterial()
&& XMaterial.ENDER_EYE.isSimilar(event.getPlayer().getItemInHand())) {
return;
}
// Not util used 2 islandLevelManager if condition is true
// Sponge level dupe fix
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13) &&
block.getType() == CompatibleMaterial.SPONGE.getBlockMaterial()) {
block.getType() == XMaterial.SPONGE.parseMaterial()) {
Bukkit.getScheduler().runTask(this.plugin, () -> {
if (blockLoc.getBlock().getType() == CompatibleMaterial.WET_SPONGE.getBlockMaterial()) {
if (blockLoc.getBlock().getType() == XMaterial.WET_SPONGE.parseMaterial()) {
IslandLevel level = island.getLevel();
CompatibleMaterial material = CompatibleMaterial.SPONGE;
XMaterial material = XMaterial.SPONGE;
if (level.hasMaterial(material.name())) {
long materialAmount = level.getMaterialAmount(material.name());
@ -545,7 +547,7 @@ public class BlockListeners implements Listener {
}
if (!this.plugin.getConfiguration().getBoolean("Island.Block.Piston.Connected.Extend")) {
if (block.getType() == CompatibleMaterial.PISTON.getMaterial() || block.getType() == CompatibleMaterial.STICKY_PISTON.getMaterial()) {
if (block.getType() == XMaterial.PISTON.parseMaterial() || block.getType() == XMaterial.STICKY_PISTON.parseMaterial()) {
event.setCancelled(true);
return;
}
@ -644,7 +646,7 @@ public class BlockListeners implements Listener {
}
if (!this.plugin.getConfiguration().getBoolean("Island.Block.Piston.Connected.Retract")) {
if (block.getType() == CompatibleMaterial.PISTON.getMaterial() || block.getType() == CompatibleMaterial.STICKY_PISTON.getMaterial()) {
if (block.getType() == XMaterial.PISTON.parseMaterial() || block.getType() == XMaterial.STICKY_PISTON.parseMaterial()) {
event.setCancelled(true);
return;
}
@ -792,7 +794,7 @@ public class BlockListeners implements Listener {
BlockFace dispenserDirection = ((org.bukkit.material.Dispenser) event.getBlock().getState().getData()).getFacing();
org.bukkit.block.Block placeLocation = event.getBlock().getRelative(dispenserDirection);
if (CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.WATER_BUCKET
if (XMaterial.WATER_BUCKET.isSimilar(event.getItem())
&& this.plugin.getConfiguration().getBoolean("Island.Nether.AllowNetherWater", false)) {
placeLocation.setType(Material.WATER);
}
@ -822,22 +824,21 @@ public class BlockListeners implements Listener {
return;
}
CompatibleMaterial destmaterial = CompatibleMaterial.getMaterial(event.getToBlock());
if (destmaterial == CompatibleMaterial.AIR) {
XMaterial destmaterial = CompatibleMaterial.getMaterial(event.getToBlock().getType()).orElse(XMaterial.AIR);
if (CompatibleMaterial.isAir(destmaterial)) {
return;
}
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) {
switch (event.getToBlock().getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON":
destmaterial = CompatibleMaterial.REPEATER;
destmaterial = XMaterial.REPEATER;
break;
}
}
CompatibleMaterial srcmaterial = CompatibleMaterial.getMaterial(event.getBlock());
if (srcmaterial != CompatibleMaterial.WATER
&& srcmaterial != CompatibleMaterial.LAVA) {
XMaterial srcmaterial = CompatibleMaterial.getMaterial(event.getBlock().getType()).orElse(null);
if (srcmaterial != XMaterial.WATER && srcmaterial != XMaterial.LAVA) {
return;
}
@ -847,7 +848,7 @@ public class BlockListeners implements Listener {
}
IslandLevel level = island.getLevel();
if (destmaterial != null && level.hasMaterial(destmaterial.name())) {
if (level.hasMaterial(destmaterial.name())) {
long materialAmount = level.getMaterialAmount(destmaterial.name());
if (materialAmount - 1 <= 0) {
@ -865,11 +866,11 @@ public class BlockListeners implements Listener {
IslandManager islandManager = this.plugin.getIslandManager();
IslandWorld world = worldManager.getIslandWorld(block.getWorld());
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
XMaterial material = CompatibleMaterial.getMaterial(block.getType()).orElse(null);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)
&& material != CompatibleMaterial.WATER
&& material != CompatibleMaterial.LAVA) {
&& material != XMaterial.WATER
&& material != XMaterial.LAVA) {
return false;
}
@ -959,8 +960,7 @@ public class BlockListeners implements Listener {
islandLevelManager.updateLevel(island, genState.getLocation());
});
} else {
Bukkit.getScheduler().runTask(this.plugin, () ->
block.setType(CompatibleMaterial.COBBLESTONE.getMaterial()));
Bukkit.getScheduler().runTask(this.plugin, () -> XBlock.setType(block, XMaterial.COBBLESTONE));
}
});
return true;

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
@ -28,9 +29,9 @@ public class BucketListeners implements Listener {
IslandManager islandManager = this.plugin.getIslandManager();
CompatibleMaterial clickedBlock = CompatibleMaterial.getBlockMaterial(event.getBlockClicked().getType());
XMaterial clickedBlock = CompatibleMaterial.getMaterial(event.getBlockClicked().getType()).orElse(null);
if (clickedBlock == CompatibleMaterial.WATER || clickedBlock == CompatibleMaterial.LAVA) {
if (clickedBlock == XMaterial.WATER || clickedBlock == XMaterial.LAVA) {
if (this.plugin.getWorldManager().isIslandWorld(block.getWorld())) {
Island island = islandManager.getIslandAtLocation(block.getLocation());
// Check permissions.

View File

@ -2,6 +2,8 @@ package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandEnvironment;
@ -70,6 +72,7 @@ import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
@ -355,10 +358,10 @@ public class EntityListeners implements Listener {
|| LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.VISITOR).clone().subtract(0, 1, 0)))
&& this.plugin.getConfiguration().getBoolean("Island.Spawn.Protection")) {
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
Optional<XMaterial> material = CompatibleMaterial.getMaterial(block.getType());
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
event.getEntity().remove();
event.getBlock().setType(material.getBlockMaterial());
XBlock.setType(event.getBlock(), material.get());
}, 1L);
return;
}
@ -407,20 +410,20 @@ public class EntityListeners implements Listener {
}
removeBlockFromLevel(island, block);
CompatibleMaterial materials;
Optional<XMaterial> materials;
if (event.getTo() != Material.AIR) {
materials = CompatibleMaterial.getBlockMaterial(event.getTo());
materials = CompatibleMaterial.getMaterial(event.getTo());
if (materials != null) {
if (materials.isPresent()) {
long materialAmount = 0;
IslandLevel level = island.getLevel();
if (level.hasMaterial(materials.name())) {
materialAmount = level.getMaterialAmount(materials.name());
if (level.hasMaterial(materials.get().name())) {
materialAmount = level.getMaterialAmount(materials.get().name());
}
level.setMaterialAmount(materials.name(), materialAmount + 1);
level.setMaterialAmount(materials.get().name(), materialAmount + 1);
}
}
@ -459,16 +462,16 @@ public class EntityListeners implements Listener {
Location blockLocation = block.getLocation();
if (stackableManager != null && stackableManager.isStacked(blockLocation)) {
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block));
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block.getType()).get());
if (stackable != null) {
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
Optional<XMaterial> material = CompatibleMaterial.getMaterial(block.getType());
byte data = block.getData();
int removedAmount = (int) (Math.random() * Math.min(64, stackable.getSize() - 1));
stackable.take(removedAmount);
Bukkit.getScheduler().runTask(this.plugin, () -> {
block.getWorld().dropItemNaturally(blockLocation.clone().add(.5, 1, .5),
new ItemStack(material.getMaterial(), (int) (Math.random() * removedAmount), data));
new ItemStack(material.get().parseMaterial(), (int) (Math.random() * removedAmount), data));
});
if (stackable.getSize() <= 1) {
@ -499,7 +502,7 @@ public class EntityListeners implements Listener {
}
}
private void removeBlockFromLevel(Island island, CompatibleMaterial material) {
private void removeBlockFromLevel(Island island, XMaterial material) {
if (material == null) {
return;
}
@ -517,7 +520,7 @@ public class EntityListeners implements Listener {
}
private void removeBlockFromLevel(Island island, Block block) {
removeBlockFromLevel(island, CompatibleMaterial.getBlockMaterial(block.getType()));
removeBlockFromLevel(island, CompatibleMaterial.getMaterial(block.getType()).get());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@ -590,14 +593,14 @@ public class EntityListeners implements Listener {
if (livingEntity instanceof Steerable) {
Steerable steerable = (Steerable) livingEntity;
if (steerable.hasSaddle()) {
dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1));
dontMultiply.add(new ItemStack(XMaterial.SADDLE.parseMaterial(), 1));
}
}
} else {
if (livingEntity instanceof Pig) {
Pig pig = (Pig) livingEntity;
if (pig.hasSaddle()) {
dontMultiply.add(new ItemStack(CompatibleMaterial.SADDLE.getMaterial(), 1));
dontMultiply.add(new ItemStack(XMaterial.SADDLE.parseMaterial(), 1));
}
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
@ -18,6 +19,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
public class FallBreakListeners implements Listener {
@ -43,7 +45,7 @@ public class FallBreakListeners implements Listener {
Island island = islandManager.getIslandAtLocation(ent.getLocation());
if (island != null) {
CompatibleMaterial material = null;
Optional<XMaterial> material = Optional.empty();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
material = CompatibleMaterial.getMaterial(ent.getBlockData().getMaterial());
} else {
@ -55,16 +57,16 @@ public class FallBreakListeners implements Listener {
}
}
if (material != null) {
if (material.isPresent()) {
IslandLevel level = island.getLevel();
if (level.hasMaterial(material.name())) {
long materialAmount = level.getMaterialAmount(material.name());
if (level.hasMaterial(material.get().name())) {
long materialAmount = level.getMaterialAmount(material.get().name());
if (materialAmount <= 1) {
level.removeMaterial(material.name());
level.removeMaterial(material.get().name());
} else {
level.setMaterialAmount(material.name(), materialAmount - 1);
level.setMaterialAmount(material.get().name(), materialAmount - 1);
}
}
}
@ -85,7 +87,7 @@ public class FallBreakListeners implements Listener {
if (event.getEntity() instanceof FallingBlock) {
WorldManager worldManager = this.plugin.getWorldManager();
if (worldManager.isIslandWorld(event.getEntity().getLocation().getWorld())) {
if (event.getTo() != CompatibleMaterial.AIR.getMaterial()) {
if (!CompatibleMaterial.isAir(CompatibleMaterial.getMaterial(event.getTo()).orElse(XMaterial.STONE))) {
this.fallingBlocks.remove(event.getEntity());
} else if (!event.isCancelled()) {
this.fallingBlocks.add((FallingBlock) event.getEntity());

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandManager;
@ -25,6 +26,7 @@ import org.bukkit.material.Crops;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
@SuppressWarnings("deprecation")
public class GrowListeners implements Listener {
@ -116,9 +118,9 @@ public class GrowListeners implements Listener {
ex.printStackTrace();
}
} else {
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")) {
Optional<XMaterial> type = CompatibleMaterial.getMaterial(block.getType());
if (block.getState().getData() instanceof Crops || type.get().name().equals("BEETROOT_BLOCK") || type.get().name().equals("CARROT") || type.get().name().equals("POTATO")
|| type.get().name().equals("WHEAT") || type.get().name().equals("CROPS")) {
try {
block.getClass().getMethod("setData", byte.class).invoke(block, (byte) (block.getData() + 1));
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException |

View File

@ -3,6 +3,8 @@ package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleHand;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.hooks.LogManager;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils;
@ -42,6 +44,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import java.io.File;
import java.util.HashMap;
import java.util.Optional;
public class InteractListeners implements Listener {
private final SkyBlock plugin;
@ -58,7 +61,7 @@ public class InteractListeners implements Listener {
Player player = event.getPlayer();
Block block = event.getClickedBlock().getRelative(event.getBlockFace());
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
Optional<XMaterial> material = CompatibleMaterial.getMaterial(block.getType());
IslandManager islandManager = this.plugin.getIslandManager();
WorldManager worldManager = this.plugin.getWorldManager();
IslandLevelManager levellingManager = this.plugin.getLevellingManager();
@ -66,14 +69,13 @@ public class InteractListeners implements Listener {
return;
}
CompatibleMaterial itemMaterial = CompatibleMaterial.getMaterial(event.getItem());
if (event.getAction() == Action.RIGHT_CLICK_BLOCK
&& worldManager.getIslandWorld(block.getWorld()) == IslandWorld.NETHER
&& (itemMaterial == CompatibleMaterial.WATER_BUCKET
|| itemMaterial == CompatibleMaterial.TROPICAL_FISH_BUCKET
|| itemMaterial == CompatibleMaterial.COD_BUCKET
|| itemMaterial == CompatibleMaterial.SALMON_BUCKET
|| itemMaterial == CompatibleMaterial.PUFFERFISH_BUCKET)) {
&& (XMaterial.WATER_BUCKET.isSimilar(event.getItem())
|| XMaterial.TROPICAL_FISH_BUCKET.isSimilar(event.getItem())
|| XMaterial.COD_BUCKET.isSimilar(event.getItem())
|| XMaterial.SALMON_BUCKET.isSimilar(event.getItem())
|| XMaterial.PUFFERFISH_BUCKET.isSimilar(event.getItem()))) {
Location blockLoc = block.getLocation();
Island island = islandManager.getIslandAtLocation(blockLoc);
@ -95,16 +97,16 @@ public class InteractListeners implements Listener {
return;
}
CompatibleMaterial type = CompatibleMaterial.getMaterial(block);
Optional<XMaterial> type = CompatibleMaterial.getMaterial(block.getType());
if (type.name().contains("SLAB")
|| type == CompatibleMaterial.BROWN_MUSHROOM
|| type == CompatibleMaterial.RED_MUSHROOM
|| type == CompatibleMaterial.CHEST
|| type == CompatibleMaterial.ENDER_CHEST
|| type == CompatibleMaterial.TRAPPED_CHEST
|| type == CompatibleMaterial.END_PORTAL
|| type == CompatibleMaterial.ENCHANTING_TABLE) {
if (type.get().name().contains("SLAB")
|| type.get() == XMaterial.BROWN_MUSHROOM
|| type.get() == XMaterial.RED_MUSHROOM
|| type.get() == XMaterial.CHEST
|| type.get() == XMaterial.ENDER_CHEST
|| type.get() == XMaterial.TRAPPED_CHEST
|| type.get() == XMaterial.END_PORTAL
|| type.get() == XMaterial.ENCHANTING_TABLE) {
event.setCancelled(true);
return;
}
@ -130,10 +132,10 @@ public class InteractListeners implements Listener {
long limit = limits.getBlockLimit(player, Material.WATER);
if (limits.isBlockLimitExceeded(itemMaterial, block.getLocation(), limit)) {
if (limits.isBlockLimitExceeded(CompatibleMaterial.getMaterial(event.getItem().getType()).get(), block.getLocation(), limit)) {
this.plugin.getMessageManager().sendMessage(player, this.plugin.getLanguage().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(itemMaterial.name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
.replace("%type", WordUtils.capitalizeFully(event.getItem().getType().name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
this.plugin.getSoundManager().playSound(player, XSound.ENTITY_VILLAGER_NO);
event.setCancelled(true);
@ -168,7 +170,7 @@ public class InteractListeners implements Listener {
return;
}
CompatibleMaterial material = block == null ? null : CompatibleMaterial.getMaterial(block.getType());
Optional<XMaterial> material = block == null ? Optional.empty() : CompatibleMaterial.getMaterial(block.getType());
// Check permissions.
if (!this.plugin.getPermissionManager().processPermission(event, player, island)) {
@ -176,23 +178,23 @@ public class InteractListeners implements Listener {
}
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
final CompatibleMaterial blockType = CompatibleMaterial.getBlockMaterial(event.getClickedBlock().getType());
final CompatibleMaterial heldType;
final Optional<XMaterial> blockType = CompatibleMaterial.getMaterial(event.getClickedBlock().getType());
final XMaterial heldType;
final ItemStack item = event.getItem();
if (item != null && CompatibleMaterial.getMaterial(item.getType()) != CompatibleMaterial.AIR) {
heldType = CompatibleMaterial.getMaterial(event.getItem());
if (item != null && !XMaterial.AIR.isSimilar(item)) {
heldType = CompatibleMaterial.getMaterial(event.getItem().getType()).get();
} else {
heldType = CompatibleMaterial.AIR;
heldType = XMaterial.AIR;
}
if (stackableManager != null && block != null && stackableManager.isStacked(block.getLocation())) {
if (blockType == CompatibleMaterial.DRAGON_EGG) {
if (blockType.get() == XMaterial.DRAGON_EGG) {
event.setCancelled(true);
}
}
if (stackableManager != null && stackableManager.isStackableMaterial(heldType) && blockType == heldType
if (stackableManager != null && stackableManager.isStackableMaterial(heldType) && blockType.get() == heldType
&& !player.isSneaking() && this.plugin.getPermissionManager().hasPermission(player, island, "Place")
&& (!this.plugin.getConfiguration().getBoolean("Island.Stackable.RequirePermission")
|| player.hasPermission("fabledskyblock.stackable"))) {
@ -211,7 +213,7 @@ public class InteractListeners implements Listener {
if (limits.isBlockLimitExceeded(block, limit)) {
this.plugin.getMessageManager().sendMessage(player,
this.plugin.getFileManager().getConfig(new File(this.plugin.getDataFolder(), "language.yml")).getFileConfiguration().getString("Island.Limit.Block.Exceeded.Message")
.replace("%type", WordUtils.capitalizeFully(material.name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
.replace("%type", WordUtils.capitalizeFully(material.get().name().replace("_", " "))).replace("%limit", NumberUtils.formatNumber(limit)));
this.plugin.getSoundManager().playSound(player, XSound.ENTITY_VILLAGER_NO);
event.setCancelled(true);
@ -219,7 +221,7 @@ public class InteractListeners implements Listener {
}
Location location = event.getClickedBlock().getLocation();
Stackable stackable = stackableManager.getStack(location, blockType);
Stackable stackable = stackableManager.getStack(location, blockType.get());
int itemAmount = event.getItem().getAmount();
FileManager.Config config = this.plugin.getFileManager().getConfig(new File(this.plugin.getDataFolder(), "config.yml"));
@ -227,10 +229,10 @@ public class InteractListeners implements Listener {
if (configLoad.getBoolean("Island.Stackable.Limit.Enable")) {
// Add block to stackable
int maxStackSize = getStackLimit(player, material);
int maxStackSize = getStackLimit(player, material.get());
if (stackable == null) {
stackableManager.addStack(stackable = new Stackable(location, blockType, maxStackSize));
stackableManager.addStack(stackable = new Stackable(location, blockType.get(), maxStackSize));
stackable.setSize(itemAmount + 1);
if (stackable.isMaxSize()) {
stackable.setSize(stackable.getMaxSize());
@ -252,7 +254,7 @@ public class InteractListeners implements Listener {
} else {
if (stackable == null) {
stackableManager.addStack(stackable = new Stackable(location, blockType));
stackableManager.addStack(stackable = new Stackable(location, blockType.get()));
stackable.setSize(itemAmount + 1);
} else {
stackable.setSize(stackable.getSize() + itemAmount);
@ -280,11 +282,11 @@ public class InteractListeners implements Listener {
return;
}
if (level.hasMaterial(material.name())) {
materialAmmount = level.getMaterialAmount(material.name());
if (level.hasMaterial(material.get().name())) {
materialAmmount = level.getMaterialAmount(material.get().name());
}
level.setMaterialAmount(material.name(), materialAmmount + itemAmount);
level.setMaterialAmount(material.get().name(), materialAmmount + itemAmount);
return;
}
@ -299,18 +301,18 @@ public class InteractListeners implements Listener {
}
if (player.getGameMode() == GameMode.SURVIVAL
&& material == CompatibleMaterial.OBSIDIAN
&& material.get() == XMaterial.OBSIDIAN
&& event.getItem() != null
&& CompatibleMaterial.getMaterial(event.getItem()) != CompatibleMaterial.AIR
&& CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.BUCKET) {
&& !XMaterial.AIR.isSimilar(event.getItem())
&& XMaterial.BUCKET.isSimilar(event.getItem())) {
if (this.plugin.getFileManager().getConfig(new File(this.plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Block.Obsidian.Enable")) {
this.plugin.getSoundManager().playSound(block.getLocation(), XSound.BLOCK_FIRE_EXTINGUISH);
block.setType(CompatibleMaterial.AIR.getBlockMaterial());
XBlock.setType(block, XMaterial.AIR);
ItemUtils.takeActiveItem(player, CompatibleHand.getHand(event));
HashMap<Integer, ItemStack> overflow = player.getInventory().addItem(CompatibleMaterial.LAVA_BUCKET.getItem());
HashMap<Integer, ItemStack> overflow = player.getInventory().addItem(XMaterial.LAVA_BUCKET.parseItem());
for (ItemStack i : overflow.values()) {
block.getWorld().dropItemNaturally(block.getLocation(), i);
}
@ -318,7 +320,7 @@ public class InteractListeners implements Listener {
event.setCancelled(true);
return;
}
} else if (material == CompatibleMaterial.END_PORTAL_FRAME) {
} else if (material.get() == XMaterial.END_PORTAL_FRAME) {
if (this.plugin.getFileManager().getConfig(new File(this.plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getBoolean("Island.Block.EndFrame.Enable")) {
@ -329,11 +331,11 @@ public class InteractListeners implements Listener {
ItemStack is = event.getPlayer().getItemInHand();
boolean hasEye = ((block.getData() >> 2) & 1) == 1;
if (CompatibleMaterial.getMaterial(is.getType()) == CompatibleMaterial.AIR) {
if (XMaterial.AIR.isSimilar(is)) {
int size = 1;
if (stackableManager != null && stackableManager.isStacked(block.getLocation())) {
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.END_PORTAL_FRAME);
Stackable stackable = stackableManager.getStack(block.getLocation(), XMaterial.END_PORTAL_FRAME);
stackable.takeOne();
if (stackable.getSize() <= 1) {
@ -342,12 +344,12 @@ public class InteractListeners implements Listener {
size = stackable.getSize();
} else {
block.setType(CompatibleMaterial.AIR.getBlockMaterial());
XBlock.setType(block, XMaterial.AIR);
}
player.getInventory().addItem(new ItemStack(CompatibleMaterial.END_PORTAL_FRAME.getMaterial(), 1));
player.getInventory().addItem(new ItemStack(XMaterial.END_PORTAL_FRAME.parseMaterial(), 1));
if (hasEye && size == 1) {
player.getInventory().addItem(new ItemStack(CompatibleMaterial.ENDER_EYE.getMaterial(), 1));
player.getInventory().addItem(new ItemStack(XMaterial.ENDER_EYE.parseMaterial(), 1));
}
player.updateInventory();
@ -355,7 +357,7 @@ public class InteractListeners implements Listener {
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Block.Level.Enable")) {
CompatibleMaterial materials = CompatibleMaterial.END_PORTAL_FRAME;
XMaterial materials = XMaterial.END_PORTAL_FRAME;
IslandLevel level = island.getLevel();
if (level.hasMaterial(materials.name())) {
@ -378,7 +380,7 @@ public class InteractListeners implements Listener {
}
}
private int getStackLimit(Player player, CompatibleMaterial materials) {
private int getStackLimit(Player player, XMaterial materials) {
String maxSizePermission = "fabledskyblock.stackable." + materials.name().toLowerCase() + ".maxsize.";
for (PermissionAttachmentInfo attachmentInfo : player.getEffectivePermissions()) {
if (attachmentInfo.getPermission().startsWith(maxSizePermission)) {

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
@ -12,6 +13,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPistonExtendEvent;
import java.util.Optional;
public class PistonListeners implements Listener {
private final SkyBlock plugin;
@ -31,7 +34,7 @@ public class PistonListeners implements Listener {
}
Island island = islandManager.getIslandAtLocation(block.getLocation());
if (island == null || CompatibleMaterial.getMaterial(block) != CompatibleMaterial.DRAGON_EGG) {
if (island == null || CompatibleMaterial.getMaterial(block.getType()).get() != XMaterial.DRAGON_EGG) {
return;
}
@ -40,21 +43,21 @@ public class PistonListeners implements Listener {
return;
}
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
if (material == null) {
Optional<XMaterial> material = CompatibleMaterial.getMaterial(block.getType());
if (!material.isPresent()) {
return;
}
IslandLevel level = island.getLevel();
if (!level.hasMaterial(material.name())) {
if (!level.hasMaterial(material.get().name())) {
return;
}
long materialAmount = level.getMaterialAmount(material.name());
long materialAmount = level.getMaterialAmount(material.get().name());
if (materialAmount <= 1) {
level.removeMaterial(material.name());
level.removeMaterial(material.get().name());
} else {
level.setMaterialAmount(material.name(), materialAmount - 1);
level.setMaterialAmount(material.get().name(), materialAmount - 1);
}
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
@ -129,9 +129,9 @@ public class PortalListeners implements Listener {
IslandWorld fromWorld = worldManager.getIslandWorld(player.getWorld());
IslandWorld toWorld = IslandWorld.NORMAL;
if (block.getType() == CompatibleMaterial.NETHER_PORTAL.getMaterial()) {
if (block.getType() == XMaterial.NETHER_PORTAL.parseMaterial()) {
toWorld = fromWorld == IslandWorld.NETHER ? IslandWorld.NORMAL : IslandWorld.NETHER;
} else if (block.getType() == CompatibleMaterial.END_PORTAL.getMaterial()) {
} else if (block.getType() == XMaterial.END_PORTAL.parseMaterial()) {
toWorld = fromWorld == IslandWorld.END ? IslandWorld.NORMAL : IslandWorld.END;
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
@ -39,7 +39,7 @@ public class SpongeListeners implements Listener {
if (stackableManager == null || !stackableManager.isStacked(blockLocation)) {
IslandLevel level = island.getLevel();
CompatibleMaterial material = CompatibleMaterial.SPONGE;
XMaterial material = XMaterial.SPONGE;
if (level.hasMaterial(material.name())) {
long materialAmount = level.getMaterialAmount(material.name());

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.player.PlayerIslandEnterEvent;
@ -58,8 +58,8 @@ public class TeleportListeners implements Listener {
// Fix for bug that tp you in the real Nether/End when entering in a portal in an island // TODO Simplify
if (event.getTo() != null && (worldManager.isIslandWorld(event.getFrom().getWorld())
&& !worldManager.isIslandWorld(event.getTo().getWorld())
&& (event.getFrom().getBlock().getType() == CompatibleMaterial.END_PORTAL.getMaterial()
|| event.getFrom().getBlock().getType() == CompatibleMaterial.NETHER_PORTAL.getMaterial())
&& (event.getFrom().getBlock().getType() == XMaterial.END_PORTAL.parseMaterial()
|| event.getFrom().getBlock().getType() == XMaterial.NETHER_PORTAL.parseMaterial())
&& (event.getTo().getWorld() != null
&& event.getTo().getWorld().getEnvironment() == World.Environment.NETHER
|| event.getTo().getWorld().getEnvironment() == World.Environment.THE_END))

View File

@ -1,19 +1,20 @@
package com.songoda.skyblock.localization.type.impl;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
public class MaterialsLocalization extends EnumLocalization<CompatibleMaterial> {
public class MaterialsLocalization extends EnumLocalization<XMaterial> {
public MaterialsLocalization(String keysPath) {
super(keysPath, CompatibleMaterial.class);
super(keysPath, XMaterial.class);
}
@Override
public CompatibleMaterial parseEnum(String input) {
return CompatibleMaterial.getMaterial(input);
public XMaterial parseEnum(String input) {
return CompatibleMaterial.getMaterial(input).get();
}
@Override
public String getDefaultLocaleFor(CompatibleMaterial obj) {
public String getDefaultLocaleFor(XMaterial obj) {
return super.getDefaultLocaleFor(obj).replace("_", " ");
}
}

View File

@ -1,14 +1,15 @@
package com.songoda.skyblock.localization.type.impl;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
public class MaterialsToMaterialLocalization extends EnumLocalization<CompatibleMaterial> {
public class MaterialsToMaterialLocalization extends EnumLocalization<XMaterial> {
public MaterialsToMaterialLocalization(String keysPath) {
super(keysPath, CompatibleMaterial.class);
super(keysPath, XMaterial.class);
}
@Override
public CompatibleMaterial parseEnum(String input) {
return CompatibleMaterial.getMaterial(input);
public XMaterial parseEnum(String input) {
return CompatibleMaterial.getMaterial(input).get();
}
}

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -72,14 +72,14 @@ public class Bans {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.BLACK_STAINED_GLASS_PANE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Bans.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Bans.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -113,7 +113,7 @@ public class Bans {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial()) && (is.hasItemMeta())) {
} else if ((XMaterial.PLAYER_HEAD.isSimilar(is)) && (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Bans.Item.Previous.Displayname")))) {
playerData1.setPage(MenuType.BANS, playerData1.getPage(MenuType.BANS) - 1);
@ -149,14 +149,14 @@ public class Bans {
Set<UUID> islandBans = island.getBan().getBans();
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Bans.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.biome.BiomeManager;
@ -86,7 +86,7 @@ public class Biome {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((XMaterial.BLACK_STAINED_GLASS_PANE.isSimilar(is))
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
langConfig.getString("Menu.Biome.Item.Barrier.Displayname"))))) {
@ -94,7 +94,7 @@ public class Biome {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
langConfig.getString("Menu.Biome.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -163,11 +163,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(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
langConfig.getString("Menu.Biome.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
plugin.formatText(langConfig.getString("Menu.Biome.Item.Barrier.Displayname")),
null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.world.SWorldBorder;
import com.songoda.skyblock.SkyBlock;
@ -64,7 +64,7 @@ public class Border {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -77,7 +77,7 @@ public class Border {
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> open(player), 1L);
} else if ((is.getType() == CompatibleMaterial.LIGHT_BLUE_DYE.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.LIGHT_BLUE_DYE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
@ -95,7 +95,7 @@ public class Border {
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> open(player), 1L);
}
} else if ((is.getType() == CompatibleMaterial.LIME_DYE.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.LIME_DYE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
@ -113,7 +113,7 @@ public class Border {
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> open(player), 1L);
}
} else if ((is.getType() == CompatibleMaterial.RED_DYE.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.RED_DYE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
@ -136,7 +136,7 @@ public class Border {
Island island = islandManager.getIsland(player);
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Border.Item.Exit.Displayname"), null, null, null, null), 0);
SWorldBorder.Color borderColor = island.getBorderColor();
@ -155,14 +155,14 @@ public class Border {
if (player.hasPermission("fabledskyblock.island.border.blue")) {
if (borderColor == SWorldBorder.Color.Blue) {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.LIGHT_BLUE_DYE.parseItem(),
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(CompatibleMaterial.LIGHT_BLUE_DYE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.LIGHT_BLUE_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Blue")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
@ -170,12 +170,12 @@ public class Border {
null, null), 2);
}
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
"", null, null, null, null), 2);
}
if (player.hasPermission("fabledskyblock.island.border.green")) {
if (borderColor == SWorldBorder.Color.Green) {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.LIME_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Selected.Lore"),
@ -183,7 +183,7 @@ public class Border {
new Placeholder("%color", configLoad.getString("Menu.Border.Item.Word.Green"))},
null, null), 3);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.LIME_DYE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.LIME_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Green")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
@ -192,19 +192,19 @@ public class Border {
null, null), 3);
}
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
"", null, null, null, null), 3);
}
if (player.hasPermission("fabledskyblock.island.border.red")) {
if (borderColor == SWorldBorder.Color.Red) {
nInv.addItem(nInv.createItem(CompatibleMaterial.RED_DYE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.RED_DYE.parseItem(),
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(CompatibleMaterial.RED_DYE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.RED_DYE.parseItem(),
configLoad.getString("Menu.Border.Item.Color.Displayname").replace("%color",
configLoad.getString("Menu.Border.Item.Word.Red")),
configLoad.getStringList("Menu.Border.Item.Color.Unselected.Lore"),
@ -212,7 +212,7 @@ public class Border {
null, null), 4);
}
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
"", null, null, null, null), 4);
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
@ -26,11 +26,11 @@ public final class ControlPanel {
MenuClickRegistry.getInstance().register((executors) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Teleport.Displayname", CompatibleMaterial.OAK_DOOR), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Teleport.Displayname", XMaterial.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", CompatibleMaterial.IRON_DOOR), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Lock.Displayname", XMaterial.IRON_DOOR), (inst, player, e) -> {
final Island island = SkyBlock.getPlugin(SkyBlock.class).getIslandManager().getIsland(player);
@ -47,35 +47,35 @@ public final class ControlPanel {
}
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Barrier.Displayname", CompatibleMaterial.BLACK_STAINED_GLASS_PANE), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Barrier.Displayname", XMaterial.BLACK_STAINED_GLASS_PANE), (inst, player, e) -> {
inst.getSoundManager().playSound(player, XSound.BLOCK_GLASS_BREAK);
e.setWillClose(false);
e.setWillDestroy(false);
});
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Level.Displayname", CompatibleMaterial.EXPERIENCE_BOTTLE), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Level.Displayname", XMaterial.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", CompatibleMaterial.NAME_TAG), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Settings.Displayname", XMaterial.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", CompatibleMaterial.ITEM_FRAME), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Members.Displayname", XMaterial.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", CompatibleMaterial.OAK_SAPLING), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Biome.Displayname", XMaterial.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", CompatibleMaterial.CLOCK), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Weather.Displayname", XMaterial.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", CompatibleMaterial.IRON_AXE), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Bans.Displayname", XMaterial.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", CompatibleMaterial.OAK_SIGN), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Visitors.Displayname", XMaterial.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", CompatibleMaterial.ANVIL), (inst, player, e) -> {
executors.put(RegistryKey.fromLanguageFile("Menu.ControlPanel.Item.Upgrades.Displayname", XMaterial.ANVIL), (inst, player, e) -> {
Bukkit.getServer().getScheduler().runTaskLater(inst, () -> Bukkit.getServer().dispatchCommand(player, "island upgrades"), 1L);
});
@ -94,52 +94,52 @@ public final class ControlPanel {
// Teleport to island and open/close island
if (player.hasPermission("fabledskyblock.island.teleport")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.OAK_DOOR.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Teleport.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Teleport.Lore"), null, null, null), 1);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 1);
}
if (player.hasPermission("fabledskyblock.island.close")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.IRON_DOOR.getItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.IRON_DOOR.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Lock.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Lock.Lore"), null, null, null), 10);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 10);
}
// Glass panes barriers
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,
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 0, 2, 5, 8,
9, 11, 14, 17);
// 4 Items at the left
if (player.hasPermission("fabledskyblock.island.level")) {
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.EXPERIENCE_BOTTLE.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.EXPERIENCE_BOTTLE.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Level.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Level.Lore"), null, null, null), 3);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 3);
}
if (player.hasPermission("fabledskyblock.island.settings")) {
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);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 4);
}
if (player.hasPermission("fabledskyblock.island.weather")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.CLOCK.getItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.CLOCK.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Weather.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Weather.Lore"), null, null, null), 12);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 12);
}
if (player.hasPermission("fabledskyblock.island.biome")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.OAK_SAPLING.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Biome.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Biome.Lore"), null, null, null), 13);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 13);
}
@ -148,28 +148,28 @@ public final class ControlPanel {
nInv.addItem(nInv.createItem(new ItemStack(Material.ITEM_FRAME), configLoad.getString("Menu.ControlPanel.Item.Members.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Members.Lore"), null, null, null), 16);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 16);
}
if (player.hasPermission("fabledskyblock.island.bans")) {
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);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 6);
}
if (player.hasPermission("fabledskyblock.island.visitors")) {
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.OAK_SIGN.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Visitors.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Visitors.Lore"), null, null, null), 7);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 7);
}
if (player.hasPermission("fabledskyblock.island.upgrade")) {
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.ANVIL.getMaterial()), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
nInv.addItem(nInv.createItem(XMaterial.ANVIL.parseItem(), configLoad.getString("Menu.ControlPanel.Item.Upgrades.Displayname"),
configLoad.getStringList("Menu.ControlPanel.Item.Upgrades.Lore"), null, null, null), 15);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.ControlPanel.Item.Barrier.Displayname"), null, null, null, null), 15);
}

View File

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

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -111,17 +111,17 @@ public class Information {
PlayerData playerData13 = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if (XMaterial.OAK_FENCE_GATE.isSimilar(is) && is.hasItemMeta()
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(configLoad.getString("Menu.Information.Categories.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
} else if ((is.getType() == CompatibleMaterial.ITEM_FRAME.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.ITEM_FRAME.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(configLoad.getString("Menu.Information.Categories.Item.Members.Displayname"))))) {
playerData13.setViewer(new Viewer(((Viewer) playerData13.getViewer()).getOwner(), Viewer.Type.MEMBERS));
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
Bukkit.getServer().getScheduler().runTaskLater(plugin,
() -> open(player), 1L);
} else if ((is.getType() == CompatibleMaterial.MAP.getMaterial())
} else if ((XMaterial.MAP.isSimilar(is))
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
plugin.formatText(configLoad.getString(
@ -130,7 +130,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PAINTING.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.PAINTING.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
plugin.formatText(configLoad.getString(
"Menu.Information.Categories.Item.Visitors.Displayname"))))) {
@ -145,14 +145,14 @@ public class Information {
}
});
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Information.Categories.Item.Exit.Displayname"), null, null, null,
null), 0, 4);
nInv.addItem(nInv.createItem(CompatibleMaterial.ITEM_FRAME.getItem(),
nInv.addItem(nInv.createItem(XMaterial.ITEM_FRAME.parseItem(),
configLoad.getString("Menu.Information.Categories.Item.Members.Displayname"),
configLoad.getStringList("Menu.Information.Categories.Item.Members.Lore"), null, null,
null), 1);
nInv.addItem(nInv.createItem(CompatibleMaterial.PAINTING.getItem(),
nInv.addItem(nInv.createItem(XMaterial.PAINTING.parseItem(),
configLoad.getString("Menu.Information.Categories.Item.Visitors.Displayname"),
configLoad.getStringList("Menu.Information.Categories.Item.Visitors.Lore"), null, null,
null), 3);
@ -188,7 +188,7 @@ public class Information {
"Menu.Information.Categories.Item.Information.Vote.Enabled.Signature.Disabled.Lore"));
}
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.addItem(nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Information.Categories.Item.Information.Displayname"),
itemLore,
new Placeholder[]{new Placeholder("%level", "" + visit.getLevel().getLevel()),
@ -227,7 +227,7 @@ public class Information {
"Menu.Information.Categories.Item.Information.Vote.Disabled.Signature.Disabled.Lore"));
}
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.addItem(nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Information.Categories.Item.Information.Displayname"),
itemLore,
new Placeholder[]{new Placeholder("%level", "" + visit.getLevel().getLevel()),
@ -254,7 +254,7 @@ public class Information {
PlayerData playerData1 = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Members.Item.Return.Displayname"))))) {
@ -263,7 +263,7 @@ public class Information {
Bukkit.getServer().getScheduler().runTaskLater(plugin,
() -> open(player), 1L);
} else if ((is.getType() == CompatibleMaterial.PAINTING.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.PAINTING.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Members.Item.Statistics.Displayname"))))) {
@ -271,7 +271,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((XMaterial.BLACK_STAINED_GLASS_PANE.isSimilar(is))
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -280,7 +280,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial())
} else if ((XMaterial.PLAYER_HEAD.isSimilar(is))
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -317,7 +317,7 @@ public class Information {
displayedMembers.addAll(islandOperators);
displayedMembers.addAll(islandMembers);
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Information.Members.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(
@ -333,7 +333,7 @@ public class Information {
new Placeholder("%operators", "" + islandOperators.size())},
null, null),
4);
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Information.Members.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -410,7 +410,7 @@ public class Information {
PlayerData playerData12 = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Visitors.Item.Return.Displayname"))))) {
@ -421,7 +421,7 @@ public class Information {
Bukkit.getServer().getScheduler().runTaskLater(plugin,
() -> open(player), 1L);
} else if ((is.getType() == CompatibleMaterial.PAINTING.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.PAINTING.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
"Menu.Information.Visitors.Item.Statistics.Displayname"))))) {
@ -429,7 +429,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((XMaterial.BLACK_STAINED_GLASS_PANE.isSimilar(is))
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -438,7 +438,7 @@ public class Information {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial())
} else if ((XMaterial.PLAYER_HEAD.isSimilar(is))
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -468,7 +468,7 @@ public class Information {
List<UUID> displayedVisitors = new ArrayList<>(islandManager.getVisitorsAtIsland(island));
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Information.Visitors.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(new ItemStack(Material.PAINTING),
@ -476,7 +476,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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Information.Visitors.Item.Barrier.Displayname"), null, null,
null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils;
@ -63,7 +63,7 @@ public class Leaderboard {
if (playerDataManager.hasPlayerData(player)) {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad.getString("Menu.Leaderboard." + Viewer.Type.BROWSE.name()
+ ".Item.Exit.Displayname"))))) {
@ -102,7 +102,7 @@ public class Leaderboard {
}
});
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Leaderboard." + viewer.getType().name() + ".Item.Exit.Displayname"),
null, null, null, null), 0, 4);
nInv.addItem(
@ -129,7 +129,7 @@ public class Leaderboard {
2);
} else {
nInv.addItem(
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), "", null, null, null, null), 2);
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(), "", null, null, null, null), 2);
}
nInv.addItem(
nInv.createItem(new ItemStack(Material.EMERALD), configLoad
@ -151,7 +151,7 @@ public class Leaderboard {
if (playerDataManager.hasPlayerData(player)) {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())) {
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Exit.Displayname")))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -225,11 +225,11 @@ public class Leaderboard {
if (plugin.getConfiguration()
.getBoolean("Island.Visitor.Vote")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Return.Displayname"), null, null,
null, null), 0, 8);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Exit.Displayname"), null, null,
null, null), 0, 8);
}

View File

@ -2,6 +2,7 @@ package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils;
@ -34,6 +35,7 @@ import org.bukkit.inventory.ItemStack;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
public class Levelling {
@ -78,13 +80,13 @@ public class Levelling {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.BLACK_STAINED_GLASS_PANE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
} else if ((is.getType() == Material.PAINTING) && (is.hasItemMeta())
@ -99,7 +101,7 @@ public class Levelling {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.FIREWORK_STAR.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.FIREWORK_STAR.isSimilar(is)) && (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());
@ -139,7 +141,7 @@ public class Levelling {
cooldownManager.createPlayer(CooldownType.LEVELLING, Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID()));
levellingManager.startScan(player, island);
});
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial()) && (is.hasItemMeta())) {
} else if ((XMaterial.PLAYER_HEAD.isSimilar(is)) && (is.hasItemMeta())) {
PlayerData playerData1 = plugin.getPlayerDataManager().getPlayerData(player);
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Levelling.Item.Previous.Displayname")))) {
@ -184,20 +186,20 @@ public class Levelling {
}
long value = testIslandMaterials.get(materialName);
CompatibleMaterial materials = CompatibleMaterial.getMaterial(materialName);
Optional<XMaterial> materials = CompatibleMaterial.getMaterial(materialName);
if (materials == null) {
if (!materials.isPresent()) {
continue;
}
ItemStack is = materials.getItem();
ItemStack is = materials.get().parseItem();
if (is == null || is.getItemMeta() == null) {
continue;
}
is.setAmount(Math.min(Math.toIntExact(value), 64));
is.setType(CompatibleMaterial.getMaterial(is).getMaterial());
is.setType(CompatibleMaterial.getMaterial(is.getType()).get().parseMaterial());
testInventory.clear();
testInventory.setItem(0, is);
@ -209,16 +211,16 @@ public class Levelling {
int playerMenuPage = playerData.getPage(MenuType.LEVELLING), nextEndIndex = islandMaterials.size() - playerMenuPage * 36;
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(), configLoad.getString("Menu.Levelling.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(), configLoad.getString("Menu.Levelling.Item.Exit.Displayname"), null, null, null, null), 0, 8);
if (player.hasPermission("fabledskyblock.island.level.rescan")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.FIREWORK_STAR.getItem(), configLoad.getString("Menu.Levelling.Item.Rescan.Displayname"), configLoad.getStringList("Menu.Levelling.Item.Rescan.Lore"), null, null,
nInv.addItem(nInv.createItem(XMaterial.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", NumberUtils.formatNumber(level.getPoints())), new Placeholder("%level", NumberUtils.formatNumber(level.getLevel()))}, null, null),
4);
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
nInv.addItem(nInv.createItem(XMaterial.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(ItemUtils.getCustomHead(
@ -235,7 +237,7 @@ public class Levelling {
}
if (islandMaterials.isEmpty()) {
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.BARRIER.getMaterial()), configLoad.getString("Menu.Levelling.Item.Nothing.Displayname"), null, null, null, null), 31);
nInv.addItem(nInv.createItem(XMaterial.BARRIER.parseItem(), 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;
@ -245,9 +247,9 @@ public class Levelling {
}
String material = (String) islandMaterials.keySet().toArray()[index];
CompatibleMaterial materials = CompatibleMaterial.getMaterial(material);
Optional<XMaterial> materials = CompatibleMaterial.getMaterial(material);
if (materials == null) {
if (!materials.isPresent()) {
break;
}
@ -275,15 +277,15 @@ public class Levelling {
double pointsEarned = materialAmountCounted * pointsMultiplier;
String name = plugin.getLocalizationManager().getLocalizationFor(CompatibleMaterial.class).getLocale(materials);
String name = plugin.getLocalizationManager().getLocalizationFor(XMaterial.class).getLocale(materials.get());
if (materials == CompatibleMaterial.FARMLAND && ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) {
materials = CompatibleMaterial.DIRT;
if (materials.get() == XMaterial.FARMLAND && ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) {
materials = Optional.of(XMaterial.DIRT);
}
ItemStack is = materials.getItem();
ItemStack is = materials.get().parseItem();
is.setAmount(Math.min(Math.toIntExact(materialAmount), 64));
is.setType(CompatibleMaterial.getMaterial(is).getMaterial());
is.setType(CompatibleMaterial.getMaterial(is.getType()).get().parseMaterial());
long finalMaterialAmountCounted = materialAmountCounted;
List<String> lore = configLoad.getStringList("Menu.Levelling.Item.Material.Lore");

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -80,14 +80,14 @@ public class Members {
return;
}
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Members.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Members.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -130,7 +130,7 @@ public class Members {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial()) && (is.hasItemMeta())) {
} else if ((is.getType() == XMaterial.PLAYER_HEAD.parseMaterial()) && (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Members.Item.Previous.Displayname")))) {
playerData.setPage(MenuType.MEMBERS, playerData.getPage(MenuType.MEMBERS) - 1);
@ -323,7 +323,7 @@ public class Members {
int playerMenuPage = playerData.getPage(MenuType.MEMBERS), nextEndIndex = displayedMembers.size() - playerMenuPage * 36;
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
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"),
@ -346,7 +346,7 @@ public class Members {
new Placeholder[]{new Placeholder("%sort", StringUtil.capitalizeUppercaseLetters(sort.name()))},
null, null), 5);
nInv.addItem(
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Members.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -74,18 +74,18 @@ public class Ownership {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.PLAYER_HEAD.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Original.Displayname"))))) {
soundManager.playSound(player, XSound.ENTITY_VILLAGER_YES);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((XMaterial.BLACK_STAINED_GLASS_PANE.isSimilar(is))
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Barrier.Displayname"))))) {
@ -93,7 +93,7 @@ public class Ownership {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.WRITABLE_BOOK.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.WRITABLE_BOOK.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Assign.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
@ -132,7 +132,7 @@ public class Ownership {
gui.setInput(is);
plugin.getGuiManager().showGUI(player, gui);
}, 1L);
} else if ((is.getType() == CompatibleMaterial.MAP.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.MAP.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Ownership.Item.Password.Displayname"))))) {
if (island.hasPassword()) {
@ -225,28 +225,28 @@ public class Ownership {
playerTexture = playerDataManager.getPlayerData(targetPlayer).getTexture();
}
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Ownership.Item.Exit.Displayname"), null, null, null, null), 0);
nInv.addItem(nInv.createItem(ItemUtils.getCustomHead(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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Ownership.Item.Barrier.Displayname"), null, null, null, null),
2);
nInv.addItem(nInv.createItem(CompatibleMaterial.WRITABLE_BOOK.getItem(),
nInv.addItem(nInv.createItem(XMaterial.WRITABLE_BOOK.parseItem(),
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(CompatibleMaterial.MAP.getItem(),
nInv.addItem(nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Hidden.Lore"), null, null, null), 4);
} else {
nInv.addItem(
nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Visible.Lore"),
new Placeholder[]{new Placeholder("%password", ownershipPassword)}, null, null),
@ -254,7 +254,7 @@ public class Ownership {
}
} else {
nInv.addItem(
nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Ownership.Item.Password.Displayname"),
configLoad.getStringList("Menu.Ownership.Item.Password.Unset.Lore"), null, null, null),
4);

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
@ -81,7 +81,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -166,7 +166,7 @@ public class Settings {
soundManager.playSound(player, XSound.BLOCK_NOTE_BLOCK_PLING);
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> open(player, Type.ROLE, IslandRole.OPERATOR, null), 1L);
} else if ((is.getType() == CompatibleMaterial.OAK_SAPLING.getMaterial()) && (is.hasItemMeta())
} else if ((XMaterial.OAK_SAPLING.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad
.getString("Menu.Settings.Categories.Item.Owner.Displayname"))))) {
@ -189,7 +189,7 @@ public class Settings {
}
});
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial()),
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),
@ -201,20 +201,20 @@ public class Settings {
if (plugin.getConfiguration()
.getBoolean("Island.Coop.Enable")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
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(CompatibleMaterial.OAK_SAPLING.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_SAPLING.parseItem(),
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(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_SAPLING.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_SAPLING.parseItem(),
configLoad.getString("Menu.Settings.Categories.Item.Owner.Displayname"),
configLoad.getStringList("Menu.Settings.Categories.Item.Owner.Lore"), null, null, null), 6);
}
@ -261,7 +261,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((XMaterial.OAK_FENCE_GATE.isSimilar(is)) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad.getString("Menu.Settings." + role.name() + ".Item.Return.Displayname"))))) {
soundManager.playSound(player, XSound.ENTITY_ARROW_HIT);
@ -417,7 +417,7 @@ public class Settings {
}
if (config.getFileConfiguration().getBoolean("Island.Visitor.Welcome.Enable")) {
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.addItem(nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Settings.Visitor.Item.Welcome.Displayname"),
configLoad.getStringList("Menu.Settings.Visitor.Item.Welcome.Lore"), null, null,
null), 5);
@ -430,54 +430,48 @@ 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", CompatibleMaterial.WHITE_BED.getItem()), 14);
nInv.addItemStack(createItem(island, role, "Bed", XMaterial.WHITE_BED.parseItem()), 14);
nInv.addItemStack(createItem(island, role, "AnimalBreeding", new ItemStack(Material.WHEAT)), 15);
nInv.addItemStack(createItem(island, role, "Brewing",
new ItemStack(CompatibleMaterial.BREWING_STAND.getMaterial())), 16);
new ItemStack(XMaterial.BREWING_STAND.parseMaterial())), 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", 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, "Workbench", XMaterial.CRAFTING_TABLE.parseItem()), 20);
nInv.addItemStack(createItem(island, role, "Crop", XMaterial.WHEAT_SEEDS.parseItem()), 21);
nInv.addItemStack(createItem(island, role, "Door", XMaterial.OAK_DOOR.parseItem()), 22);
nInv.addItemStack(createItem(island, role, "Gate", XMaterial.OAK_FENCE_GATE.parseItem()), 23);
nInv.addItemStack(createItem(island, role, "Projectile", new ItemStack(Material.ARROW)), 24);
nInv.addItemStack(createItem(island, role, "Enchant", CompatibleMaterial.ENCHANTING_TABLE.getItem()), 25);
nInv.addItemStack(createItem(island, role, "Enchant", XMaterial.ENCHANTING_TABLE.parseItem()), 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", CompatibleMaterial.CHEST_MINECART.getItem()),
nInv.addItemStack(createItem(island, role, "HorseInventory", XMaterial.CHEST_MINECART.parseItem()),
28);
nInv.addItemStack(createItem(island, role, "MobRiding", new ItemStack(Material.SADDLE)), 29);
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, "MonsterHurting", XMaterial.BONE.parseItem()), 30);
nInv.addItemStack(createItem(island, role, "MobHurting", XMaterial.WOODEN_SWORD.parseItem()), 31);
nInv.addItemStack(createItem(island, role, "MobTaming", XMaterial.POPPY.parseItem()), 32);
nInv.addItemStack(createItem(island, role, "Leash", XMaterial.LEAD.parseItem()), 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", CompatibleMaterial.OAK_PRESSURE_PLATE.getItem()), 37);
nInv.addItemStack(createItem(island, role, "PressurePlate", XMaterial.OAK_PRESSURE_PLATE.parseItem()), 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);
nInv.addItemStack(createItem(island, role, "ItemDrop", new ItemStack(Material.PUMPKIN_SEEDS)), 41);
nInv.addItemStack(createItem(island, role, "ItemPickup", new ItemStack(Material.MELON_SEEDS)), 42);
nInv.addItemStack(createItem(island, role, "Fishing", new ItemStack(Material.FISHING_ROD)), 43);
nInv.addItemStack(createItem(island, role, "DropperDispenser", new ItemStack(Material.DISPENSER)),
44);
nInv.addItemStack(createItem(island, role, "DropperDispenser", new ItemStack(Material.DISPENSER)), 44);
nInv.addItemStack(createItem(island, role, "SpawnEgg", new ItemStack(Material.EGG)), 45);
nInv.addItemStack(createItem(island, role, "HangingDestroy", new ItemStack(Material.ITEM_FRAME)),
46);
nInv.addItemStack(createItem(island, role, "HangingDestroy", new ItemStack(Material.ITEM_FRAME)), 46);
nInv.addItemStack(createItem(island, role, "Cake", new ItemStack(Material.CAKE)), 47);
nInv.addItemStack(createItem(island, role, "DragonEggUse", new ItemStack(Material.DRAGON_EGG)), 48);
nInv.addItemStack(createItem(island, role, "MinecartBoat", new ItemStack(Material.MINECART)), 49);
nInv.addItemStack(createItem(island, role, "Portal", new ItemStack(Material.ENDER_PEARL)), 50);
nInv.addItemStack(createItem(island, role, "Hopper", new ItemStack(Material.HOPPER)), 51);
nInv.addItemStack(createItem(island, role, "EntityPlacement", new ItemStack(Material.ARMOR_STAND)),
52);
nInv.addItemStack(
createItem(island, role, "ExperienceOrbPickup", CompatibleMaterial.EXPERIENCE_BOTTLE.getItem()),
53);
nInv.addItemStack(createItem(island, role, "EntityPlacement", new ItemStack(Material.ARMOR_STAND)), 52);
nInv.addItemStack(createItem(island, role, "ExperienceOrbPickup", XMaterial.EXPERIENCE_BOTTLE.parseItem()), 53);
nInv.setTitle(plugin.formatText(
configLoad.getString("Menu.Settings." + role.name() + ".Title")));
@ -487,18 +481,18 @@ public class Settings {
if (mainConfig.getBoolean("Island.Coop.Enable")) {
if (mainConfig.getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 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", CompatibleMaterial.RED_DYE.getItem()),
nInv.addItemStack(createItem(island, role, "Unban", XMaterial.RED_DYE.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", XMaterial.OAK_SIGN.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
nInv.addItemStack(createItem(island, role, "Member", XMaterial.PAINTING.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
15);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
16);
@ -512,21 +506,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", CompatibleMaterial.CLOCK.getItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 24);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 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", CompatibleMaterial.RED_DYE.getItem()),
nInv.addItemStack(createItem(island, role, "Unban", XMaterial.RED_DYE.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
13);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
14);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
15);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
16);
@ -538,23 +532,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", CompatibleMaterial.CLOCK.getItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 24);
}
} else {
if (mainConfig.getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 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", CompatibleMaterial.RED_DYE.getItem()),
nInv.addItemStack(createItem(island, role, "Unban", XMaterial.RED_DYE.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
14);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
15);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
16);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
@ -564,21 +558,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", CompatibleMaterial.CLOCK.getItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 24);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 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", CompatibleMaterial.RED_DYE.getItem()),
nInv.addItemStack(createItem(island, role, "Unban", XMaterial.RED_DYE.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
14);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
15);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
16);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 20);
@ -586,7 +580,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", CompatibleMaterial.CLOCK.getItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 24);
}
}
@ -595,14 +589,14 @@ public class Settings {
if (mainConfig.getBoolean("Island.Coop.Enable")) {
if (mainConfig.getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
12);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
13);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
15);
@ -616,17 +610,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", CompatibleMaterial.CLOCK.getItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 24);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
12);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
13);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "Coop", new ItemStack(Material.NAME_TAG)),
15);
@ -638,21 +632,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", CompatibleMaterial.CLOCK.getItem()), 24);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 24);
}
nInv.setRows(3);
} else {
if (mainConfig.getBoolean("Island.WorldBorder.Enable")) {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 10);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 10);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
11);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
12);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
13);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
14);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 15);
@ -662,19 +656,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", CompatibleMaterial.CLOCK.getItem()), 23);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 23);
nInv.setRows(3);
} else {
nInv.addItemStack(
createItem(island, role, "Invite", CompatibleMaterial.WRITABLE_BOOK.getItem()), 9);
createItem(island, role, "Invite", XMaterial.WRITABLE_BOOK.parseItem()), 9);
nInv.addItemStack(createItem(island, role, "Kick", new ItemStack(Material.IRON_DOOR)),
10);
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial())),
nInv.addItemStack(createItem(island, role, "Visitor", new ItemStack(XMaterial.OAK_SIGN.parseMaterial())),
11);
nInv.addItemStack(createItem(island, role, "Member", new ItemStack(Material.PAINTING)),
12);
nInv.addItemStack(createItem(island, role, "Island", CompatibleMaterial.OAK_SAPLING.getItem()),
nInv.addItemStack(createItem(island, role, "Island", XMaterial.OAK_SAPLING.parseItem()),
13);
nInv.addItemStack(
createItem(island, role, "MainSpawn", new ItemStack(Material.EMERALD)), 14);
@ -682,7 +676,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", CompatibleMaterial.CLOCK.getItem()), 17);
nInv.addItemStack(createItem(island, role, "Weather", XMaterial.CLOCK.parseItem()), 17);
nInv.setRows(2);
}
@ -697,64 +691,64 @@ public class Settings {
if (mainConfig.getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
XMaterial.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 16);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
XMaterial.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 17);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 17);
}
} else {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
XMaterial.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
@ -763,19 +757,19 @@ public class Settings {
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
@ -785,79 +779,79 @@ public class Settings {
if (mainConfig.getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
XMaterial.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
10);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 16);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 16);
}
} else {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "PvP", new ItemStack(Material.DIAMOND_SWORD)), 12);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 15);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
16);
}
}
@ -867,58 +861,58 @@ public class Settings {
if (mainConfig.getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 9);
XMaterial.PIG_SPAWN_EGG.parseItem()), 9);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
10);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
11);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 12);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 16);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
17);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 16);
}
} else {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
14);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 15);
@ -927,17 +921,17 @@ public class Settings {
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(createItem(island, role, "KeepItemsOnDeath",
new ItemStack(Material.ITEM_FRAME)), 16);
@ -947,71 +941,71 @@ public class Settings {
if (mainConfig.getBoolean("Island.Settings.Damage.Enable")) {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 13);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
14);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 15);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 15);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(
createItem(island, role, "Damage", CompatibleMaterial.RED_DYE.getItem()), 16);
createItem(island, role, "Damage", XMaterial.RED_DYE.parseItem()), 16);
}
} else {
if (mainConfig.getBoolean("Island.Settings.Hunger.Enable")) {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 10);
XMaterial.PIG_SPAWN_EGG.parseItem()), 10);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
11);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
12);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
nInv.addItemStack(
createItem(island, role, "Hunger", new ItemStack(Material.COOKED_BEEF)),
16);
} else {
nInv.addItemStack(createItem(island, role, "NaturalMobSpawning",
CompatibleMaterial.PIG_SPAWN_EGG.getItem()), 11);
XMaterial.PIG_SPAWN_EGG.parseItem()), 11);
nInv.addItemStack(
createItem(island, role, "MobGriefing", CompatibleMaterial.IRON_SHOVEL.getItem()),
createItem(island, role, "MobGriefing", XMaterial.IRON_SHOVEL.parseItem()),
12);
nInv.addItemStack(
createItem(island, role, "Explosions", CompatibleMaterial.GUNPOWDER.getItem()),
createItem(island, role, "Explosions", XMaterial.GUNPOWDER.parseItem()),
13);
nInv.addItemStack(createItem(island, role, "FireSpread",
new ItemStack(Material.FLINT_AND_STEEL)), 14);
nInv.addItemStack(
createItem(island, role, "LeafDecay", CompatibleMaterial.OAK_LEAVES.getItem()),
createItem(island, role, "LeafDecay", XMaterial.OAK_LEAVES.parseItem()),
15);
}
}
@ -1023,7 +1017,7 @@ public class Settings {
nInv.setRows(2);
}
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Settings." + role.name() + ".Item.Return.Displayname"), null, null,
null, null), 0, 8);
@ -1061,7 +1055,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
plugin.formatText(configLoad.getString(
"Menu.Settings.Visitor.Panel.Welcome.Item.Return.Displayname"))))) {
@ -1215,7 +1209,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(CompatibleMaterial.OAK_SIGN.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial()),
configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Message.Displayname"),
itemLore, null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.ARROW),
@ -1225,7 +1219,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(CompatibleMaterial.OAK_SIGN.getMaterial(), welcomeMessage.size()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial(), 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),
@ -1236,7 +1230,7 @@ public class Settings {
null, null, null), 3);
}
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Settings.Visitor.Panel.Welcome.Item.Return.Displayname"), null,
null, null, null), 0, 4);
@ -1276,7 +1270,7 @@ public class Settings {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
plugin.formatText(configLoad.getString(
"Menu.Settings.Visitor.Panel.Signature.Item.Return.Displayname"))))) {
@ -1436,7 +1430,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(CompatibleMaterial.OAK_SIGN.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial()),
configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Message.Displayname"),
itemLore, null, null, null), 2);
nInv.addItem(nInv.createItem(new ItemStack(Material.ARROW),
@ -1446,7 +1440,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(CompatibleMaterial.OAK_SIGN.getMaterial(), signatureMessage.size()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial(), 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),
@ -1457,7 +1451,7 @@ public class Settings {
null, null, null), 3);
}
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Settings.Visitor.Panel.Signature.Item.Return.Displayname"), null,
null, null, null), 0, 4);

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.NumberUtils;
import com.songoda.skyblock.SkyBlock;
@ -195,7 +195,7 @@ public class Upgrade {
}
}
}
} else if ((is.getType() == CompatibleMaterial.WHEAT_SEEDS.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.WHEAT_SEEDS.parseMaterial()) && (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)) {
@ -435,7 +435,7 @@ public class Upgrade {
event.setWillClose(false);
event.setWillDestroy(false);
}
} else if ((is.getType() == CompatibleMaterial.SPAWNER.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.SPAWNER.parseMaterial()) && (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)) {
@ -601,7 +601,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(CompatibleMaterial.WHEAT_SEEDS.getItem(),
nInv.addItem(nInv.createItem(XMaterial.WHEAT_SEEDS.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimed.Lore"),
@ -612,7 +612,7 @@ public class Upgrade {
null, null), 3);
} else {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
nInv.addItem(nInv.createItem(XMaterial.WHEAT_SEEDS.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Claimable.Lore"),
@ -620,7 +620,7 @@ public class Upgrade {
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 3);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
nInv.addItem(nInv.createItem(XMaterial.WHEAT_SEEDS.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Crop.Unclaimable.Lore"),
@ -839,7 +839,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(CompatibleMaterial.SPAWNER.getItem(),
nInv.addItem(nInv.createItem(XMaterial.SPAWNER.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimed.Lore"),
@ -850,7 +850,7 @@ public class Upgrade {
null, null), 8);
} else {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
nInv.addItem(nInv.createItem(XMaterial.SPAWNER.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Claimable.Lore"),
@ -858,7 +858,7 @@ public class Upgrade {
new Placeholder("%cost", NumberUtils.formatNumber(upgrade.getCost()))},
null, null), 8);
} else {
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
nInv.addItem(nInv.createItem(XMaterial.SPAWNER.parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Upgrade.Item.Spawner.Unclaimable.Lore"),

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils;
@ -67,14 +67,14 @@ public class Visit {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visit.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visit.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -116,7 +116,7 @@ public class Visit {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial()) && (is.hasItemMeta())) {
} else if ((is.getType() == XMaterial.PLAYER_HEAD.parseMaterial()) && (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visit.Item.Previous.Displayname")))) {
playerData.setPage(MenuType.VISIT, playerData.getPage(MenuType.VISIT) - 1);
@ -326,7 +326,7 @@ public class Visit {
nextEndIndex = visitIslands.size() - playerMenuPage * 36,
totalIslands = visitManager.getIslands().size();
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
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"),
@ -348,7 +348,7 @@ public class Visit {
new Placeholder[]{new Placeholder("%sort", StringUtil.capitalizeUppercaseLetters(sort.name()))},
null, null), 5);
nInv.addItem(
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Visit.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -66,14 +66,14 @@ public class Visitors {
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -91,7 +91,7 @@ public class Visitors {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial()) && (is.hasItemMeta())) {
} else if ((is.getType() == XMaterial.PLAYER_HEAD.parseMaterial()) && (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Visitors.Item.Previous.Displayname")))) {
playerData.setPage(MenuType.VISITORS, playerData.getPage(MenuType.VISITORS) - 1);
@ -163,7 +163,7 @@ public class Visitors {
}
}
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"), null, null, null, null), 0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(Material.PAINTING),
@ -172,7 +172,7 @@ public class Visitors {
new Placeholder[]{new Placeholder("%visitors", "" + sortedIslandVisitors.size())}, null, null),
4);
nInv.addItem(
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
@ -76,7 +76,7 @@ public class Weather {
event.setWillClose(false);
event.setWillDestroy(false);
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((is.getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Weather.Item.Barrier.Displayname"))))) {
@ -84,11 +84,11 @@ public class Weather {
event.setWillClose(false);
event.setWillDestroy(false);
} else if (is.getType() == CompatibleMaterial.BARRIER.getMaterial()) {
} else if (is.getType() == XMaterial.BARRIER.parseMaterial()) {
event.setWillClose(false);
event.setWillDestroy(false);
soundManager.playSound(player, XSound.ENTITY_VILLAGER_NO);
} else if ((is.getType() == CompatibleMaterial.SUNFLOWER.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.SUNFLOWER.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Weather.Item.Time.Displayname"))))) {
int islandTime = island.getTime();
@ -222,11 +222,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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Weather.Item.Barrier.Displayname"), null, null, null, null), 1);
if (!island.isWeatherSynchronized()) {
nInv.addItem(nInv.createItem(CompatibleMaterial.SUNFLOWER.getItem(),
nInv.addItem(nInv.createItem(XMaterial.SUNFLOWER.parseItem(),
configLoad.getString("Menu.Weather.Item.Time.Displayname"),
configLoad.getStringList("Menu.Weather.Item.Time.Lore"),
new Placeholder[]{new Placeholder("%choice", timeChoice)}, null, null), 2);
@ -235,7 +235,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(CompatibleMaterial.BARRIER.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BARRIER.parseItem(),
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

@ -3,6 +3,7 @@ package com.songoda.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -61,16 +62,16 @@ public class Creator implements Listener {
if (playerData.getViewer() == null) {
List<Structure> structures = structureManager.getStructures();
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Exit.Displayname"), null, null, null, null), 0,
8);
nInv.addItem(
nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getItem()),
nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseItem()),
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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -93,7 +94,7 @@ public class Creator implements Listener {
}
if (structures.isEmpty()) {
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.BARRIER.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.BARRIER.parseMaterial()),
configLoad.getString("Menu.Admin.Creator.Browse.Item.Nothing.Displayname"), null, null, null,
null), 31);
} else {
@ -105,7 +106,7 @@ public class Creator implements Listener {
inventorySlot++;
Structure structure = structures.get(index);
nInv.addItem(nInv.createItem(structure.getMaterial().getItem(),
nInv.addItem(nInv.createItem(structure.getMaterial().parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Structure.Displayname")
.replace("%structure", structure.getName())),
@ -119,7 +120,7 @@ public class Creator implements Listener {
} else {
Structure structure = structureManager.getStructure(((Creator.Viewer) playerData.getViewer()).getName());
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Creator.Options.Item.Return.Displayname"), null, null, null, null),
0, 8);
@ -130,7 +131,7 @@ public class Creator implements Listener {
displayName = ChatColor.translateAlternateColorCodes('&', structure.getDisplayname());
}
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.NAME_TAG.parseMaterial()),
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);
@ -159,7 +160,7 @@ public class Creator implements Listener {
}
}
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.ENCHANTED_BOOK.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.ENCHANTED_BOOK.parseMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Description.Displayname"), descriptionLore,
null, null, null), 2);
@ -186,7 +187,7 @@ public class Creator implements Listener {
}
}
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.BOOK.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.BOOK.parseMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Commands.Displayname"), commandsLore, null,
null, null), 3);
@ -197,7 +198,7 @@ public class Creator implements Listener {
permissionLore = configLoad.getStringList("Menu.Admin.Creator.Options.Item.Permission.Enable.Lore");
}
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.addItem(nInv.createItem(XMaterial.MAP.parseItem(),
configLoad.getString("Menu.Admin.Creator.Options.Item.Permission.Displayname"), permissionLore,
new Placeholder[]{new Placeholder("%permission", structure.getPermission())}, null, null), 4);
@ -223,19 +224,19 @@ public class Creator implements Listener {
endFileName = fileName;
}
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.PAPER.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.PAPER.parseMaterial()),
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(CompatibleMaterial.DIAMOND.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.DIAMOND.parseMaterial()),
configLoad.getString("Menu.Admin.Creator.Options.Item.Item.Displayname"),
configLoad.getStringList("Menu.Admin.Creator.Options.Item.Item.Lore"),
new Placeholder[]{new Placeholder("%material", structure.getMaterial().name())}, null, null),
6);
nInv.addItem(nInv.createItem(new ItemStack(CompatibleMaterial.GOLD_NUGGET.getMaterial()),
nInv.addItem(nInv.createItem(new ItemStack(XMaterial.GOLD_NUGGET.parseMaterial()),
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);
@ -254,7 +255,7 @@ public class Creator implements Listener {
Player player = (Player) event.getWhoClicked();
ItemStack is = event.getCurrentItem();
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != CompatibleMaterial.AIR.getMaterial()) {
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != XMaterial.AIR.parseMaterial()) {
SkyBlock plugin = SkyBlock.getInstance();
StructureManager structureManager = plugin.getStructureManager();
@ -289,14 +290,14 @@ public class Creator implements Listener {
return;
}
if ((event.getCurrentItem().getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
if ((event.getCurrentItem().getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial())
} else if ((event.getCurrentItem().getType() == XMaterial.OAK_FENCE_GATE.parseMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Exit.Displayname")))) {
@ -315,7 +316,7 @@ public class Creator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.OAK_SIGN.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
@ -337,7 +338,7 @@ public class Creator implements Listener {
configLoad.getString("Island.Admin.Creator.Characters.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else {
structureManager.addStructure(gui.getInputText(), CompatibleMaterial.GRASS_BLOCK, null, null, null,
structureManager.addStructure(gui.getInputText(), XMaterial.GRASS_BLOCK, null, null, null,
null, false, new ArrayList<>(), new ArrayList<>(), 0.0D);
messageManager.sendMessage(player,
@ -366,7 +367,7 @@ public class Creator implements Listener {
player.closeInventory();
});
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
is = new ItemStack(XMaterial.NAME_TAG.parseMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(configLoad.getString("Menu.Admin.Creator.Browse.Item.Information.Word.Enter"));
is.setItemMeta(im);
@ -375,13 +376,13 @@ public class Creator implements Listener {
plugin.getGuiManager().showGUI(player, gui);
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.BARRIER.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.BARRIER.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Browse.Item.Nothing.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.NAME_TAG.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.NAME_TAG.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -453,7 +454,7 @@ public class Creator implements Listener {
player.closeInventory();
});
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
is = new ItemStack(XMaterial.NAME_TAG.parseMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.Displayname.Word.Enter"));
@ -475,7 +476,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.ENCHANTED_BOOK.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.ENCHANTED_BOOK.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Description.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -582,7 +583,7 @@ public class Creator implements Listener {
player.closeInventory();
});
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
is = new ItemStack(XMaterial.NAME_TAG.parseMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.Description.Word.Enter"));
@ -605,7 +606,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.BOOK.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.BOOK.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Commands.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -710,7 +711,7 @@ public class Creator implements Listener {
player.closeInventory();
});
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
is = new ItemStack(XMaterial.NAME_TAG.parseMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.Commands.Word.Enter"));
@ -735,7 +736,7 @@ public class Creator implements Listener {
return;
} else if ((event.getCurrentItem().
getType() == CompatibleMaterial.MAP.getMaterial())
getType() == XMaterial.MAP.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().
@ -790,7 +791,7 @@ public class Creator implements Listener {
return;
} else if ((event.getCurrentItem().
getType() == CompatibleMaterial.PAPER.getMaterial()) && (is.hasItemMeta())
getType() == XMaterial.PAPER.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().
getDisplayName().
@ -914,9 +915,8 @@ public class Creator implements Listener {
});
}
} else {
messageManager.sendMessage(player,
configLoad.getString("Island.Admin.Creator.File.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
messageManager.sendMessage(player, configLoad.getString("Island.Admin.Creator.File.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
}
player.closeInventory();
@ -927,7 +927,7 @@ public class Creator implements Listener {
player.closeInventory();
});
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
is = new ItemStack(XMaterial.NAME_TAG.parseMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.File.Word.Enter"));
@ -951,7 +951,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.DIAMOND.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.DIAMOND.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.Item.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -992,7 +992,7 @@ public class Creator implements Listener {
}
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.GOLD_NUGGET.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.GOLD_NUGGET.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Creator.Options.Item.DeletionCost.Displayname"))))) {
if (playerData.getViewer() == null) {
@ -1079,7 +1079,7 @@ public class Creator implements Listener {
player.closeInventory();
});
is = new ItemStack(CompatibleMaterial.NAME_TAG.getMaterial());
is = new ItemStack(XMaterial.NAME_TAG.parseMaterial());
ItemMeta im = is.getItemMeta();
im.setDisplayName(
configLoad.getString("Menu.Admin.Creator.Options.Item.DeletionCost.Word.Enter"));
@ -1110,8 +1110,8 @@ public class Creator implements Listener {
if (viewer.isItem()) {
if (structureManager.containsStructure(viewer.getName())) {
Structure structure = structureManager.getStructure(viewer.getName());
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
materials.getItem().setData(event.getCurrentItem().getData());
XMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType()).get();
materials.parseItem().setData(event.getCurrentItem().getData());
structure.setMaterial(materials);
@ -1152,7 +1152,7 @@ public class Creator implements Listener {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
for (Structure structureList : structureManager.getStructures()) {
if (event.getCurrentItem().getType() == structureList.getMaterial().getMaterial()
if (structureList.getMaterial().isSimilar(event.getCurrentItem())
&& ChatColor.stripColor(is.getItemMeta().getDisplayName())
.equals(structureList.getName())) {
if (event.getClick() == ClickType.LEFT) {

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.songoda.skyblock.SkyBlock;
@ -61,16 +62,16 @@ public class Generator implements Listener {
if (playerData.getViewer() == null) {
List<com.songoda.skyblock.generator.Generator> generators = generatorManager.getGenerators();
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial()),
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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Browse.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -105,7 +106,7 @@ public class Generator implements Listener {
inventorySlot++;
com.songoda.skyblock.generator.Generator generator = generators.get(index);
nInv.addItem(nInv.createItem(generator.getMaterials().getItem(),
nInv.addItem(nInv.createItem(generator.getMaterials().parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Generator.Displayname")
.replace("%generator", generator.getName())),
@ -128,16 +129,16 @@ public class Generator implements Listener {
.getStringList("Menu.Admin.Generator.Generator.Item.Information.Permission.Enable.Lore");
}
nInv.addItem(nInv.createItem(CompatibleMaterial.MAP.getItem(),
nInv.addItem(nInv.createItem(XMaterial.MAP.parseItem(),
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(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Return.Displayname"), null, null, null,
null), 0, 8);
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Generator.Generator.Item.Barrier.Displayname"), null, null, null,
null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -159,7 +160,7 @@ public class Generator implements Listener {
inventorySlot++;
GeneratorMaterial generatorMaterial = generatorMaterials.get(index);
nInv.addItem(nInv.createItem(generatorMaterial.getMaterials().getItem(),
nInv.addItem(nInv.createItem(generatorMaterial.getMaterials().parseItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Generator.Item.Material.Displayname")
.replace("%material", generatorMaterial.getMaterials().name())),
@ -228,7 +229,7 @@ public class Generator implements Listener {
return;
}
if ((event.getCurrentItem().getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
if ((event.getCurrentItem().getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&',
@ -239,7 +240,7 @@ public class Generator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial())
} else if ((event.getCurrentItem().getType() == XMaterial.OAK_FENCE_GATE.parseMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Exit.Displayname")))) {
@ -258,7 +259,7 @@ public class Generator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.OAK_SIGN.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Information.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
@ -317,7 +318,7 @@ public class Generator implements Listener {
plugin.getGuiManager().showGUI(player, gui);
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.MAP.getMaterial())
} else if ((event.getCurrentItem().getType() == XMaterial.MAP.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(ChatColor.translateAlternateColorCodes('&', configLoad
@ -377,7 +378,7 @@ public class Generator implements Listener {
return;
}
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial())
} else if ((event.getCurrentItem().getType() == XMaterial.PLAYER_HEAD.parseMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Generator.Browse.Item.Previous.Displayname")))) {
@ -411,7 +412,7 @@ public class Generator implements Listener {
if (generator.getGeneratorMaterials() != null) {
for (GeneratorMaterial generatorMaterialList : generator.getGeneratorMaterials()) {
if ((event.getCurrentItem().getType() == generatorMaterialList.getMaterials().getMaterial())
if ((generatorMaterialList.getMaterials().isSimilar(event.getCurrentItem()))
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(
ChatColor.translateAlternateColorCodes('&', configLoad.getString(
@ -542,8 +543,8 @@ public class Generator implements Listener {
configLoad.getString("Island.Admin.Generator.Material.Limit.Message"));
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
} else {
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
materials.getItem().setData(event.getCurrentItem().getData());
XMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType()).get();
materials.parseItem().setData(event.getCurrentItem().getData());
for (GeneratorMaterial generatorMaterialList : generator.getGeneratorMaterials()) {
if (generatorMaterialList.getMaterials() == materials) {
@ -601,7 +602,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().getMaterial()
if (generatorList.getMaterials().isSimilar(event.getCurrentItem())
&& ChatColor.stripColor(is.getItemMeta().getDisplayName())
.equals(generatorList.getName())) {
if (event.getClick() == ClickType.LEFT) {

View File

@ -3,6 +3,7 @@ package com.songoda.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils;
@ -60,13 +61,13 @@ public class Levelling implements Listener {
// Filter out materials that won't be displayed in the GUI properly
Inventory testInventory = Bukkit.createInventory(null, 9);
levellingMaterials = levellingMaterials.stream().filter(x -> {
if (x.getMaterials() == CompatibleMaterial.SPAWNER) {
if (x.getMaterials() == XMaterial.SPAWNER) {
return false;
}
if (x.getItemStack() == null) {
return false;
}
ItemStack itemStack = x.getMaterials().getItem();
ItemStack itemStack = x.getMaterials().parseItem();
itemStack.setAmount(1);
itemStack.setDurability(x.getItemStack().getDurability());
if (itemStack.getItemMeta() == null) {
@ -81,11 +82,11 @@ public class Levelling implements Listener {
nInventoryUtil nInv = new nInventoryUtil(player, null);
nInv.addItem(
nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Admin.Levelling.Item.Exit.Displayname"), null, null, null, null),
0, 8);
nInv.addItem(
nInv.createItem(new ItemStack(CompatibleMaterial.OAK_SIGN.getMaterial()),
nInv.createItem(new ItemStack(XMaterial.OAK_SIGN.parseMaterial()),
configLoad.getString("Menu.Admin.Levelling.Item.Information.Displayname"),
configLoad.getStringList("Menu.Admin.Levelling.Item.Information.Lore"),
new Placeholder[]{new Placeholder("%materials", "" + levellingMaterials.size()),
@ -95,7 +96,7 @@ public class Levelling implements Listener {
null, null),
4);
nInv.addItem(
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
configLoad.getString("Menu.Admin.Levelling.Item.Barrier.Displayname"), null, null, null, null),
9, 10, 11, 12, 13, 14, 15, 16, 17);
@ -128,7 +129,7 @@ public class Levelling implements Listener {
inventorySlot++;
LevellingMaterial material = levellingMaterials.get(index);
ItemStack itemStack = material.getMaterials().getItem();
ItemStack itemStack = material.getMaterials().parseItem();
itemStack.setAmount(1);
itemStack.setDurability(material.getItemStack().getDurability());
nInv.addItem(
@ -191,14 +192,14 @@ public class Levelling implements Listener {
return;
}
if ((event.getCurrentItem().getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
if ((event.getCurrentItem().getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Levelling.Item.Barrier.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_GLASS_BREAK);
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial())
} else if ((event.getCurrentItem().getType() == XMaterial.OAK_FENCE_GATE.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Levelling.Item.Exit.Displayname"))))) {
@ -206,7 +207,7 @@ public class Levelling implements Listener {
player.closeInventory();
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.OAK_SIGN.getMaterial()) && (is.hasItemMeta())
} else if ((event.getCurrentItem().getType() == XMaterial.OAK_SIGN.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Levelling.Item.Information.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
@ -270,7 +271,7 @@ public class Levelling implements Listener {
soundManager.playSound(player, XSound.BLOCK_ANVIL_LAND);
return;
} else if ((event.getCurrentItem().getType() == CompatibleMaterial.PLAYER_HEAD.getMaterial())
} else if ((event.getCurrentItem().getType() == XMaterial.PLAYER_HEAD.parseMaterial())
&& (is.hasItemMeta())) {
if (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Admin.Levelling.Item.Previous.Displayname")))) {
@ -297,10 +298,10 @@ public class Levelling implements Listener {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
for (LevellingMaterial materialList : levellingManager.getWorthsAsLevelingMaterials()) {
CompatibleMaterial materials = materialList.getMaterials();
XMaterial materials = materialList.getMaterials();
if (CompatibleMaterial.getMaterial(materials.getMaterial()) != null
&& event.getCurrentItem().getType() == CompatibleMaterial.getMaterial(materials.getMaterial()).getMaterial()
if (CompatibleMaterial.getMaterial(materials.parseMaterial()) != null
&& event.getCurrentItem().getType() == CompatibleMaterial.getMaterial(materials.parseMaterial()).get().parseMaterial()
&& ChatColor.stripColor(is.getItemMeta().getDisplayName()).equals(materials.name())) {
if (event.getClick() == ClickType.LEFT) {
@ -323,8 +324,7 @@ public class Levelling implements Listener {
.getString("Island.Admin.Levelling.Points.Message")
.replace("%material", materials.name()).replace("%points",
NumberUtils.formatNumber(materialPoints)));
soundManager.playSound(player, XSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
1.0F);
soundManager.playSound(player, XSound.ENTITY_PLAYER_LEVELUP);
player.closeInventory();
Bukkit.getServer().getScheduler().runTaskLater(plugin,
@ -398,10 +398,10 @@ public class Levelling implements Listener {
}
}
CompatibleMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType());
XMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType()).get();
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) {
materials.getItem().setData(event.getCurrentItem().getData());
materials.parseItem().setData(event.getCurrentItem().getData());
}
if (levellingManager.hasWorth(materials)) {

View File

@ -1,8 +1,8 @@
package com.songoda.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.NumberUtils;
import com.songoda.skyblock.SkyBlock;
@ -70,7 +70,7 @@ public class Upgrade {
ItemStack is = event.getItem();
com.songoda.skyblock.upgrade.Upgrade upgrade = null;
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Exit.Displayname"))))) {
soundManager.playSound(player, XSound.BLOCK_CHEST_CLOSE);
@ -88,7 +88,7 @@ public class Upgrade {
.get(0);
viewer.setUpgrade(com.songoda.skyblock.upgrade.Upgrade.Type.JUMP);
}
} else if ((is.getType() == CompatibleMaterial.WHEAT_SEEDS.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.WHEAT_SEEDS.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName().equals(plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Crop.Displayname"))))) {
upgrade = upgradeManager.getUpgrades(com.songoda.skyblock.upgrade.Upgrade.Type.CROP)
@ -124,7 +124,7 @@ public class Upgrade {
soundManager.playSound(player, XSound.BLOCK_WOODEN_BUTTON_CLICK_ON);
Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> open(player), 1L);
} else if ((is.getType() == CompatibleMaterial.SPAWNER.getMaterial()) && (is.hasItemMeta())
} else if ((is.getType() == XMaterial.SPAWNER.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad
.getString("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Displayname"))))) {
@ -281,7 +281,7 @@ public class Upgrade {
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
upgrade = upgradeManager.getUpgrades(com.songoda.skyblock.upgrade.Upgrade.Type.CROP).get(0);
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
nInv.addItem(nInv.createItem(XMaterial.WHEAT_SEEDS.parseItem(),
plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Crop.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Crop.Lore"),
@ -334,13 +334,13 @@ public class Upgrade {
upgradeTiersMembers = upgradesMembers.size();
}
nInv.addItem(nInv.createItem(CompatibleMaterial.BOOKSHELF.getItem(), plugin.formatText(
nInv.addItem(nInv.createItem(XMaterial.BOOKSHELF.parseItem(), plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Members.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Members.Lore"),
new Placeholder[]{new Placeholder("%tiers", "" + upgradeTiersMembers)}, null, null), 4);
upgrade = upgradeManager.getUpgrades(com.songoda.skyblock.upgrade.Upgrade.Type.SPAWNER).get(0);
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
nInv.addItem(nInv.createItem(XMaterial.SPAWNER.parseItem(),
plugin.formatText(configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Upgrades.Item.Spawner.Lore"),
new Placeholder[]{
@ -348,7 +348,7 @@ public class Upgrade {
new Placeholder("%status", getStatus(upgrade))},
null, null), 6);
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
plugin.formatText(configLoad.getString("Menu.Admin.Upgrade.Upgrades.Item.Exit.Displayname")),
null, null, null, null), 8);
@ -371,7 +371,7 @@ public class Upgrade {
PlayerData playerData = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad
.getString("Menu.Admin.Upgrade.Size.Item.Return.Displayname"))))) {
@ -474,7 +474,7 @@ public class Upgrade {
}, 1L);
}
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((is.getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad
@ -672,7 +672,7 @@ public class Upgrade {
}
});
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Size.Item.Return.Displayname")),
null, null, null, null), 0);
@ -683,7 +683,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(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Size.Item.Barrier.Displayname")),
null, null, null, null), 2);
@ -736,7 +736,7 @@ public class Upgrade {
PlayerData playerData = playerDataManager.getPlayerData(player);
ItemStack is = event.getItem();
if ((is.getType() == CompatibleMaterial.OAK_FENCE_GATE.getMaterial()) && (is.hasItemMeta())
if ((is.getType() == XMaterial.OAK_FENCE_GATE.parseMaterial()) && (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad
.getString("Menu.Admin.Upgrade.Members.Item.Return.Displayname"))))) {
@ -838,7 +838,7 @@ public class Upgrade {
}, 1L);
}
} else if ((is.getType() == CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getMaterial())
} else if ((is.getType() == XMaterial.BLACK_STAINED_GLASS_PANE.parseMaterial())
&& (is.hasItemMeta())
&& (is.getItemMeta().getDisplayName()
.equals(plugin.formatText(configLoad
@ -1042,7 +1042,7 @@ public class Upgrade {
}
});
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Members.Item.Return.Displayname")),
null, null, null, null), 0);
@ -1051,7 +1051,7 @@ public class Upgrade {
configLoad.getString("Menu.Admin.Upgrade.Members.Item.Information.Displayname")),
configLoad.getStringList("Menu.Admin.Upgrade.Members.Item.Information.Lore"), null, null, null),
1);
nInv.addItem(nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(),
plugin.formatText(
configLoad.getString("Menu.Admin.Upgrade.Members.Item.Barrier.Displayname")),
null, null, null, null), 2);

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.permission;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
@ -16,10 +16,10 @@ import java.util.List;
public abstract class BasicPermission {
private final String name;
private final CompatibleMaterial icon;
private final XMaterial icon;
private final PermissionType type;
protected BasicPermission(@Nonnull String name, @Nonnull CompatibleMaterial icon, @Nonnull PermissionType type) {
protected BasicPermission(@Nonnull String name, @Nonnull XMaterial icon, @Nonnull PermissionType type) {
this.name = name;
this.icon = icon;
this.type = type;
@ -30,7 +30,7 @@ public abstract class BasicPermission {
}
public ItemStack getItem(boolean permissionEnabled, IslandRole role) {
ItemStack is = this.icon.getItem();
ItemStack is = this.icon.parseItem();
FileConfiguration configLoad = SkyBlock.getInstance().getLanguage();
List<String> itemLore = new ArrayList<>();
@ -65,7 +65,7 @@ public abstract class BasicPermission {
return this.name;
}
public CompatibleMaterial getIcon() {
public XMaterial getIcon() {
return this.icon;
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.permission;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
@ -35,7 +35,7 @@ import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
public abstract class ListeningPermission extends BasicPermission {
protected ListeningPermission(String name, CompatibleMaterial icon, PermissionType type) {
protected ListeningPermission(String name, XMaterial icon, PermissionType type) {
super(name, icon, type);
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class BanPermission extends BasicPermission {
public BanPermission() {
super("Ban", CompatibleMaterial.IRON_AXE, PermissionType.OPERATOR);
super("Ban", XMaterial.IRON_AXE, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class BiomePermission extends BasicPermission {
public BiomePermission() {
super("Biome", CompatibleMaterial.MAP, PermissionType.OPERATOR);
super("Biome", XMaterial.MAP, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class BorderPermission extends BasicPermission {
public BorderPermission() {
super("Border", CompatibleMaterial.BEACON, PermissionType.OPERATOR);
super("Border", XMaterial.BEACON, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class CoopPlayersPermission extends BasicPermission {
public CoopPlayersPermission() {
super("CoopPlayers", CompatibleMaterial.BOOK, PermissionType.OPERATOR);
super("CoopPlayers", XMaterial.BOOK, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class FireSpreadPermission extends BasicPermission {
public FireSpreadPermission() {
super("FireSpread", CompatibleMaterial.FLINT_AND_STEEL, PermissionType.ISLAND);
super("FireSpread", XMaterial.FLINT_AND_STEEL, PermissionType.ISLAND);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class IslandPermission extends BasicPermission {
public IslandPermission() {
super("Island", CompatibleMaterial.OAK_SAPLING, PermissionType.OPERATOR);
super("Island", XMaterial.OAK_SAPLING, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class KeepItemsOnDeathPermission extends BasicPermission {
public KeepItemsOnDeathPermission() {
super("KeepItemsOnDeath", CompatibleMaterial.ITEM_FRAME, PermissionType.ISLAND);
super("KeepItemsOnDeath", XMaterial.ITEM_FRAME, PermissionType.ISLAND);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class KickPermission extends BasicPermission {
public KickPermission() {
super("Visitor", CompatibleMaterial.IRON_DOOR, PermissionType.OPERATOR);
super("Visitor", XMaterial.IRON_DOOR, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class LeafDecayPermission extends BasicPermission {
public LeafDecayPermission() {
super("LeafDecay", CompatibleMaterial.OAK_LEAVES, PermissionType.ISLAND);
super("LeafDecay", XMaterial.OAK_LEAVES, PermissionType.ISLAND);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class MainSpawnPermission extends BasicPermission {
public MainSpawnPermission() {
super("MainSpawn", CompatibleMaterial.EMERALD, PermissionType.OPERATOR);
super("MainSpawn", XMaterial.EMERALD, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class MemberPermission extends BasicPermission {
public MemberPermission() {
super("Member", CompatibleMaterial.PAINTING, PermissionType.OPERATOR);
super("Member", XMaterial.PAINTING, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class NaturalMobSpawningPermission extends BasicPermission {
public NaturalMobSpawningPermission() {
super("NaturalMobSpawning", CompatibleMaterial.PIG_SPAWN_EGG, PermissionType.ISLAND);
super("NaturalMobSpawning", XMaterial.PIG_SPAWN_EGG, PermissionType.ISLAND);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class UnbanPermission extends BasicPermission {
public UnbanPermission() {
super("Unban", CompatibleMaterial.RED_DYE, PermissionType.OPERATOR);
super("Unban", XMaterial.RED_DYE, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class VisitorPermission extends BasicPermission {
public VisitorPermission() {
super("Visitor", CompatibleMaterial.OAK_SIGN, PermissionType.OPERATOR);
super("Visitor", XMaterial.OAK_SIGN, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class VisitorSpawnPermission extends BasicPermission {
public VisitorSpawnPermission() {
super("VisitorSpawn", CompatibleMaterial.NETHER_STAR, PermissionType.OPERATOR);
super("VisitorSpawn", XMaterial.NETHER_STAR, PermissionType.OPERATOR);
}
}

View File

@ -1,11 +1,11 @@
package com.songoda.skyblock.permission.permissions.basic;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.permission.BasicPermission;
import com.songoda.skyblock.permission.PermissionType;
public class WeatherPermission extends BasicPermission {
public WeatherPermission() {
super("Weather", CompatibleMaterial.CLOCK, PermissionType.OPERATOR);
super("Weather", XMaterial.CLOCK, PermissionType.OPERATOR);
}
}

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -18,7 +18,7 @@ public class AnimalBreedingPermission extends ListeningPermission {
private final MessageManager messageManager;
public AnimalBreedingPermission(SkyBlock plugin) {
super("AnimalBreeding", CompatibleMaterial.WHEAT, PermissionType.GENERIC);
super("AnimalBreeding", XMaterial.WHEAT, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -30,27 +30,27 @@ public class AnimalBreedingPermission extends ListeningPermission {
Entity entity = event.getRightClicked();
if (entity.getType() == EntityType.HORSE) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.GOLDEN_APPLE
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.GOLDEN_CARROT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.SUGAR
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.WHEAT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.APPLE
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.HAY_BLOCK)) {
if (!(XMaterial.GOLDEN_APPLE.isSimilar(is)
|| XMaterial.GOLDEN_CARROT.isSimilar(is)
|| XMaterial.SUGAR.isSimilar(is)
|| XMaterial.WHEAT.isSimilar(is)
|| XMaterial.APPLE.isSimilar(is)
|| XMaterial.HAY_BLOCK.isSimilar(is))) {
return;
}
} else if (entity.getType() == EntityType.SHEEP || entity.getType() == EntityType.COW || entity.getType() == EntityType.MUSHROOM_COW) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.WHEAT)) {
if (!(XMaterial.WHEAT.isSimilar(is))) {
return;
}
} else if (entity.getType() == EntityType.PIG) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.CARROT || CompatibleMaterial.getMaterial(is) == CompatibleMaterial.POTATO)) {
if (!(XMaterial.CARROT.isSimilar(is) || XMaterial.POTATO.isSimilar(is))) {
return;
}
} else if (entity.getType() == EntityType.CHICKEN) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.WHEAT_SEEDS
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.PUMPKIN_SEEDS || CompatibleMaterial.getMaterial(is) == CompatibleMaterial.MELON_SEEDS)) {
if (!(XMaterial.WHEAT_SEEDS.isSimilar(is)
|| XMaterial.PUMPKIN_SEEDS.isSimilar(is) || XMaterial.MELON_SEEDS.isSimilar(is))) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BEETROOT_SEEDS)) {
if (!(XMaterial.BEETROOT_SEEDS.isSimilar(is))) {
return;
}
} else {
@ -58,42 +58,42 @@ public class AnimalBreedingPermission extends ListeningPermission {
}
}
} else if (entity.getType() == EntityType.WOLF) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BONE
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.PORKCHOP
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.BEEF
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.CHICKEN
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.RABBIT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.MUTTON
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.ROTTEN_FLESH
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_PORKCHOP
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_BEEF
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_CHICKEN
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_RABBIT
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COOKED_MUTTON)) {
if (!(XMaterial.BONE.isSimilar(is)
|| XMaterial.PORKCHOP.isSimilar(is)
|| XMaterial.BEEF.isSimilar(is)
|| XMaterial.CHICKEN.isSimilar(is)
|| XMaterial.RABBIT.isSimilar(is)
|| XMaterial.MUTTON.isSimilar(is)
|| XMaterial.ROTTEN_FLESH.isSimilar(is)
|| XMaterial.COOKED_PORKCHOP.isSimilar(is)
|| XMaterial.COOKED_BEEF.isSimilar(is)
|| XMaterial.COOKED_CHICKEN.isSimilar(is)
|| XMaterial.COOKED_RABBIT.isSimilar(is)
|| XMaterial.COOKED_MUTTON.isSimilar(is))) {
return;
}
} else if (entity.getType() == EntityType.OCELOT) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.COD
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.SALMON
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.TROPICAL_FISH
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.PUFFERFISH)) {
if (!(XMaterial.COD.isSimilar(is)
|| XMaterial.SALMON.isSimilar(is)
|| XMaterial.TROPICAL_FISH.isSimilar(is)
|| XMaterial.PUFFERFISH.isSimilar(is))) {
return;
}
} else if (entity.getType() == EntityType.RABBIT) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.DANDELION
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.CARROTS
|| CompatibleMaterial.getMaterial(is) == CompatibleMaterial.GOLDEN_CARROT)) {
if (!(XMaterial.DANDELION.isSimilar(is)
|| XMaterial.CARROTS.isSimilar(is)
|| XMaterial.GOLDEN_CARROT.isSimilar(is))) {
return;
}
} else {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_10)) {
if (entity.getType() == EntityType.LLAMA) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.HAY_BLOCK)) {
if (!(XMaterial.HAY_BLOCK.isSimilar(is))) {
return;
}
} else if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) {
if (entity.getType() == EntityType.TURTLE) {
if (!(CompatibleMaterial.getMaterial(is) == CompatibleMaterial.SEAGRASS)) {
if (!(XMaterial.SEAGRASS.isSimilar(is))) {
return;
}
} else {

View File

@ -1,12 +1,12 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
import com.songoda.skyblock.permission.PermissionHandler;
import com.songoda.skyblock.permission.PermissionType;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
@ -15,7 +15,7 @@ public class AnvilPermission extends ListeningPermission {
private final MessageManager messageManager;
public AnvilPermission(SkyBlock plugin) {
super("Anvil", CompatibleMaterial.ANVIL, PermissionType.GENERIC);
super("Anvil", XMaterial.ANVIL, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -26,11 +26,9 @@ public class AnvilPermission extends ListeningPermission {
return;
}
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
Player player = event.getPlayer();
if (material == CompatibleMaterial.ANVIL) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
XMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock().getType()).orElse(null);
if (material == XMaterial.ANVIL) {
cancelAndMessage(event, event.getPlayer(), this.plugin, this.messageManager);
}
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -16,7 +16,7 @@ public class ArmorStandUsePermission extends ListeningPermission {
private final MessageManager messageManager;
public ArmorStandUsePermission(SkyBlock plugin) {
super("ArmorStandUse", CompatibleMaterial.ARMOR_STAND, PermissionType.GENERIC);
super("ArmorStandUse", XMaterial.ARMOR_STAND, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -25,8 +25,9 @@ public class ArmorStandUsePermission extends ListeningPermission {
public void onInteractEntity(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
if (event.getRightClicked() instanceof ArmorStand)
if (event.getRightClicked() instanceof ArmorStand) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
}
}
@PermissionHandler

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -17,7 +17,7 @@ public class BeaconPermission extends ListeningPermission {
private final MessageManager messageManager;
public BeaconPermission(SkyBlock plugin) {
super("Beacon", CompatibleMaterial.BEACON, PermissionType.GENERIC);
super("Beacon", XMaterial.BEACON, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -15,7 +16,7 @@ public class BedPermission extends ListeningPermission {
private final MessageManager messageManager;
public BedPermission(SkyBlock plugin) {
super("Bed", CompatibleMaterial.RED_BED, PermissionType.GENERIC);
super("Bed", XMaterial.RED_BED, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -26,17 +27,17 @@ public class BedPermission extends ListeningPermission {
return;
}
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
XMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock().getType()).orElse(null);
Player player = event.getPlayer();
if (material == CompatibleMaterial.WHITE_BED || material == CompatibleMaterial.ORANGE_BED
|| material == CompatibleMaterial.MAGENTA_BED || material == CompatibleMaterial.LIGHT_BLUE_BED
|| material == CompatibleMaterial.YELLOW_BED || material == CompatibleMaterial.LIME_BED
|| material == CompatibleMaterial.PINK_BED || material == CompatibleMaterial.GRAY_BED
|| material == CompatibleMaterial.LIGHT_GRAY_BED || material == CompatibleMaterial.CYAN_BED
|| material == CompatibleMaterial.PURPLE_BED || material == CompatibleMaterial.BLUE_BED
|| material == CompatibleMaterial.BROWN_BED || material == CompatibleMaterial.GREEN_BED
|| material == CompatibleMaterial.RED_BED || material == CompatibleMaterial.BLACK_BED) {
if (material == XMaterial.WHITE_BED || material == XMaterial.ORANGE_BED
|| material == XMaterial.MAGENTA_BED || material == XMaterial.LIGHT_BLUE_BED
|| material == XMaterial.YELLOW_BED || material == XMaterial.LIME_BED
|| material == XMaterial.PINK_BED || material == XMaterial.GRAY_BED
|| material == XMaterial.LIGHT_GRAY_BED || material == XMaterial.CYAN_BED
|| material == XMaterial.PURPLE_BED || material == XMaterial.BLUE_BED
|| material == XMaterial.BROWN_BED || material == XMaterial.GREEN_BED
|| material == XMaterial.RED_BED || material == XMaterial.BLACK_BED) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -15,7 +15,7 @@ public class BoatPermission extends ListeningPermission {
private final MessageManager messageManager;
public BoatPermission(SkyBlock plugin) {
super("Boat", CompatibleMaterial.OAK_BOAT, PermissionType.GENERIC);
super("Boat", XMaterial.OAK_BOAT, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -16,7 +17,7 @@ public class BrewingPermission extends ListeningPermission {
private final MessageManager messageManager;
public BrewingPermission(SkyBlock plugin) {
super("Brewing", CompatibleMaterial.BREWING_STAND, PermissionType.GENERIC);
super("Brewing", XMaterial.BREWING_STAND, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -30,7 +31,7 @@ public class BrewingPermission extends ListeningPermission {
Player player = event.getPlayer();
Block block = event.getClickedBlock();
if (CompatibleMaterial.getMaterial(block) == CompatibleMaterial.BREWING_STAND) {
if (CompatibleMaterial.getMaterial(block.getType()).orElse(null) == XMaterial.BREWING_STAND) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
}
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -18,7 +19,7 @@ public class BucketPermission extends ListeningPermission {
private final MessageManager messageManager;
public BucketPermission(SkyBlock plugin) {
super("Bucket", CompatibleMaterial.BUCKET, PermissionType.GENERIC);
super("Bucket", XMaterial.BUCKET, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -28,16 +29,16 @@ public class BucketPermission extends ListeningPermission {
Player player = event.getPlayer();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
if (player.getGameMode() == GameMode.SURVIVAL
&& CompatibleMaterial.getMaterial(event.getClickedBlock()) == CompatibleMaterial.OBSIDIAN
&& CompatibleMaterial.getMaterial(event.getClickedBlock().getType()).orElse(null) == XMaterial.OBSIDIAN
&& event.getItem() != null
&& CompatibleMaterial.getMaterial(event.getItem()) != CompatibleMaterial.AIR
&& CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.BUCKET) {
&& !CompatibleMaterial.isAir(CompatibleMaterial.getMaterial(event.getItem().getType()).orElse(XMaterial.STONE))
&& XMaterial.BUCKET.isSimilar(event.getItem())) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
}
} else if (event.getItem() != null && CompatibleMaterial.getMaterial(event.getItem()) != CompatibleMaterial.AIR) {
if (CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.BUCKET
|| CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.WATER_BUCKET
|| CompatibleMaterial.getMaterial(event.getItem()) == CompatibleMaterial.LAVA_BUCKET) {
} else if (event.getItem() != null && !CompatibleMaterial.isAir(CompatibleMaterial.getMaterial(event.getItem().getType()).orElse(XMaterial.STONE))) {
if (XMaterial.BUCKET.isSimilar(event.getItem())
|| XMaterial.WATER_BUCKET.isSimilar(event.getItem())
|| XMaterial.LAVA_BUCKET.isSimilar(event.getItem())) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
player.updateInventory();
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -16,7 +17,7 @@ public class CakePermission extends ListeningPermission {
private final MessageManager messageManager;
public CakePermission(SkyBlock plugin) {
super("Cake", CompatibleMaterial.CAKE, PermissionType.GENERIC);
super("Cake", XMaterial.CAKE, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -30,7 +31,7 @@ public class CakePermission extends ListeningPermission {
Player player = event.getPlayer();
Block block = event.getClickedBlock();
if (CompatibleMaterial.getMaterial(block) == CompatibleMaterial.CAKE) {
if (CompatibleMaterial.getMaterial(block.getType()).orElse(null) == XMaterial.CAKE) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
}
}

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -16,7 +17,7 @@ public class CauldronPermission extends ListeningPermission {
private final MessageManager messageManager;
public CauldronPermission(SkyBlock plugin) {
super("Cauldron", CompatibleMaterial.CAULDRON, PermissionType.GENERIC);
super("Cauldron", XMaterial.CAULDRON, PermissionType.GENERIC);
this.plugin = plugin;
this.messageManager = plugin.getMessageManager();
}
@ -29,7 +30,7 @@ public class CauldronPermission extends ListeningPermission {
Block block = event.getClickedBlock();
if (CompatibleMaterial.getMaterial(block) == CompatibleMaterial.CAULDRON) {
if (CompatibleMaterial.getMaterial(block.getType()).orElse(null) == XMaterial.CAULDRON) {
cancelAndMessage(event, player, this.plugin, this.messageManager);
}
}

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.permission.ListeningPermission;
@ -21,7 +21,7 @@ public class DamagePermission extends ListeningPermission {
private final FileManager fileManager;
public DamagePermission(SkyBlock plugin) {
super("Damage", CompatibleMaterial.RED_DYE, PermissionType.GENERIC);
super("Damage", XMaterial.RED_DYE, PermissionType.GENERIC);
this.plugin = plugin;
this.fileManager = plugin.getFileManager();
}

Some files were not shown because too many files have changed in this diff Show More