Migrate from SongodaCore to CraftaroCore v3.0.0-SNAPSHOT

This commit is contained in:
Christian Koop 2023-06-29 09:43:54 +02:00
parent 1851f7665e
commit f2c9ce176a
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
29 changed files with 176 additions and 158 deletions

26
pom.xml
View File

@ -68,6 +68,14 @@
<exclude>LICENSE.**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.craftaro:CraftaroCore</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
</includes>
</filter>
</filters>
</configuration>
</execution>
@ -89,6 +97,11 @@
<url>https://repo.craftaro.com/repository/minecraft-plugins/</url>
</repository>
<repository>
<id>SpigotMC</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>public</id>
<url>https://repo.songoda.com/repository/public/</url>
@ -96,20 +109,15 @@
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<url>https://jitpack.io/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<version>2.6.20</version>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId>
<version>3.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

View File

@ -1,19 +1,19 @@
package com.songoda.epichoppers;
import com.songoda.core.SongodaCore;
import com.songoda.core.SongodaPlugin;
import com.songoda.core.commands.CommandManager;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.configuration.Config;
import com.songoda.core.database.DataMigrationManager;
import com.songoda.core.database.DatabaseConnector;
import com.songoda.core.database.MySQLConnector;
import com.songoda.core.database.SQLiteConnector;
import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.SongodaCore;
import com.craftaro.core.SongodaPlugin;
import com.craftaro.core.commands.CommandManager;
import com.craftaro.core.configuration.Config;
import com.craftaro.core.database.DataMigrationManager;
import com.craftaro.core.database.DatabaseConnector;
import com.craftaro.core.database.MySQLConnector;
import com.craftaro.core.database.SQLiteConnector;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.hooks.EconomyManager;
import com.craftaro.core.hooks.ProtectionManager;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.boost.BoostManager;
import com.songoda.epichoppers.commands.CommandBoost;
import com.songoda.epichoppers.commands.CommandGive;
@ -84,7 +84,7 @@ public class EpicHoppers extends SongodaPlugin {
@Override
public void onPluginEnable() {
// Run Songoda Updater
SongodaCore.registerPlugin(this, 15, CompatibleMaterial.HOPPER);
SongodaCore.registerPlugin(this, 15, XMaterial.HOPPER);
// Load Economy
EconomyManager.load();
@ -252,7 +252,7 @@ public class EpicHoppers extends SongodaPlugin {
}
public ItemStack newHopperItem(Level level) {
ItemStack item = new ItemStack(CompatibleMaterial.HOPPER.getMaterial());
ItemStack item = XMaterial.HOPPER.parseItem();
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(TextUtils.formatText(Methods.formatName(level.getLevel())));
String line = getLocale().getMessage("general.nametag.lore").getMessage();

View File

@ -1,8 +1,8 @@
package com.songoda.epichoppers.commands;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.core.utils.NumberUtils;
import com.songoda.core.utils.TimeUtils;
import com.craftaro.core.commands.AbstractCommand;
import com.craftaro.core.utils.NumberUtils;
import com.craftaro.core.utils.TimeUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.boost.BoostData;
import org.bukkit.Bukkit;

View File

@ -1,6 +1,6 @@
package com.songoda.epichoppers.commands;
import com.songoda.core.commands.AbstractCommand;
import com.craftaro.core.commands.AbstractCommand;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.levels.Level;
import org.bukkit.Bukkit;

View File

@ -1,6 +1,6 @@
package com.songoda.epichoppers.commands;
import com.songoda.core.commands.AbstractCommand;
import com.craftaro.core.commands.AbstractCommand;
import com.songoda.epichoppers.EpicHoppers;
import org.bukkit.command.CommandSender;

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.commands;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.core.configuration.editor.PluginConfigGui;
import com.craftaro.core.commands.AbstractCommand;
import com.craftaro.core.configuration.editor.PluginConfigGui;
import com.songoda.epichoppers.EpicHoppers;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.database;
import com.songoda.core.database.DataManagerAbstract;
import com.songoda.core.database.DatabaseConnector;
import com.craftaro.core.database.DataManagerAbstract;
import com.craftaro.core.database.DatabaseConnector;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.boost.BoostData;
import com.songoda.epichoppers.hopper.Filter;

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.database.migrations;
import com.songoda.core.database.DataMigration;
import com.songoda.core.database.MySQLConnector;
import com.craftaro.core.database.DataMigration;
import com.craftaro.core.database.MySQLConnector;
import com.songoda.epichoppers.EpicHoppers;
import java.sql.Connection;

View File

@ -1,9 +1,9 @@
package com.songoda.epichoppers.gui;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.CustomizableGui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.gui.CustomizableGui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Filter;
import com.songoda.epichoppers.hopper.Hopper;
@ -60,7 +60,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
mirrorFill("mirrorfill_8", 2, 8, true, false, glass2);
mirrorFill("mirrorfill_9", 4, 7, false, false, glass1);
setButton("back", 8, GuiUtils.createButtonItem(CompatibleMaterial.ARROW.getItem(),
setButton("back", 8, GuiUtils.createButtonItem(XMaterial.ARROW.parseItem(),
plugin.getLocale().getMessage("general.nametag.back").getMessage()),
(event) -> {
hopper.overview(this.guiManager, event.player);
@ -68,7 +68,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
});
// Whitelist
ItemStack indicatorItem = CompatibleMaterial.WHITE_STAINED_GLASS_PANE.getItem();
ItemStack indicatorItem = XMaterial.WHITE_STAINED_GLASS_PANE.parseItem();
ItemMeta indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.whitelist").getMessage());
indicatorItem.setItemMeta(indicatorMeta);
@ -88,7 +88,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
}
// Blacklist
indicatorItem = CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem();
indicatorItem = XMaterial.BLACK_STAINED_GLASS_PANE.parseItem();
indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.blacklist").getMessage());
indicatorItem.setItemMeta(indicatorMeta);
@ -108,7 +108,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
}
// Info item
indicatorItem = new ItemStack(CompatibleMaterial.PAPER.getMaterial());
indicatorItem = XMaterial.PAPER.parseItem();
indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.infotitle").getMessage());

View File

@ -1,9 +1,9 @@
package com.songoda.epichoppers.gui;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.CustomizableGui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.gui.CustomizableGui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.hopper.levels.modules.ModuleAutoCrafting;
@ -35,7 +35,7 @@ public class GUICrafting extends CustomizableGui {
mirrorFill("mirrorfill_4", 1, 0, false, true, glass2);
mirrorFill("mirrorfill_5", 1, 1, false, true, glass3);
setButton("back", 8, GuiUtils.createButtonItem(CompatibleMaterial.ARROW.getItem(),
setButton("back", 8, GuiUtils.createButtonItem(XMaterial.ARROW.parseItem(),
plugin.getLocale().getMessage("general.nametag.back").getMessage()),
(event) -> {
hopper.overview(this.guiManager, event.player);

View File

@ -1,9 +1,9 @@
package com.songoda.epichoppers.gui;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.CustomizableGui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.gui.CustomizableGui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Filter;
import com.songoda.epichoppers.hopper.Hopper;
@ -59,12 +59,12 @@ public class GUIFilter extends CustomizableGui {
mirrorFill("mirrorfill_7", 2, 7, true, false, glass1);
mirrorFill("mirrorfill_8", 2, 8, true, false, glass2);
ItemStack it = CompatibleMaterial.WHITE_STAINED_GLASS_PANE.getItem();
ItemStack it = XMaterial.WHITE_STAINED_GLASS_PANE.parseItem();
ItemMeta itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.whitelist").getMessage());
it.setItemMeta(itm);
setButton("back", 8, GuiUtils.createButtonItem(CompatibleMaterial.ARROW.getItem(),
setButton("back", 8, GuiUtils.createButtonItem(XMaterial.ARROW.parseItem(),
plugin.getLocale().getMessage("general.nametag.back").getMessage()),
(event) -> {
hopper.overview(this.guiManager, event.player);
@ -86,7 +86,7 @@ public class GUIFilter extends CustomizableGui {
num++;
}
it = CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem();
it = XMaterial.BLACK_STAINED_GLASS_PANE.parseItem();
itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.blacklist").getMessage());
it.setItemMeta(itm);
@ -107,7 +107,7 @@ public class GUIFilter extends CustomizableGui {
num++;
}
it = new ItemStack(CompatibleMaterial.BARRIER.getMaterial());
it = XMaterial.BARRIER.parseItem();
itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.void").getMessage());
it.setItemMeta(itm);
@ -127,7 +127,7 @@ public class GUIFilter extends CustomizableGui {
num++;
}
ItemStack itemInfo = new ItemStack(CompatibleMaterial.PAPER.getMaterial());
ItemStack itemInfo = XMaterial.PAPER.parseItem();
ItemMeta itemMetaInfo = itemInfo.getItemMeta();
itemMetaInfo.setDisplayName(plugin.getLocale().getMessage("interface.filter.infotitle").getMessage());
ArrayList<String> loreInfo = new ArrayList<>();
@ -141,7 +141,7 @@ public class GUIFilter extends CustomizableGui {
setItem("info", 16, itemInfo);
ItemStack hook = new ItemStack(CompatibleMaterial.TRIPWIRE_HOOK.getMaterial());
ItemStack hook = XMaterial.TRIPWIRE_HOOK.parseItem();
ItemMeta hookMeta = hook.getItemMeta();
hookMeta.setDisplayName(plugin.getLocale().getMessage("interface.hopper.rejectsync").getMessage());
ArrayList<String> loreHook = new ArrayList<>();

View File

@ -1,12 +1,12 @@
package com.songoda.epichoppers.gui;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.gui.CustomizableGui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.NumberUtils;
import com.songoda.core.utils.TextUtils;
import com.songoda.core.utils.TimeUtils;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.CustomizableGui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.NumberUtils;
import com.craftaro.core.utils.TextUtils;
import com.craftaro.core.utils.TimeUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.boost.BoostData;
import com.songoda.epichoppers.hopper.Hopper;
@ -250,7 +250,7 @@ public class GUIOverview extends CustomizableGui {
&& level.getCostExperience() != -1
&& this.player.hasPermission("EpicHoppers.Upgrade.XP")) {
setButton("upgrade_xp", 1, 2, GuiUtils.createButtonItem(
Settings.XP_ICON.getMaterial(CompatibleMaterial.EXPERIENCE_BOTTLE),
Settings.XP_ICON.getMaterial(XMaterial.EXPERIENCE_BOTTLE),
this.plugin.getLocale().getMessage("interface.hopper.upgradewithxp").getMessage(),
nextLevel != null
? this.plugin.getLocale().getMessage("interface.hopper.upgradewithxplore")
@ -265,7 +265,7 @@ public class GUIOverview extends CustomizableGui {
&& level.getCostEconomy() != -1
&& this.player.hasPermission("EpicHoppers.Upgrade.ECO")) {
setButton("upgrade_economy", 1, 6, GuiUtils.createButtonItem(
Settings.ECO_ICON.getMaterial(CompatibleMaterial.SUNFLOWER),
Settings.ECO_ICON.getMaterial(XMaterial.SUNFLOWER),
this.plugin.getLocale().getMessage("interface.hopper.upgradewitheconomy").getMessage(),
nextLevel != null
? this.plugin.getLocale().getMessage("interface.hopper.upgradewitheconomylore")

View File

@ -1,9 +1,10 @@
package com.songoda.epichoppers.gui;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.CustomizableGui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.gui.CustomizableGui;
import com.craftaro.core.gui.GuiUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.hopper.levels.modules.ModuleAutoSmelter;
@ -22,9 +23,9 @@ public class GUISmeltable extends CustomizableGui {
private final int maxPages;
private final ModuleAutoSmelter moduleAutoSmelter;
private static final List<CompatibleMaterial> BURNABLES = Arrays
.stream(CompatibleMaterial.values())
.filter(material -> material.getBurnResult() != null)
private static final List<XMaterial> BURNABLES = Arrays
.stream(XMaterial.values())
.filter(material -> CompatibleMaterial.getFurnaceResult(material) != null)
.collect(Collectors.toList());
public GUISmeltable(ModuleAutoSmelter moduleAutoSmelter, EpicHoppers plugin, Hopper hopper) {
@ -61,11 +62,17 @@ public class GUISmeltable extends CustomizableGui {
int smeltableIndex = this.page == 1 ? 0 : 32 * (this.page - 1);
for (int i = 9; i < 45; i++) {
if (i == 9 || i == 17 || i == 44 || i == 36) continue;
if (i == 9 || i == 17 || i == 44 || i == 36) {
continue;
}
setItem(i, null);
clearActions(i);
if (smeltableIndex >= (BURNABLES.size() - 1)) continue;
CompatibleMaterial burnable = BURNABLES.get(smeltableIndex);
if (smeltableIndex >= (BURNABLES.size() - 1)) {
continue;
}
XMaterial burnable = BURNABLES.get(smeltableIndex);
setButton(i, getItemStack(burnable, this.moduleAutoSmelter.isSmeltable(this.hopper, burnable)), (event) -> {
this.moduleAutoSmelter.toggleSmeltable(this.hopper, burnable);
setItem(event.slot, getItemStack(burnable, this.moduleAutoSmelter.isSmeltable(this.hopper, burnable)));
@ -75,7 +82,7 @@ public class GUISmeltable extends CustomizableGui {
clearActions(51);
if (this.page < this.maxPages) {
setButton("next", 51, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton("next", 51, GuiUtils.createButtonItem(XMaterial.ARROW,
this.plugin.getLocale().getMessage("general.nametag.next").getMessage()),
(event) -> {
this.page++;
@ -85,7 +92,7 @@ public class GUISmeltable extends CustomizableGui {
clearActions(47);
if (this.page > 1) {
setButton("back", 47, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
setButton("back", 47, GuiUtils.createButtonItem(XMaterial.ARROW,
this.plugin.getLocale().getMessage("general.nametag.back").getMessage()),
(event) -> {
this.page--;
@ -93,16 +100,16 @@ public class GUISmeltable extends CustomizableGui {
});
}
setButton("exit", 49, GuiUtils.createButtonItem(CompatibleMaterial.OAK_DOOR,
setButton("exit", 49, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()),
(event) -> this.hopper.overview(this.plugin.getGuiManager(), event.player));
}
public ItemStack getItemStack(CompatibleMaterial material, boolean enabled) {
ItemStack item = material.getItem();
public ItemStack getItemStack(XMaterial material, boolean enabled) {
ItemStack item = material.parseItem();
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(TextUtils.formatText("&e" + material.name()));
meta.setLore(Arrays.asList(TextUtils.formatText(" &7-> &e" + material.getBurnResult().name()),
meta.setLore(Arrays.asList(TextUtils.formatText(" &7-> &e" + CompatibleMaterial.getFurnaceResult(material).getType().name()),
TextUtils.formatText("&7Enabled: &6" + String.valueOf(enabled).toLowerCase() + "&7."),
"",
this.plugin.getLocale().getMessage("interface.hopper.toggle").getMessage()));

View File

@ -1,10 +1,10 @@
package com.songoda.epichoppers.hopper;
import com.songoda.core.compatibility.CompatibleParticleHandler;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager;
import com.craftaro.core.compatibility.CompatibleParticleHandler;
import com.craftaro.core.compatibility.CompatibleSound;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.hooks.EconomyManager;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.api.events.HopperAccessEvent;
import com.songoda.epichoppers.gui.GUIOverview;

View File

@ -1,8 +1,8 @@
package com.songoda.epichoppers.hopper.levels;
import com.songoda.core.nms.NmsManager;
import com.songoda.core.nms.nbt.NBTCore;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.core.nms.NmsManager;
import com.craftaro.core.nms.nbt.NBTCore;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.epichoppers.hopper.levels.modules.Module;
import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack;

View File

@ -1,6 +1,6 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.core.configuration.Config;
import com.craftaro.core.configuration.Config;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.utils.Methods;

View File

@ -1,7 +1,8 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.utils.TextUtils;
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.epichoppers.EpicHoppers;
import com.songoda.epichoppers.gui.GUICrafting;
import com.songoda.epichoppers.hopper.Hopper;
@ -187,9 +188,9 @@ public class ModuleAutoCrafting extends Module {
@Override
public ItemStack getGUIButton(Hopper hopper) {
ItemStack crafting = CompatibleMaterial.CRAFTING_TABLE.getItem();
ItemMeta craftingmeta = crafting.getItemMeta();
craftingmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.craftingtitle")
ItemStack crafting = XMaterial.CRAFTING_TABLE.parseItem();
ItemMeta craftingMeta = crafting.getItemMeta();
craftingMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.craftingtitle")
.getMessage());
ArrayList<String> lorecrafting = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.craftinglore")
@ -197,8 +198,8 @@ public class ModuleAutoCrafting extends Module {
for (String line : parts) {
lorecrafting.add(TextUtils.formatText(line));
}
craftingmeta.setLore(lorecrafting);
crafting.setItemMeta(craftingmeta);
craftingMeta.setLore(lorecrafting);
crafting.setItemMeta(craftingMeta);
return crafting;
}

View File

@ -1,9 +1,9 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.utils.NumberUtils;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.hooks.EconomyManager;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.NumberUtils;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.gui.GUIAutoSellFilter;
import com.songoda.epichoppers.hopper.Filter;
@ -109,7 +109,7 @@ public class ModuleAutoSell extends Module {
ex.printStackTrace();
}
} else {
value = Settings.AUTOSELL_PRICES.getStringList().stream().filter(line -> CompatibleMaterial.valueOf(line.split(",")[0]) == CompatibleMaterial.getMaterial(itemStack)).findFirst()
value = Settings.AUTOSELL_PRICES.getStringList().stream().filter(line -> XMaterial.valueOf(line.split(",")[0]).isSimilar(itemStack)).findFirst()
.map(s -> Double.valueOf(s.split(",")[1])).orElse(0.0);
}
@ -142,7 +142,7 @@ public class ModuleAutoSell extends Module {
@Override
public ItemStack getGUIButton(Hopper hopper) {
ItemStack sellItem = CompatibleMaterial.SUNFLOWER.getItem();
ItemStack sellItem = XMaterial.SUNFLOWER.parseItem();
ItemMeta sellMeta = sellItem.getItemMeta();
sellMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.selltitle").getMessage());

View File

@ -1,7 +1,8 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.utils.TextUtils;
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.epichoppers.EpicHoppers;
import com.songoda.epichoppers.gui.GUISmeltable;
import com.songoda.epichoppers.hopper.Hopper;
@ -52,13 +53,14 @@ public class ModuleAutoSmelter extends Module {
if (itemStack == null) {
continue;
}
CompatibleMaterial material = CompatibleMaterial.getMaterial(itemStack);
XMaterial material = CompatibleMaterial.getMaterial(itemStack.getType()).get();
if (!isSmeltable(hopper, material)) {
continue;
}
CompatibleMaterial result = CompatibleMaterial.getMaterial(itemStack).getBurnResult();
XMaterial input = CompatibleMaterial.getMaterial(itemStack.getType()).get();
ItemStack result = CompatibleMaterial.getFurnaceResult(input);
if (hopperCache.addItem(result.getItem())) {
if (hopperCache.addItem(result)) {
if (itemStack.getAmount() == 1) {
hopperCache.setItem(i, null);
} else {
@ -78,9 +80,9 @@ public class ModuleAutoSmelter extends Module {
@Override
public ItemStack getGUIButton(Hopper hopper) {
ItemStack block = CompatibleMaterial.IRON_INGOT.getItem();
ItemMeta blockmeta = block.getItemMeta();
blockmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.smelttitle").getMessage());
ItemStack block = XMaterial.IRON_INGOT.parseItem();
ItemMeta blockMeta = block.getItemMeta();
blockMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.smelttitle").getMessage());
ArrayList<String> loreBlock = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.smeltlore")
.processPlaceholder("timeleft", getTime(hopper) == -9999 ? "" : (int) Math.floor(getTime(hopper) / 20.0))
@ -93,8 +95,8 @@ public class ModuleAutoSmelter extends Module {
for (String line : parts) {
loreBlock.add(TextUtils.formatText(line));
}
blockmeta.setLore(loreBlock);
block.setItemMeta(blockmeta);
blockMeta.setLore(loreBlock);
block.setItemMeta(blockMeta);
return block;
}
@ -114,9 +116,9 @@ public class ModuleAutoSmelter extends Module {
}
List<Material> blockedItems = new ArrayList<>();
for (CompatibleMaterial material : CompatibleMaterial.values()) {
if (material.getBurnResult() != null && isSmeltable(hopper, material)) {
blockedItems.add(material.getMaterial());
for (XMaterial material : XMaterial.values()) {
if (CompatibleMaterial.getFurnaceResult(material) != null && isSmeltable(hopper, material)) {
blockedItems.add(material.parseMaterial());
}
}
@ -145,7 +147,7 @@ public class ModuleAutoSmelter extends Module {
return ((int) obj) != -9999;
}
public boolean isSmeltable(Hopper hopper, CompatibleMaterial material) {
public boolean isSmeltable(Hopper hopper, XMaterial material) {
Object obj = getData(hopper, material.name());
if (obj == null) {
return false;
@ -162,7 +164,7 @@ public class ModuleAutoSmelter extends Module {
}
}
public void toggleSmeltable(Hopper hopper, CompatibleMaterial material) {
public void toggleSmeltable(Hopper hopper, XMaterial material) {
saveData(hopper, material.name(), !isSmeltable(hopper, material));
}
}

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.settings.Settings;

View File

@ -1,6 +1,6 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.utils.StorageContainerCache;

View File

@ -1,10 +1,10 @@
package com.songoda.epichoppers.hopper.levels.modules;
import com.bgsoftware.wildstacker.api.WildStackerAPI;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleParticleHandler;
import com.songoda.core.locale.Locale;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.compatibility.CompatibleParticleHandler;
import com.craftaro.core.locale.Locale;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.settings.Settings;
@ -182,7 +182,7 @@ public class ModuleSuction extends Module {
@Override
public ItemStack getGUIButton(Hopper hopper) {
Locale locale = this.plugin.getLocale();
ItemStack item = CompatibleMaterial.CAULDRON.getItem();
ItemStack item = XMaterial.CAULDRON.parseItem();
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(locale.getMessage("interface.hopper.suctiontitle").getMessage());
List<String> lore = new ArrayList<>();

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.hopper.teleport;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.compatibility.ServerVersion;
import com.craftaro.core.compatibility.CompatibleSound;
import com.craftaro.core.compatibility.ServerVersion;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.settings.Settings;

View File

@ -1,6 +1,6 @@
package com.songoda.epichoppers.listeners;
import com.songoda.core.compatibility.ServerVersion;
import com.craftaro.core.compatibility.ServerVersion;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.api.events.HopperBreakEvent;
import com.songoda.epichoppers.api.events.HopperPlaceEvent;

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.listeners;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.nms.NmsManager;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.nms.NmsManager;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.hopper.levels.modules.Module;

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.listeners;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.hooks.WorldGuardHook;
import com.craftaro.core.hooks.ProtectionManager;
import com.craftaro.core.hooks.WorldGuardHook;
import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper;
import com.songoda.epichoppers.hopper.teleport.TeleportTrigger;

View File

@ -1,9 +1,9 @@
package com.songoda.epichoppers.settings;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.configuration.Config;
import com.songoda.core.configuration.ConfigSetting;
import com.songoda.core.hooks.EconomyManager;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.configuration.Config;
import com.craftaro.core.configuration.ConfigSetting;
import com.craftaro.core.hooks.EconomyManager;
import com.songoda.epichoppers.EpicHoppers;
import java.util.Arrays;
@ -132,13 +132,13 @@ public class Settings {
// convert glass pane settings
int color;
if ((color = GLASS_TYPE_1.getInt(-1)) != -1) {
CONFIG.set(GLASS_TYPE_1.getKey(), CompatibleMaterial.getGlassPaneColor(color).name());
CONFIG.set(GLASS_TYPE_1.getKey(), CompatibleMaterial.getGlassPaneForColor(color).name());
}
if ((color = GLASS_TYPE_2.getInt(-1)) != -1) {
CONFIG.set(GLASS_TYPE_2.getKey(), CompatibleMaterial.getGlassPaneColor(color).name());
CONFIG.set(GLASS_TYPE_2.getKey(), CompatibleMaterial.getGlassPaneForColor(color).name());
}
if ((color = GLASS_TYPE_3.getInt(-1)) != -1) {
CONFIG.set(GLASS_TYPE_3.getKey(), CompatibleMaterial.getGlassPaneColor(color).name());
CONFIG.set(GLASS_TYPE_3.getKey(), CompatibleMaterial.getGlassPaneForColor(color).name());
}
// convert economy settings

View File

@ -1,7 +1,7 @@
package com.songoda.epichoppers.utils;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.TextUtils;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epichoppers.EpicHoppers;
import org.bukkit.Bukkit;
import org.bukkit.Location;

View File

@ -1,8 +1,9 @@
package com.songoda.epichoppers.utils;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.nms.NmsManager;
import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.nms.Nms;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@ -109,7 +110,7 @@ public class StorageContainerCache {
}
}
NmsManager.getWorld().updateAdjacentComparators(e.getKey());
Nms.getImplementations().getWorld().updateAdjacentComparators(e.getKey());
});
INVENTORY_CACHE.clear();
}
@ -260,9 +261,8 @@ public class StorageContainerCache {
boolean[] check = null;
// some destination containers have special conditions
switch (this.type.name()) {
case "BREWING_STAND": {
switch (CompatibleMaterial.getMaterial(this.type).orElse(XMaterial.AIR)) {
case BREWING_STAND: {
// first compile a list of what slots to check
check = new boolean[5];
String typeStr = item.getType().name().toUpperCase();
@ -273,20 +273,19 @@ public class StorageContainerCache {
// fuel in 5th position, input in 4th
if (item.getType() == Material.BLAZE_POWDER) {
check[4] = true;
} else if (CompatibleMaterial.getMaterial(item).isBrewingStandIngredient()) {
} else if (CompatibleMaterial.isBrewingStandIngredient(CompatibleMaterial.getMaterial(item.getType()).get())) {
check[3] = true;
}
break;
}
case "SMOKER":
case "BLAST_FURNACE":
case "BURNING_FURNACE":
case "FURNACE": {
case SMOKER:
case BLAST_FURNACE:
case FURNACE: {
check = new boolean[3];
boolean isFuel = !item.getType().name().contains("LOG") && CompatibleMaterial.getMaterial(item.getType()).isFuel();
boolean isFuel = !item.getType().name().contains("LOG") && CompatibleMaterial.isFurnaceFuel(CompatibleMaterial.getMaterial(item.getType()).get());
// fuel is 2nd slot, input is first
if (isFuel) {
check[1] = true;
@ -296,6 +295,7 @@ public class StorageContainerCache {
break;
}
default:
break;
}