Migrate from SongodaCore to CraftaroCore v3.0.0-SNAPSHOT

This commit is contained in:
Christian Koop 2023-06-29 12:10:58 +02:00
parent 660585b847
commit 69b2210ae0
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
23 changed files with 135 additions and 122 deletions

16
pom.xml
View File

@ -9,7 +9,7 @@
<version>4.9.7</version> <version>4.9.7</version>
<name>EpicFurnaces</name> <name>EpicFurnaces</name>
<description></description> <description>EpicFurnaces allows you to upgrade basic Minecraft features to make the game way more entertaining</description>
<url>https://craftaro.com/marketplace/product/22</url> <url>https://craftaro.com/marketplace/product/22</url>
<properties> <properties>
@ -68,6 +68,14 @@
<exclude>LICENSE.**</exclude> <exclude>LICENSE.**</exclude>
</excludes> </excludes>
</filter> </filter>
<filter>
<artifact>com.craftaro:CraftaroCore</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
</includes>
</filter>
</filters> </filters>
</configuration> </configuration>
</execution> </execution>
@ -102,9 +110,9 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.songoda</groupId> <groupId>com.craftaro</groupId>
<artifactId>SongodaCore</artifactId> <artifactId>CraftaroCore</artifactId>
<version>2.6.19</version> <version>3.0.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -1,20 +1,21 @@
package com.songoda.epicfurnaces; package com.songoda.epicfurnaces;
import com.songoda.core.SongodaCore; import com.craftaro.core.SongodaCore;
import com.songoda.core.SongodaPlugin; import com.craftaro.core.SongodaPlugin;
import com.songoda.core.commands.CommandManager; import com.craftaro.core.commands.CommandManager;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.configuration.Config; import com.craftaro.core.configuration.Config;
import com.songoda.core.database.DataMigrationManager; import com.craftaro.core.database.DataMigrationManager;
import com.songoda.core.database.DatabaseConnector; import com.craftaro.core.database.DatabaseConnector;
import com.songoda.core.database.MySQLConnector; import com.craftaro.core.database.MySQLConnector;
import com.songoda.core.database.SQLiteConnector; import com.craftaro.core.database.SQLiteConnector;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.core.hooks.HologramManager; import com.craftaro.core.hooks.HologramManager;
import com.songoda.core.hooks.ProtectionManager; import com.craftaro.core.hooks.ProtectionManager;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.core.utils.TextUtils;
import com.songoda.epicfurnaces.boost.BoostData; import com.songoda.epicfurnaces.boost.BoostData;
import com.songoda.epicfurnaces.boost.BoostManager; import com.songoda.epicfurnaces.boost.BoostManager;
import com.songoda.epicfurnaces.commands.CommandBoost; import com.songoda.epicfurnaces.commands.CommandBoost;
@ -103,7 +104,7 @@ public class EpicFurnaces extends SongodaPlugin {
@Override @Override
public void onPluginEnable() { public void onPluginEnable() {
// Run Songoda Updater // Run Songoda Updater
SongodaCore.registerPlugin(this, 22, CompatibleMaterial.FURNACE); SongodaCore.registerPlugin(this, 22, XMaterial.FURNACE);
// Load Economy // Load Economy
EconomyManager.load(); EconomyManager.load();
@ -180,7 +181,7 @@ public class EpicFurnaces extends SongodaPlugin {
converted = true; converted = true;
Storage storage = new StorageYaml(this); Storage storage = new StorageYaml(this);
if (storage.containsGroup("charged")) { if (storage.containsGroup("charged")) {
this.console.sendMessage("[" + getDescription().getName() + "] " + ChatColor.RED + Bukkit.getConsoleSender().sendMessage("[" + getDescription().getName() + "] " + ChatColor.RED +
"Conversion process starting. Do NOT turn off your server." + "Conversion process starting. Do NOT turn off your server." +
"EpicFurnaces hasn't fully loaded yet, so make sure users don't" + "EpicFurnaces hasn't fully loaded yet, so make sure users don't" +
"interact with the plugin until the conversion process is complete."); "interact with the plugin until the conversion process is complete.");
@ -210,11 +211,11 @@ public class EpicFurnaces extends SongodaPlugin {
} }
List<UUID> usableList = list.stream().map(UUID::fromString).collect(Collectors.toList()); List<UUID> usableList = list.stream().map(UUID::fromString).collect(Collectors.toList());
Map<CompatibleMaterial, Integer> toLevel = new HashMap<>(); Map<XMaterial, Integer> toLevel = new HashMap<>();
List<String> toLevelCompiled = row.get("tolevelnew").asStringList(); List<String> toLevelCompiled = row.get("tolevelnew").asStringList();
for (String line : toLevelCompiled) { for (String line : toLevelCompiled) {
String[] split = line.split(":"); String[] split = line.split(":");
toLevel.put(CompatibleMaterial.getMaterial(split[0]), Integer.parseInt(split[1])); toLevel.put(CompatibleMaterial.getMaterial(split[0]).get(), Integer.parseInt(split[1]));
} }
furnaces.add(new FurnaceBuilder(location) furnaces.add(new FurnaceBuilder(location)
@ -247,7 +248,7 @@ public class EpicFurnaces extends SongodaPlugin {
final boolean finalConverted = converted; final boolean finalConverted = converted;
this.dataManager.runAsync(() -> { this.dataManager.runAsync(() -> {
if (finalConverted) { if (finalConverted) {
this.console.sendMessage("[" + getDescription().getName() + "] " + ChatColor.GREEN + "Conversion complete :)"); Bukkit.getConsoleSender().sendMessage("[" + getDescription().getName() + "] " + ChatColor.GREEN + "Conversion complete :)");
} }
this.dataManager.getFurnaces((furnaces) -> { this.dataManager.getFurnaces((furnaces) -> {
@ -396,11 +397,11 @@ public class EpicFurnaces extends SongodaPlugin {
int overheat = levels.getInt("Overheat"); int overheat = levels.getInt("Overheat");
int fuelShare = levels.getInt("Fuel-share"); int fuelShare = levels.getInt("Fuel-share");
Map<CompatibleMaterial, Integer> materials = new LinkedHashMap<>(); Map<XMaterial, Integer> materials = new LinkedHashMap<>();
if (levels.contains("Cost-item")) { if (levels.contains("Cost-item")) {
for (String materialStr : levels.getStringList("Cost-item")) { for (String materialStr : levels.getStringList("Cost-item")) {
String[] materialSplit = materialStr.split(":"); String[] materialSplit = materialStr.split(":");
materials.put(CompatibleMaterial.getMaterial(materialSplit[0]), Integer.parseInt(materialSplit[1])); materials.put(CompatibleMaterial.getMaterial(materialSplit[0]).get(), Integer.parseInt(materialSplit[1]));
} }
} }

View File

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

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.commands; package com.songoda.epicfurnaces.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.furnace.levels.Level; import com.songoda.epicfurnaces.furnace.levels.Level;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;

View File

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

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.commands; package com.songoda.epicfurnaces.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
import com.songoda.epicfurnaces.settings.Settings; import com.songoda.epicfurnaces.settings.Settings;

View File

@ -1,8 +1,8 @@
package com.songoda.epicfurnaces.commands; package com.songoda.epicfurnaces.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.configuration.editor.PluginConfigGui; import com.craftaro.core.configuration.editor.PluginConfigGui;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,8 +1,9 @@
package com.songoda.epicfurnaces.database; package com.songoda.epicfurnaces.database;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.database.DataManagerAbstract; import com.craftaro.core.database.DataManagerAbstract;
import com.songoda.core.database.DatabaseConnector; import com.craftaro.core.database.DatabaseConnector;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.boost.BoostData; import com.songoda.epicfurnaces.boost.BoostData;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
@ -154,7 +155,7 @@ public class DataManager extends DataManagerAbstract {
String createNewLevel = "INSERT INTO " + this.getTablePrefix() + "to_level_new (furnace_id, item, amount) VALUES (?, ?, ?)"; String createNewLevel = "INSERT INTO " + this.getTablePrefix() + "to_level_new (furnace_id, item, amount) VALUES (?, ?, ?)";
try (PreparedStatement statement = connection.prepareStatement(createNewLevel)) { try (PreparedStatement statement = connection.prepareStatement(createNewLevel)) {
for (Map.Entry<CompatibleMaterial, Integer> entry : furnace.getToLevel().entrySet()) { for (Map.Entry<XMaterial, Integer> entry : furnace.getToLevel().entrySet()) {
statement.setInt(1, furnace.getId()); statement.setInt(1, furnace.getId());
statement.setString(2, entry.getKey().name()); statement.setString(2, entry.getKey().name());
statement.setInt(3, entry.getValue()); statement.setInt(3, entry.getValue());
@ -271,7 +272,7 @@ public class DataManager extends DataManagerAbstract {
}); });
} }
public void updateLevelupItems(Furnace furnace, CompatibleMaterial material, int amount) { public void updateLevelupItems(Furnace furnace, XMaterial material, int amount) {
this.runAsync(() -> { this.runAsync(() -> {
try (Connection connection = this.databaseConnector.getConnection()) { try (Connection connection = this.databaseConnector.getConnection()) {
String deleteLevelupItem = "DELETE FROM " + this.getTablePrefix() + "to_level_new WHERE furnace_id = ? AND item = ?"; String deleteLevelupItem = "DELETE FROM " + this.getTablePrefix() + "to_level_new WHERE furnace_id = ? AND item = ?";
@ -356,7 +357,7 @@ public class DataManager extends DataManagerAbstract {
ResultSet result = statement.executeQuery(selectLevelupItems); ResultSet result = statement.executeQuery(selectLevelupItems);
while (result.next()) { while (result.next()) {
int id = result.getInt("furnace_id"); int id = result.getInt("furnace_id");
CompatibleMaterial material = CompatibleMaterial.getMaterial(result.getString("item")); XMaterial material = CompatibleMaterial.getMaterial(result.getString("item")).get();
int amount = result.getInt("amount"); int amount = result.getInt("amount");
Furnace furnace = furnaces.get(id); Furnace furnace = furnaces.get(id);

View File

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

View File

@ -1,11 +1,13 @@
package com.songoda.epicfurnaces.furnace; package com.songoda.epicfurnaces.furnace;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.core.hooks.ProtectionManager; import com.craftaro.core.hooks.ProtectionManager;
import com.songoda.core.math.MathUtils; import com.craftaro.core.math.MathUtils;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.boost.BoostData; import com.songoda.epicfurnaces.boost.BoostData;
import com.songoda.epicfurnaces.furnace.levels.Level; import com.songoda.epicfurnaces.furnace.levels.Level;
@ -18,7 +20,6 @@ import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -35,9 +36,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
/**
* Created by songoda on 3/7/2017.
*/
public class Furnace { public class Furnace {
private final EpicFurnaces plugin = EpicFurnaces.getPlugin(EpicFurnaces.class); private final EpicFurnaces plugin = EpicFurnaces.getPlugin(EpicFurnaces.class);
@ -52,7 +50,7 @@ public class Furnace {
private UUID placedBy = null; private UUID placedBy = null;
private int uses, radiusOverheatLast, radiusFuelshareLast = 0; private int uses, radiusOverheatLast, radiusFuelshareLast = 0;
private final Map<CompatibleMaterial, Integer> toLevel = new HashMap<>(); private final Map<XMaterial, Integer> toLevel = new HashMap<>();
private final List<Location> radiusOverheat = new ArrayList<>(); private final List<Location> radiusOverheat = new ArrayList<>();
private final List<Location> radiusFuelshare = new ArrayList<>(); private final List<Location> radiusFuelshare = new ArrayList<>();
@ -88,7 +86,7 @@ public class Furnace {
this.uses++; this.uses++;
this.plugin.getDataManager().queueFurnaceForUpdate(this); this.plugin.getDataManager().queueFurnaceForUpdate(this);
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getResult()); XMaterial material = CompatibleMaterial.getMaterial(event.getResult().getType()).get();
int needed = -1; int needed = -1;
if (this.level.getMaterials().containsKey(material)) { if (this.level.getMaterials().containsKey(material)) {
@ -204,17 +202,17 @@ public class Furnace {
player.getWorld().spawnParticle(org.bukkit.Particle.valueOf(this.plugin.getConfig().getString("Main.Upgrade Particle Type")), loc, 200, .5, .5, .5); player.getWorld().spawnParticle(org.bukkit.Particle.valueOf(this.plugin.getConfig().getString("Main.Upgrade Particle Type")), loc, 200, .5, .5, .5);
if (this.plugin.getLevelManager().getHighestLevel() != this.level) { if (this.plugin.getLevelManager().getHighestLevel() != this.level) {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.6F, 15.0F); XSound.ENTITY_PLAYER_LEVELUP.play(player, .6f, 15);
} else { } else {
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 25.0F); XSound.ENTITY_PLAYER_LEVELUP.play(player, 2, 25);
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
return; return;
} }
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 2F, 25.0F); XSound.BLOCK_NOTE_BLOCK_CHIME.play(player, 2, 25);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 1.2F, 35.0F), 5L); Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> XSound.BLOCK_NOTE_BLOCK_CHIME.play(player, 1.2f, 35), 5);
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 1.8F, 35.0F), 10L); Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> XSound.BLOCK_NOTE_BLOCK_CHIME.play(player, 1.8f, 35), 10);
} }
} }
@ -368,18 +366,18 @@ public class Furnace {
this.uses = uses; this.uses = uses;
} }
public int getToLevel(CompatibleMaterial material) { public int getToLevel(XMaterial material) {
if (!this.toLevel.containsKey(material)) { if (!this.toLevel.containsKey(material)) {
return 0; return 0;
} }
return this.toLevel.get(material); return this.toLevel.get(material);
} }
public Map<CompatibleMaterial, Integer> getToLevel() { public Map<XMaterial, Integer> getToLevel() {
return Collections.unmodifiableMap(this.toLevel); return Collections.unmodifiableMap(this.toLevel);
} }
public int addToLevel(CompatibleMaterial material, int amount) { public int addToLevel(XMaterial material, int amount) {
if (this.toLevel.containsKey(material)) { if (this.toLevel.containsKey(material)) {
int newAmount = this.toLevel.get(material) + amount; int newAmount = this.toLevel.get(material) + amount;
this.toLevel.put(material, newAmount); this.toLevel.put(material, newAmount);

View File

@ -1,6 +1,7 @@
package com.songoda.epicfurnaces.furnace; package com.songoda.epicfurnaces.furnace;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.epicfurnaces.furnace.levels.Level; import com.songoda.epicfurnaces.furnace.levels.Level;
import org.bukkit.Location; import org.bukkit.Location;
@ -32,8 +33,8 @@ public class FurnaceBuilder {
return this; return this;
} }
public FurnaceBuilder setToLevel(Map<CompatibleMaterial, Integer> toLevel) { public FurnaceBuilder setToLevel(Map<XMaterial, Integer> toLevel) {
for (Map.Entry<CompatibleMaterial, Integer> entry : toLevel.entrySet()) { for (Map.Entry<XMaterial, Integer> entry : toLevel.entrySet()) {
this.furnace.addToLevel(entry.getKey(), entry.getValue()); this.furnace.addToLevel(entry.getKey(), entry.getValue());
} }
return this; return this;

View File

@ -1,11 +1,10 @@
package com.songoda.epicfurnaces.furnace.levels; package com.songoda.epicfurnaces.furnace.levels;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -18,13 +17,13 @@ public class Level {
private final int overheat; private final int overheat;
private final int fuelShare; private final int fuelShare;
private Map<CompatibleMaterial, Integer> materials; private Map<XMaterial, Integer> materials;
private final String reward; private final String reward;
private final List<String> description = new ArrayList<>(); private final List<String> description = new ArrayList<>();
Level(int level, int costExperience, int costEconomy, int performance, String reward, int fuelDuration, int overheat, int fuelShare, Map<CompatibleMaterial, Integer> materials) { Level(int level, int costExperience, int costEconomy, int performance, String reward, int fuelDuration, int overheat, int fuelShare, Map<XMaterial, Integer> materials) {
this.level = level; this.level = level;
this.costExperience = costExperience; this.costExperience = costExperience;
this.costEconomy = costEconomy; this.costEconomy = costEconomy;
@ -118,7 +117,7 @@ public class Level {
return this.costEconomy; return this.costEconomy;
} }
public Map<CompatibleMaterial, Integer> getMaterials() { public Map<XMaterial, Integer> getMaterials() {
return Collections.unmodifiableMap(this.materials); return Collections.unmodifiableMap(this.materials);
} }
} }

View File

@ -1,6 +1,7 @@
package com.songoda.epicfurnaces.furnace.levels; package com.songoda.epicfurnaces.furnace.levels;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
@ -10,7 +11,7 @@ import java.util.TreeMap;
public class LevelManager { public class LevelManager {
private final NavigableMap<Integer, Level> registeredLevels = new TreeMap<>(); private final NavigableMap<Integer, Level> registeredLevels = new TreeMap<>();
public void addLevel(int level, int costExperience, int costEconomy, int performance, String reward, int fuelDuration, int overheat, int fuelShare, Map<CompatibleMaterial, Integer> materials) { public void addLevel(int level, int costExperience, int costEconomy, int performance, String reward, int fuelDuration, int overheat, int fuelShare, Map<XMaterial, Integer> materials) {
this.registeredLevels.put(level, new Level(level, costExperience, costEconomy, performance, reward, fuelDuration, overheat, fuelShare, materials)); this.registeredLevels.put(level, new Level(level, costExperience, costEconomy, performance, reward, fuelDuration, overheat, fuelShare, materials));
} }

View File

@ -1,12 +1,13 @@
package com.songoda.epicfurnaces.gui; package com.songoda.epicfurnaces.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.CustomizableGui; import com.craftaro.core.gui.CustomizableGui;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.input.ChatPrompt; import com.craftaro.core.input.ChatPrompt;
import com.songoda.core.utils.NumberUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.NumberUtils;
import com.songoda.core.utils.TimeUtils; import com.craftaro.core.utils.TextUtils;
import com.craftaro.core.utils.TimeUtils;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.boost.BoostData; import com.songoda.epicfurnaces.boost.BoostData;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
@ -65,7 +66,7 @@ public class GUIOverview extends CustomizableGui {
// main furnace information icon // main furnace information icon
setItem("information", 1, 4, GuiUtils.createButtonItem( setItem("information", 1, 4, GuiUtils.createButtonItem(
CompatibleMaterial.getMaterial(this.furnace.getLocation().getBlock().getType()), CompatibleMaterial.getMaterial(this.furnace.getLocation().getBlock().getType()).get(),
this.plugin.getLocale().getMessage("interface.furnace.currentlevel") this.plugin.getLocale().getMessage("interface.furnace.currentlevel")
.processPlaceholder("level", level.getLevel()).getMessage(), .processPlaceholder("level", level.getLevel()).getMessage(),
getFurnaceDescription(this.furnace, level, nextLevel))); getFurnaceDescription(this.furnace, level, nextLevel)));
@ -92,14 +93,14 @@ public class GUIOverview extends CustomizableGui {
if (level.getPerformance() != 0) { if (level.getPerformance() != 0) {
setItem("performance", infoIconOrder[num][current++], GuiUtils.createButtonItem( setItem("performance", infoIconOrder[num][current++], GuiUtils.createButtonItem(
Settings.PERFORMANCE_ICON.getMaterial(CompatibleMaterial.REDSTONE), Settings.PERFORMANCE_ICON.getMaterial(XMaterial.REDSTONE),
this.plugin.getLocale().getMessage("interface.furnace.performancetitle").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.performancetitle").getMessage(),
this.plugin.getLocale().getMessage("interface.furnace.performanceinfo") this.plugin.getLocale().getMessage("interface.furnace.performanceinfo")
.processPlaceholder("amount", level.getPerformance()).getMessage().split("\\|"))); .processPlaceholder("amount", level.getPerformance()).getMessage().split("\\|")));
} }
if (level.getReward() != null) { if (level.getReward() != null) {
setItem("reward", infoIconOrder[num][current++], GuiUtils.createButtonItem( setItem("reward", infoIconOrder[num][current++], GuiUtils.createButtonItem(
Settings.REWARD_ICON.getMaterial(CompatibleMaterial.GOLDEN_APPLE), Settings.REWARD_ICON.getMaterial(XMaterial.GOLDEN_APPLE),
this.plugin.getLocale().getMessage("interface.furnace.rewardtitle").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.rewardtitle").getMessage(),
this.plugin.getLocale().getMessage("interface.furnace.rewardinfo") this.plugin.getLocale().getMessage("interface.furnace.rewardinfo")
.processPlaceholder("amount", level.getReward().split(":")[0].replace("%", "")) .processPlaceholder("amount", level.getReward().split(":")[0].replace("%", ""))
@ -107,7 +108,7 @@ public class GUIOverview extends CustomizableGui {
} }
if (level.getFuelDuration() != 0) { if (level.getFuelDuration() != 0) {
setItem("fuel", infoIconOrder[num][current++], GuiUtils.createButtonItem( setItem("fuel", infoIconOrder[num][current++], GuiUtils.createButtonItem(
Settings.FUEL_DURATION_ICON.getMaterial(CompatibleMaterial.COAL), Settings.FUEL_DURATION_ICON.getMaterial(XMaterial.COAL),
this.plugin.getLocale().getMessage("interface.furnace.fueldurationtitle").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.fueldurationtitle").getMessage(),
this.plugin.getLocale().getMessage("interface.furnace.fueldurationinfo") this.plugin.getLocale().getMessage("interface.furnace.fueldurationinfo")
.processPlaceholder("amount", level.getFuelDuration()) .processPlaceholder("amount", level.getFuelDuration())
@ -115,7 +116,7 @@ public class GUIOverview extends CustomizableGui {
} }
if (level.getFuelShare() != 0) { if (level.getFuelShare() != 0) {
setItem("fuel_share", infoIconOrder[num][current++], GuiUtils.createButtonItem( setItem("fuel_share", infoIconOrder[num][current++], GuiUtils.createButtonItem(
Settings.FUEL_SHARE_ICON.getMaterial(CompatibleMaterial.COAL_BLOCK), Settings.FUEL_SHARE_ICON.getMaterial(XMaterial.COAL_BLOCK),
this.plugin.getLocale().getMessage("interface.furnace.fuelsharetitle").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.fuelsharetitle").getMessage(),
this.plugin.getLocale().getMessage("interface.furnace.fuelshareinfo") this.plugin.getLocale().getMessage("interface.furnace.fuelshareinfo")
.processPlaceholder("amount", level.getOverheat() * 3) .processPlaceholder("amount", level.getOverheat() * 3)
@ -123,7 +124,7 @@ public class GUIOverview extends CustomizableGui {
} }
if (level.getOverheat() != 0) { if (level.getOverheat() != 0) {
setItem("overheat", infoIconOrder[num][current++], GuiUtils.createButtonItem( setItem("overheat", infoIconOrder[num][current++], GuiUtils.createButtonItem(
Settings.OVERHEAT_ICON.getMaterial(CompatibleMaterial.FIRE_CHARGE), Settings.OVERHEAT_ICON.getMaterial(XMaterial.FIRE_CHARGE),
this.plugin.getLocale().getMessage("interface.furnace.overheattitle").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.overheattitle").getMessage(),
this.plugin.getLocale().getMessage("interface.furnace.overheatinfo") this.plugin.getLocale().getMessage("interface.furnace.overheatinfo")
.processPlaceholder("amount", level.getOverheat() * 3) .processPlaceholder("amount", level.getOverheat() * 3)
@ -133,7 +134,7 @@ public class GUIOverview extends CustomizableGui {
// remote control // remote control
if (Settings.REMOTE.getBoolean() && this.player.hasPermission("EpicFurnaces.Remote")) { if (Settings.REMOTE.getBoolean() && this.player.hasPermission("EpicFurnaces.Remote")) {
setButton("remote", 4, GuiUtils.createButtonItem( setButton("remote", 4, GuiUtils.createButtonItem(
CompatibleMaterial.TRIPWIRE_HOOK, XMaterial.TRIPWIRE_HOOK,
this.plugin.getLocale().getMessage("interface.furnace.remotefurnace").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.remotefurnace").getMessage(),
getFurnaceRemoteLore(this.furnace)), getFurnaceRemoteLore(this.furnace)),
ClickType.LEFT, (event) -> { ClickType.LEFT, (event) -> {
@ -164,7 +165,7 @@ public class GUIOverview extends CustomizableGui {
&& level.getCostExperience() != -1 && level.getCostExperience() != -1
&& this.player.hasPermission("EpicFurnaces.Upgrade.XP")) { && this.player.hasPermission("EpicFurnaces.Upgrade.XP")) {
setButton("upgrade_xp", 1, 2, GuiUtils.createButtonItem( 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.furnace.upgradewithxp").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.upgradewithxp").getMessage(),
nextLevel != null nextLevel != null
? this.plugin.getLocale().getMessage("interface.furnace.upgradewithxplore") ? this.plugin.getLocale().getMessage("interface.furnace.upgradewithxplore")
@ -179,7 +180,7 @@ public class GUIOverview extends CustomizableGui {
&& level.getCostEconomy() != -1 && level.getCostEconomy() != -1
&& this.player.hasPermission("EpicFurnaces.Upgrade.ECO")) { && this.player.hasPermission("EpicFurnaces.Upgrade.ECO")) {
setButton("upgrade_economy", 1, 6, GuiUtils.createButtonItem( setButton("upgrade_economy", 1, 6, GuiUtils.createButtonItem(
Settings.ECO_ICON.getMaterial(CompatibleMaterial.SUNFLOWER), Settings.ECO_ICON.getMaterial(XMaterial.SUNFLOWER),
this.plugin.getLocale().getMessage("interface.furnace.upgradewitheconomy").getMessage(), this.plugin.getLocale().getMessage("interface.furnace.upgradewitheconomy").getMessage(),
nextLevel != null nextLevel != null
? this.plugin.getLocale().getMessage("interface.furnace.upgradewitheconomylore") ? this.plugin.getLocale().getMessage("interface.furnace.upgradewitheconomylore")
@ -215,7 +216,7 @@ public class GUIOverview extends CustomizableGui {
if (Settings.UPGRADE_BY_SMELTING.getBoolean()) { if (Settings.UPGRADE_BY_SMELTING.getBoolean()) {
lore.add(this.plugin.getLocale().getMessage("interface.furnace.itemsneeded").getMessage()); lore.add(this.plugin.getLocale().getMessage("interface.furnace.itemsneeded").getMessage());
for (Map.Entry<CompatibleMaterial, Integer> entry : level.getMaterials().entrySet()) { for (Map.Entry<XMaterial, Integer> entry : level.getMaterials().entrySet()) {
lore.add(this.plugin.getLocale().getMessage("interface.furnace.neededitem") lore.add(this.plugin.getLocale().getMessage("interface.furnace.neededitem")
.processPlaceholder("amount", entry.getValue() - furnace.getToLevel(entry.getKey())) .processPlaceholder("amount", entry.getValue() - furnace.getToLevel(entry.getKey()))
.processPlaceholder("type", Methods.cleanString(entry.getKey().name())) .processPlaceholder("type", Methods.cleanString(entry.getKey().name()))

View File

@ -1,11 +1,11 @@
package com.songoda.epicfurnaces.gui; package com.songoda.epicfurnaces.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion;
import com.songoda.core.compatibility.ServerVersion; import com.craftaro.core.gui.CustomizableGui;
import com.songoda.core.gui.CustomizableGui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.input.ChatPrompt;
import com.songoda.core.input.ChatPrompt; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
import com.songoda.epicfurnaces.settings.Settings; import com.songoda.epicfurnaces.settings.Settings;
@ -39,8 +39,8 @@ public class GUIRemoteAccess extends CustomizableGui {
private void showPage() { private void showPage() {
reset(); reset();
ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial(CompatibleMaterial.BLUE_STAINED_GLASS_PANE)); ItemStack glass2 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_2.getMaterial(XMaterial.BLUE_STAINED_GLASS_PANE));
ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial(CompatibleMaterial.LIGHT_BLUE_STAINED_GLASS_PANE)); ItemStack glass3 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_3.getMaterial(XMaterial.LIGHT_BLUE_STAINED_GLASS_PANE));
// edges will be type 3 // edges will be type 3
mirrorFill("mirrorfill_1", 0, 2, true, true, glass3); mirrorFill("mirrorfill_1", 0, 2, true, true, glass3);
@ -53,14 +53,14 @@ public class GUIRemoteAccess extends CustomizableGui {
this.pages = (int) Math.max(1, Math.ceil(this.furnace.getAccessList().size() / ((double) 28))); this.pages = (int) Math.max(1, Math.ceil(this.furnace.getAccessList().size() / ((double) 28)));
setNextPage(5, 7, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage())); setNextPage(5, 7, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.next").getMessage()));
setPrevPage(5, 1, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage())); setPrevPage(5, 1, GuiUtils.createButtonItem(XMaterial.ARROW, this.plugin.getLocale().getMessage("general.nametag.back").getMessage()));
setOnPage((event) -> showPage()); setOnPage((event) -> showPage());
setButton("exit", 8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_DOOR, setButton("exit", 8, GuiUtils.createButtonItem(XMaterial.OAK_DOOR,
this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()), (event) -> this.player.closeInventory()); this.plugin.getLocale().getMessage("general.nametag.exit").getMessage()), (event) -> this.player.closeInventory());
setButton("addplayer", 4, GuiUtils.createButtonItem(CompatibleMaterial.EMERALD, setButton("addplayer", 4, GuiUtils.createButtonItem(XMaterial.EMERALD,
this.plugin.getLocale().getMessage("interface.remoteaccess.addplayertitle").getMessage()), (event) -> { this.plugin.getLocale().getMessage("interface.remoteaccess.addplayertitle").getMessage()), (event) -> {
this.plugin.getLocale().getMessage("event.remote.enterplayer").sendPrefixedMessage(this.player); this.plugin.getLocale().getMessage("event.remote.enterplayer").sendPrefixedMessage(this.player);
ChatPrompt.showPrompt(this.plugin, this.player, chat -> { ChatPrompt.showPrompt(this.plugin, this.player, chat -> {
@ -89,7 +89,7 @@ public class GUIRemoteAccess extends CustomizableGui {
num = num + 2; num = num + 2;
} }
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(entry); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(entry);
ItemStack itemStack = GuiUtils.createButtonItem(CompatibleMaterial.PLAYER_HEAD, TextUtils.formatText("&6" + offlinePlayer.getName()), ItemStack itemStack = GuiUtils.createButtonItem(XMaterial.PLAYER_HEAD, TextUtils.formatText("&6" + offlinePlayer.getName()),
this.plugin.getLocale().getMessage("interface.remoteaccess.playerinfo") this.plugin.getLocale().getMessage("interface.remoteaccess.playerinfo")
.getMessage().split("\\|")); .getMessage().split("\\|"));
SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); SkullMeta meta = (SkullMeta) itemStack.getItemMeta();

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.handlers; package com.songoda.epicfurnaces.handlers;
import com.songoda.core.configuration.Config; import com.craftaro.core.configuration.Config;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.listeners; package com.songoda.epicfurnaces.listeners;
import com.songoda.core.utils.PlayerUtils; import com.craftaro.core.utils.PlayerUtils;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
import com.songoda.epicfurnaces.furnace.FurnaceBuilder; import com.songoda.epicfurnaces.furnace.FurnaceBuilder;

View File

@ -3,8 +3,8 @@ package com.songoda.epicfurnaces.listeners;
import com.craftaro.epichoppers.EpicHoppersApi; import com.craftaro.epichoppers.EpicHoppersApi;
import com.craftaro.epichoppers.player.PlayerData; import com.craftaro.epichoppers.player.PlayerData;
import com.craftaro.epichoppers.player.SyncType; import com.craftaro.epichoppers.player.SyncType;
import com.songoda.core.compatibility.CompatibleHand; import com.craftaro.core.compatibility.CompatibleHand;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;

View File

@ -1,10 +1,10 @@
package com.songoda.epicfurnaces.settings; package com.songoda.epicfurnaces.settings;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.configuration.Config; import com.craftaro.core.configuration.Config;
import com.songoda.core.configuration.ConfigSetting; import com.craftaro.core.configuration.ConfigSetting;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.core.hooks.HologramManager; import com.craftaro.core.hooks.HologramManager;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
public class Settings { public class Settings {
@ -107,13 +107,13 @@ public class Settings {
// convert glass pane settings // convert glass pane settings
int color; int color;
if ((color = GLASS_TYPE_1.getInt(-1)) != -1) { 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) { 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) { 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 // convert economy settings

View File

@ -1,7 +1,7 @@
package com.songoda.epicfurnaces.storage; package com.songoda.epicfurnaces.storage;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.configuration.Config;
import com.songoda.core.configuration.Config; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.boost.BoostData; import com.songoda.epicfurnaces.boost.BoostData;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
@ -37,12 +37,15 @@ public abstract class Storage {
if (furnace == null if (furnace == null
|| furnace.getLocation() == null || furnace.getLocation() == null
|| furnace.getLocation().getWorld() == null || furnace.getLocation().getWorld() == null
|| furnace.getLevel() == null) continue; || furnace.getLevel() == null) {
continue;
}
String locationStr = Methods.serializeLocation(furnace.getLocation()); String locationStr = Methods.serializeLocation(furnace.getLocation());
List<String> toLevel = new ArrayList<>(); List<String> toLevel = new ArrayList<>();
for (Map.Entry<CompatibleMaterial, Integer> entry : furnace.getToLevel().entrySet()) for (Map.Entry<XMaterial, Integer> entry : furnace.getToLevel().entrySet()) {
toLevel.add(entry.getKey().name() + ":" + entry.getValue()); toLevel.add(entry.getKey().name() + ":" + entry.getValue());
}
prepareSaveItem("charged", new StorageItem("location", locationStr), prepareSaveItem("charged", new StorageItem("location", locationStr),
new StorageItem("level", furnace.getLevel().getLevel()), new StorageItem("level", furnace.getLevel().getLevel()),

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.tasks; package com.songoda.epicfurnaces.tasks;
import com.songoda.core.compatibility.CompatibleParticleHandler; import com.craftaro.core.compatibility.CompatibleParticleHandler;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import com.songoda.epicfurnaces.furnace.Furnace; import com.songoda.epicfurnaces.furnace.Furnace;
import com.songoda.epicfurnaces.settings.Settings; import com.songoda.epicfurnaces.settings.Settings;

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.tasks; package com.songoda.epicfurnaces.tasks;
import com.songoda.core.hooks.HologramManager; import com.craftaro.core.hooks.HologramManager;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;

View File

@ -1,6 +1,6 @@
package com.songoda.epicfurnaces.utils; package com.songoda.epicfurnaces.utils;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.epicfurnaces.EpicFurnaces; import com.songoda.epicfurnaces.EpicFurnaces;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;