Make the plugin compatible with the latest Core-Snapshot build
I've replaced CompatibleMaterial with a library adding XMaterial.
This commit is contained in:
parent
bbfd62c1d3
commit
dea440732e
|
@ -50,6 +50,13 @@
|
|||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>CraftaroCore</artifactId>
|
||||
<version>${craftaro.coreVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<dependency>
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>CraftaroCore</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<version>${craftaro.coreVersion}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ package com.songoda.epicanchors;
|
|||
import com.craftaro.core.SongodaCore;
|
||||
import com.craftaro.core.SongodaPlugin;
|
||||
import com.craftaro.core.commands.CommandManager;
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import com.craftaro.core.configuration.Config;
|
||||
import com.craftaro.core.database.DatabaseConnector;
|
||||
import com.craftaro.core.database.SQLiteConnector;
|
||||
import com.craftaro.core.gui.GuiManager;
|
||||
import com.craftaro.core.hooks.EconomyManager;
|
||||
import com.craftaro.core.hooks.HologramManager;
|
||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.songoda.epicanchors.api.AnchorManager;
|
||||
import com.songoda.epicanchors.commands.EpicAnchorsCommand;
|
||||
import com.songoda.epicanchors.commands.sub.GiveCommand;
|
||||
|
@ -46,7 +46,7 @@ public final class EpicAnchors extends SongodaPlugin {
|
|||
|
||||
@Override
|
||||
public void onPluginEnable() {
|
||||
SongodaCore.registerPlugin(this, 31, CompatibleMaterial.END_PORTAL_FRAME);
|
||||
SongodaCore.registerPlugin(this, 31, XMaterial.END_PORTAL_FRAME);
|
||||
|
||||
// Initialize database
|
||||
this.getLogger().info("Initializing SQLite...");
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.craftaro.core.compatibility.CompatibleParticleHandler;
|
|||
import com.craftaro.core.configuration.Config;
|
||||
import com.craftaro.core.configuration.ConfigSetting;
|
||||
import com.craftaro.core.hooks.EconomyManager;
|
||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.songoda.epicanchors.EpicAnchors;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
@ -13,60 +14,60 @@ public class Settings {
|
|||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static final Config config = JavaPlugin.getPlugin(EpicAnchors.class).getCoreConfig();
|
||||
public static final Config CONFIG = JavaPlugin.getPlugin(EpicAnchors.class).getCoreConfig();
|
||||
|
||||
public static final ConfigSetting NAME_TAG = new ConfigSetting(config, "Main.Name Tag",
|
||||
public static final ConfigSetting NAME_TAG = new ConfigSetting(CONFIG, "Main.Name Tag",
|
||||
"&6Anchor &8(&7{REMAINING}&8)",
|
||||
"The anchor name tag used on the item and in the hologram.");
|
||||
|
||||
public static final ConfigSetting LORE = new ConfigSetting(config, "Main.Anchor Lore",
|
||||
public static final ConfigSetting LORE = new ConfigSetting(CONFIG, "Main.Anchor Lore",
|
||||
"&7Place down to keep that chunk\n&7loaded until the time runs out.",
|
||||
"The lore on the anchor item.");
|
||||
|
||||
public static final ConfigSetting MATERIAL = new ConfigSetting(config, "Main.Anchor Block Material",
|
||||
CompatibleMaterial.END_PORTAL_FRAME.name(), "The material an anchor is represented with?");
|
||||
public static final ConfigSetting MATERIAL = new ConfigSetting(CONFIG, "Main.Anchor Block Material",
|
||||
XMaterial.END_PORTAL_FRAME.name(), "The material an anchor is represented with?");
|
||||
|
||||
public static final ConfigSetting ADD_TIME_WITH_XP = new ConfigSetting(config, "Main.Add Time With XP", true,
|
||||
public static final ConfigSetting ADD_TIME_WITH_XP = new ConfigSetting(CONFIG, "Main.Add Time With XP", true,
|
||||
"Should players be able to add time to their anchors by using experience?");
|
||||
|
||||
public static final ConfigSetting XP_COST = new ConfigSetting(config, "Main.XP Cost", 10,
|
||||
public static final ConfigSetting XP_COST = new ConfigSetting(CONFIG, "Main.XP Cost", 10,
|
||||
"The cost in experience levels to add 30 minutes to an anchor.");
|
||||
|
||||
public static final ConfigSetting ADD_TIME_WITH_ECONOMY = new ConfigSetting(config, "Main.Add Time With Economy", true,
|
||||
public static final ConfigSetting ADD_TIME_WITH_ECONOMY = new ConfigSetting(CONFIG, "Main.Add Time With Economy", true,
|
||||
"Should players be able to add time to their anchors by using economy?");
|
||||
|
||||
public static final ConfigSetting ECONOMY_COST = new ConfigSetting(config, "Main.Economy Cost", 5000.0,
|
||||
public static final ConfigSetting ECONOMY_COST = new ConfigSetting(CONFIG, "Main.Economy Cost", 5000.0,
|
||||
"The cost in economy to add 30 minutes to an anchor.");
|
||||
|
||||
public static final ConfigSetting ALLOW_ANCHOR_BREAKING = new ConfigSetting(config, "Main.Allow Anchor Breaking", false,
|
||||
public static final ConfigSetting ALLOW_ANCHOR_BREAKING = new ConfigSetting(CONFIG, "Main.Allow Anchor Breaking", false,
|
||||
"Should players be able to break anchors and get an item dropped?");
|
||||
|
||||
public static final ConfigSetting HOLOGRAMS = new ConfigSetting(config, "Main.Holograms", true,
|
||||
public static final ConfigSetting HOLOGRAMS = new ConfigSetting(CONFIG, "Main.Holograms", true,
|
||||
"Toggle holograms showing above anchors.");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(config, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
|
||||
public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(CONFIG, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
|
||||
"Which economy plugin should be used?",
|
||||
"Supported plugins you have installed: \"" + String.join(", ", EconomyManager.getManager().getRegisteredPlugins()) + "\".");
|
||||
|
||||
public static final ConfigSetting ECO_ICON = new ConfigSetting(config, "Interfaces.Economy Icon", CompatibleMaterial.SUNFLOWER.name(),
|
||||
public static final ConfigSetting ECO_ICON = new ConfigSetting(CONFIG, "Interfaces.Economy Icon", XMaterial.SUNFLOWER.name(),
|
||||
"Item to be displayed as the icon for economy upgrades.");
|
||||
|
||||
public static final ConfigSetting XP_ICON = new ConfigSetting(config, "Interfaces.XP Icon", CompatibleMaterial.EXPERIENCE_BOTTLE.name(),
|
||||
public static final ConfigSetting XP_ICON = new ConfigSetting(CONFIG, "Interfaces.XP Icon", XMaterial.EXPERIENCE_BOTTLE.name(),
|
||||
"Item to be displayed as the icon for XP upgrades.");
|
||||
|
||||
public static final ConfigSetting GLASS_TYPE_1 = new ConfigSetting(config, "Interfaces.Glass Type 1", CompatibleMaterial.GRAY_STAINED_GLASS_PANE.name());
|
||||
public static final ConfigSetting GLASS_TYPE_2 = new ConfigSetting(config, "Interfaces.Glass Type 2", CompatibleMaterial.BLUE_STAINED_GLASS_PANE.name());
|
||||
public static final ConfigSetting GLASS_TYPE_3 = new ConfigSetting(config, "Interfaces.Glass Type 3", CompatibleMaterial.LIGHT_BLUE_STAINED_GLASS_PANE.name());
|
||||
public static final ConfigSetting GLASS_TYPE_1 = new ConfigSetting(CONFIG, "Interfaces.Glass Type 1", XMaterial.GRAY_STAINED_GLASS_PANE.name());
|
||||
public static final ConfigSetting GLASS_TYPE_2 = new ConfigSetting(CONFIG, "Interfaces.Glass Type 2", XMaterial.BLUE_STAINED_GLASS_PANE.name());
|
||||
public static final ConfigSetting GLASS_TYPE_3 = new ConfigSetting(CONFIG, "Interfaces.Glass Type 3", XMaterial.LIGHT_BLUE_STAINED_GLASS_PANE.name());
|
||||
|
||||
public static final ConfigSetting PARTICLE_DESTROY = new ConfigSetting(config, "Particles.Destroy",
|
||||
public static final ConfigSetting PARTICLE_DESTROY = new ConfigSetting(CONFIG, "Particles.Destroy",
|
||||
CompatibleParticleHandler.ParticleType.LAVA.name());
|
||||
public static final ConfigSetting PARTICLE_UPGRADE = new ConfigSetting(config, "Particles.Upgrade",
|
||||
public static final ConfigSetting PARTICLE_UPGRADE = new ConfigSetting(CONFIG, "Particles.Upgrade",
|
||||
CompatibleParticleHandler.ParticleType.SPELL_WITCH.name());
|
||||
public static final ConfigSetting PARTICLE_VISUALIZER = new ConfigSetting(config, "Particles.Visualizer",
|
||||
public static final ConfigSetting PARTICLE_VISUALIZER = new ConfigSetting(CONFIG, "Particles.Visualizer",
|
||||
CompatibleParticleHandler.ParticleType.VILLAGER_HAPPY.name());
|
||||
|
||||
public static final ConfigSetting LANGUAGE = new ConfigSetting(config, "System.Language Mode", "en_US",
|
||||
public static final ConfigSetting LANGUAGE = new ConfigSetting(CONFIG, "System.Language Mode", "en_US",
|
||||
"The enabled language file.",
|
||||
"More language files (if available) can be found in the plugins data folder.");
|
||||
|
||||
|
@ -75,31 +76,31 @@ public class Settings {
|
|||
* called after EconomyManager load
|
||||
*/
|
||||
public static void setupConfig() {
|
||||
config.load();
|
||||
config.setAutoremove(true)
|
||||
CONFIG.load();
|
||||
CONFIG.setAutoremove(true)
|
||||
.setAutosave(true);
|
||||
|
||||
// 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.getGlassPaneColor(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.getGlassPaneColor(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.getGlassPaneColor(color).name());
|
||||
}
|
||||
|
||||
// convert economy settings
|
||||
if (config.getBoolean("Economy.Use Vault Economy") && EconomyManager.getManager().isEnabled("Vault")) {
|
||||
config.set("Main.Economy", "Vault");
|
||||
} else if (config.getBoolean("Economy.Use Reserve Economy") && EconomyManager.getManager().isEnabled("Reserve")) {
|
||||
config.set("Main.Economy", "Reserve");
|
||||
} else if (config.getBoolean("Economy.Use Player Points Economy") && EconomyManager.getManager().isEnabled("PlayerPoints")) {
|
||||
config.set("Main.Economy", "PlayerPoints");
|
||||
if (CONFIG.getBoolean("Economy.Use Vault Economy") && EconomyManager.getManager().isEnabled("Vault")) {
|
||||
CONFIG.set("Main.Economy", "Vault");
|
||||
} else if (CONFIG.getBoolean("Economy.Use Reserve Economy") && EconomyManager.getManager().isEnabled("Reserve")) {
|
||||
CONFIG.set("Main.Economy", "Reserve");
|
||||
} else if (CONFIG.getBoolean("Economy.Use Player Points Economy") && EconomyManager.getManager().isEnabled("PlayerPoints")) {
|
||||
CONFIG.set("Main.Economy", "PlayerPoints");
|
||||
}
|
||||
|
||||
config.saveChanges();
|
||||
CONFIG.saveChanges();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.songoda.epicanchors.guis;
|
||||
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import com.craftaro.core.compatibility.CompatibleParticleHandler;
|
||||
import com.craftaro.core.compatibility.CompatibleSound;
|
||||
import com.craftaro.core.gui.Gui;
|
||||
import com.craftaro.core.gui.GuiUtils;
|
||||
import com.craftaro.core.hooks.EconomyManager;
|
||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.craftaro.core.utils.TimeUtils;
|
||||
import com.songoda.epicanchors.EpicAnchors;
|
||||
|
@ -42,7 +42,7 @@ public class AnchorGui extends Gui {
|
|||
.getMessage();
|
||||
|
||||
setButton(11,
|
||||
GuiUtils.createButtonItem(Settings.XP_ICON.getMaterial(CompatibleMaterial.EXPERIENCE_BOTTLE), itemName, itemLore),
|
||||
GuiUtils.createButtonItem(Settings.XP_ICON.getMaterial(XMaterial.EXPERIENCE_BOTTLE), itemName, itemLore),
|
||||
event -> buyTime(this.anchor, event.player, false));
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class AnchorGui extends Gui {
|
|||
.getMessage();
|
||||
|
||||
setButton(15,
|
||||
GuiUtils.createButtonItem(Settings.ECO_ICON.getMaterial(CompatibleMaterial.SUNFLOWER), itemName, itemLore),
|
||||
GuiUtils.createButtonItem(Settings.ECO_ICON.getMaterial(XMaterial.SUNFLOWER), itemName, itemLore),
|
||||
event -> buyTime(this.anchor, event.player, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.songoda.epicanchors.guis;
|
||||
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import com.craftaro.core.gui.Gui;
|
||||
import com.craftaro.core.gui.GuiUtils;
|
||||
import com.craftaro.core.gui.methods.Closable;
|
||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.utils.TextUtils;
|
||||
import com.songoda.epicanchors.EpicAnchors;
|
||||
import com.songoda.epicanchors.api.Anchor;
|
||||
|
@ -48,17 +48,17 @@ public class DestroyConfirmationGui extends Gui {
|
|||
|
||||
String cancelLore = this.plugin.getLocale().getMessage("interface.button.cancelDestroyLore").getMessage();
|
||||
String confirmLore = this.plugin.getLocale().getMessage("interface.button." +
|
||||
(Settings.ALLOW_ANCHOR_BREAKING.getBoolean() ? "confirmDestroyLore" : "confirmDestroyLoreNoDrops"))
|
||||
(Settings.ALLOW_ANCHOR_BREAKING.getBoolean() ? "confirmDestroyLore" : "confirmDestroyLoreNoDrops"))
|
||||
.getMessage();
|
||||
|
||||
setButton(11, GuiUtils.createButtonItem(CompatibleMaterial.RED_TERRACOTTA,
|
||||
setButton(11, GuiUtils.createButtonItem(XMaterial.RED_TERRACOTTA,
|
||||
this.plugin.getLocale().getMessage("interface.button.cancelDestroy").getMessage(),
|
||||
cancelLore.isEmpty() ? new String[0] : new String[] {cancelLore}),
|
||||
cancelLore.isEmpty() ? new String[0] : new String[]{cancelLore}),
|
||||
event -> this.handler.accept(null, false));
|
||||
|
||||
setButton(15, GuiUtils.createButtonItem(CompatibleMaterial.GREEN_TERRACOTTA,
|
||||
setButton(15, GuiUtils.createButtonItem(XMaterial.GREEN_TERRACOTTA,
|
||||
this.plugin.getLocale().getMessage("interface.button.confirmDestroy").getMessage(),
|
||||
confirmLore.isEmpty() ? new String[0] : new String[] {confirmLore}),
|
||||
confirmLore.isEmpty() ? new String[0] : new String[]{confirmLore}),
|
||||
event -> this.handler.accept(null, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class AnchorListener implements Listener {
|
|||
e.getPlayer().sendMessage("Error creating anchor!"); // TODO
|
||||
|
||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||
if (Settings.MATERIAL.getMaterial().getMaterial() == e.getBlock().getType()) {
|
||||
if (Settings.MATERIAL.getMaterial().parseMaterial() == e.getBlock().getType()) {
|
||||
e.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
|
|
7
pom.xml
7
pom.xml
|
@ -20,6 +20,8 @@
|
|||
<url>https://songoda.com/marketplace/product/31</url>
|
||||
|
||||
<properties>
|
||||
<craftaro.coreVersion>3.0.0-SNAPSHOT</craftaro.coreVersion>
|
||||
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
@ -45,6 +47,11 @@
|
|||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>craftaro-minecraft-plugins</id>
|
||||
<url>https://repo.craftaro.com/repository/minecraft-plugins/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
Loading…
Reference in New Issue