Moved from songoda to craftaro

This commit is contained in:
Fernando Pettinelli 2023-07-26 21:28:26 -04:00
parent e018710208
commit 3a652c597d
64 changed files with 659 additions and 686 deletions

39
pom.xml
View File

@ -4,13 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.craftaro</groupId>
<artifactId>UltimateKits</artifactId> <artifactId>UltimateKits</artifactId>
<version>2.7.7</version> <version>2.7.7</version>
<name>UltimateKits</name> <name>UltimateKits</name>
<description>Creating and displaying your servers kits has never been easier</description> <description>Creating and displaying your servers kits has never been easier</description>
<url>https://songoda.com/marketplace/product/14</url> <url>https://craftaro.com/marketplace/product/ultimatekits.14</url>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
@ -19,14 +19,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<issueManagement>
<url>https://support.songoda.com/servicedesk/customer/portal/3</url>
<system>Jira Service Desk</system>
</issueManagement>
<scm> <scm>
<url>https://github.com/songoda/UltimateKits</url> <url>https://github.com/craftaro/UltimateKits</url>
<connection>scm:git:git:github.com/songoda/UltimateKits.git</connection> <connection>scm:git:git:github.com/craftaro/UltimateKits.git</connection>
</scm> </scm>
<build> <build>
@ -60,13 +55,14 @@
<configuration> <configuration>
<finalName>${project.name}-${project.version}</finalName> <finalName>${project.name}-${project.version}</finalName>
<createDependencyReducedPom>false</createDependencyReducedPom> <shadedArtifactAttached>false</shadedArtifactAttached>
<useDependencyReducedPomInJar>true</useDependencyReducedPomInJar>
<minimizeJar>true</minimizeJar> <minimizeJar>true</minimizeJar>
<relocations> <relocations>
<relocation> <relocation>
<pattern>com.songoda.core</pattern> <pattern>com.craftaro.core</pattern>
<shadedPattern>com.songoda.epicanchors.core</shadedPattern> <shadedPattern>com.craftaro.ultimatestacker.core</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
@ -80,6 +76,15 @@
<exclude>LICENSE.**</exclude> <exclude>LICENSE.**</exclude>
</excludes> </excludes>
</filter> </filter>
<filter>
<artifact>com.craftaro:CraftaroCore</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
<include>**/core/third_party/**</include>
</includes>
</filter>
</filters> </filters>
</configuration> </configuration>
</execution> </execution>
@ -102,7 +107,7 @@
</repository> </repository>
<repository> <repository>
<id>songoda-public</id> <id>public</id>
<url>https://repo.songoda.com/repository/public/</url> <url>https://repo.songoda.com/repository/public/</url>
</repository> </repository>
</repositories> </repositories>
@ -111,14 +116,14 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version> <version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.songoda</groupId> <groupId>com.craftaro</groupId>
<artifactId>SongodaCore</artifactId> <artifactId>CraftaroCore</artifactId>
<version>2.6.21</version> <version>3.0.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -1,56 +1,53 @@
package com.songoda.ultimatekits; package com.craftaro.ultimatekits;
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.gui.GuiManager;
import com.songoda.core.database.DatabaseConnector; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.core.database.MySQLConnector; import com.craftaro.core.hooks.HologramManager;
import com.songoda.core.database.SQLiteConnector; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.utils.TextUtils;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.ultimatekits.handlers.DisplayItemHandler;
import com.songoda.core.hooks.HologramManager; import com.craftaro.ultimatekits.handlers.ParticleHandler;
import com.songoda.core.utils.TextUtils; import com.craftaro.ultimatekits.key.KeyManager;
import com.songoda.ultimatekits.category.Category; import com.craftaro.ultimatekits.kit.KitItem;
import com.songoda.ultimatekits.category.CategoryManager; import com.craftaro.ultimatekits.kit.KitType;
import com.songoda.ultimatekits.commands.CommandCategories; import com.craftaro.ultimatekits.category.Category;
import com.songoda.ultimatekits.commands.CommandCrate; import com.craftaro.ultimatekits.category.CategoryManager;
import com.songoda.ultimatekits.commands.CommandCreatekit; import com.craftaro.ultimatekits.commands.CommandCategories;
import com.songoda.ultimatekits.commands.CommandEdit; import com.craftaro.ultimatekits.commands.CommandCrate;
import com.songoda.ultimatekits.commands.CommandKey; import com.craftaro.ultimatekits.commands.CommandCreatekit;
import com.songoda.ultimatekits.commands.CommandKit; import com.craftaro.ultimatekits.commands.CommandEdit;
import com.songoda.ultimatekits.commands.CommandPreviewKit; import com.craftaro.ultimatekits.commands.CommandKey;
import com.songoda.ultimatekits.commands.CommandReload; import com.craftaro.ultimatekits.commands.CommandKit;
import com.songoda.ultimatekits.commands.CommandRemove; import com.craftaro.ultimatekits.commands.CommandPreviewKit;
import com.songoda.ultimatekits.commands.CommandSet; import com.craftaro.ultimatekits.commands.CommandReload;
import com.songoda.ultimatekits.commands.CommandSettings; import com.craftaro.ultimatekits.commands.CommandRemove;
import com.songoda.ultimatekits.conversion.Convert; import com.craftaro.ultimatekits.commands.CommandSet;
import com.songoda.ultimatekits.crate.Crate; import com.craftaro.ultimatekits.commands.CommandSettings;
import com.songoda.ultimatekits.crate.CrateManager; import com.craftaro.ultimatekits.conversion.Convert;
import com.songoda.ultimatekits.database.DataManager; import com.craftaro.ultimatekits.crate.Crate;
import com.songoda.ultimatekits.database.migrations._1_InitialMigration; import com.craftaro.ultimatekits.crate.CrateManager;
import com.songoda.ultimatekits.database.migrations._2_DuplicateMigration; import com.craftaro.ultimatekits.database.DataManager;
import com.songoda.ultimatekits.handlers.DisplayItemHandler; import com.craftaro.ultimatekits.database.migrations._1_InitialMigration;
import com.songoda.ultimatekits.handlers.ParticleHandler; import com.craftaro.ultimatekits.database.migrations._2_DuplicateMigration;
import com.songoda.ultimatekits.key.Key; import com.craftaro.ultimatekits.key.Key;
import com.songoda.ultimatekits.key.KeyManager; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.KitAnimation;
import com.songoda.ultimatekits.kit.KitAnimation; import com.craftaro.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitManager;
import com.songoda.ultimatekits.kit.KitItem; import com.craftaro.ultimatekits.listeners.BlockListeners;
import com.songoda.ultimatekits.kit.KitManager; import com.craftaro.ultimatekits.listeners.ChatListeners;
import com.songoda.ultimatekits.kit.KitType; import com.craftaro.ultimatekits.listeners.ChunkListeners;
import com.songoda.ultimatekits.listeners.BlockListeners; import com.craftaro.ultimatekits.listeners.EntityListeners;
import com.songoda.ultimatekits.listeners.ChatListeners; import com.craftaro.ultimatekits.listeners.InteractListeners;
import com.songoda.ultimatekits.listeners.ChunkListeners; import com.craftaro.ultimatekits.listeners.PlayerListeners;
import com.songoda.ultimatekits.listeners.EntityListeners; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.listeners.InteractListeners; import com.craftaro.ultimatekits.utils.ItemSerializer;
import com.songoda.ultimatekits.listeners.PlayerListeners; import com.craftaro.ultimatekits.utils.Methods;
import com.songoda.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.ItemSerializer;
import com.songoda.ultimatekits.utils.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -84,8 +81,6 @@ public class UltimateKits extends SongodaPlugin {
private KeyManager keyManager; private KeyManager keyManager;
private CrateManager crateManager; private CrateManager crateManager;
private CategoryManager categoryManager; private CategoryManager categoryManager;
private DatabaseConnector databaseConnector;
private DataManager dataManager; private DataManager dataManager;
private boolean loaded = false; private boolean loaded = false;
@ -101,7 +96,8 @@ public class UltimateKits extends SongodaPlugin {
@Override @Override
public void onPluginEnable() { public void onPluginEnable() {
SongodaCore.registerPlugin(this, 14, CompatibleMaterial.BEACON); initDatabase(Arrays.asList(new _1_InitialMigration(), new _2_DuplicateMigration()));
SongodaCore.registerPlugin(this, 14, XMaterial.BEACON);
// Load Economy // Load Economy
EconomyManager.load(); EconomyManager.load();
@ -115,6 +111,7 @@ public class UltimateKits extends SongodaPlugin {
// Set economy preference // Set economy preference
EconomyManager.getManager().setPreferredHook(Settings.ECONOMY_PLUGIN.getString()); EconomyManager.getManager().setPreferredHook(Settings.ECONOMY_PLUGIN.getString());
this.dataManager = new DataManager(this);
this.kitManager = new KitManager(); this.kitManager = new KitManager();
this.keyManager = new KeyManager(); this.keyManager = new KeyManager();
this.crateManager = new CrateManager(); this.crateManager = new CrateManager();
@ -161,35 +158,6 @@ public class UltimateKits extends SongodaPlugin {
pluginManager.registerEvents(new InteractListeners(this, this.guiManager), this); pluginManager.registerEvents(new InteractListeners(this, this.guiManager), this);
pluginManager.registerEvents(new PlayerListeners(), this); pluginManager.registerEvents(new PlayerListeners(), this);
try {
if (Settings.MYSQL_ENABLED.getBoolean()) {
String hostname = Settings.MYSQL_HOSTNAME.getString();
int port = Settings.MYSQL_PORT.getInt();
String database = Settings.MYSQL_DATABASE.getString();
String username = Settings.MYSQL_USERNAME.getString();
String password = Settings.MYSQL_PASSWORD.getString();
boolean useSSL = Settings.MYSQL_USE_SSL.getBoolean();
int poolSize = Settings.MYSQL_POOL_SIZE.getInt();
this.databaseConnector = new MySQLConnector(this, hostname, port, database, username, password, useSSL, poolSize);
this.getLogger().info("Data handler connected using MySQL.");
} else {
this.databaseConnector = new SQLiteConnector(this);
this.getLogger().info("Data handler connected using SQLite.");
}
this.dataManager = new DataManager(this.databaseConnector, this);
DataMigrationManager dataMigrationManager = new DataMigrationManager(this.databaseConnector, this.dataManager,
new _1_InitialMigration(),
new _2_DuplicateMigration(this.databaseConnector instanceof SQLiteConnector));
dataMigrationManager.runMigrations();
} catch (Exception ex) {
this.getLogger().severe("Fatal error trying to connect to database. " +
"Please make sure all your connection settings are correct and try again. Plugin has been disabled. (" + ex.getMessage() + ")");
emergencyStop();
return;
}
this.displayItemHandler.start(); this.displayItemHandler.start();
this.particleHandler.start(); this.particleHandler.start();
} }
@ -211,7 +179,7 @@ public class UltimateKits extends SongodaPlugin {
Category category = categoryManager.addCategory(key, section.getString("name")); Category category = categoryManager.addCategory(key, section.getString("name"));
if (section.contains("material")) { if (section.contains("material")) {
category.setMaterial(CompatibleMaterial.getMaterial(section.getString("material")).getMaterial()); category.setMaterial(CompatibleMaterial.getMaterial(section.getString("material")).get().parseMaterial());
} }
} }
} }
@ -237,7 +205,7 @@ public class UltimateKits extends SongodaPlugin {
if (itemString.contains("{")) { if (itemString.contains("{")) {
item = ItemSerializer.deserializeItemStackFromJson(itemString); item = ItemSerializer.deserializeItemStackFromJson(itemString);
} else { } else {
item = CompatibleMaterial.getMaterial(itemString).getItem(); item = CompatibleMaterial.getMaterial(itemString).get().parseItem();
} }
} }
@ -411,7 +379,7 @@ public class UltimateKits extends SongodaPlugin {
} }
private List<String> formatHologram(KitBlockData data) { private List<String> formatHologram(KitBlockData data) {
getDataManager().updateBlockData(data); getKitDataManager().updateBlockData(data);
List<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
@ -599,15 +567,8 @@ public class UltimateKits extends SongodaPlugin {
return this.displayItemHandler; return this.displayItemHandler;
} }
/**
* @deprecated Will be made private or removed completely in the future.
*/
@Deprecated
public DatabaseConnector getDatabaseConnector() {
return this.databaseConnector;
}
public DataManager getDataManager() { public DataManager getKitDataManager() {
return this.dataManager; return this.dataManager;
} }

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.category; package com.craftaro.ultimatekits.category;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatekits.category; package com.craftaro.ultimatekits.category;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.gui.CategoryEditorGui; import com.craftaro.ultimatekits.gui.CategoryEditorGui;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,10 +1,10 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.crate.Crate; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.utils.Methods;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.crate.Crate;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.gui.KitEditorGui; import com.craftaro.ultimatekits.gui.KitEditorGui;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,12 +1,12 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.gui.BlockEditorGui; import com.craftaro.ultimatekits.gui.BlockEditorGui;
import com.songoda.ultimatekits.gui.KitEditorGui; import com.craftaro.ultimatekits.gui.KitEditorGui;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,11 +1,11 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.utils.PlayerUtils; import com.craftaro.core.utils.PlayerUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.key.Key; import com.craftaro.ultimatekits.key.Key;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,11 +1,11 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.gui.CategorySelectorGui; import com.craftaro.ultimatekits.gui.CategorySelectorGui;
import com.songoda.ultimatekits.gui.KitSelectorGui; import com.craftaro.ultimatekits.gui.KitSelectorGui;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.core.hooks.HologramManager; import com.craftaro.core.hooks.HologramManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.commands;
import com.songoda.core.commands.AbstractCommand; import com.craftaro.core.commands.AbstractCommand;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +34,7 @@ public class CommandSet extends AbstractCommand {
} }
Block b = player.getTargetBlock(null, 200); Block b = player.getTargetBlock(null, 200);
KitBlockData data = plugin.getKitManager().addKitToLocation(kit, b.getLocation()); KitBlockData data = plugin.getKitManager().addKitToLocation(kit, b.getLocation());
UltimateKits.getInstance().getDataManager().createBlockData(data); UltimateKits.getInstance().getKitDataManager().createBlockData(data);
plugin.getLocale().newMessage("&8Kit &a" + kit.getKey() + " &8set to: &a" + b.getType().toString() + "&8.") plugin.getLocale().newMessage("&8Kit &a" + kit.getKey() + " &8set to: &a" + b.getType().toString() + "&8.")
.sendPrefixedMessage(sender); .sendPrefixedMessage(sender);
return ReturnType.SUCCESS; return ReturnType.SUCCESS;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.commands; package com.craftaro.ultimatekits.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.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,12 +1,12 @@
package com.songoda.ultimatekits.conversion; package com.craftaro.ultimatekits.conversion;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.conversion.hooks.CMIHook; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.conversion.hooks.DefaultHook; import com.craftaro.ultimatekits.kit.KitItem;
import com.songoda.ultimatekits.conversion.hooks.EssentialsHook; import com.craftaro.ultimatekits.conversion.hooks.CMIHook;
import com.songoda.ultimatekits.conversion.hooks.UltimateCoreHook; import com.craftaro.ultimatekits.conversion.hooks.DefaultHook;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.conversion.hooks.EssentialsHook;
import com.songoda.ultimatekits.kit.KitItem; import com.craftaro.ultimatekits.conversion.hooks.UltimateCoreHook;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.conversion; package com.craftaro.ultimatekits.conversion;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,10 +1,10 @@
package com.songoda.ultimatekits.conversion.hooks; package com.craftaro.ultimatekits.conversion.hooks;
import com.Zrips.CMI.CMI; import com.Zrips.CMI.CMI;
import com.Zrips.CMI.Modules.Kits.Kit; import com.Zrips.CMI.Modules.Kits.Kit;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.conversion.Hook; import com.craftaro.ultimatekits.conversion.Hook;
import com.songoda.ultimatekits.kit.type.KitContentCommand; import com.craftaro.ultimatekits.kit.type.KitContentCommand;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatekits.conversion.hooks; package com.craftaro.ultimatekits.conversion.hooks;
import com.songoda.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.songoda.ultimatekits.conversion.Hook; import com.craftaro.ultimatekits.conversion.Hook;
import com.songoda.ultimatekits.utils.ItemSerializer; import com.craftaro.ultimatekits.utils.ItemSerializer;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,10 +1,10 @@
package com.songoda.ultimatekits.conversion.hooks; package com.craftaro.ultimatekits.conversion.hooks;
import com.craftaro.ultimatekits.UltimateKits;
import com.craftaro.ultimatekits.conversion.Hook;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.Kit; import com.earth2me.essentials.Kit;
import com.earth2me.essentials.MetaItemStack; import com.earth2me.essentials.MetaItemStack;
import com.songoda.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.conversion.Hook;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatekits.conversion.hooks; package com.craftaro.ultimatekits.conversion.hooks;
import bammerbom.ultimatecore.bukkit.api.UC; import bammerbom.ultimatecore.bukkit.api.UC;
import bammerbom.ultimatecore.bukkit.api.UKit; import bammerbom.ultimatecore.bukkit.api.UKit;
import com.songoda.ultimatekits.conversion.Hook; import com.craftaro.ultimatekits.conversion.Hook;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatekits.crate; package com.craftaro.ultimatekits.crate;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.crate; package com.craftaro.ultimatekits.crate;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -1,15 +1,12 @@
package com.songoda.ultimatekits.database; package com.craftaro.ultimatekits.database;
import com.songoda.core.database.DataManagerAbstract; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.core.database.DatabaseConnector; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.KitType;
import com.songoda.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.kit.KitType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.plugin.Plugin;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -19,15 +16,16 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
public class DataManager extends DataManagerAbstract { public class DataManager {
public DataManager(DatabaseConnector databaseConnector, Plugin plugin) { private final UltimateKits plugin;
super(databaseConnector, plugin); public DataManager(UltimateKits plugin) {
this.plugin = plugin;
} }
public void bulkUpdateBlockData(Map<Location, KitBlockData> blockData) { public void bulkUpdateBlockData(Map<Location, KitBlockData> blockData) {
try (Connection connection = this.databaseConnector.getConnection()) { try (Connection connection = plugin.getDataManager().getDatabaseConnector().getConnection()) {
String updateData = "UPDATE " + this.getTablePrefix() + "blockdata SET type = ?, kit = ?, holograms = ?, " + String updateData = "UPDATE " + plugin.getDataManager().getTablePrefix() + "blockdata SET type = ?, kit = ?, holograms = ?, " +
"displayItems = ?, particles = ?, itemOverride = ? " + "displayItems = ?, particles = ?, itemOverride = ? " +
"WHERE world = ? AND x = ? AND y = ? AND z = ?"; "WHERE world = ? AND x = ? AND y = ? AND z = ?";
PreparedStatement statement = connection.prepareStatement(updateData); PreparedStatement statement = connection.prepareStatement(updateData);
@ -54,9 +52,10 @@ public class DataManager extends DataManagerAbstract {
public void updateBlockData(KitBlockData blockData) { public void updateBlockData(KitBlockData blockData) {
if (blockData.getWorld() == null) return; if (blockData.getWorld() == null) return;
this.runAsync(() -> {
try (Connection connection = this.databaseConnector.getConnection()) { Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
String updateData = "UPDATE " + this.getTablePrefix() + "blockdata SET type = ?, kit = ?, holograms = ?, " + try (Connection connection = plugin.getDataManager().getDatabaseConnector().getConnection()) {
String updateData = "UPDATE " + plugin.getDataManager().getTablePrefix() + "blockdata SET type = ?, kit = ?, holograms = ?, " +
"displayItems = ?, particles = ?, itemOverride = ? " + "displayItems = ?, particles = ?, itemOverride = ? " +
"WHERE world = ? AND x = ? AND y = ? AND z = ?"; "WHERE world = ? AND x = ? AND y = ? AND z = ?";
PreparedStatement statement = connection.prepareStatement(updateData); PreparedStatement statement = connection.prepareStatement(updateData);
@ -79,9 +78,9 @@ public class DataManager extends DataManagerAbstract {
public void createBlockData(KitBlockData blockData) { public void createBlockData(KitBlockData blockData) {
if (blockData.getWorld() == null) return; if (blockData.getWorld() == null) return;
this.runAsync(() -> { Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try (Connection connection = this.databaseConnector.getConnection()) { try (Connection connection = plugin.getDataManager().getDatabaseConnector().getConnection()) {
String createData = "INSERT INTO " + this.getTablePrefix() + "blockdata (" + String createData = "INSERT INTO " + plugin.getDataManager().getTablePrefix() + "blockdata (" +
"type, kit, holograms, displayItems, particles, itemOverride, world, x, y, z)" + "type, kit, holograms, displayItems, particles, itemOverride, world, x, y, z)" +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement statement = connection.prepareStatement(createData); PreparedStatement statement = connection.prepareStatement(createData);
@ -103,9 +102,9 @@ public class DataManager extends DataManagerAbstract {
} }
public void deleteBlockData(KitBlockData blockData) { public void deleteBlockData(KitBlockData blockData) {
this.runAsync(() -> { Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try (Connection connection = this.databaseConnector.getConnection()) { try (Connection connection = plugin.getDataManager().getDatabaseConnector().getConnection()) {
String deleteData = "DELETE FROM " + this.getTablePrefix() + "blockdata WHERE world = ? " + String deleteData = "DELETE FROM " + plugin.getDataManager().getTablePrefix() + "blockdata WHERE world = ? " +
"AND x = ? AND y = ? AND z = ?"; "AND x = ? AND y = ? AND z = ?";
PreparedStatement statement = connection.prepareStatement(deleteData); PreparedStatement statement = connection.prepareStatement(deleteData);
statement.setString(1, blockData.getWorld().getName()); statement.setString(1, blockData.getWorld().getName());
@ -120,9 +119,9 @@ public class DataManager extends DataManagerAbstract {
} }
public void getBlockData(Consumer<Map<Location, KitBlockData>> callback) { public void getBlockData(Consumer<Map<Location, KitBlockData>> callback) {
this.runAsync(() -> { Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try (Connection connection = this.databaseConnector.getConnection()) { try (Connection connection = plugin.getDataManager().getDatabaseConnector().getConnection()) {
String selectData = "SELECT * FROM " + this.getTablePrefix() + "blockdata"; String selectData = "SELECT * FROM " + plugin.getDataManager().getTablePrefix() + "blockdata";
Map<Location, KitBlockData> blockData = new HashMap<>(); Map<Location, KitBlockData> blockData = new HashMap<>();
Statement statement = connection.createStatement(); Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery(selectData); ResultSet result = statement.executeQuery(selectData);
@ -147,7 +146,7 @@ public class DataManager extends DataManagerAbstract {
blockData.put(location, new KitBlockData(kit, location, type, holograms, particles, displayItems, itemOverride)); blockData.put(location, new KitBlockData(kit, location, type, holograms, particles, displayItems, itemOverride));
} }
this.sync(() -> callback.accept(blockData)); Bukkit.getScheduler().runTask(plugin, () -> callback.accept(blockData));
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }

View File

@ -1,6 +1,7 @@
package com.songoda.ultimatekits.database.migrations; package com.craftaro.ultimatekits.database.migrations;
import com.songoda.core.database.DataMigration; import com.craftaro.core.database.DataMigration;
import com.craftaro.core.database.DatabaseConnector;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
@ -13,12 +14,8 @@ public class _1_InitialMigration extends DataMigration {
} }
@Override @Override
public void migrate(Connection connection, String tablePrefix) throws SQLException { public void migrate(DatabaseConnector databaseConnector, String tablePrefix) throws SQLException {
// String autoIncrement = UltimateKits.getInstance().getDatabaseConnector() instanceof try (Statement statement = databaseConnector.getConnection().createStatement()) {
// MySQLConnector ? " AUTO_INCREMENT" : "";
// Create plugin settings table
try (Statement statement = connection.createStatement()) {
statement.execute("CREATE TABLE " + tablePrefix + "blockdata (" + statement.execute("CREATE TABLE " + tablePrefix + "blockdata (" +
"type TEXT NOT NULL," + "type TEXT NOT NULL," +
"kit TEXT NOT NULL," + "kit TEXT NOT NULL," +

View File

@ -1,6 +1,9 @@
package com.songoda.ultimatekits.database.migrations; package com.craftaro.ultimatekits.database.migrations;
import com.songoda.core.database.DataMigration;
import com.craftaro.core.database.DataMigration;
import com.craftaro.core.database.DatabaseConnector;
import com.craftaro.core.database.SQLiteConnector;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -11,16 +14,16 @@ import java.util.HashMap;
public class _2_DuplicateMigration extends DataMigration { public class _2_DuplicateMigration extends DataMigration {
private final boolean sqlite;
public _2_DuplicateMigration(boolean sqlite) { public _2_DuplicateMigration() {
super(2); super(2);
this.sqlite = sqlite;
} }
@Override @Override
public void migrate(Connection connection, String tablePrefix) throws SQLException { public void migrate(DatabaseConnector databaseConnector, String tablePrefix) throws SQLException {
// Fix duplicate data caused by old sqlite data duplication bug // Fix duplicate data caused by old sqlite data duplication bug
Connection connection = databaseConnector.getConnection();
boolean sqlite = databaseConnector instanceof SQLiteConnector;
if (sqlite) { if (sqlite) {
HashMap<String, TempKitData> data = new HashMap(); HashMap<String, TempKitData> data = new HashMap();
// grab a copy of the unique data values // grab a copy of the unique data values

View File

@ -1,136 +1,137 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.core.third_party.org.apache.commons.text.WordUtils;
import com.songoda.ultimatekits.kit.KitItem; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.utils.ArmorType; import com.craftaro.ultimatekits.kit.KitItem;
import org.apache.commons.lang.WordUtils; import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.Bukkit; import com.craftaro.ultimatekits.utils.ArmorType;
import org.bukkit.entity.Player; import org.bukkit.Bukkit;
import org.bukkit.inventory.ItemStack; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayDeque;
import java.util.Collections; import java.util.ArrayDeque;
import java.util.Iterator; import java.util.Collections;
import java.util.List; import java.util.Iterator;
import java.util.Map; import java.util.List;
import java.util.Random; import java.util.Map;
import java.util.Random;
public class AnimatedKitGui extends Gui {
public class AnimatedKitGui extends Gui {
static final Random rand = new Random();
static final Random rand = new Random();
private final UltimateKits plugin;
private final Player player; private final UltimateKits plugin;
private final ItemStack give; private final Player player;
private final ArrayDeque<KitItem> items = new ArrayDeque(); private final ItemStack give;
private boolean finish = false; private final ArrayDeque<KitItem> items = new ArrayDeque();
private boolean done = false; private boolean finish = false;
private int tick = 0, updateTick = 0; private boolean done = false;
private int ticksPerUpdate = 3; private int tick = 0, updateTick = 0;
private int task; private int ticksPerUpdate = 3;
private int task;
public AnimatedKitGui(UltimateKits plugin, Player player, Kit kit, ItemStack give) {
this.plugin = plugin; public AnimatedKitGui(UltimateKits plugin, Player player, Kit kit, ItemStack give) {
this.player = player; this.plugin = plugin;
this.give = give; this.player = player;
setRows(3); this.give = give;
setAllowClose(false); setRows(3);
setTitle(kit.getName()); setAllowClose(false);
setDefaultItem(GuiUtils.getBorderItem(CompatibleMaterial.GRAY_STAINED_GLASS_PANE)); setTitle(kit.getName());
setDefaultItem(GuiUtils.getBorderItem(XMaterial.GRAY_STAINED_GLASS_PANE));
// ideally, we'd populate the items in such a way that the end item isn't far from the center when the animation is complete
// would be something to do if people have large kit loot tables. // ideally, we'd populate the items in such a way that the end item isn't far from the center when the animation is complete
List<KitItem> kitItems = kit.getContents(); // would be something to do if people have large kit loot tables.
if (kitItems.isEmpty()) { List<KitItem> kitItems = kit.getContents();
throw new RuntimeException("Cannot give an empty kit!"); if (kitItems.isEmpty()) {
} throw new RuntimeException("Cannot give an empty kit!");
Collections.shuffle(kitItems); }
this.items.addAll(kitItems); Collections.shuffle(kitItems);
while (this.items.size() < 10) { this.items.addAll(kitItems);
items.addAll(kitItems); while (this.items.size() < 10) {
} items.addAll(kitItems);
}
setItem(4, GuiUtils.getBorderItem(CompatibleMaterial.TRIPWIRE_HOOK));
setItem(22, GuiUtils.getBorderItem(CompatibleMaterial.TRIPWIRE_HOOK)); setItem(4, GuiUtils.getBorderItem(XMaterial.TRIPWIRE_HOOK));
tick(); setItem(22, GuiUtils.getBorderItem(XMaterial.TRIPWIRE_HOOK));
setOnOpen(event -> { tick();
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> tick(), 1L, 1L); setOnOpen(event -> {
}); task = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> tick(), 1L, 1L);
} });
}
private void tick() {
if (++tick < ticksPerUpdate) { private void tick() {
return; if (++tick < ticksPerUpdate) {
} return;
tick = 0; }
int updatesPerSlow = 6; tick = 0;
if (++updateTick >= updatesPerSlow) { int updatesPerSlow = 6;
updateTick = 0; if (++updateTick >= updatesPerSlow) {
int ticksPerUpdateSlow = Settings.ROULETTE_LENGTH_MULTIPLIER.getInt(); updateTick = 0;
if (++ticksPerUpdate >= ticksPerUpdateSlow) { int ticksPerUpdateSlow = Settings.ROULETTE_LENGTH_MULTIPLIER.getInt();
finish = true; if (++ticksPerUpdate >= ticksPerUpdateSlow) {
} finish = true;
} }
// now update the display }
// rainbow disco! // now update the display
for (int col = 0; col < 9; ++col) { // rainbow disco!
if (col == 4) continue; for (int col = 0; col < 9; ++col) {
setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); if (col == 4) continue;
setItem(2, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
} setItem(2, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
}
// item slider
if (!done) { // item slider
CompatibleSound.UI_BUTTON_CLICK.play(player, 5F, 5F); if (!done) {
items.addFirst(items.getLast()); XSound.UI_BUTTON_CLICK.play(player, 5F, 5F);
items.removeLast(); items.addFirst(items.getLast());
Iterator<KitItem> itemIter = items.iterator(); items.removeLast();
for (int i = 9; i < 18; i++) { Iterator<KitItem> itemIter = items.iterator();
setItem(0, i, itemIter.next().getItem()); for (int i = 9; i < 18; i++) {
} setItem(0, i, itemIter.next().getItem());
} }
}
// should we try to wrap it up?
if (finish) { // should we try to wrap it up?
ItemStack item = getItem(13); if (finish) {
KitItem kitItem = items.stream().filter(i -> i.getItem().isSimilar(item)).findFirst().orElse(null); ItemStack item = getItem(13);
if (item == null) { KitItem kitItem = items.stream().filter(i -> i.getItem().isSimilar(item)).findFirst().orElse(null);
done = true; // idk. if (item == null) {
} else if (item.isSimilar(give)) { done = true; // idk.
if (!done) { } else if (item.isSimilar(give)) {
done = true; if (!done) {
if (!Settings.AUTO_EQUIP_ARMOR_ROULETTE.getBoolean() || !ArmorType.equip(player, give)) { done = true;
if (!Settings.AUTO_EQUIP_ARMOR_ROULETTE.getBoolean() || !ArmorType.equip(player, give)) {
ItemStack processedItem = kitItem.getContent().process(player);
if (processedItem != null) { ItemStack processedItem = kitItem.getContent().process(player);
Map<Integer, ItemStack> overfilled = player.getInventory().addItem(give); if (processedItem != null) {
for (ItemStack item2 : overfilled.values()) { Map<Integer, ItemStack> overfilled = player.getInventory().addItem(give);
player.getWorld().dropItemNaturally(player.getLocation(), item2); for (ItemStack item2 : overfilled.values()) {
} player.getWorld().dropItemNaturally(player.getLocation(), item2);
} }
} }
}
CompatibleSound.ENTITY_PLAYER_LEVELUP.play(player, 10f, 10f);
plugin.getLocale().getMessage("event.create.won") XSound.ENTITY_PLAYER_LEVELUP.play(player, 10f, 10f);
.processPlaceholder("item", WordUtils.capitalize(give.getType().name().toLowerCase().replace("_", " "))) plugin.getLocale().getMessage("event.create.won")
.sendPrefixedMessage(player); .processPlaceholder("item", WordUtils.capitalize(give.getType().name().toLowerCase().replace("_", " ")))
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, this::finish, 50); .sendPrefixedMessage(player);
setAllowClose(true); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, this::finish, 50);
} setAllowClose(true);
}
}
} }
}
}
}
private void finish() {
Bukkit.getScheduler().cancelTask(task); private void finish() {
exit(); Bukkit.getScheduler().cancelTask(task);
} exit();
} }
}

View File

@ -1,13 +1,13 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitType;
import com.songoda.ultimatekits.kit.KitType; import com.craftaro.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -29,13 +29,13 @@ public class BlockEditorGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> event.player.closeInventory()); event -> event.player.closeInventory());
// kit type // kit type
setButton(1, 2, GuiUtils.createButtonItem(CompatibleMaterial.COMPARATOR, setButton(1, 2, GuiUtils.createButtonItem(XMaterial.COMPARATOR,
plugin.getLocale().getMessage("interface.kitblock.switchtype").getMessage(), plugin.getLocale().getMessage("interface.kitblock.switchtype").getMessage(),
kitTypeLore(plugin)), kitTypeLore(plugin)),
ClickType.LEFT, ClickType.LEFT,
@ -57,14 +57,14 @@ public class BlockEditorGui extends Gui {
}); });
// decor options // decor options
setButton(1, 4, GuiUtils.createButtonItem(CompatibleMaterial.POPPY, setButton(1, 4, GuiUtils.createButtonItem(XMaterial.POPPY,
plugin.getLocale().getMessage("interface.kitblock.decor").getMessage(), plugin.getLocale().getMessage("interface.kitblock.decor").getMessage(),
plugin.getLocale().getMessage("interface.kitblock.decorlore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kitblock.decorlore").getMessage().split("\\|")),
ClickType.LEFT, ClickType.LEFT,
event -> event.manager.showGUI(event.player, new KitDecorOptionsGui(plugin, kitBlockData, this))); event -> event.manager.showGUI(event.player, new KitDecorOptionsGui(plugin, kitBlockData, this)));
// edit // edit
setButton(1, 6, GuiUtils.createButtonItem(CompatibleMaterial.DIAMOND_PICKAXE, setButton(1, 6, GuiUtils.createButtonItem(XMaterial.DIAMOND_PICKAXE,
plugin.getLocale().getMessage("interface.kitblock.edit").getMessage(), plugin.getLocale().getMessage("interface.kitblock.edit").getMessage(),
plugin.getLocale().getMessage("interface.kitblock.editlore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kitblock.editlore").getMessage().split("\\|")),
ClickType.LEFT, ClickType.LEFT,

View File

@ -1,15 +1,15 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; 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.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.category.Category; import com.craftaro.ultimatekits.category.Category;
import com.songoda.ultimatekits.category.CategoryManager; import com.craftaro.ultimatekits.category.CategoryManager;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -34,7 +34,7 @@ public class CategoryEditorGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
mirrorFill(1, 1, false, true, getDefaultItem()); mirrorFill(1, 1, false, true, getDefaultItem());
setButton(4, GuiUtils.createButtonItem(CompatibleMaterial.GREEN_DYE, "Create Category"), setButton(4, GuiUtils.createButtonItem(XMaterial.GREEN_DYE, "Create Category"),
(event) -> { (event) -> {
if (categoryManager.getCategories().size() >= 7) { if (categoryManager.getCategories().size() >= 7) {
plugin.getLocale().newMessage("&cYou already have the maximum amount of categories...").sendPrefixedMessage(player); plugin.getLocale().newMessage("&cYou already have the maximum amount of categories...").sendPrefixedMessage(player);
@ -61,7 +61,7 @@ public class CategoryEditorGui extends Gui {
}); });
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> exit()); event -> exit());
@ -73,7 +73,7 @@ public class CategoryEditorGui extends Gui {
for (int i = 0; i < categories.size(); i++) { for (int i = 0; i < categories.size(); i++) {
Category category = categories.get(i); Category category = categories.get(i);
setButton(i + 10, setButton(i + 10,
GuiUtils.createButtonItem(CompatibleMaterial.getMaterial(category.getMaterial()), GuiUtils.createButtonItem(XMaterial.matchXMaterial(category.getMaterial()),
TextUtils.formatText(category.getName()), TextUtils.formatText(category.getName()),
TextUtils.formatText("&6Left click to change name"), TextUtils.formatText("&6Left click to change name"),
"", "",

View File

@ -1,13 +1,14 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.category.Category; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.category.Category;
import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -37,12 +38,12 @@ public class CategorySelectorGui extends Gui {
int nrows = (int) Math.ceil(categories.size() / (double) showPerRow); int nrows = (int) Math.ceil(categories.size() / (double) showPerRow);
setRows(glassless ? nrows : nrows + 2); setRows(glassless ? nrows : nrows + 2);
setItem(0, 4, GuiUtils.createButtonItem(CompatibleMaterial.BOOK, setItem(0, 4, GuiUtils.createButtonItem(XMaterial.BOOK,
plugin.getLocale().getMessage("interface.categoryselector.details") plugin.getLocale().getMessage("interface.categoryselector.details")
.processPlaceholder("player", player.getName()).getMessage().split("\\|"))); .processPlaceholder("player", player.getName()).getMessage().split("\\|")));
if (!glassless) { if (!glassless) {
setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
UltimateKits.getInstance().getLocale().getMessage("interface.button.exit").getMessage()), UltimateKits.getInstance().getLocale().getMessage("interface.button.exit").getMessage()),
event -> exit()); event -> exit());
} }
@ -72,7 +73,7 @@ public class CategorySelectorGui extends Gui {
int i = 10; int i = 10;
for (Category category : categories) { for (Category category : categories) {
setButton(i, GuiUtils.createButtonItem(CompatibleMaterial.getMaterial(category.getMaterial()), setButton(i, GuiUtils.createButtonItem(XMaterial.matchXMaterial(category.getMaterial()),
TextUtils.formatText(category.getName()), TextUtils.formatText(category.getName()),
"", "",
plugin.getLocale().getMessage("interface.categoryselector.view").getMessage()), plugin.getLocale().getMessage("interface.categoryselector.view").getMessage()),
@ -88,13 +89,13 @@ public class CategorySelectorGui extends Gui {
for (int col = 1; col < 8; ++col) { for (int col = 1; col < 8; ++col) {
ItemStack it; ItemStack it;
if ((it = getItem(0, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE")) if ((it = getItem(0, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE"))
setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
if ((it = getItem(rows - 1, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE")) if ((it = getItem(rows - 1, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE"))
setItem(rows - 1, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(rows - 1, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
} }
for (int row = 1; row + 1 < rows; ++row) { for (int row = 1; row + 1 < rows; ++row) {
setItem(row, 0, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(row, 0, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
setItem(row, 8, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(row, 8, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
} }
} }
} }

View File

@ -1,13 +1,13 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; 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.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -29,12 +29,12 @@ public class ConfirmBuyGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// Kit information // Kit information
setItem(0, 4, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : CompatibleMaterial.DIAMOND_HELMET.getItem(), setItem(0, 4, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : XMaterial.DIAMOND_HELMET.parseItem(),
ChatColor.RED + TextUtils.formatText(kit.getKey().toLowerCase(), true), ChatColor.RED + TextUtils.formatText(kit.getKey().toLowerCase(), true),
ChatColor.GREEN + Settings.CURRENCY_SYMBOL.getString() + Methods.formatEconomy(cost))); ChatColor.GREEN + Settings.CURRENCY_SYMBOL.getString() + Methods.formatEconomy(cost)));
// confirm button // confirm button
setButton(1, 2, GuiUtils.createButtonItem(Settings.BUY_ICON.getMaterial(CompatibleMaterial.EMERALD), setButton(1, 2, GuiUtils.createButtonItem(Settings.BUY_ICON.getMaterial(XMaterial.EMERALD),
plugin.getLocale().getMessage("interface.yesno.yes").getMessage()), plugin.getLocale().getMessage("interface.yesno.yes").getMessage()),
event -> { event -> {
kit.processPurchaseUse(event.player); kit.processPurchaseUse(event.player);
@ -42,7 +42,7 @@ public class ConfirmBuyGui extends Gui {
}); });
// cancel button // cancel button
setButton(1, 6, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(1, 6, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.yesno.no").getMessage()), plugin.getLocale().getMessage("interface.yesno.no").getMessage()),
event -> { event -> {
plugin.getLocale().getMessage("event.purchase.cancelled").sendPrefixedMessage(event.player); plugin.getLocale().getMessage("event.purchase.cancelled").sendPrefixedMessage(event.player);

View File

@ -1,14 +1,14 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
public class KitDecorOptionsGui extends Gui { public class KitDecorOptionsGui extends Gui {
@ -26,7 +26,7 @@ public class KitDecorOptionsGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> exit()); event -> exit());
@ -41,7 +41,7 @@ public class KitDecorOptionsGui extends Gui {
final String disableLore = plugin.getLocale().getMessage("interface.kitdecor.settingoff").getMessage(); final String disableLore = plugin.getLocale().getMessage("interface.kitdecor.settingoff").getMessage();
// Hologram // Hologram
setButton(1, 1, GuiUtils.createButtonItem(CompatibleMaterial.NAME_TAG, setButton(1, 1, GuiUtils.createButtonItem(XMaterial.NAME_TAG,
plugin.getLocale().getMessage("interface.kitdecor.hologram").getMessage(), plugin.getLocale().getMessage("interface.kitdecor.hologram").getMessage(),
kitBlockData.showHologram() ? enableLore : disableLore), kitBlockData.showHologram() ? enableLore : disableLore),
event -> { event -> {
@ -51,7 +51,7 @@ public class KitDecorOptionsGui extends Gui {
}); });
// Particle effects // Particle effects
setButton(1, 3, GuiUtils.createButtonItem(CompatibleMaterial.POTION, setButton(1, 3, GuiUtils.createButtonItem(XMaterial.POTION,
plugin.getLocale().getMessage("interface.kitdecor.particle").getMessage(), plugin.getLocale().getMessage("interface.kitdecor.particle").getMessage(),
kitBlockData.hasParticles() ? enableLore : disableLore), kitBlockData.hasParticles() ? enableLore : disableLore),
event -> { event -> {
@ -60,7 +60,7 @@ public class KitDecorOptionsGui extends Gui {
}); });
// Item Display // Item Display
setButton(1, 5, GuiUtils.createButtonItem(CompatibleMaterial.DIAMOND, setButton(1, 5, GuiUtils.createButtonItem(XMaterial.DIAMOND,
plugin.getLocale().getMessage("interface.kitdecor.display").getMessage(), plugin.getLocale().getMessage("interface.kitdecor.display").getMessage(),
kitBlockData.isDisplayingItems() ? enableLore : disableLore), kitBlockData.isDisplayingItems() ? enableLore : disableLore),
event -> { event -> {
@ -71,7 +71,7 @@ public class KitDecorOptionsGui extends Gui {
}); });
// Item Display Override // Item Display Override
setButton(1, 7, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : CompatibleMaterial.BEACON.getItem(), setButton(1, 7, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : XMaterial.BEACON.parseItem(),
plugin.getLocale().getMessage("interface.kitdecor.displayone").getMessage(), plugin.getLocale().getMessage("interface.kitdecor.displayone").getMessage(),
plugin.getLocale().getMessage("interface.kitdecor.displayonelore") plugin.getLocale().getMessage("interface.kitdecor.displayonelore")
.processPlaceholder("enabled", kitBlockData.isItemOverride() ? enableLore : disableLore) .processPlaceholder("enabled", kitBlockData.isItemOverride() ? enableLore : disableLore)

View File

@ -1,19 +1,19 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.AnvilGui;
import com.songoda.core.compatibility.CompatibleSound; import com.craftaro.core.gui.DoubleGui;
import com.songoda.core.gui.AnvilGui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.DoubleGui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.Gui; import com.craftaro.core.input.ChatPrompt;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.input.ChatPrompt; import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitAnimation; import com.craftaro.ultimatekits.kit.KitAnimation;
import com.songoda.ultimatekits.kit.KitItem; import com.craftaro.ultimatekits.kit.KitItem;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -26,6 +26,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
public class KitEditorGui extends DoubleGui { public class KitEditorGui extends DoubleGui {
@ -54,7 +55,7 @@ public class KitEditorGui extends DoubleGui {
setOnClose((event) -> { setOnClose((event) -> {
restoreItemsInstance(); restoreItemsInstance();
saveKit(player, inventory, false); saveKit(player, inventory, false);
CompatibleSound.ENTITY_VILLAGER_YES.play(player); XSound.ENTITY_VILLAGER_YES.play(player);
}); });
ItemStack glass1 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial()); ItemStack glass1 = GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial());
@ -68,7 +69,7 @@ public class KitEditorGui extends DoubleGui {
mirrorFill(0, 3, false, true, glass1); mirrorFill(0, 3, false, true, glass1);
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> player.closeInventory()); event -> player.closeInventory());
@ -84,7 +85,7 @@ public class KitEditorGui extends DoubleGui {
}); });
// info icon // info icon
setItem(0, 4, GuiUtils.createButtonItem(CompatibleMaterial.CHEST, setItem(0, 4, GuiUtils.createButtonItem(XMaterial.CHEST,
plugin.getLocale().getMessage("interface.kiteditor.info") plugin.getLocale().getMessage("interface.kiteditor.info")
.processPlaceholder("kit", kit.getKey()) .processPlaceholder("kit", kit.getKey())
.processPlaceholder("perm", "ultimatekits.claim." + kit.getKey().toLowerCase()) .processPlaceholder("perm", "ultimatekits.claim." + kit.getKey().toLowerCase())
@ -151,13 +152,13 @@ public class KitEditorGui extends DoubleGui {
setUnlockedRange(2, 0, 3, 8); setUnlockedRange(2, 0, 3, 8);
setUnlockedRange(4, 1, 4, 7); setUnlockedRange(4, 1, 4, 7);
item = GuiUtils.createButtonItem(CompatibleMaterial.PAPER, item = GuiUtils.createButtonItem(XMaterial.PAPER,
plugin.getLocale().getMessage("interface.kiteditor.itemediting").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.itemediting").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.itemeditinglore").getMessage().split("\\|")); plugin.getLocale().getMessage("interface.kiteditor.itemeditinglore").getMessage().split("\\|"));
} else { } else {
unlockedCells.clear(); unlockedCells.clear();
item = GuiUtils.createButtonItem(CompatibleMaterial.PAPER, item = GuiUtils.createButtonItem(XMaterial.PAPER,
plugin.getLocale().getMessage("interface.kiteditor.itemmoving").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.itemmoving").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.itemmovinglore").getMessage().split("\\|")); plugin.getLocale().getMessage("interface.kiteditor.itemmovinglore").getMessage().split("\\|"));
} }
@ -171,10 +172,10 @@ public class KitEditorGui extends DoubleGui {
ItemStack item2; ItemStack item2;
item2 = isInInventory ? GuiUtils.createButtonItem(CompatibleMaterial.ITEM_FRAME, item2 = isInInventory ? GuiUtils.createButtonItem(XMaterial.ITEM_FRAME,
plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctions").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctions").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctionslore").getMessage().split("\\|")) plugin.getLocale().getMessage("interface.kiteditor.switchtokitfunctionslore").getMessage().split("\\|"))
: GuiUtils.createButtonItem(CompatibleMaterial.ITEM_FRAME, : GuiUtils.createButtonItem(XMaterial.ITEM_FRAME,
plugin.getLocale().getMessage("interface.kiteditor.switchtoinventory").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.switchtoinventory").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.switchtoinventorylore").getMessage().split("\\|")); plugin.getLocale().getMessage("interface.kiteditor.switchtoinventorylore").getMessage().split("\\|"));
@ -211,7 +212,7 @@ public class KitEditorGui extends DoubleGui {
} }
private void setInvItems() { private void setInvItems() {
setPlayerButton(0, GuiUtils.createButtonItem(CompatibleMaterial.REDSTONE_TORCH, setPlayerButton(0, GuiUtils.createButtonItem(XMaterial.REDSTONE_TORCH,
plugin.getLocale().getMessage("interface.kiteditor.generaloptions").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.generaloptions").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.generaloptionslore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kiteditor.generaloptionslore").getMessage().split("\\|")),
(event) -> { (event) -> {
@ -219,7 +220,7 @@ public class KitEditorGui extends DoubleGui {
guiManager.showGUI(player, new KitGeneralOptionsGui(plugin, player, kit, back)); guiManager.showGUI(player, new KitGeneralOptionsGui(plugin, player, kit, back));
}); });
setPlayerButton(1, GuiUtils.createButtonItem(CompatibleMaterial.EMERALD, setPlayerButton(1, GuiUtils.createButtonItem(XMaterial.EMERALD,
plugin.getLocale().getMessage("interface.kiteditor.sellingoptions").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.sellingoptions").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.sellingoptionslore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kiteditor.sellingoptionslore").getMessage().split("\\|")),
(event) -> { (event) -> {
@ -227,7 +228,7 @@ public class KitEditorGui extends DoubleGui {
guiManager.showGUI(player, new KitSellingOptionsGui(plugin, player, kit, back)); guiManager.showGUI(player, new KitSellingOptionsGui(plugin, player, kit, back));
}); });
setPlayerButton(3, GuiUtils.createButtonItem(CompatibleMaterial.ITEM_FRAME, setPlayerButton(3, GuiUtils.createButtonItem(XMaterial.ITEM_FRAME,
plugin.getLocale().getMessage("interface.kiteditor.guioptions").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.guioptions").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.guioptionslore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kiteditor.guioptionslore").getMessage().split("\\|")),
(event) -> { (event) -> {
@ -235,7 +236,7 @@ public class KitEditorGui extends DoubleGui {
guiManager.showGUI(player, new KitGuiOptionsGui(plugin, player, kit, back)); guiManager.showGUI(player, new KitGuiOptionsGui(plugin, player, kit, back));
}); });
setPlayerButton(4, GuiUtils.createButtonItem(CompatibleMaterial.PAPER, setPlayerButton(4, GuiUtils.createButtonItem(XMaterial.PAPER,
plugin.getLocale().getMessage("interface.kiteditor.addcommand").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.addcommand").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.addcommandlore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kiteditor.addcommandlore").getMessage().split("\\|")),
(event) -> { (event) -> {
@ -272,7 +273,7 @@ public class KitEditorGui extends DoubleGui {
}); });
}); });
setPlayerButton(5, GuiUtils.createButtonItem(CompatibleMaterial.SUNFLOWER, setPlayerButton(5, GuiUtils.createButtonItem(XMaterial.SUNFLOWER,
plugin.getLocale().getMessage("interface.kiteditor.addeconomy").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.addeconomy").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.addeconomylore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kiteditor.addeconomylore").getMessage().split("\\|")),
(event) -> { (event) -> {
@ -305,7 +306,7 @@ public class KitEditorGui extends DoubleGui {
guiManager.showGUI(event.player, gui); guiManager.showGUI(event.player, gui);
}); });
setPlayerButton(7, GuiUtils.createButtonItem(CompatibleMaterial.SHEEP_SPAWN_EGG, setPlayerButton(7, GuiUtils.createButtonItem(XMaterial.SHEEP_SPAWN_EGG,
plugin.getLocale().getMessage("interface.kiteditor.clone").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.clone").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.clonelore") plugin.getLocale().getMessage("interface.kiteditor.clonelore")
.getMessage().split("\\|")), .getMessage().split("\\|")),
@ -321,15 +322,19 @@ public class KitEditorGui extends DoubleGui {
} else { } else {
Kit newKit = kit.clone(kitStr); Kit newKit = kit.clone(kitStr);
plugin.getKitManager().addKit(newKit); plugin.getKitManager().addKit(newKit);
player.closeInventory();
restoreItemsInstance();
saveKit(player, inventory, false);
XSound.ENTITY_VILLAGER_YES.play(player);
Bukkit.getScheduler().runTaskLater(plugin, () -> Bukkit.getScheduler().runTaskLater(plugin, () ->
guiManager.showGUI(player, new KitEditorGui(plugin, player, newKit, null)), 2L); guiManager.showGUI(player, new KitEditorGui(plugin, player, newKit, null)), 5L);
} }
}); });
guiManager.showGUI(player, gui); guiManager.showGUI(player, gui);
}); });
setPlayerButton(8, GuiUtils.createButtonItem(CompatibleMaterial.CHEST, setPlayerButton(8, GuiUtils.createButtonItem(XMaterial.CHEST,
plugin.getLocale().getMessage("interface.kiteditor.animation").getMessage(), plugin.getLocale().getMessage("interface.kiteditor.animation").getMessage(),
plugin.getLocale().getMessage("interface.kiteditor.animationlore") plugin.getLocale().getMessage("interface.kiteditor.animationlore")
.processPlaceholder("animation", kit.getKitAnimation().name()) .processPlaceholder("animation", kit.getKitAnimation().name())
@ -394,11 +399,11 @@ public class KitEditorGui extends DoubleGui {
AnvilGui gui = new AnvilGui(player, this); AnvilGui gui = new AnvilGui(player, this);
gui.setTitle("Enter a Material"); gui.setTitle("Enter a Material");
gui.setAction(event -> { gui.setAction(event -> {
CompatibleMaterial compatibleMaterial = CompatibleMaterial.getMaterial(gui.getInputText().trim()); Optional<XMaterial> compatibleMaterial = XMaterial.matchXMaterial(gui.getInputText().trim());
if (compatibleMaterial == null) { if (!compatibleMaterial.isPresent()) {
player.sendMessage("'" + gui.getInputText().trim() + "' is not a valid material."); player.sendMessage("'" + gui.getInputText().trim() + "' is not a valid material.");
} else { } else {
Material material = compatibleMaterial.getMaterial(); Material material = compatibleMaterial.get().parseMaterial();
KitItem newItem = new KitItem(itemStack); KitItem newItem = new KitItem(itemStack);
newItem.setDisplayItem(material); newItem.setDisplayItem(material);
setItem(slot, newItem.getMoveableItem()); setItem(slot, newItem.getMoveableItem());

View File

@ -1,15 +1,15 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.AnvilGui;
import com.songoda.core.gui.AnvilGui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.category.Category; import com.craftaro.ultimatekits.category.Category;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -25,7 +25,7 @@ public class KitGeneralOptionsGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> exit()); event -> exit());
@ -37,7 +37,7 @@ public class KitGeneralOptionsGui extends Gui {
event -> guiManager.showGUI(player, new KitEditorGui(plugin, player, kit, back))); event -> guiManager.showGUI(player, new KitEditorGui(plugin, player, kit, back)));
// edit delay // edit delay
setButton(1, 2, GuiUtils.createButtonItem(CompatibleMaterial.CLOCK, setButton(1, 2, GuiUtils.createButtonItem(XMaterial.CLOCK,
plugin.getLocale().getMessage("interface.kitoptions.delay").getMessage(), plugin.getLocale().getMessage("interface.kitoptions.delay").getMessage(),
plugin.getLocale().getMessage("interface.kitoptions.delaylore") plugin.getLocale().getMessage("interface.kitoptions.delaylore")
.processPlaceholder("delay", kit.getDelay()).getMessage().split("\\|")), .processPlaceholder("delay", kit.getDelay()).getMessage().split("\\|")),
@ -61,7 +61,7 @@ public class KitGeneralOptionsGui extends Gui {
}); });
// edit category // edit category
setButton(1, 4, GuiUtils.createButtonItem(CompatibleMaterial.BOOK, setButton(1, 4, GuiUtils.createButtonItem(XMaterial.BOOK,
plugin.getLocale().getMessage("interface.kitoptions.category").getMessage(), plugin.getLocale().getMessage("interface.kitoptions.category").getMessage(),
plugin.getLocale().getMessage("interface.kitoptions.categorylore") plugin.getLocale().getMessage("interface.kitoptions.categorylore")
.processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).getMessage().split("\\|")), .processPlaceholder("category", kit.getCategory() == null ? "none" : kit.getCategory().getName()).getMessage().split("\\|")),
@ -91,7 +91,7 @@ public class KitGeneralOptionsGui extends Gui {
}); });
// delete // delete
setButton(1, 6, GuiUtils.createButtonItem(CompatibleMaterial.TNT, setButton(1, 6, GuiUtils.createButtonItem(XMaterial.TNT,
plugin.getLocale().getMessage("interface.kitoptions.destroy").getMessage(), plugin.getLocale().getMessage("interface.kitoptions.destroy").getMessage(),
plugin.getLocale().getMessage("interface.kitoptions.destroylore").getMessage().split("\\|")), plugin.getLocale().getMessage("interface.kitoptions.destroylore").getMessage().split("\\|")),
event -> { event -> {

View File

@ -1,14 +1,14 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.AnvilGui;
import com.songoda.core.gui.AnvilGui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -34,7 +34,7 @@ public class KitGuiOptionsGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> exit()); event -> exit());
@ -49,7 +49,7 @@ public class KitGuiOptionsGui extends Gui {
private void paint() { private void paint() {
// set hologram title // set hologram title
setButton(1, 2, GuiUtils.createButtonItem(CompatibleMaterial.NAME_TAG, setButton(1, 2, GuiUtils.createButtonItem(XMaterial.NAME_TAG,
plugin.getLocale().getMessage("interface.kitguioptions.holo").getMessage(), plugin.getLocale().getMessage("interface.kitguioptions.holo").getMessage(),
plugin.getLocale().getMessage("interface.kitguioptions.hololore") plugin.getLocale().getMessage("interface.kitguioptions.hololore")
.processPlaceholder("onoff", .processPlaceholder("onoff",
@ -82,7 +82,7 @@ public class KitGuiOptionsGui extends Gui {
plugin.saveKits(false); plugin.saveKits(false);
}); });
setButton(1, 4, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : CompatibleMaterial.BEACON.getItem(), setButton(1, 4, GuiUtils.createButtonItem(kit.getDisplayItem() != null ? kit.getDisplayItem() : XMaterial.BEACON.parseItem(),
plugin.getLocale().getMessage("interface.kitguioptions.item").getMessage(), plugin.getLocale().getMessage("interface.kitguioptions.item").getMessage(),
plugin.getLocale().getMessage("interface.kitguioptions.itemlore") plugin.getLocale().getMessage("interface.kitguioptions.itemlore")
.processPlaceholder("onoff", .processPlaceholder("onoff",
@ -103,12 +103,12 @@ public class KitGuiOptionsGui extends Gui {
plugin.saveKits(false); plugin.saveKits(false);
}); });
setAction(1, 4, ClickType.RIGHT, event -> { setAction(1, 4, ClickType.RIGHT, event -> {
kit.setDisplayItem((ItemStack) null); kit.setDisplayItem(null);
plugin.getLocale().getMessage("interface.kitguioptions.itemremoved").processPlaceholder("kit", kit.getName()).sendPrefixedMessage(player); plugin.getLocale().getMessage("interface.kitguioptions.itemremoved").processPlaceholder("kit", kit.getName()).sendPrefixedMessage(player);
paint(); paint();
}); });
setButton(1, 6, GuiUtils.createButtonItem(CompatibleMaterial.COAL, setButton(1, 6, GuiUtils.createButtonItem(XMaterial.COAL,
plugin.getLocale().getMessage("interface.kitguioptions.hide").getMessage(), plugin.getLocale().getMessage("interface.kitguioptions.hide").getMessage(),
plugin.getLocale().getMessage("interface.kitguioptions.hidelore") plugin.getLocale().getMessage("interface.kitguioptions.hidelore")
.processPlaceholder("onoff", plugin.getLocale().getMessage( .processPlaceholder("onoff", plugin.getLocale().getMessage(

View File

@ -1,15 +1,16 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.category.Category; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.category.Category;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.settings.Settings;
import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -50,7 +51,7 @@ public class KitSelectorGui extends Gui {
showPerPage = showPerRow * (glassless ? (nrows == 6 ? 6 : 5) : 4); showPerPage = showPerRow * (glassless ? (nrows == 6 ? 6 : 5) : 4);
setPages(kitList.size() / showPerPage); setPages(kitList.size() / showPerPage);
setItem(0, 4, GuiUtils.createButtonItem(CompatibleMaterial.BOOK, setItem(0, 4, GuiUtils.createButtonItem(XMaterial.BOOK,
plugin.getLocale().getMessage("interface.selector.details") plugin.getLocale().getMessage("interface.selector.details")
.processPlaceholder("player", player.getName()).getMessage().split("\\|"))); .processPlaceholder("player", player.getName()).getMessage().split("\\|")));
@ -65,8 +66,8 @@ public class KitSelectorGui extends Gui {
} }
if (!glassless) { if (!glassless) {
setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
UltimateKits.getInstance().getLocale().getMessage("interface.button.exit").getMessage()), UltimateKits.getInstance().getLocale().getMessage("interface.button.exit").getMessage()),
event -> exit()); event -> exit());
} }
@ -95,7 +96,7 @@ public class KitSelectorGui extends Gui {
if (category != null) if (category != null)
setButton(0, 0, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"), setButton(0, 0, GuiUtils.createButtonItem(ItemUtils.getCustomHead("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"),
plugin.getLocale().getMessage("interface.button.back").getMessage()), plugin.getLocale().getMessage("interface.button.back").getMessage()),
event -> guiManager.showGUI(player, new CategorySelectorGui(plugin, player))); event -> guiManager.showGUI(player, new CategorySelectorGui(plugin, player)));
@ -116,13 +117,13 @@ public class KitSelectorGui extends Gui {
for (int col = 1; col < 8; ++col) { for (int col = 1; col < 8; ++col) {
ItemStack it; ItemStack it;
if ((it = getItem(0, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE")) if ((it = getItem(0, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE"))
setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(0, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
if ((it = getItem(rows - 1, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE")) if ((it = getItem(rows - 1, col)) == null || it.getType() == Material.AIR || it.getType().name().contains("PANE"))
setItem(rows - 1, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(rows - 1, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
} }
for (int row = 1; row + 1 < rows; ++row) { for (int row = 1; row + 1 < rows; ++row) {
setItem(row, 0, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(row, 0, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
setItem(row, 8, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); setItem(row, 8, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
} }
} }
@ -144,8 +145,8 @@ public class KitSelectorGui extends Gui {
.processPlaceholder("kit", TextUtils.formatText(kitItem, true)).getMessage(); .processPlaceholder("kit", TextUtils.formatText(kitItem, true)).getMessage();
setButton(row, col, GuiUtils.createButtonItem( setButton(row, col, GuiUtils.createButtonItem(
kit.getDisplayItem() != null ? kit.getDisplayItem() : CompatibleMaterial.ENCHANTED_BOOK.getItem(), kitTitle, kit.getDisplayItem() != null ? kit.getDisplayItem() : XMaterial.ENCHANTED_BOOK.parseItem(), kitTitle,
getKitLore(kit)), getKitLore(kit)),
event -> { event -> {
if (event.clickType == ClickType.MIDDLE && player.hasPermission("ultimatekits.admin")) { if (event.clickType == ClickType.MIDDLE && player.hasPermission("ultimatekits.admin")) {
kitsmode = !kitsmode; kitsmode = !kitsmode;

View File

@ -1,15 +1,15 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.AnvilGui;
import com.songoda.core.gui.AnvilGui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -32,7 +32,7 @@ public class KitSellingOptionsGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// exit button // exit button
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
ClickType.LEFT, ClickType.LEFT,
event -> exit()); event -> exit());
@ -47,7 +47,7 @@ public class KitSellingOptionsGui extends Gui {
private void paint() { private void paint() {
// remove sale // remove sale
setButton(1, 2, GuiUtils.createButtonItem(CompatibleMaterial.BARRIER, setButton(1, 2, GuiUtils.createButtonItem(XMaterial.BARRIER,
plugin.getLocale().getMessage("interface.kitsell.nosell").getMessage(), plugin.getLocale().getMessage("interface.kitsell.nosell").getMessage(),
plugin.getLocale().getMessage("interface.kitsell.noselllore") plugin.getLocale().getMessage("interface.kitsell.noselllore")
.processPlaceholder("onoff", plugin.getLocale().getMessage( .processPlaceholder("onoff", plugin.getLocale().getMessage(
@ -60,7 +60,7 @@ public class KitSellingOptionsGui extends Gui {
}); });
// kit link // kit link
setButton(1, 4, GuiUtils.createButtonItem(CompatibleMaterial.PAPER, setButton(1, 4, GuiUtils.createButtonItem(XMaterial.PAPER,
plugin.getLocale().getMessage("interface.kitsell.link").getMessage(), plugin.getLocale().getMessage("interface.kitsell.link").getMessage(),
plugin.getLocale().getMessage("interface.kitsell.linklore") plugin.getLocale().getMessage("interface.kitsell.linklore")
.processPlaceholder("onoff", .processPlaceholder("onoff",
@ -86,7 +86,7 @@ public class KitSellingOptionsGui extends Gui {
}); });
// kit price // kit price
setButton(1, 6, GuiUtils.createButtonItem(CompatibleMaterial.SUNFLOWER, setButton(1, 6, GuiUtils.createButtonItem(XMaterial.SUNFLOWER,
plugin.getLocale().getMessage("interface.kitsell.price").getMessage(), plugin.getLocale().getMessage("interface.kitsell.price").getMessage(),
plugin.getLocale().getMessage("interface.kitsell.pricelore") plugin.getLocale().getMessage("interface.kitsell.pricelore")
.processPlaceholder("onoff", .processPlaceholder("onoff",

View File

@ -1,14 +1,14 @@
package com.songoda.ultimatekits.gui; package com.craftaro.ultimatekits.gui;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiUtils;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -81,7 +81,7 @@ public class PreviewKitGui extends Gui {
Methods.fillGlass(this); Methods.fillGlass(this);
// exit button is only visible with a glass border // exit button is only visible with a glass border
setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(CompatibleMaterial.OAK_DOOR), setButton(0, 8, GuiUtils.createButtonItem(Settings.EXIT_ICON.getMaterial(XMaterial.OAK_DOOR),
plugin.getLocale().getMessage("interface.button.exit").getMessage()), plugin.getLocale().getMessage("interface.button.exit").getMessage()),
event -> exit()); event -> exit());
@ -93,7 +93,7 @@ public class PreviewKitGui extends Gui {
} }
// purchase button // purchase button
if (buyable) { if (buyable) {
setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.BUY_ICON.getMaterial(CompatibleMaterial.EMERALD), setButton(rows - 1, 4, GuiUtils.createButtonItem(Settings.BUY_ICON.getMaterial(XMaterial.EMERALD),
plugin.getLocale().getMessage("interface.button.buynow").getMessage(), plugin.getLocale().getMessage("interface.button.buynow").getMessage(),
getBuyLore()), getBuyLore()),
event -> { event -> {

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.handlers; package com.craftaro.ultimatekits.handlers;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.handlers; package com.craftaro.ultimatekits.handlers;
import com.songoda.core.compatibility.CompatibleParticleHandler; import com.craftaro.core.compatibility.CompatibleParticleHandler;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;

View File

@ -1,11 +1,11 @@
package com.songoda.ultimatekits.key; package com.craftaro.ultimatekits.key;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -35,7 +35,7 @@ public class Key {
public ItemStack getKeyItem(Kit kit, int amount) { public ItemStack getKeyItem(Kit kit, int amount) {
UltimateKits plugin = UltimateKits.getInstance(); UltimateKits plugin = UltimateKits.getInstance();
ItemStack item = Settings.KEY_MATERIAL.getMaterial().getItem(); ItemStack item = Settings.KEY_MATERIAL.getMaterial().parseItem();
item.setAmount(amount); item.setAmount(amount);
String kitName = kit != null ? TextUtils.formatText(kit.getName(), true) String kitName = kit != null ? TextUtils.formatText(kit.getName(), true)

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.key; package com.craftaro.ultimatekits.key;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,26 +1,26 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
import com.songoda.core.compatibility.CompatibleHand; import com.craftaro.core.compatibility.CompatibleHand;
import com.songoda.core.compatibility.CompatibleSound; import com.craftaro.core.configuration.Config;
import com.songoda.core.configuration.Config; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.GuiManager;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.core.third_party.com.cryptomorin.xseries.XSound;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.category.Category; import com.craftaro.ultimatekits.gui.PreviewKitGui;
import com.songoda.ultimatekits.crate.Crate; import com.craftaro.ultimatekits.key.Key;
import com.songoda.ultimatekits.gui.AnimatedKitGui; import com.craftaro.ultimatekits.kit.type.KitContentCommand;
import com.songoda.ultimatekits.gui.ConfirmBuyGui; import com.craftaro.ultimatekits.kit.type.KitContentEconomy;
import com.songoda.ultimatekits.gui.PreviewKitGui; import com.craftaro.ultimatekits.category.Category;
import com.songoda.ultimatekits.key.Key; import com.craftaro.ultimatekits.crate.Crate;
import com.songoda.ultimatekits.kit.type.KitContentCommand; import com.craftaro.ultimatekits.gui.AnimatedKitGui;
import com.songoda.ultimatekits.kit.type.KitContentEconomy; import com.craftaro.ultimatekits.gui.ConfirmBuyGui;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.ArmorType; import com.craftaro.ultimatekits.utils.ArmorType;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -320,7 +320,7 @@ public class Kit implements Cloneable {
} }
if (Settings.SOUNDS_ENABLED.getBoolean() && kitAnimation == KitAnimation.NONE) if (Settings.SOUNDS_ENABLED.getBoolean() && kitAnimation == KitAnimation.NONE)
CompatibleSound.ENTITY_PLAYER_LEVELUP.play(player, 0.6F, 15.0F); XSound.ENTITY_PLAYER_LEVELUP.play(player, 0.6F, 15.0F);
return generateRandomItem(innerContents, itemGiveAmount, 0, player); return generateRandomItem(innerContents, itemGiveAmount, 0, player);
} }

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
public enum KitAnimation { public enum KitAnimation {
NONE, ROULETTE NONE, ROULETTE

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -40,7 +40,7 @@ public class KitBlockData {
UltimateKits.getInstance().getDisplayItemHandler().displayItem(this); UltimateKits.getInstance().getDisplayItemHandler().displayItem(this);
UltimateKits.getInstance().removeHologram(this); UltimateKits.getInstance().removeHologram(this);
UltimateKits.getInstance().getDataManager().updateBlockData(this); UltimateKits.getInstance().getKitDataManager().updateBlockData(this);
} }
public Kit getKit() { public Kit getKit() {

View File

@ -1,14 +1,14 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
import com.songoda.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.songoda.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.kit.type.KitContent;
import com.songoda.ultimatekits.kit.type.KitContent; import com.craftaro.ultimatekits.kit.type.KitContentCommand;
import com.songoda.ultimatekits.kit.type.KitContentCommand; import com.craftaro.ultimatekits.kit.type.KitContentEconomy;
import com.songoda.ultimatekits.kit.type.KitContentEconomy; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.type.KitContentItem; import com.craftaro.ultimatekits.kit.type.KitContentItem;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import com.songoda.ultimatekits.utils.ItemSerializer; import com.craftaro.ultimatekits.utils.ItemSerializer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
public enum KitItemType { public enum KitItemType {

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.Location; import org.bukkit.Location;
import java.util.ArrayList; import java.util.ArrayList;
@ -56,7 +56,7 @@ public final class KitManager {
kit.reset(); kit.reset();
KitBlockData removed = kitsAtLocations.remove(roundLocation(location)); KitBlockData removed = kitsAtLocations.remove(roundLocation(location));
UltimateKits.getInstance().getDataManager().deleteBlockData(removed); UltimateKits.getInstance().getKitDataManager().deleteBlockData(removed);
return (removed != null ? removed.getKit() : null); return (removed != null ? removed.getKit() : null);
} }

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.kit; package com.craftaro.ultimatekits.kit;
public enum KitType { public enum KitType {

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.kit.type; package com.craftaro.ultimatekits.kit.type;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatekits.kit.type; package com.craftaro.ultimatekits.kit.type;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatekits.kit.type; package com.craftaro.ultimatekits.kit.type;
import com.songoda.core.hooks.EconomyManager; import com.craftaro.core.hooks.EconomyManager;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,7 +1,6 @@
package com.songoda.ultimatekits.kit.type; package com.craftaro.ultimatekits.kit.type;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.utils.ItemSerializer;
import com.songoda.ultimatekits.utils.ItemSerializer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatekits.listeners; package com.craftaro.ultimatekits.listeners;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.key.Key; import com.craftaro.ultimatekits.key.Key;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@ -1,4 +1,4 @@
package com.songoda.ultimatekits.listeners; package com.craftaro.ultimatekits.listeners;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatekits.listeners; package com.craftaro.ultimatekits.listeners;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatekits.listeners; package com.craftaro.ultimatekits.listeners;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;

View File

@ -1,15 +1,15 @@
package com.songoda.ultimatekits.listeners; package com.craftaro.ultimatekits.listeners;
import com.songoda.core.compatibility.CompatibleHand; import com.craftaro.core.compatibility.CompatibleHand;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion;
import com.songoda.core.compatibility.ServerVersion; import com.craftaro.core.gui.GuiManager;
import com.songoda.core.gui.GuiManager; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.gui.BlockEditorGui; import com.craftaro.ultimatekits.gui.BlockEditorGui;
import com.songoda.ultimatekits.kit.Kit; import com.craftaro.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.kit.KitBlockData; import com.craftaro.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.kit.KitType; import com.craftaro.ultimatekits.kit.KitType;
import com.songoda.ultimatekits.utils.Methods; import com.craftaro.ultimatekits.utils.Methods;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -103,8 +103,8 @@ public class InteractListeners implements Listener {
// Filter physical actions (pressure plates, buttons) // Filter physical actions (pressure plates, buttons)
if (event.getAction() == Action.PHYSICAL if (event.getAction() == Action.PHYSICAL
|| event.getItem() == null || event.getItem() == null
|| event.getItem().getType() == CompatibleMaterial.AIR.getMaterial() || event.getItem().getType() == XMaterial.AIR.parseMaterial()
|| CompatibleMaterial.getMaterial(event.getItem()) != CompatibleMaterial.CHEST) || XMaterial.matchXMaterial(event.getItem()) != XMaterial.CHEST)
return; return;
ItemStack item = event.getItem(); ItemStack item = event.getItem();

View File

@ -1,7 +1,7 @@
package com.songoda.ultimatekits.listeners; package com.craftaro.ultimatekits.listeners;
import com.songoda.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

View File

@ -1,10 +1,10 @@
package com.songoda.ultimatekits.settings; package com.craftaro.ultimatekits.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.ultimatekits.UltimateKits; import com.craftaro.ultimatekits.UltimateKits;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -74,13 +74,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,4 +1,4 @@
package com.songoda.ultimatekits.utils; package com.craftaro.ultimatekits.utils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatekits.utils; package com.craftaro.ultimatekits.utils;
import com.songoda.core.compatibility.ClassMapping; import com.craftaro.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.MethodMapping; import com.craftaro.core.compatibility.MethodMapping;
import com.songoda.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;

View File

@ -1,9 +1,10 @@
package com.songoda.ultimatekits.utils; package com.craftaro.ultimatekits.utils;
import com.songoda.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.Gui; import com.craftaro.core.gui.Gui;
import com.songoda.core.gui.GuiUtils; import com.craftaro.core.gui.GuiUtils;
import com.songoda.ultimatekits.settings.Settings; import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.ultimatekits.settings.Settings;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -183,16 +184,16 @@ public class Methods {
if (Settings.RAINBOW.getBoolean()) { if (Settings.RAINBOW.getBoolean()) {
for (int row = 0; row < gui.getRows(); ++row) { for (int row = 0; row < gui.getRows(); ++row) {
for (int col = row == 1 ? 2 : 3; col < (row == 1 ? 7 : 6); ++col) { for (int col = row == 1 ? 2 : 3; col < (row == 1 ? 7 : 6); ++col) {
gui.setItem(row, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneColor(rand.nextInt(16)))); gui.setItem(row, col, GuiUtils.getBorderItem(CompatibleMaterial.getGlassPaneForColor(rand.nextInt(16))));
} }
} }
} else { } else {
gui.setDefaultItem(GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial(CompatibleMaterial.GRAY_STAINED_GLASS_PANE))); gui.setDefaultItem(GuiUtils.getBorderItem(Settings.GLASS_TYPE_1.getMaterial(XMaterial.GRAY_STAINED_GLASS_PANE)));
} }
// decorate the edges // decorate the edges
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
gui.mirrorFill(0, 2, true, true, glass3); gui.mirrorFill(0, 2, true, true, glass3);

View File

@ -3,7 +3,7 @@ description: ${project.description}
version: ${project.version} version: ${project.version}
api-version: 1.13 api-version: 1.13
main: com.songoda.ultimatekits.UltimateKits main: com.craftaro.ultimatekits.UltimateKits
softdepend: softdepend:
- CMI - CMI
- Essentials - Essentials