diff --git a/.gitignore b/.gitignore index 85e7c1df..a43a23d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,89 @@ -/.idea/ +# Git +*.orig +!.gitignore + +# Windows +Thumbs.db +ehthumbs.db +ehthumbs_vista.db +*.stackdump +[Dd]esktop.ini +$RECYCLE.BIN/ +*.lnk + +# Linux +*~ +.fuse_hidden* +.directory +.Trash-* +.nfs* + +# MacOS +.DS_Store +.AppleDouble +.LSOverride +._* + +# Java +*.class +*.log +*.ctxt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +hs_err_pid* + +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +pom.properties +createdFiles.lst +inputFiles.lst +dependency-reduced-pom.xml +buildNumber.properties + +# Intellij +*.iml +*.java___jb_tmp___ +.idea/* +*.ipr +*.iws +/out/ +.idea_modules/ + +# Eclipse +*.pydevproject +.metadata +.gradle +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.project +.externalToolBuilders/ +*.launch +.cproject +.classpath +.buildpath +.target + +# NetBeans +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml +.nb-gradle/ \ No newline at end of file diff --git a/README.md b/README.md index 90cb7902..ca583445 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ -# Github Repo for Cosmetics Addon -This is the github repo for the cosmetics addon, wiki at https://iamthedefender.gitbook.io/bedwars1058-cosmetics/ -Not the worst code eh? +# BedWars Cosmetics +This is an addon that adds various sets of cosmetics to enchance a player's experience in your server. Before you start using this you would require a supported bedwars plugin and some other plugins on which this plugin rely to make it's features work as expected. The current author and maintainer of this plugin is [IamTheDefender](https://iamthedefender.xyz). As of 2022, this plugin is open source and will stay that way. This plugin is open source under the GPL-3.0 License -Thank you to all the contributers! +## Contributions +All contributions are welcome, after all, it is better to have all the required features in this plugin itself rather than creating multiple forks. I would really appericate if you contribute into this project. But please note that, try not to use NMS + +## Documentation (or Wiki) +A detailed documentaion of this plugin is provided at the [wiki](https://dev-wiki.iamthedefender.xyz/bedwars-cosmetics), please look through the wiki before reporting an issue in this GitHub Repository or the Discord Support Server. + +## Support Server +You can join our [discord support server](discord.iamthedefender.xyz) if you have issues with the plugin but please do check wiki before doing so, you can create a ticket in the discord server only if you think you need immediate help with a critical issue, I check every message whenever I have the time so don't ping me please. + +## 3rd Party libraries +- [HikariCP](https://github.com/brettwooldridge/HikariCP) +- [HCore](https://github.com/hakan-krgn/hCore) +- [XSeries](https://github.com/CryptoMorin/XSeries) +- [ParticleLib](https://github.com/ByteZ1337/ParticleLib/tree/master) diff --git a/lib/proxy-plugin-1.0-SNAPSHOT (1).jar b/lib/proxy-plugin-1.0-SNAPSHOT (1).jar new file mode 100644 index 00000000..da3e4f54 Binary files /dev/null and b/lib/proxy-plugin-1.0-SNAPSHOT (1).jar differ diff --git a/license b/license deleted file mode 100644 index ef08d6bd..00000000 --- a/license +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 IamTheDefender - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/pom.xml b/pom.xml index 74c16b3a..05c4c78a 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,6 @@ com/cryptomorin/xseries/NMSExtras* com/cryptomorin/xseries/NoteBlockMusic* com/cryptomorin/xseries/SkullCacheListener* - com/hakan/core/scoreboard @@ -156,17 +155,13 @@ jar provided - - - mysql - mysql-connector-java - 8.0.33 - + com.github.hakan-krgn.hCore hCore-bukkit 0.7.3.3 + compile me.clip @@ -191,11 +186,24 @@ 1.8.4 compile + + mysql + mysql-connector-java + 8.0.33 + + com.comphenix.protocol ProtocolLib 5.1.0 provided + + com.tompkeuper + bedwars2023-proxy + 1.0-SNAPSHOT + system + ${basedir}/lib/proxy-plugin-1.0-SNAPSHOT (1).jar + diff --git a/src/main/java/me/defender/cosmetics/api/BwcAPI.java b/src/main/java/me/defender/cosmetics/BwcAPI.java similarity index 80% rename from src/main/java/me/defender/cosmetics/api/BwcAPI.java rename to src/main/java/me/defender/cosmetics/BwcAPI.java index 6dc00117..20f7e264 100644 --- a/src/main/java/me/defender/cosmetics/api/BwcAPI.java +++ b/src/main/java/me/defender/cosmetics/BwcAPI.java @@ -1,25 +1,32 @@ -package me.defender.cosmetics.api; +package me.defender.cosmetics; import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.CosmeticsType; -import me.defender.cosmetics.util.Utility; -import me.defender.cosmetics.database.PlayerData; +import me.defender.cosmetics.api.database.IDatabase; +import me.defender.cosmetics.api.handler.IHandler; +import me.defender.cosmetics.data.PlayerData; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.RegisteredServiceProvider; -public class BwcAPI { +public class BwcAPI implements CosmeticsAPI { /** * Check if MySQL is enabled. * @return true if enabled. */ - public Boolean isMySQL() { + public boolean isMySQL() { return Cosmetics.getInstance().getConfig().getBoolean("mysql.enable"); } + @Override + public IHandler getHandler() { + return Cosmetics.getInstance().getHandler(); + } + /** * Get the selected cosmetic for a player. * @param p Player @@ -30,7 +37,7 @@ public String getSelectedCosmetic(Player p, CosmeticsType cos){ if(p == null){ return null; } - PlayerData playerData = Utility.playerDataList.get(p.getUniqueId()); + PlayerData playerData = Cosmetics.getInstance().getPlayerManager().getPlayerData(p.getUniqueId()); switch (cos){ case BedBreakEffects: return playerData.getBedDestroy(); @@ -65,7 +72,7 @@ public String getSelectedCosmetic(Player p, CosmeticsType cos){ * @param value Cosmetic value. */ public void setSelectedCosmetic(Player p, CosmeticsType cos, String value){ - PlayerData playerData = Utility.playerDataList.get(p.getUniqueId()); + PlayerData playerData = Cosmetics.getInstance().getPlayerManager().getPlayerData(p.getUniqueId()); switch (cos){ case BedBreakEffects: playerData.setBedDestroy(value); @@ -101,25 +108,20 @@ public void setSelectedCosmetic(Player p, CosmeticsType cos, String value){ playerData.setWoodSkin(value); break; } - Utility.playerDataList.replace(p.getUniqueId(), playerData); // Ran ASYNC HCore.asyncScheduler().run(playerData::save); } - /** - * Get the vault economy. - * @return the vault economy. - */ - public Economy getEco(){ - final RegisteredServiceProvider rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); - return rsp.getProvider(); - } - /** * Check if the plugin is running on a proxy. * @return true if running on a proxy. */ - public Boolean isProxy(){ - return Bukkit.getPluginManager().getPlugin("BedWarsProxy") != null; + public boolean isProxy(){ + return Bukkit.getPluginManager().getPlugin("BedWarsProxy") != null || + Bukkit.getPluginManager().getPlugin("BWProxy2023") != null; + } + + public IDatabase getDatabase(){ + return Cosmetics.getInstance().getRemoteDatabase(); } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/Cosmetics.java b/src/main/java/me/defender/cosmetics/Cosmetics.java index bbbe4871..d69e9c2f 100644 --- a/src/main/java/me/defender/cosmetics/Cosmetics.java +++ b/src/main/java/me/defender/cosmetics/Cosmetics.java @@ -4,51 +4,46 @@ import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; import com.hakan.core.HCore; -import com.tomkeuper.bedwars.api.BedWars; -import com.zaxxer.hikari.HikariDataSource; import lombok.Getter; -import lombok.Setter; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; +import me.defender.cosmetics.api.database.DatabaseType; +import me.defender.cosmetics.api.handler.IHandler; +import me.defender.cosmetics.data.manager.PlayerManager; +import me.defender.cosmetics.support.bedwars.handler.bedwars1058.BW1058Handler; +import me.defender.cosmetics.support.bedwars.handler.bedwars1058.BW1058ProxyHandler; +import me.defender.cosmetics.support.bedwars.handler.bedwars2023.BW2023Handler; +import me.defender.cosmetics.support.bedwars.handler.bedwars2023.BW2023ProxyHandler; import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.MainMenuUtils; import me.defender.cosmetics.util.config.DefaultsUtils; -import me.defender.cosmetics.util.Utility; import me.defender.cosmetics.command.MainCommand; -import me.defender.cosmetics.util.config.MainMenuData; -import me.defender.cosmetics.database.IDatabase; -import me.defender.cosmetics.database.PlayerData; -import me.defender.cosmetics.database.PlayerOwnedData; -import me.defender.cosmetics.database.mysql.MySQL; -import me.defender.cosmetics.database.sqlite.SQLite; -import me.defender.cosmetics.support.bedwars.BedWars2023; +import me.defender.cosmetics.api.database.IDatabase; +import me.defender.cosmetics.data.PlayerData; +import me.defender.cosmetics.data.PlayerOwnedData; +import me.defender.cosmetics.data.database.MySQL; +import me.defender.cosmetics.data.database.SQLite; +import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; +import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; import java.sql.Connection; import java.sql.SQLException; import java.util.HashMap; -import java.util.concurrent.TimeUnit; -public class Cosmetics extends JavaPlugin -{ - - @Setter - @Getter - private BedWars bedWars2023API; - @Getter - private com.andrei1058.bedwars.api.BedWars bedWars1058API; - public MainMenuData menuData; - public static HikariDataSource db; +public class Cosmetics extends JavaPlugin { @Getter - public static Connection dbConnection; + public ConfigManager menuData; public boolean dependenciesMissing = false; @Getter static boolean placeholderAPI; @Getter - private IDatabase dataBase; + private IDatabase remoteDatabase; @Getter private static Cosmetics instance; @Getter @@ -56,33 +51,49 @@ public class Cosmetics extends JavaPlugin @Getter private HashMap entityPlayerHashMap; + @Getter + private PlayerManager playerManager; + @Getter + private CosmeticsAPI api; + @Getter + private Economy economy; + @Getter + private IHandler handler; @Override public void onEnable() { + try{ + HCore.initialize(this); + }catch (IllegalStateException ignored){ + getLogger().severe("BW1058-Cosmetics does not support your server version, please check dev builds or contact the developer for more info!"); + setEnabled(false); + dependenciesMissing = true; + return; + } + instance = this; + api = new BwcAPI(); if(!StartupUtils.checkDependencies()){ getLogger().severe("Cosmetics addon will now disable, make sure you have all dependencies installed!"); getServer().getPluginManager().disablePlugin(this); dependenciesMissing = true; return; } - if (StartupUtils.isBw2023) { - BedWars2023 bedWars2023 = new BedWars2023(this); - bedWars2023.start(); - } else { - this.bedWars1058API = Bukkit.getServer().getServicesManager().getRegistration(com.andrei1058.bedwars.api.BedWars.class).getProvider(); - } + handler = (api.isProxy() ? (StartupUtils.isBw2023 ? new BW2023ProxyHandler() : new BW1058ProxyHandler()) : (StartupUtils.isBw2023 ? new BW2023Handler() : new BW1058Handler())); + handler.register(); + getLogger().info("All dependencies found, continuing with plugin startup."); - try{ - HCore.initialize(this); - }catch (IllegalStateException ignored){ - getLogger().severe("BW1058-Cosmetics does not support your server version, please check dev builds or contact the developer for more info!"); - setEnabled(false); + RegisteredServiceProvider rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); + if(rsp == null){ + getLogger().severe("Cosmetics addon will now disable, make sure you have Vault supported Economy plugin installed!"); + getServer().getPluginManager().disablePlugin(this); + dependenciesMissing = true; return; } - instance = this; + economy = rsp.getProvider(); protocolManager = ProtocolLibrary.getProtocolManager(); entityPlayerHashMap = new HashMap<>(); + playerManager = new PlayerManager(); StartupUtils.addEntityHideListener(); // Download Glyphs StartupUtils.downloadGlyphs(); @@ -100,21 +111,17 @@ public void onEnable() { ConfigUtils.getMainConfig().save(); ConfigUtils.addExtrasToLang(); - this.menuData = new MainMenuData(this); + this.menuData = new ConfigManager(this, "MainMenu", getHandler().getAddonPath()); ConfigUtils.addSlotsList(); getLogger().info("Configuration file successfully loaded."); - getLogger().info("Loading " + (new BwcAPI().isMySQL() ? "MySQL" : "SQLite") + " database..."); - if(new BwcAPI().isMySQL()){ - dataBase = new MySQL(this); + getLogger().info("Loading " + (api.isMySQL() ? "MySQL" : "SQLite") + " database..."); + if(api.isMySQL()){ + remoteDatabase = new MySQL(this); }else{ - dataBase = new SQLite(this); + remoteDatabase = new SQLite(this); } - db = dataBase.getDataSource(); - dbConnection = dataBase.getConnection(); // Load all the list - Utility.playerDataList = new HashMap<>(); - Utility.playerOwnedDataList = new HashMap<>(); StartupUtils.loadLists(); getLogger().info("Cosmetics list successfully loaded."); @@ -136,11 +143,17 @@ public void onEnable() { // This is a check to make sure victory dance config doesn't have any issues. VictoryDance.getDefault(null); - HCore.asyncScheduler().every(5, TimeUnit.SECONDS).run(() -> { - try (Connection connection = dataBase.getConnection()){ + HCore.asyncScheduler().every(5L).run(() -> { + try (Connection connection = remoteDatabase.getConnection()){ connection.createStatement(); }catch (Exception e){ - dataBase.connect(); + remoteDatabase.connect(); + } + }); + + HCore.asyncScheduler().every(5 * 20L).run(() -> { + for (Player onlinePlayer : getServer().getOnlinePlayers()) { + getPlayerManager().getPlayerOwnedData(onlinePlayer.getUniqueId()).updateOwned(); } }); @@ -152,37 +165,44 @@ public void onDisable() { getLogger().severe("Detected forced disable! plugin will not unload anything!"); return; } - if(!new BwcAPI().isMySQL()){ + if(remoteDatabase.getDatabaseType() == DatabaseType.SQLITE){ getLogger().info("Saving player data to SQLite database..."); getLogger().info("Please wait it may take some time!"); - for(PlayerData playerData : Utility.playerDataList.values()){ + for(PlayerData playerData : getPlayerManager().getPlayerDataHashMap().values()){ playerData.save(); } - for (PlayerOwnedData playerOwnedData : Utility.playerOwnedDataList.values()){ + for (PlayerOwnedData playerOwnedData : getPlayerManager().getPlayerOwnedDataHashMap().values()) { playerOwnedData.save(); } getLogger().info("Player data saved to SQLite database!"); } try { - db.getConnection().close(); + remoteDatabase.getConnection().close(); } catch (SQLException e) { getLogger().severe("There was an error while closing connection to database: " + e.getMessage()); } } + @Override + public FileConfiguration getConfig() { + return ConfigUtils.getMainConfig().getYml(); + } + @Override + public void reloadConfig() { + ConfigUtils.getMainConfig().reload(); + } - public static HikariDataSource getDB(){ - return db; + @Override + public void saveConfig() { + ConfigUtils.getMainConfig().save(); } public static void setPlaceholderAPI(boolean placeholderAPI) { Cosmetics.placeholderAPI = placeholderAPI; } - public boolean isBw2023() { - return getBedWars2023API() != null; - } + } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/api/CosmeticsAPI.java b/src/main/java/me/defender/cosmetics/api/CosmeticsAPI.java new file mode 100644 index 00000000..b4ed8cd6 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/CosmeticsAPI.java @@ -0,0 +1,16 @@ +package me.defender.cosmetics.api; + +import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.database.IDatabase; +import me.defender.cosmetics.api.handler.IHandler; +import org.bukkit.entity.Player; + +public interface CosmeticsAPI { + IDatabase getDatabase(); + String getSelectedCosmetic(Player player, CosmeticsType type); + void setSelectedCosmetic(Player player, CosmeticsType type, String value); + boolean isProxy(); + boolean isMySQL(); + + IHandler getHandler(); +} diff --git a/src/main/java/me/defender/cosmetics/api/configuration/ConfigManager.java b/src/main/java/me/defender/cosmetics/api/configuration/ConfigManager.java index 3c6484cd..0d95e92c 100644 --- a/src/main/java/me/defender/cosmetics/api/configuration/ConfigManager.java +++ b/src/main/java/me/defender/cosmetics/api/configuration/ConfigManager.java @@ -1,11 +1,5 @@ package me.defender.cosmetics.api.configuration; -import java.io.File; -import java.io.IOException; -import java.util.*; -import java.util.logging.Level; -import java.util.stream.Collectors; - import com.cryptomorin.xseries.XMaterial; import me.defender.cosmetics.util.SkullUtil; import org.bukkit.Bukkit; @@ -14,6 +8,13 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.Plugin; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.logging.Level; +import java.util.stream.Collectors; + // Why copy code from bedwars1058 Config Manager? // well because proxy have PluginConfig and bedwars1058 have ConfigManager @@ -110,7 +111,9 @@ public ItemStack getItemStack(String path) { int damage = Integer.parseInt(data[1]); item = XMaterial.matchXMaterial(material.toUpperCase()).get().parseItem(); assert item != null; - item.setDurability((short) damage); + if(damage != 0){ + item.setDurability((short) damage); + } } catch (NoSuchElementException e2) { e2.printStackTrace(); Bukkit.getLogger().severe("Looks like the material " + material + " is invalid!"); diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/CosmeticsType.java b/src/main/java/me/defender/cosmetics/api/cosmetics/CosmeticsType.java index adbefb77..5e5623f2 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/CosmeticsType.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/CosmeticsType.java @@ -21,11 +21,11 @@ public enum CosmeticsType { ShopKeeperSkin("ShopKeeper Skin", ConfigUtils.getShopKeeperSkins(), shopKeeperSkinList, "shopkeeper-skins", "shopkeeperskin"), IslandTopper("Island Topper", ConfigUtils.getIslandToppers(), islandTopperList, "island-topper", "islandtopper"); - private String formatedName; - private ConfigManager configManager; - private List itemsList; - private String sectionKey; - private String permissionFormat; + private final String formatedName; + private final ConfigManager configManager; + private final List itemsList; + private final String sectionKey; + private final String permissionFormat; CosmeticsType(String formatedName, ConfigManager configManager, List itemsList, String sectionKey, String permissionFormat){ this.formatedName = formatedName; this.configManager = configManager; diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/BedDestroy.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/BedDestroy.java index 2dcba9b9..bf66647d 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/BedDestroy.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/BedDestroy.java @@ -2,14 +2,15 @@ import com.andrei1058.bedwars.api.arena.team.ITeam; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.handler.ITeamHandler; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -19,9 +20,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; /** * Bed destroy effect. @@ -36,9 +37,7 @@ public abstract class BedDestroy extends Cosmetics { * @param player player who destroyed the bed. * @param bedLocation location of the bed. */ - public abstract void execute1058(Player player, Location bedLocation, ITeam victimTeam); - public abstract void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam); - + public abstract void execute(Player player, Location bedLocation, ITeamHandler victimTeam); /** * Register the bed destroy effect. * This method should be called when the plugin is enabled. diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/DeathCry.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/DeathCry.java index 5da8466a..f69c8828 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/DeathCry.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/DeathCry.java @@ -3,14 +3,14 @@ import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -19,9 +19,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class DeathCry extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/FinalKillEffect.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/FinalKillEffect.java index 91f99909..d88f6a7d 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/FinalKillEffect.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/FinalKillEffect.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class FinalKillEffect extends Cosmetics { /** diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/Glyph.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/Glyph.java index ff4ede07..dfa53614 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/Glyph.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/Glyph.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class Glyph extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/IslandTopper.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/IslandTopper.java index f54a861a..d51ebace 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/IslandTopper.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/IslandTopper.java @@ -1,15 +1,15 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.category.islandtoppers.items.DummyTopper; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.category.islandtoppers.items.DummyTopper; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -19,9 +19,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class IslandTopper extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/KillMessage.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/KillMessage.java index beb1802f..a1cba43e 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/KillMessage.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/KillMessage.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -17,9 +17,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class KillMessage extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/ProjectileTrail.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/ProjectileTrail.java index 1a485526..1fc1bc29 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/ProjectileTrail.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/ProjectileTrail.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -17,9 +17,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class ProjectileTrail extends Cosmetics { private final String category = "projectile-trails"; diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/ShopKeeperSkin.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/ShopKeeperSkin.java index 3b4db863..acd37afa 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/ShopKeeperSkin.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/ShopKeeperSkin.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class ShopKeeperSkin extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/Spray.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/Spray.java index 46499498..38170f4d 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/Spray.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/Spray.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class Spray extends Cosmetics { private final String category = "sprays"; diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/VictoryDance.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/VictoryDance.java index 372c01c6..4a3e040d 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/VictoryDance.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/VictoryDance.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class VictoryDance extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/cosmetics/category/WoodSkin.java b/src/main/java/me/defender/cosmetics/api/cosmetics/category/WoodSkin.java index 1a83b54e..1d3ff3ef 100644 --- a/src/main/java/me/defender/cosmetics/api/cosmetics/category/WoodSkin.java +++ b/src/main/java/me/defender/cosmetics/api/cosmetics/category/WoodSkin.java @@ -1,14 +1,14 @@ package me.defender.cosmetics.api.cosmetics.category; import com.cryptomorin.xseries.XMaterial; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.Cosmetics; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -18,9 +18,9 @@ import java.util.Arrays; import java.util.List; +import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; import static me.defender.cosmetics.util.config.ConfigUtils.get; import static me.defender.cosmetics.util.config.ConfigUtils.saveIfNotFound; -import static me.defender.cosmetics.util.Utility.saveIfNotExistsLang; public abstract class WoodSkin extends Cosmetics { diff --git a/src/main/java/me/defender/cosmetics/api/database/DatabaseType.java b/src/main/java/me/defender/cosmetics/api/database/DatabaseType.java new file mode 100644 index 00000000..bc3fd286 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/database/DatabaseType.java @@ -0,0 +1,6 @@ +package me.defender.cosmetics.api.database; + +public enum DatabaseType { + SQLITE, + MYSQL +} diff --git a/src/main/java/me/defender/cosmetics/database/IDatabase.java b/src/main/java/me/defender/cosmetics/api/database/IDatabase.java similarity index 76% rename from src/main/java/me/defender/cosmetics/database/IDatabase.java rename to src/main/java/me/defender/cosmetics/api/database/IDatabase.java index 9f43c86d..a4c98115 100644 --- a/src/main/java/me/defender/cosmetics/database/IDatabase.java +++ b/src/main/java/me/defender/cosmetics/api/database/IDatabase.java @@ -1,4 +1,4 @@ -package me.defender.cosmetics.database; +package me.defender.cosmetics.api.database; import com.zaxxer.hikari.HikariDataSource; @@ -7,8 +7,11 @@ // TODO migrate load and save method to this public interface IDatabase { + DatabaseType getDatabaseType(); + void connect(); void createTable(); HikariDataSource getDataSource(); Connection getConnection(); } + diff --git a/src/main/java/me/defender/cosmetics/api/event/BedBreakEffectExecuteEvent.java b/src/main/java/me/defender/cosmetics/api/event/BedBreakEffectExecuteEvent.java index b6ef370a..da79f933 100644 --- a/src/main/java/me/defender/cosmetics/api/event/BedBreakEffectExecuteEvent.java +++ b/src/main/java/me/defender/cosmetics/api/event/BedBreakEffectExecuteEvent.java @@ -1,7 +1,7 @@ package me.defender.cosmetics.api.event; import lombok.Getter; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -33,7 +33,7 @@ public class BedBreakEffectExecuteEvent extends Event implements Cancellable { public BedBreakEffectExecuteEvent(Player WhoBroke){ this.cancelled = false; this.WhoBrokeTheBed = WhoBroke; - this.selected = new BwcAPI().getSelectedCosmetic(WhoBroke, CosmeticsType.BedBreakEffects); + this.selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(WhoBroke, CosmeticsType.BedBreakEffects); } diff --git a/src/main/java/me/defender/cosmetics/api/event/FinalKillEffectsExecuteEvent.java b/src/main/java/me/defender/cosmetics/api/event/FinalKillEffectsExecuteEvent.java index bd473dd7..bb9680e3 100644 --- a/src/main/java/me/defender/cosmetics/api/event/FinalKillEffectsExecuteEvent.java +++ b/src/main/java/me/defender/cosmetics/api/event/FinalKillEffectsExecuteEvent.java @@ -16,7 +16,7 @@ public class FinalKillEffectsExecuteEvent extends Event implements Cancellable { * @return Player */ @Getter - private Player victim; + private final Player victim; /** * -- GETTER -- * Get the killer. @@ -24,7 +24,7 @@ public class FinalKillEffectsExecuteEvent extends Event implements Cancellable { * @return Player */ @Getter - private Player killer; + private final Player killer; /** * -- GETTER -- @@ -33,7 +33,7 @@ public class FinalKillEffectsExecuteEvent extends Event implements Cancellable { * @return String */ @Getter - private String selected; + private final String selected; public FinalKillEffectsExecuteEvent(Player victim, Player killer, String selected){ this.cancelled = false; this.victim = victim; diff --git a/src/main/java/me/defender/cosmetics/api/event/VictoryDancesExecuteEvent.java b/src/main/java/me/defender/cosmetics/api/event/VictoryDancesExecuteEvent.java index d05eed34..b287fd52 100644 --- a/src/main/java/me/defender/cosmetics/api/event/VictoryDancesExecuteEvent.java +++ b/src/main/java/me/defender/cosmetics/api/event/VictoryDancesExecuteEvent.java @@ -1,7 +1,7 @@ package me.defender.cosmetics.api.event; import lombok.Getter; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -33,7 +33,7 @@ public class VictoryDancesExecuteEvent extends Event implements Cancellable { public VictoryDancesExecuteEvent(Player winner){ this.cancelled = false; this.player = winner; - this.selected = new BwcAPI().getSelectedCosmetic(winner, CosmeticsType.VictoryDances); + this.selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(winner, CosmeticsType.VictoryDances); } @Override diff --git a/src/main/java/me/defender/cosmetics/api/handler/IArenaHandler.java b/src/main/java/me/defender/cosmetics/api/handler/IArenaHandler.java new file mode 100644 index 00000000..b3fbac1a --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/IArenaHandler.java @@ -0,0 +1,9 @@ +package me.defender.cosmetics.api.handler; + + +import org.bukkit.entity.Player; + +public interface IArenaHandler { + + ITeamHandler getTeam(Player player); +} diff --git a/src/main/java/me/defender/cosmetics/api/handler/IArenaUtil.java b/src/main/java/me/defender/cosmetics/api/handler/IArenaUtil.java new file mode 100644 index 00000000..50894b15 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/IArenaUtil.java @@ -0,0 +1,8 @@ +package me.defender.cosmetics.api.handler; + +import org.bukkit.entity.Player; + +public interface IArenaUtil { + + IArenaHandler getArenaByPlayer(Player player); +} diff --git a/src/main/java/me/defender/cosmetics/api/handler/IHandler.java b/src/main/java/me/defender/cosmetics/api/handler/IHandler.java new file mode 100644 index 00000000..f4211b18 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/IHandler.java @@ -0,0 +1,15 @@ +package me.defender.cosmetics.api.handler; + +import java.util.UUID; + +public interface IHandler { + + void register(); + + ISetupSession getSetupSession(UUID playerUUID); + IScoreboardUtil getScoreboardUtil(); + IArenaUtil getArenaUtil(); + ILanguage getLanguageUtil(); + String getAddonPath(); + +} diff --git a/src/main/java/me/defender/cosmetics/api/handler/ILanguage.java b/src/main/java/me/defender/cosmetics/api/handler/ILanguage.java new file mode 100644 index 00000000..def65637 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/ILanguage.java @@ -0,0 +1,13 @@ +package me.defender.cosmetics.api.handler; + +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.Objects; + +public interface ILanguage { + + String getMessage(Player player, String path); + List getMessageList(Player player, String path); + void saveIfNotExists(String path, Object data); +} diff --git a/src/main/java/me/defender/cosmetics/api/handler/IScoreboardUtil.java b/src/main/java/me/defender/cosmetics/api/handler/IScoreboardUtil.java new file mode 100644 index 00000000..7772b7df --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/IScoreboardUtil.java @@ -0,0 +1,8 @@ +package me.defender.cosmetics.api.handler; + +import org.bukkit.entity.Player; + +public interface IScoreboardUtil { + void giveScoreboard(Player player, boolean b); + void removePlayerScoreboard(Player player); +} diff --git a/src/main/java/me/defender/cosmetics/api/handler/ISetupSession.java b/src/main/java/me/defender/cosmetics/api/handler/ISetupSession.java new file mode 100644 index 00000000..c5c65a69 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/ISetupSession.java @@ -0,0 +1,13 @@ +package me.defender.cosmetics.api.handler; + +import org.bukkit.Location; +import org.bukkit.configuration.file.FileConfiguration; + +import java.util.UUID; + +public interface ISetupSession { + UUID getPlayerUUID(); + FileConfiguration getConfig(); + void saveConfigLoc(String path, Location value); + void saveConfig(); +} diff --git a/src/main/java/me/defender/cosmetics/api/handler/ITeamHandler.java b/src/main/java/me/defender/cosmetics/api/handler/ITeamHandler.java new file mode 100644 index 00000000..8e080ad8 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/api/handler/ITeamHandler.java @@ -0,0 +1,22 @@ +package me.defender.cosmetics.api.handler; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import java.util.List; + +public interface ITeamHandler { + Location getBed(); + List getPlayers(); + String getName(); + Location getTeamUpgrades(); + Location getShop(); + Location getSpawn(); + int getSize(); + default boolean isBed(Location location){ + return getBed().getBlockX() == location.getBlockX() && getBed().getBlockY() == location.getBlockY() && getBed().getBlockZ() == location.getBlockZ(); + } + default boolean isMember(Player player){ + return getPlayers().contains(player); + } +} diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler1058.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler1058.java index 82872c63..01aa568f 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler1058.java @@ -2,14 +2,14 @@ import com.andrei1058.bedwars.api.events.player.PlayerBedBreakEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.event.BedBreakEffectExecuteEvent; -import me.defender.cosmetics.util.StartupUtils; +import me.defender.cosmetics.util.BedWarsWrapper; import me.defender.cosmetics.util.DebugUtil; +import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -21,7 +21,7 @@ public class BedDestroyHandler1058 implements Listener{ @EventHandler public void onBedBreak1058(PlayerBedBreakEvent e) { - String selected = new BwcAPI().getSelectedCosmetic(e.getPlayer(), CosmeticsType.BedBreakEffects); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getPlayer(), CosmeticsType.BedBreakEffects); BedBreakEffectExecuteEvent event = new BedBreakEffectExecuteEvent(e.getPlayer()); Bukkit.getServer().getPluginManager().callEvent(event); @@ -36,7 +36,7 @@ public void onBedBreak1058(PlayerBedBreakEvent e) { for(BedDestroy bedDestroy : StartupUtils.bedDestroyList){ if(selected.equals(bedDestroy.getIdentifier())){ if(bedDestroy.getField(FieldsType.RARITY, p) != RarityType.NONE) { - bedDestroy.execute1058(p, loc, e.getVictimTeam()); + bedDestroy.execute(p, loc, BedWarsWrapper.wrap(e.getVictimTeam())); } } } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler2023.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler2023.java index 617c9bb8..a19b67e2 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/BedDestroyHandler2023.java @@ -1,12 +1,12 @@ package me.defender.cosmetics.category.bedbreakeffects; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.event.BedBreakEffectExecuteEvent; +import me.defender.cosmetics.util.BedWarsWrapper; import me.defender.cosmetics.util.DebugUtil; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; @@ -15,13 +15,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class BedDestroyHandler2023 implements Listener { @EventHandler public void onBedBreak2023(com.tomkeuper.bedwars.api.events.player.PlayerBedBreakEvent e) { - String selected = new BwcAPI().getSelectedCosmetic(e.getPlayer(), CosmeticsType.BedBreakEffects); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getPlayer(), CosmeticsType.BedBreakEffects); BedBreakEffectExecuteEvent event = new BedBreakEffectExecuteEvent(e.getPlayer()); Bukkit.getServer().getPluginManager().callEvent(event); @@ -36,7 +34,7 @@ public void onBedBreak2023(com.tomkeuper.bedwars.api.events.player.PlayerBedBrea for(BedDestroy bedDestroy : StartupUtils.bedDestroyList){ if(selected.equals(bedDestroy.getIdentifier())){ if(bedDestroy.getField(FieldsType.RARITY, p) != RarityType.NONE) { - bedDestroy.execute2023(p, loc, e.getVictimTeam()); + bedDestroy.execute(p, loc, BedWarsWrapper.wrap(e.getVictimTeam())); } } } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/BedBugsBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/BedBugsBedDestroy.java index 9780f18d..0713a9c8 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/BedBugsBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/BedBugsBedDestroy.java @@ -1,10 +1,10 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Location; import org.bukkit.entity.Endermite; @@ -59,7 +59,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { List endermites = new ArrayList<>(); HCore.syncScheduler().every(1L).limit(4).run(() -> { Location loc = UsefulUtilsVD.getRandomLocation(bedLocation, 1); @@ -72,17 +72,4 @@ public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { }); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - List endermites = new ArrayList<>(); - HCore.syncScheduler().every(1L).limit(4).run(() -> { - Location loc = UsefulUtilsVD.getRandomLocation(bedLocation, 1); - Endermite mite = (Endermite) player.getWorld().spawnEntity(loc.add(0,1,0), EntityType.ENDERMITE); - endermites.add(mite); - }); - - HCore.syncScheduler().after(100L).run(() -> { - endermites.forEach(Entity::remove); - }); - } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/EggExplosionBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/EggExplosionBedDestroy.java index a63cfca0..85979338 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/EggExplosionBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/EggExplosionBedDestroy.java @@ -1,12 +1,12 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import me.defender.cosmetics.util.MathUtil; import org.bukkit.Location; import org.bukkit.entity.Egg; @@ -54,7 +54,7 @@ public RarityType getRarity() { } @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { // Define the center point where the eggs should be spawned Location center = bedLocation; for (int i = 0; i < MathUtil.getRandom(5, 6); i++) { @@ -79,29 +79,4 @@ public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { } } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - // Define the center point where the eggs should be spawned - Location center = bedLocation; - for (int i = 0; i < MathUtil.getRandom(5, 6); i++) { - // Choose a random direction vector - Vector direction = new Vector(MathUtil.getRandom(-1, 1), 0, MathUtil.getRandom(-1, 1)).normalize(); - - // Spawn an egg entity in the chosen direction - Egg egg = player.getWorld().spawn(center, Egg.class); - egg.setVelocity(direction.multiply(1.5)); // Make the egg fly faster in the chosen direction - - // Spawn particle effects at the egg's location - for (int j = 0; j < 10; j++) { - HCore.playParticle(egg.getLocation(), new Particle(ParticleType.SPELL_WITCH, 1, center.toVector())); - HCore.playParticle(egg.getLocation(), new Particle(ParticleType.SPELL_INSTANT, 1, center.toVector())); - } - - // Schedule a task to run after 5 seconds to spawn a chicken and despawn the egg - HCore.syncScheduler().run(() -> { - egg.getWorld().spawnEntity(egg.getLocation(), EntityType.CHICKEN); // Spawn a chicken entity - egg.remove(); // Remove the egg entity - }); - } - } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/FireworksBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/FireworksBedDestroy.java index 9e821673..0780f8d8 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/FireworksBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/FireworksBedDestroy.java @@ -1,9 +1,9 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Color; import org.bukkit.Location; @@ -55,12 +55,9 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { UsefulUtilsVD.spawnFireWorks(player, 1, Color.RED, Color.GREEN, bedLocation, false); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - UsefulUtilsVD.spawnFireWorks(player, 1, Color.RED, Color.GREEN, bedLocation, false); - } + } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/GhostBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/GhostBedDestroy.java index ff9ac06e..f843fb01 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/GhostBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/GhostBedDestroy.java @@ -1,13 +1,13 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; import com.hakan.core.HCore; import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Location; import org.bukkit.entity.*; @@ -63,33 +63,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { - List standsAndBats = new ArrayList<>(); - HCore.syncScheduler().every(10L).limit(5).run(() -> { - Location loc = UsefulUtilsVD.getRandomLocation(bedLocation, 2); - Bat bat = (Bat) player.getWorld().spawnEntity(loc, EntityType.BAT); - bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 19999980, 1)); - ArmorStand stand = (ArmorStand) player.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND); - stand.setVisible(false); - stand.setGravity(false); - bat.setPassenger(stand); - stand.setHelmet(UsefulUtilsVD.gethead("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZlOTM0NjdhM2EwNzkyMjdmNGE3ZDNlYmE3NjE3NTM2ZGE0OTFiYzJmYzZkNzNlZTM5NjhkM2NmMWE2YTUifX19", "")); - standsAndBats.addAll(Arrays.asList(stand, bat)); - }); - HCore.syncScheduler().after(8, TimeUnit.SECONDS).run(() -> { - for(Entity entity : standsAndBats){ - if(entity instanceof Bat) { - Location location = entity.getLocation(); - HCore.playParticle(location, new Particle(ParticleType.EXPLOSION_LARGE, 0.0f, new Vector(0.0f, 0.0f, 0.0f))); - XSound.ENTITY_GENERIC_EXPLODE.play(location); - entity.getPassenger().remove(); - entity.remove(); - } - } - }); - } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { List standsAndBats = new ArrayList<>(); HCore.syncScheduler().every(10L).limit(5).run(() -> { Location loc = UsefulUtilsVD.getRandomLocation(bedLocation, 2); diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/HologramBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/HologramBedDestroy.java index 5746d7eb..293b5a74 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/HologramBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/HologramBedDestroy.java @@ -1,10 +1,11 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; import com.hakan.core.utils.ColorUtil; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; @@ -56,16 +57,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { - ArmorStand stand = (ArmorStand) player.getWorld().spawnEntity(bedLocation.add(0,1,0), EntityType.ARMOR_STAND); - stand.setVisible(false); - stand.setGravity(false); - stand.setCustomName(ColorUtil.colored("&c" + victimTeam.getName() + "'s Bed was destroyed by " + player.getDisplayName())); - stand.setCustomNameVisible(true); - } - - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { ArmorStand stand = (ArmorStand) player.getWorld().spawnEntity(bedLocation.add(0,1,0), EntityType.ARMOR_STAND); stand.setVisible(false); stand.setGravity(false); diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/LightStrikeBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/LightStrikeBedDestroy.java index d1d6186f..6f622b49 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/LightStrikeBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/LightStrikeBedDestroy.java @@ -1,9 +1,10 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -53,12 +54,8 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { player.getWorld().strikeLightningEffect(bedLocation); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - player.getWorld().strikeLightningEffect(bedLocation); - } } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/NoneBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/NoneBedDestroy.java index 5473030d..47b7b174 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/NoneBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/NoneBedDestroy.java @@ -1,9 +1,10 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -54,10 +55,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { - } + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { } } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/PigMissileBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/PigMissileBedDestroy.java index f115962a..92687e0b 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/PigMissileBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/PigMissileBedDestroy.java @@ -1,15 +1,15 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; import com.hakan.core.HCore; import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Location; @@ -64,7 +64,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { final Pig pig = (Pig)player.getWorld().spawnEntity(bedLocation, EntityType.PIG); final ArmorStand stand = (ArmorStand)player.getWorld().spawnEntity(bedLocation, EntityType.ARMOR_STAND); pig.setSaddle(true); @@ -98,38 +98,4 @@ public void run() { }.runTaskTimer(Cosmetics.getInstance(), 4L, 1L); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - final Pig pig = (Pig)player.getWorld().spawnEntity(bedLocation, EntityType.PIG); - final ArmorStand stand = (ArmorStand)player.getWorld().spawnEntity(bedLocation, EntityType.ARMOR_STAND); - pig.setSaddle(true); - stand.setGravity(false); - stand.setPassenger(pig); - stand.setVisible(false); - new BukkitRunnable() { - int i1 = 0; - - public void run() { - ++this.i1; - stand.eject(); - stand.teleport(stand.getLocation().add(0.0, 0.5, 0.0)); - stand.setPassenger(pig); - Particle flame = new Particle(ParticleType.FLAME, 1, 0.0f, new Vector(0.0f, 0.0f, 0.0f)); - HCore.playParticle(player, stand.getLocation(), flame); - XSound.ENTITY_CHICKEN_EGG.play(stand.getLocation(), 1.0f, 1.0f); - if (this.i1 == 13) { - final Firework fw = stand.getWorld().spawn(stand.getLocation(), Firework.class); - final FireworkMeta fm = fw.getFireworkMeta(); - fm.addEffect(FireworkEffect.builder().flicker(true).trail(false).with(FireworkEffect.Type.BALL).withColor(Color.BLACK).withFade(Color.BLACK).build()); - fw.setFireworkMeta(fm); - } - if (this.i1 == 25) { - stand.remove(); - pig.remove(); - this.i1 = 0; - this.cancel(); - } - } - }.runTaskTimer(Cosmetics.getInstance(), 4L, 1L); - } } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/RandomBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/RandomBedDestroy.java index beaa2032..c1af4215 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/RandomBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/RandomBedDestroy.java @@ -1,10 +1,11 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -51,24 +52,14 @@ public RarityType getRarity() { } @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { List bedDestroys = new ArrayList<>(); for (BedDestroy bedDestroy : StartupUtils.bedDestroyList) { if(player.hasPermission(CosmeticsType.BedBreakEffects.getPermissionFormat() + "." + bedDestroy.getIdentifier())){ bedDestroys.add(bedDestroy); } } - bedDestroys.get(new Random().nextInt(bedDestroys.size())).execute1058(player, bedLocation, victimTeam); + bedDestroys.get(new Random().nextInt(bedDestroys.size())).execute(player, bedLocation, victimTeam); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - List bedDestroys = new ArrayList<>(); - for (BedDestroy bedDestroy : StartupUtils.bedDestroyList) { - if(player.hasPermission(CosmeticsType.BedBreakEffects.getPermissionFormat() + "." + bedDestroy.getIdentifier())){ - bedDestroys.add(bedDestroy); - } - } - bedDestroys.get(new Random().nextInt(bedDestroys.size())).execute2023(player, bedLocation, victimTeam); - } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/SquidMissileBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/SquidMissileBedDestroy.java index aaa1f840..6f43214a 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/SquidMissileBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/SquidMissileBedDestroy.java @@ -1,15 +1,15 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; import com.hakan.core.HCore; import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Location; @@ -64,7 +64,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { Squid squid = (Squid) player.getWorld().spawnEntity(bedLocation, EntityType.SQUID); ArmorStand stand = (ArmorStand) player.getWorld().spawnEntity(bedLocation, EntityType.ARMOR_STAND); stand.setGravity(false); @@ -97,37 +97,5 @@ public void run() { }.runTaskTimer(Cosmetics.getInstance(), 4L, 1L); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - Squid squid = (Squid) player.getWorld().spawnEntity(bedLocation, EntityType.SQUID); - ArmorStand stand = (ArmorStand) player.getWorld().spawnEntity(bedLocation, EntityType.ARMOR_STAND); - stand.setGravity(false); - stand.setPassenger(squid); - stand.setVisible(false); - new BukkitRunnable() { - int i1 = 0; - public void run() { - ++this.i1; - squid.getLocation().setYaw(180.0f); - stand.eject(); - stand.teleport(stand.getLocation().add(0.0, 0.5, 0.0)); - stand.setPassenger(squid); - Particle flame = new Particle(ParticleType.FLAME, 1, 0.0f, new Vector(0.0f, 0.0f, 0.0f)); - HCore.playParticle(player, stand.getLocation(), flame); - player.playSound(player.getLocation(), XSound.ENTITY_CHICKEN_EGG.parseSound(), 1.0f, 1.0f); - if (this.i1 == 13) { - final Firework fw = stand.getWorld().spawn(stand.getLocation(), Firework.class); - final FireworkMeta fm = fw.getFireworkMeta(); - fm.addEffect(FireworkEffect.builder().flicker(true).trail(false).with(FireworkEffect.Type.BALL).withColor(Color.BLACK).withFade(Color.BLACK).build()); - fw.setFireworkMeta(fm); - } - if (this.i1 == 25) { - stand.remove(); - squid.remove(); - this.i1 = 0; - this.cancel(); - } - } - }.runTaskTimer(Cosmetics.getInstance(), 4L, 1L); - } + } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TheifBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TheifBedDestroy.java index 486dafa1..a7a19797 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TheifBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TheifBedDestroy.java @@ -1,10 +1,11 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Location; import org.bukkit.entity.Enderman; import org.bukkit.entity.EntityType; @@ -56,18 +57,11 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { Enderman enderman = (Enderman) player.getWorld().spawnEntity(bedLocation, EntityType.ENDERMAN); assert XMaterial.RED_BED.parseMaterial() != null; enderman.setCarriedMaterial(new MaterialData(XMaterial.RED_BED.parseMaterial())); HCore.syncScheduler().after(70L).run(enderman::remove); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - Enderman enderman = (Enderman) player.getWorld().spawnEntity(bedLocation, EntityType.ENDERMAN); - assert XMaterial.RED_BED.parseMaterial() != null; - enderman.setCarriedMaterial(new MaterialData(XMaterial.RED_BED.parseMaterial())); - HCore.syncScheduler().after(70L).run(enderman::remove); - } } diff --git a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TornadoBedDestroy.java b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TornadoBedDestroy.java index 980c9735..e5e81171 100644 --- a/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TornadoBedDestroy.java +++ b/src/main/java/me/defender/cosmetics/category/bedbreakeffects/items/TornadoBedDestroy.java @@ -1,13 +1,13 @@ package me.defender.cosmetics.category.bedbreakeffects.items; -import com.andrei1058.bedwars.api.arena.team.ITeam; + import com.cryptomorin.xseries.XSound; import com.hakan.core.HCore; import com.hakan.core.particle.Particle; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.BedDestroy; +import me.defender.cosmetics.api.handler.ITeamHandler; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -60,7 +60,7 @@ public RarityType getRarity() { } /** {@inheritDoc} */ @Override - public void execute1058(Player player, Location bedLocation, ITeam victimTeam) { + public void execute(Player player, Location bedLocation, ITeamHandler victimTeam) { player.playSound(bedLocation, XSound.ENTITY_GENERIC_EXPLODE.parseSound(), 1.0f, 1.0f); new BukkitRunnable() { int angle = 0; @@ -87,31 +87,4 @@ public void run() { }.runTaskTimer(Cosmetics.getInstance(), 2L, 0L); } - @Override - public void execute2023(Player player, Location bedLocation, com.tomkeuper.bedwars.api.arena.team.ITeam victimTeam) { - player.playSound(bedLocation, XSound.ENTITY_GENERIC_EXPLODE.parseSound(), 1.0f, 1.0f); - new BukkitRunnable() { - int angle = 0; - - public void run() { - final int max_height = 7; - final double max_radius = 3.0; - final int lines = 4; - final double height_increasement = 0.25; - final double radius_increasement = max_radius / max_height; - for (int l = 0; l < lines; ++l) { - for (double y = 0.0; y < max_height; y += height_increasement) { - double radius = y * radius_increasement; - double x = Math.cos(Math.toRadians(360 / lines * l + y * 30.0 - this.angle)) * radius; - double z = Math.sin(Math.toRadians(360 / lines * l + y * 30.0 - this.angle)) * radius; - HCore.playParticle(bedLocation.clone().add(x,y,z), new Particle(com.hakan.core.particle.type.ParticleType.CLOUD, 1, 0.01, new Vector(0.0f, 0.0f, 0.0f))); - } - } - ++this.angle; - if (this.angle == 70) { - this.cancel(); - } - } - }.runTaskTimer(Cosmetics.getInstance(), 2L, 0L); - } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler1058.java b/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler1058.java index 1da46193..cac15da8 100644 --- a/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler1058.java @@ -5,13 +5,12 @@ import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; import com.cryptomorin.xseries.XSound; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.StartupUtils; +import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.util.DebugUtil; +import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -19,14 +18,12 @@ import java.util.NoSuchElementException; -import static me.defender.cosmetics.util.Utility.plugin; - public class DeathCryHandler1058 implements Listener { @EventHandler public void onPlayerDeath1058(PlayerKillEvent e) { Player killed = e.getVictim(); - String selected = new BwcAPI().getSelectedCosmetic(killed, CosmeticsType.DeathCries); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(killed, CosmeticsType.DeathCries); boolean isDeathCriesEnabled = Cosmetics.getInstance().getConfig().getBoolean("death-cries.enabled"); if (!isDeathCriesEnabled) return; diff --git a/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler2023.java b/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler2023.java index 7101cfd5..4c055d1a 100644 --- a/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/deathcries/DeathCryHandler2023.java @@ -2,11 +2,10 @@ import com.cryptomorin.xseries.XSound; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.util.DebugUtil; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; @@ -16,14 +15,12 @@ import java.util.NoSuchElementException; -import static me.defender.cosmetics.util.Utility.plugin; - public class DeathCryHandler2023 implements Listener { @EventHandler public void onPlayerDeath2023(com.tomkeuper.bedwars.api.events.player.PlayerKillEvent e) { Player killed = e.getVictim(); - String selected = new BwcAPI().getSelectedCosmetic(killed, CosmeticsType.DeathCries); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(killed, CosmeticsType.DeathCries); boolean isDeathCriesEnabled = Cosmetics.getInstance().getConfig().getBoolean("death-cries.enabled"); if (!isDeathCriesEnabled) return; diff --git a/src/main/java/me/defender/cosmetics/category/deathcries/items/DeathCryItems.java b/src/main/java/me/defender/cosmetics/category/deathcries/items/DeathCryItems.java index bac00a57..6a09c641 100644 --- a/src/main/java/me/defender/cosmetics/category/deathcries/items/DeathCryItems.java +++ b/src/main/java/me/defender/cosmetics/category/deathcries/items/DeathCryItems.java @@ -1,16 +1,15 @@ package me.defender.cosmetics.category.deathcries.items; import com.cryptomorin.xseries.XSound; -import me.defender.cosmetics.api.cosmetics.category.DeathCry; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.util.StringUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; import java.util.List; public class DeathCryItems { @@ -49,7 +48,7 @@ public List getLore() { if(getRarity() == RarityType.NONE){ return List.of("&7Selecting this option disables your", "&7Death Cry."); } - return Arrays.asList("&7Select " + getDisplayName() + " as your Death cry"); + return List.of("&7Select " + getDisplayName() + " as your Death cry"); } @Override diff --git a/src/main/java/me/defender/cosmetics/category/deathcries/preview/DeathCryPreview.java b/src/main/java/me/defender/cosmetics/category/deathcries/preview/DeathCryPreview.java index 6823827c..ed4de0a8 100644 --- a/src/main/java/me/defender/cosmetics/category/deathcries/preview/DeathCryPreview.java +++ b/src/main/java/me/defender/cosmetics/category/deathcries/preview/DeathCryPreview.java @@ -1,9 +1,9 @@ package me.defender.cosmetics.category.deathcries.preview; import com.cryptomorin.xseries.XSound; -import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler1058.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler1058.java index 9891a849..cfc7f455 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler1058.java @@ -2,7 +2,7 @@ import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; @@ -15,13 +15,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class FinalKillEffectHandler1058 implements Listener { @EventHandler public void onFinalKill1058(PlayerKillEvent e){ - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); if(e.getKiller() == null) return; boolean isFinalKillEffectsEnabled = Cosmetics.getInstance().getConfig().getBoolean("final-kill-effects.enabled"); diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler2023.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler2023.java index 096acf5f..0c91b69b 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/FinalKillEffectHandler2023.java @@ -1,7 +1,7 @@ package me.defender.cosmetics.category.finalkilleffects; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; @@ -14,13 +14,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class FinalKillEffectHandler2023 implements Listener { @EventHandler public void onFinalKill2023(com.tomkeuper.bedwars.api.events.player.PlayerKillEvent e){ - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); if(e.getKiller() == null) return; boolean isFinalKillEffectsEnabled = Cosmetics.getInstance().getConfig().getBoolean("final-kill-effects.enabled"); diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BatCruxEffect.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BatCruxEffect.java index 8fc0d192..fa11f4f4 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BatCruxEffect.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BatCruxEffect.java @@ -5,24 +5,20 @@ import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; import com.hakan.core.utils.ColorUtil; -import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.util.Utility; import org.bukkit.Location; import org.bukkit.entity.Bat; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static me.defender.cosmetics.util.Utility.plugin; - public class BatCruxEffect extends FinalKillEffect { @Override public ItemStack getItem() { diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BurningShoesEffect.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BurningShoesEffect.java index 45c4d5d6..c17032cf 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BurningShoesEffect.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/BurningShoesEffect.java @@ -40,7 +40,7 @@ public String getDisplayName() { @Override public List getLore() { - return Arrays.asList("&7Makes your shoes burn!"); + return List.of("&7Makes your shoes burn!"); } @Override diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/NoneEffect.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/NoneEffect.java index 481e9da7..ef1e0f24 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/NoneEffect.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/NoneEffect.java @@ -1,7 +1,7 @@ package me.defender.cosmetics.category.finalkilleffects.items; -import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/RektEffect.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/RektEffect.java index 5a18d3e4..6ecdca8a 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/RektEffect.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/RektEffect.java @@ -6,8 +6,8 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.util.Utility; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; @@ -19,8 +19,6 @@ import java.util.Arrays; import java.util.List; -import static me.defender.cosmetics.util.Utility.plugin; - public class RektEffect extends FinalKillEffect { @Override public ItemStack getItem() { diff --git a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/TornadoEffect.java b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/TornadoEffect.java index fad26b8f..8cbd71ad 100644 --- a/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/TornadoEffect.java +++ b/src/main/java/me/defender/cosmetics/category/finalkilleffects/items/TornadoEffect.java @@ -6,9 +6,8 @@ import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler1058.java b/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler1058.java index b7b6728f..bd928615 100644 --- a/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler1058.java @@ -4,14 +4,13 @@ import com.andrei1058.bedwars.api.events.player.PlayerGeneratorCollectEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.Glyph; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.util.DebugUtil; +import me.defender.cosmetics.api.cosmetics.category.Glyph; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; +import me.defender.cosmetics.util.DebugUtil; +import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -20,8 +19,6 @@ import java.util.HashMap; -import static me.defender.cosmetics.util.Utility.plugin; - public class GlyphHandler1058 implements Listener { public static HashMap glyphs = new HashMap<>(); @@ -33,7 +30,7 @@ public void onGenCollect1058(PlayerGeneratorCollectEvent e) { if (!isGlyphsEnabled) return; if (e.getItemStack().getType() == Material.DIAMOND || e.getItemStack().getType() == Material.EMERALD) { - String selected = new BwcAPI().getSelectedCosmetic(e.getPlayer(), CosmeticsType.Glyphs); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getPlayer(), CosmeticsType.Glyphs); for (Block loc : UsefulUtilsVD.getBlocksInRadius(e.getPlayer().getLocation(), 2, false)) { if (loc.getType() == Material.DIAMOND_BLOCK || loc.getType() == Material.EMERALD_BLOCK) { diff --git a/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler2023.java b/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler2023.java index 09a864aa..c183e301 100644 --- a/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/glyphs/GlyphHandler2023.java @@ -1,12 +1,11 @@ package me.defender.cosmetics.category.glyphs; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.Glyph; -import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.Glyph; +import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import me.defender.cosmetics.util.DebugUtil; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Material; @@ -14,8 +13,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class GlyphHandler2023 implements Listener { @EventHandler @@ -25,7 +22,7 @@ public void onGenCollect2023(com.tomkeuper.bedwars.api.events.player.PlayerGener if (!isGlyphsEnabled) return; if (e.getItemStack().getType() == Material.DIAMOND || e.getItemStack().getType() == Material.EMERALD) { - String selected = new BwcAPI().getSelectedCosmetic(e.getPlayer(), CosmeticsType.Glyphs); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getPlayer(), CosmeticsType.Glyphs); for (Block loc : UsefulUtilsVD.getBlocksInRadius(e.getPlayer().getLocation(), 2, false)) { if (loc.getType() == Material.DIAMOND_BLOCK || loc.getType() == Material.EMERALD_BLOCK) { diff --git a/src/main/java/me/defender/cosmetics/category/glyphs/items/GlyphItems.java b/src/main/java/me/defender/cosmetics/category/glyphs/items/GlyphItems.java index f18ec540..3ea3be13 100644 --- a/src/main/java/me/defender/cosmetics/category/glyphs/items/GlyphItems.java +++ b/src/main/java/me/defender/cosmetics/category/glyphs/items/GlyphItems.java @@ -2,10 +2,10 @@ import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.configuration.ConfigManager; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.Glyph; import me.defender.cosmetics.category.glyphs.util.glyphUtil; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; @@ -68,8 +68,8 @@ public RarityType getRarity() { @Override public void execute(Player player, Location location) { String fileLocation = config.getString(path + "file"); - File file = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/Glyphs/" + fileLocation); - HCore.asyncScheduler().every(500, TimeUnit.MILLISECONDS).limit(10).run(()-> { + File file = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/Glyphs/" + fileLocation); + HCore.asyncScheduler().every(100, TimeUnit.MILLISECONDS).limit(10).run(()-> { glyphUtil.sendGlyphs(file, location); }); } diff --git a/src/main/java/me/defender/cosmetics/category/glyphs/preview/GlyphPreview.java b/src/main/java/me/defender/cosmetics/category/glyphs/preview/GlyphPreview.java index 081ffe7a..33c3c84a 100644 --- a/src/main/java/me/defender/cosmetics/category/glyphs/preview/GlyphPreview.java +++ b/src/main/java/me/defender/cosmetics/category/glyphs/preview/GlyphPreview.java @@ -8,14 +8,14 @@ import com.hakan.core.ui.inventory.InventoryGui; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.Glyph; -import me.defender.cosmetics.category.glyphs.util.ImageParticles; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.Glyph; +import me.defender.cosmetics.category.glyphs.util.ImageParticles; import me.defender.cosmetics.util.StartupUtils; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Location; @@ -147,7 +147,7 @@ private void sendGlyphParticles(Player player, Location location, String selecte } File file = new File( - Cosmetics.getInstance().getDataFolder().getPath() + + Cosmetics.getInstance().getHandler().getAddonPath() + "/Glyphs/" + glyphFile); diff --git a/src/main/java/me/defender/cosmetics/category/glyphs/util/glyphUtil.java b/src/main/java/me/defender/cosmetics/category/glyphs/util/glyphUtil.java index a288503c..5b10d1a8 100644 --- a/src/main/java/me/defender/cosmetics/category/glyphs/util/glyphUtil.java +++ b/src/main/java/me/defender/cosmetics/category/glyphs/util/glyphUtil.java @@ -3,6 +3,7 @@ package me.defender.cosmetics.category.glyphs.util; import com.hakan.core.HCore; +import me.defender.cosmetics.Cosmetics; import org.bukkit.Color; import org.bukkit.Location; import xyz.xenondevs.particle.ParticleBuilder; @@ -25,7 +26,7 @@ public static void sendGlyphs(File file, Location loc) { try { image = ImageIO.read(file); } catch (final IOException e) { - Logger.getLogger("Minecraft").log(Level.SEVERE, "UNABLE TO READ FILE! GLYPHUTIL()"); + Cosmetics.getInstance().getLogger().log(Level.SEVERE, "UNABLE TO READ FILE! GLYPHUTIL()"); } ImageParticles particles = new ImageParticles(image, 1); particles.setAnchor(50, 10); diff --git a/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler1058.java b/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler1058.java index 5dcf4572..1982a701 100644 --- a/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler1058.java @@ -7,19 +7,16 @@ import com.andrei1058.bedwars.api.events.gameplay.GameStateChangeEvent; import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class IslandTopperHandler1058 implements Listener { @EventHandler public void onSpawn1058(GameStateChangeEvent e) { @@ -31,7 +28,7 @@ public void onSpawn1058(GameStateChangeEvent e) { for (ITeam teams : e.getArena().getTeams()) { Player player = null; for (Player p : teams.getMembers()) { - if (!new BwcAPI().getSelectedCosmetic(p, CosmeticsType.IslandTopper).equals("none")) { + if (!Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.IslandTopper).equals("none")) { player = p; } } @@ -43,7 +40,7 @@ public void onSpawn1058(GameStateChangeEvent e) { if (location == null) { return; } - String selected = new BwcAPI().getSelectedCosmetic(player, CosmeticsType.IslandTopper); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(player, CosmeticsType.IslandTopper); for(IslandTopper islandTopper : StartupUtils.islandTopperList){ if(islandTopper.getIdentifier().equals(selected)){ if(islandTopper.getField(FieldsType.RARITY, player) != RarityType.NONE) { diff --git a/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler2023.java b/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler2023.java index c735d1a5..c30c9a70 100644 --- a/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/islandtoppers/IslandTopperHandler2023.java @@ -3,11 +3,10 @@ import com.tomkeuper.bedwars.api.arena.GameState; import com.tomkeuper.bedwars.api.events.gameplay.GameStateChangeEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -15,8 +14,6 @@ import org.bukkit.event.Listener; import org.bukkit.scheduler.BukkitRunnable; -import static me.defender.cosmetics.util.Utility.plugin; - public class IslandTopperHandler2023 implements Listener { @EventHandler public void onSpawn2023(GameStateChangeEvent e) { @@ -37,7 +34,7 @@ public void run() { for (com.tomkeuper.bedwars.api.arena.team.ITeam teams : e.getArena().getTeams()) { Player player = null; for (Player p : teams.getMembers()) { - if (!new BwcAPI().getSelectedCosmetic(p, CosmeticsType.IslandTopper).equals("none")) { + if (!Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.IslandTopper).equals("none")) { player = p; } } @@ -49,7 +46,7 @@ public void run() { if (location == null) { return; } - String selected = new BwcAPI().getSelectedCosmetic(player, CosmeticsType.IslandTopper); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(player, CosmeticsType.IslandTopper); for(IslandTopper islandTopper : StartupUtils.islandTopperList){ if(islandTopper.getIdentifier().equals(selected)){ if(islandTopper.getField(FieldsType.RARITY, player) != RarityType.NONE) { diff --git a/src/main/java/me/defender/cosmetics/category/islandtoppers/items/DummyTopper.java b/src/main/java/me/defender/cosmetics/category/islandtoppers/items/DummyTopper.java index 4b918d63..a198f3d2 100644 --- a/src/main/java/me/defender/cosmetics/category/islandtoppers/items/DummyTopper.java +++ b/src/main/java/me/defender/cosmetics/category/islandtoppers/items/DummyTopper.java @@ -1,13 +1,12 @@ package me.defender.cosmetics.category.islandtoppers.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; import java.util.List; public class DummyTopper extends IslandTopper { @@ -33,7 +32,7 @@ public String getDisplayName() { @Override public List getLore() { - return Arrays.asList("Island Toppers are DISABLED for some reason!"); + return List.of("Island Toppers are DISABLED for some reason!"); } @Override diff --git a/src/main/java/me/defender/cosmetics/category/islandtoppers/items/IslandTopperItems.java b/src/main/java/me/defender/cosmetics/category/islandtoppers/items/IslandTopperItems.java index 360320ea..1c8ff845 100644 --- a/src/main/java/me/defender/cosmetics/category/islandtoppers/items/IslandTopperItems.java +++ b/src/main/java/me/defender/cosmetics/category/islandtoppers/items/IslandTopperItems.java @@ -2,10 +2,10 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.configuration.ConfigManager; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.IslandTopper; import me.defender.cosmetics.category.islandtoppers.util.IslandToppersUtil; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -73,7 +73,7 @@ public void execute(Player player, Location topperLocation, String selected) { Bukkit.getLogger().severe("Can't find file for " + selected + " island topper!"); return; } - File file = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/IslandToppers/" + fileName); + File file = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/IslandToppers/" + fileName); if(!file.exists()){ Bukkit.getLogger().severe("The file " + file.getName() + " does not exists!"); return; diff --git a/src/main/java/me/defender/cosmetics/category/islandtoppers/preview/IslandTopperPreview.java b/src/main/java/me/defender/cosmetics/category/islandtoppers/preview/IslandTopperPreview.java index 7b4fce05..0a68ad56 100644 --- a/src/main/java/me/defender/cosmetics/category/islandtoppers/preview/IslandTopperPreview.java +++ b/src/main/java/me/defender/cosmetics/category/islandtoppers/preview/IslandTopperPreview.java @@ -8,20 +8,20 @@ import com.hakan.core.HCore; import com.hakan.core.ui.inventory.InventoryGui; import com.hakan.core.utils.ColorUtil; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.data.DataException; import com.sk89q.worldedit.schematic.SchematicFormat; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.IslandTopper; -import me.defender.cosmetics.category.islandtoppers.util.BlockData; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.IslandTopper; +import me.defender.cosmetics.category.islandtoppers.util.BlockData; import me.defender.cosmetics.util.StartupUtils; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -38,7 +38,9 @@ import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; -import static me.defender.cosmetics.util.StartupUtils.*; + +import static me.defender.cosmetics.util.StartupUtils.getCosmeticLocation; +import static me.defender.cosmetics.util.StartupUtils.getPlayerLocation; public class IslandTopperPreview { @@ -141,7 +143,7 @@ private void sendIslandTopper(Player player, Location location, String selected) return; } - File file = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/IslandToppers/" + topperFileName); + File file = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/IslandToppers/" + topperFileName); if(!file.exists()){ Bukkit.getLogger().severe("The file " + file.getName() + " does not exists!"); return; diff --git a/src/main/java/me/defender/cosmetics/category/islandtoppers/util/IslandToppersUtil.java b/src/main/java/me/defender/cosmetics/category/islandtoppers/util/IslandToppersUtil.java index 60dfc9b4..be3655c0 100644 --- a/src/main/java/me/defender/cosmetics/category/islandtoppers/util/IslandToppersUtil.java +++ b/src/main/java/me/defender/cosmetics/category/islandtoppers/util/IslandToppersUtil.java @@ -2,13 +2,11 @@ package me.defender.cosmetics.category.islandtoppers.util; -import com.andrei1058.bedwars.api.arena.IArena; import com.sk89q.worldedit.*; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.schematic.SchematicFormat; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.handler.IArenaHandler; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -33,36 +31,18 @@ public static void sendIslandTopper(World world, Location loc, Player p, File fi Bukkit.getLogger().severe("Schematic format is null! most probably file is invalid! (" + file.getName() + ")"); return; } - if (!Cosmetics.getInstance().isBw2023()){ - IArena arena = Cosmetics.getInstance().getBedWars1058API().getArenaUtil().getArenaByPlayer(p); - if(arena != null) { - Block block = arena.getTeam(p).getBed().getBlock(); - if (block.getType() == Material.BED_BLOCK){ - if (block.getState().getData() instanceof Directional){ - Directional directional = (Directional) block.getState().getData(); - CuboidClipboard clipboard = schematicFormat.load(file); - clipboard = flipDirection(clipboard, directional.getFacing()); - // Move the schematic to the target location - clipboard.setOrigin(new Vector(loc.getX(), loc.getY(), loc.getZ())); - // Paste the schematic - clipboard.paste(editSession, new Vector(loc.getX(), loc.getY(), loc.getZ()), true); - } - } - } - } else { - com.tomkeuper.bedwars.api.arena.IArena arena = Cosmetics.getInstance().getBedWars2023API().getArenaUtil().getArenaByPlayer(p); - if(arena != null) { - Block block = arena.getTeam(p).getBed().getBlock(); - if (block.getType() == Material.BED_BLOCK){ - if (block.getState().getData() instanceof Directional){ - Directional directional = (Directional) block.getState().getData(); - CuboidClipboard clipboard = schematicFormat.load(file); - clipboard = flipDirection(clipboard, directional.getFacing()); - // Move the schematic to the target location - clipboard.setOrigin(new Vector(loc.getX(), loc.getY(), loc.getZ())); - // Paste the schematic - clipboard.paste(editSession, new Vector(loc.getX(), loc.getY(), loc.getZ()), true); - } + IArenaHandler arena = Cosmetics.getInstance().getHandler().getArenaUtil().getArenaByPlayer(p); + if(arena != null) { + Block block = arena.getTeam(p).getBed().getBlock(); + if (block.getType() == Material.BED_BLOCK){ + if (block.getState().getData() instanceof Directional){ + Directional directional = (Directional) block.getState().getData(); + CuboidClipboard clipboard = schematicFormat.load(file); + clipboard = flipDirection(clipboard, directional.getFacing()); + // Move the schematic to the target location + clipboard.setOrigin(new Vector(loc.getX(), loc.getY(), loc.getZ())); + // Paste the schematic + clipboard.paste(editSession, new Vector(loc.getX(), loc.getY(), loc.getZ()), true); } } } diff --git a/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler1058.java b/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler1058.java index 71f51852..3c8a457f 100644 --- a/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler1058.java @@ -4,16 +4,14 @@ import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.category.killmessage.util.KillMessageUtils; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.category.killmessage.util.KillMessageUtils; import me.defender.cosmetics.util.DebugUtil; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class KillMessageHandler1058 implements Listener { @EventHandler @@ -24,7 +22,7 @@ public void onPlayerKillByOtherPlayer1058(PlayerKillEvent e) { boolean isKillMessagesEnabled = Cosmetics.getInstance().getConfig().getBoolean("kill-messages.enabled"); if (!isKillMessagesEnabled) return; - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); // Death Cries disabling sound stuff if (!api.getSelectedCosmetic(e.getVictim(), CosmeticsType.DeathCries).equals("NONE")) { @@ -35,7 +33,7 @@ public void onPlayerKillByOtherPlayer1058(PlayerKillEvent e) { ChatColor color3 = e.getArena().getTeam(e.getVictim()).getColor().chat(); // KILL MESSAGES! - if(new BwcAPI().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage).equals("Default")){ + if(Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage).equals("Default")){ return; } @@ -44,7 +42,7 @@ public void onPlayerKillByOtherPlayer1058(PlayerKillEvent e) { // Get the final kill flag based on the kill cause boolean isFinalKill = e.getCause().isFinalKill(); - String selected = new BwcAPI().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage); // Send the appropriate kill message to all players in the arena switch (e.getCause()) { diff --git a/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler2023.java b/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler2023.java index 57db0674..6db7e517 100644 --- a/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/killmessage/KillMessageHandler2023.java @@ -1,16 +1,14 @@ package me.defender.cosmetics.category.killmessage; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.category.killmessage.util.KillMessageUtils; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.category.killmessage.util.KillMessageUtils; import me.defender.cosmetics.util.DebugUtil; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import static me.defender.cosmetics.util.Utility.plugin; - public class KillMessageHandler2023 implements Listener { @EventHandler public void onPlayerKillByOtherPlayer2023(com.tomkeuper.bedwars.api.events.player.PlayerKillEvent e) { @@ -20,7 +18,7 @@ public void onPlayerKillByOtherPlayer2023(com.tomkeuper.bedwars.api.events.playe boolean isKillMessagesEnabled = Cosmetics.getInstance().getConfig().getBoolean("kill-messages.enabled"); if (!isKillMessagesEnabled) return; - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); // Death Cries disabling sound stuff if (!api.getSelectedCosmetic(e.getVictim(), CosmeticsType.DeathCries).equals("NONE")) { @@ -31,7 +29,7 @@ public void onPlayerKillByOtherPlayer2023(com.tomkeuper.bedwars.api.events.playe ChatColor color3 = e.getArena().getTeam(e.getVictim()).getColor().chat(); // KILL MESSAGES! - if(new BwcAPI().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage).equals("Default")){ + if(Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage).equals("Default")){ return; } @@ -40,7 +38,7 @@ public void onPlayerKillByOtherPlayer2023(com.tomkeuper.bedwars.api.events.playe // Get the final kill flag based on the kill cause boolean isFinalKill = e.getCause().isFinalKill(); - String selected = new BwcAPI().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(e.getKiller(), CosmeticsType.KillMessage); // Send the appropriate kill message to all players in the arena switch (e.getCause()) { diff --git a/src/main/java/me/defender/cosmetics/category/killmessage/items/KillMessageItems.java b/src/main/java/me/defender/cosmetics/category/killmessage/items/KillMessageItems.java index 16b05980..709bd846 100644 --- a/src/main/java/me/defender/cosmetics/category/killmessage/items/KillMessageItems.java +++ b/src/main/java/me/defender/cosmetics/category/killmessage/items/KillMessageItems.java @@ -1,10 +1,10 @@ package me.defender.cosmetics.category.killmessage.items; -import me.defender.cosmetics.api.cosmetics.category.KillMessage; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.KillMessage; import me.defender.cosmetics.util.StringUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/defender/cosmetics/category/killmessage/preview/KillMessagePreview.java b/src/main/java/me/defender/cosmetics/category/killmessage/preview/KillMessagePreview.java index 26bbfe61..cfcdd648 100644 --- a/src/main/java/me/defender/cosmetics/category/killmessage/preview/KillMessagePreview.java +++ b/src/main/java/me/defender/cosmetics/category/killmessage/preview/KillMessagePreview.java @@ -4,10 +4,10 @@ import com.hakan.core.HCore; import com.hakan.core.ui.inventory.InventoryGui; import com.hakan.core.utils.ColorUtil; -import me.defender.cosmetics.api.cosmetics.category.KillMessage; -import me.defender.cosmetics.category.killmessage.util.KillMessageUtils; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.KillMessage; +import me.defender.cosmetics.category.killmessage.util.KillMessageUtils; import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.Utility; import org.bukkit.ChatColor; diff --git a/src/main/java/me/defender/cosmetics/category/killmessage/util/KillMessageUtils.java b/src/main/java/me/defender/cosmetics/category/killmessage/util/KillMessageUtils.java index c346f457..638a2b4f 100644 --- a/src/main/java/me/defender/cosmetics/category/killmessage/util/KillMessageUtils.java +++ b/src/main/java/me/defender/cosmetics/category/killmessage/util/KillMessageUtils.java @@ -2,11 +2,11 @@ import com.hakan.core.utils.ColorUtil; import me.clip.placeholderapi.PlaceholderAPI; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.KillMessage; +import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.KillMessage; import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.ChatColor; @@ -59,7 +59,7 @@ public static boolean isNone(String id){ * @param oldMessage never used, leave as null. */ public static void sendKillMessage(Player player, String victim, Player killer, boolean finalKill, ChatColor victimColor, ChatColor killerColor, String type, String oldMessage, boolean preview, String previewID, String previewKillerName) { - String selectedMessage = new BwcAPI().getSelectedCosmetic(killer, CosmeticsType.KillMessage); + String selectedMessage = Cosmetics.getInstance().getApi().getSelectedCosmetic(killer, CosmeticsType.KillMessage); List messages; if (preview) { messages = ConfigUtils.getKillMessages().getYml().getStringList(CosmeticsType.KillMessage.getSectionKey() + "." + previewID + "." + type + "-Kill"); @@ -107,9 +107,9 @@ public static void sendKillMessage(Player player, String victim, Player killer, * @param type The type of death. Accepted values: "PvP", "Void", "Shoot", "Explosion" */ public static String sendKillMessage(Player player, String victim, Player killer, boolean finalKill, ChatColor victimColor, ChatColor killerColor, String type) { - String selectedMessage = new BwcAPI().getSelectedCosmetic(killer, CosmeticsType.KillMessage); + String selectedMessage = Cosmetics.getInstance().getApi().getSelectedCosmetic(killer, CosmeticsType.KillMessage); if(victim.equalsIgnoreCase(killer.getName())) type = "Void"; - List messages = ConfigUtils.getKillMessages().getYml().getStringList(CosmeticsType.KillMessage.getSectionKey() + "." + selectedMessage + "." + type + "-Kill");; + List messages = ConfigUtils.getKillMessages().getYml().getStringList(CosmeticsType.KillMessage.getSectionKey() + "." + selectedMessage + "." + type + "-Kill"); for (KillMessage killMessage : StartupUtils.killMessageList) { if (killMessage.getIdentifier().equals(selectedMessage)) { if (killMessage.getField(FieldsType.RARITY, player) == RarityType.NONE) return null; diff --git a/src/main/java/me/defender/cosmetics/category/projectiletrails/util/ProjectileEffectsUtil.java b/src/main/java/me/defender/cosmetics/category/projectiletrails/util/ProjectileEffectsUtil.java index d75b20a8..7ff82147 100644 --- a/src/main/java/me/defender/cosmetics/category/projectiletrails/util/ProjectileEffectsUtil.java +++ b/src/main/java/me/defender/cosmetics/category/projectiletrails/util/ProjectileEffectsUtil.java @@ -3,7 +3,7 @@ import com.hakan.core.HCore; import com.hakan.core.particle.Particle; import com.hakan.core.particle.type.ParticleType; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.cosmetics.category.ProjectileTrail; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; @@ -26,7 +26,7 @@ public class ProjectileEffectsUtil { */ public static void sendEffect(Entity e, Player p) { CosmeticsType type = CosmeticsType.ProjectileTrails; - String selected = new BwcAPI().getSelectedCosmetic(p, type); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, type); String effect = ConfigUtils.getProjectileTrails().getString(type.getSectionKey() + "." + selected + ".particle"); Color color = ConfigUtils.getProjectileTrails().getYml().getColor(type.getSectionKey() + "." + selected + ".color"); ProjectileTrail projectileTrail = null; diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java index 818aefb8..b8c65fd3 100644 --- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler1058.java @@ -3,19 +3,20 @@ package me.defender.cosmetics.category.shopkeeperskins; import com.andrei1058.bedwars.api.BedWars; +import com.andrei1058.bedwars.api.arena.GameState; import com.andrei1058.bedwars.api.arena.team.ITeam; import com.andrei1058.bedwars.api.events.gameplay.GameEndEvent; import com.andrei1058.bedwars.api.events.gameplay.GameStateChangeEvent; import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; +import me.defender.cosmetics.api.handler.IHandler; +import me.defender.cosmetics.util.DebugUtil; import me.defender.cosmetics.util.MathUtil; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.util.DebugUtil; -import me.defender.cosmetics.util.Utility; import net.citizensnpcs.api.CitizensAPI; +import net.citizensnpcs.api.npc.NPC; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; @@ -29,7 +30,7 @@ import java.util.HashMap; import java.util.List; -import static me.defender.cosmetics.util.Utility.plugin; +import static org.bukkit.Bukkit.getServer; public class ShopKeeperHandler1058 implements Listener { @@ -66,7 +67,7 @@ public void run() { // Choose random player from the team Player player = team.getMembers().get(MathUtil.getRandom(0, team.getMembers().size() -1)); - String skin = new BwcAPI().getSelectedCosmetic(player, CosmeticsType.ShopKeeperSkin); + String skin = Cosmetics.getInstance().getApi().getSelectedCosmetic(player, CosmeticsType.ShopKeeperSkin); DebugUtil.addMessage("Selected skin: " + skin); // Spawn new NPCs for (ShopKeeperSkin skins : StartupUtils.shopKeeperSkinList) { @@ -79,9 +80,9 @@ public void run() { } for (Player p : team.getMembers()) { - BedWars api = plugin.getBedWars1058API(); - api.getScoreboardUtil().removePlayerScoreboard(p); - api.getScoreboardUtil().givePlayerScoreboard(p, true); + IHandler handler = plugin.getHandler(); + handler.getScoreboardUtil().removePlayerScoreboard(p); + handler.getScoreboardUtil().giveScoreboard(p, true); } } } @@ -121,4 +122,22 @@ public void run() { } }.runTaskLater(Cosmetics.getInstance(), 300L); } + + @EventHandler + public void onGameStartEvent(GameStateChangeEvent event){ + if(event.getNewState() != GameState.playing) return; + getServer().getScheduler().runTaskLater(Cosmetics.getInstance(), () -> { + World world = event.getArena().getWorld(); + for (Entity entity : world.getEntities()) { + boolean isCitizensNPC = entity.hasMetadata("NPC"); + if(!entity.isDead() && isCitizensNPC){ + NPC npc = CitizensAPI.getNPCRegistry().getNPC(entity); + npc.data().setPersistent(NPC.Metadata.DEATH_SOUND, ""); + npc.data().setPersistent(NPC.Metadata.AMBIENT_SOUND, ""); + npc.data().setPersistent(NPC.Metadata.HURT_SOUND, ""); + npc.data().setPersistent(NPC.Metadata.SILENT, true); + } + } + }, 40L); + } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java index dc49235a..c26a56f5 100644 --- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/ShopKeeperHandler2023.java @@ -2,16 +2,18 @@ import com.hakan.core.HCore; import com.tomkeuper.bedwars.api.BedWars; +import com.tomkeuper.bedwars.api.arena.GameState; import com.tomkeuper.bedwars.api.arena.team.ITeam; +import com.tomkeuper.bedwars.api.events.gameplay.GameStateChangeEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; +import me.defender.cosmetics.api.handler.IHandler; import me.defender.cosmetics.util.DebugUtil; import me.defender.cosmetics.util.MathUtil; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.util.Utility; import net.citizensnpcs.api.CitizensAPI; +import net.citizensnpcs.api.npc.NPC; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Entity; @@ -24,7 +26,7 @@ import java.util.List; -import static me.defender.cosmetics.util.Utility.plugin; +import static org.bukkit.Bukkit.getServer; public class ShopKeeperHandler2023 implements Listener { @@ -54,7 +56,7 @@ public void run() { // Choose random player from the team Player player = team.getMembers().get(MathUtil.getRandom(0, team.getMembers().size() -1)); - String skin = new BwcAPI().getSelectedCosmetic(player, CosmeticsType.ShopKeeperSkin); + String skin = Cosmetics.getInstance().getApi().getSelectedCosmetic(player, CosmeticsType.ShopKeeperSkin); DebugUtil.addMessage("Selected skin: " + skin); // Spawn new NPCs for (ShopKeeperSkin skins : StartupUtils.shopKeeperSkinList) { @@ -67,9 +69,9 @@ public void run() { } for (Player p : team.getMembers()) { - BedWars api = Cosmetics.getInstance().getBedWars2023API(); + IHandler api = Cosmetics.getInstance().getHandler(); api.getScoreboardUtil().removePlayerScoreboard(p); - api.getScoreboardUtil().givePlayerScoreboard(p, true); + api.getScoreboardUtil().giveScoreboard(p, true); } } } @@ -77,6 +79,24 @@ public void run() { } } + @EventHandler + public void onGameStartEvent(GameStateChangeEvent event){ + if(event.getNewState() != GameState.playing) return; + getServer().getScheduler().runTaskLater(Cosmetics.getInstance(), () -> { + World world = event.getArena().getWorld(); + for (Entity entity : world.getEntities()) { + boolean isCitizensNPC = entity.hasMetadata("NPC"); + if(!entity.isDead() && isCitizensNPC){ + NPC npc = CitizensAPI.getNPCRegistry().getNPC(entity); + npc.data().setPersistent(NPC.Metadata.DEATH_SOUND, ""); + npc.data().setPersistent(NPC.Metadata.AMBIENT_SOUND, ""); + npc.data().setPersistent(NPC.Metadata.HURT_SOUND, ""); + npc.data().setPersistent(NPC.Metadata.SILENT, true); + } + } + }, 40L); + } + @EventHandler public void onPlayerTeleportEvent(PlayerTeleportEvent e){ diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/items/ShopKeeperItems.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/items/ShopKeeperItems.java index 4b627b2e..e701f07b 100644 --- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/items/ShopKeeperItems.java +++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/items/ShopKeeperItems.java @@ -1,13 +1,13 @@ package me.defender.cosmetics.category.shopkeeperskins.items; -import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; +import me.defender.cosmetics.category.shopkeeperskins.utils.ShopKeeperSkinsUtils; import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.StringUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.category.shopkeeperskins.utils.ShopKeeperSkinsUtils; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/preview/ShopKeeperPreview.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/preview/ShopKeeperPreview.java index 5d32b3ed..6fb2767e 100644 --- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/preview/ShopKeeperPreview.java +++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/preview/ShopKeeperPreview.java @@ -8,10 +8,10 @@ import com.hakan.core.ui.inventory.InventoryGui; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; -import me.defender.cosmetics.category.shopkeeperskins.utils.ShopKeeperSkinsUtils; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; +import me.defender.cosmetics.category.shopkeeperskins.utils.ShopKeeperSkinsUtils; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/utils/ShopKeeperSkinsUtils.java b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/utils/ShopKeeperSkinsUtils.java index 731793dc..f5c52386 100644 --- a/src/main/java/me/defender/cosmetics/category/shopkeeperskins/utils/ShopKeeperSkinsUtils.java +++ b/src/main/java/me/defender/cosmetics/category/shopkeeperskins/utils/ShopKeeperSkinsUtils.java @@ -1,11 +1,10 @@ package me.defender.cosmetics.category.shopkeeperskins.utils; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; +import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.config.ConfigUtils; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.npc.MemoryNPCDataStore; import net.citizensnpcs.api.npc.NPC; @@ -20,7 +19,10 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.scheduler.BukkitRunnable; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.UUID; public class ShopKeeperSkinsUtils { @@ -158,7 +160,7 @@ public void run() { */ public static void spawnShopKeeperNPC(Player p, Location loc, Location loc1) { Cosmetics plugin = Cosmetics.getInstance(); - String skin = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.ShopKeeperSkin); + String skin = plugin.getApi().getSelectedCosmetic(p, CosmeticsType.ShopKeeperSkin); ConfigManager config = ConfigUtils.getShopKeeperSkins(); String key = CosmeticsType.ShopKeeperSkin.getSectionKey(); String skinvalue = config.getString(key + "." + skin + ".skin-value"); diff --git a/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler1058.java b/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler1058.java index 5925fcbc..8b7b787f 100644 --- a/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler1058.java @@ -5,11 +5,9 @@ import com.andrei1058.bedwars.api.events.gameplay.GameStateChangeEvent; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.Spray; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.cosmetics.category.Spray; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.util.Utility; import org.bukkit.Material; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; @@ -17,8 +15,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.metadata.FixedMetadataValue; -import static me.defender.cosmetics.util.Utility.plugin; - public class SpraysHandler1058 implements Listener { @@ -32,7 +28,7 @@ public void onRightClick(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof ItemFrame) { ItemFrame itemFrame = (ItemFrame) e.getRightClicked(); if(itemFrame.getItem() == null) return; - String selected = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.Sprays); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.Sprays); if(itemFrame.getItem().getType() == Material.AIR || itemFrame.getItem().getType() == Material.MAP || itemFrame.getItem().getType() == Material.EMPTY_MAP) { for(Spray spray : StartupUtils.sprayList){ if(spray.getIdentifier().equals(selected)){ diff --git a/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler2023.java b/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler2023.java index 6746eecc..dcafd167 100644 --- a/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/sprays/SpraysHandler2023.java @@ -2,11 +2,9 @@ import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.Spray; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.cosmetics.category.Spray; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.util.Utility; import org.bukkit.Material; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; @@ -14,8 +12,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.metadata.FixedMetadataValue; -import static me.defender.cosmetics.util.Utility.plugin; - public class SpraysHandler2023 implements Listener { @EventHandler @@ -28,7 +24,7 @@ public void onRightClick(PlayerInteractEntityEvent e) { if (e.getRightClicked() instanceof ItemFrame) { ItemFrame itemFrame = (ItemFrame) e.getRightClicked(); if(itemFrame.getItem() == null) return; - String selected = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.Sprays); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.Sprays); if(itemFrame.getItem().getType() == Material.AIR || itemFrame.getItem().getType() == Material.MAP || itemFrame.getItem().getType() == Material.EMPTY_MAP) { for(Spray spray : StartupUtils.sprayList){ if(spray.getIdentifier().equals(selected)){ diff --git a/src/main/java/me/defender/cosmetics/category/sprays/items/SprayItems.java b/src/main/java/me/defender/cosmetics/category/sprays/items/SprayItems.java index 3df860a4..1663e3a4 100644 --- a/src/main/java/me/defender/cosmetics/category/sprays/items/SprayItems.java +++ b/src/main/java/me/defender/cosmetics/category/sprays/items/SprayItems.java @@ -1,11 +1,11 @@ package me.defender.cosmetics.category.sprays.items; -import me.defender.cosmetics.api.cosmetics.category.Spray; -import me.defender.cosmetics.category.sprays.util.SpraysUtil; +import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.Spray; +import me.defender.cosmetics.category.sprays.util.SpraysUtil; import me.defender.cosmetics.util.StringUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; diff --git a/src/main/java/me/defender/cosmetics/category/sprays/preview/SprayPreview.java b/src/main/java/me/defender/cosmetics/category/sprays/preview/SprayPreview.java index 3a9bcf67..ddbf3b25 100644 --- a/src/main/java/me/defender/cosmetics/category/sprays/preview/SprayPreview.java +++ b/src/main/java/me/defender/cosmetics/category/sprays/preview/SprayPreview.java @@ -10,15 +10,16 @@ import com.hakan.core.ui.inventory.InventoryGui; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.Spray; -import me.defender.cosmetics.category.sprays.util.CustomRenderer; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.Spray; +import me.defender.cosmetics.category.sprays.util.CustomRenderer; import me.defender.cosmetics.util.StartupUtils; -import org.bukkit.*; +import me.defender.cosmetics.util.config.ConfigUtils; +import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; import org.bukkit.entity.ArmorStand; diff --git a/src/main/java/me/defender/cosmetics/category/sprays/util/SpraysUtil.java b/src/main/java/me/defender/cosmetics/category/sprays/util/SpraysUtil.java index 7168606d..b2de3150 100644 --- a/src/main/java/me/defender/cosmetics/category/sprays/util/SpraysUtil.java +++ b/src/main/java/me/defender/cosmetics/category/sprays/util/SpraysUtil.java @@ -7,14 +7,15 @@ import com.hakan.core.HCore; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; +import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; import me.defender.cosmetics.util.DebugUtil; import me.defender.cosmetics.util.Utility; -import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import org.bukkit.*; +import me.defender.cosmetics.util.config.ConfigUtils; +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.Rotation; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.ItemFrame; @@ -40,7 +41,7 @@ public class SpraysUtil public static void spawnSprays(Player player, ItemFrame itemFrame) { HCore.syncScheduler().run(() -> { MapView view = Bukkit.createMap(player.getWorld()); - String spray = new BwcAPI().getSelectedCosmetic(player, CosmeticsType.Sprays); + String spray = Cosmetics.getInstance().getApi().getSelectedCosmetic(player, CosmeticsType.Sprays); ConfigManager config = ConfigUtils.getSprays(); if (SpraysUtil.cooldown.containsKey(player.getName())) { @@ -79,7 +80,7 @@ else if (ShopKeeperHandler1058.arenas.containsKey(player.getWorld().getName())) } } else { sprayFile = config.getString(CosmeticsType.Sprays.getSectionKey() + "." + spray + ".file"); - File file = new File(Cosmetics.getInstance().getDataFolder().getAbsolutePath() + "/" + Cosmetics.getInstance().getConfig().getString("Spray-Dir") + "/" + sprayFile); + File file = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/" + Cosmetics.getInstance().getConfig().getString("Spray-Dir") + "/" + sprayFile); if (!renderer.load(file)) { player.sendMessage(ColorUtil.colored("&cLooks like there's an error rendering the Spray, contact the admin!")); Logger.getLogger("Minecraft").log(Level.SEVERE, "Could not load the File for the " + spray + ". Check if the File in Sprays.yml is valid!"); diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler1058.java b/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler1058.java index 8bd8d007..d3ac6a58 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler1058.java @@ -4,14 +4,13 @@ import com.andrei1058.bedwars.api.events.gameplay.GameEndEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.api.event.VictoryDancesExecuteEvent; -import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.DebugUtil; +import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -19,8 +18,6 @@ import java.util.UUID; -import static me.defender.cosmetics.util.Utility.plugin; - public class VictoryDanceHandler1058 implements Listener { @EventHandler public void onGameEnd1058(GameEndEvent e) { @@ -30,7 +27,7 @@ public void onGameEnd1058(GameEndEvent e) { for (UUID uuid : e.getWinners()) { Player p = Bukkit.getPlayer(uuid); - String selected = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.VictoryDances); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.VictoryDances); VictoryDancesExecuteEvent event = new VictoryDancesExecuteEvent(p); Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler2023.java b/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler2023.java index 2182026f..026c0d19 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/VictoryDanceHandler2023.java @@ -2,7 +2,6 @@ import com.tomkeuper.bedwars.api.events.gameplay.GameEndEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.api.cosmetics.FieldsType; import me.defender.cosmetics.api.cosmetics.RarityType; @@ -17,8 +16,6 @@ import java.util.UUID; -import static me.defender.cosmetics.util.Utility.plugin; - public class VictoryDanceHandler2023 implements Listener { @EventHandler @@ -29,7 +26,7 @@ public void onGameEnd2023(GameEndEvent e) { for (UUID uuid : e.getWinners()) { Player p = Bukkit.getPlayer(uuid); - String selected = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.VictoryDances); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.VictoryDances); VictoryDancesExecuteEvent event = new VictoryDancesExecuteEvent(p); Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/AnvilRainDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/AnvilRainDance.java index ded162fe..66313694 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/AnvilRainDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/AnvilRainDance.java @@ -2,10 +2,10 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; -import me.defender.cosmetics.api.cosmetics.RarityType; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.FallingBlock; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/ColdSnapDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/ColdSnapDance.java index 53218767..1eeda898 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/ColdSnapDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/ColdSnapDance.java @@ -3,17 +3,19 @@ import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; -import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; -import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.VictoryDance; +import me.defender.cosmetics.util.Utility; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; public class ColdSnapDance extends VictoryDance { @Override @@ -53,18 +55,25 @@ public RarityType getRarity() { @Override public void execute(Player winner) { - new BukkitRunnable() { - public void run() { - final Location loc = UsefulUtilsVD.getRandomLocation(winner.getLocation(), 3); - if(ShopKeeperHandler1058.arenas.containsKey(winner.getWorld().getName())) { - if (loc.getBlock().getType() != Material.AIR) { - loc.getBlock().setType(Material.ICE); - winner.playSound(winner.getLocation(), XSound.BLOCK_NOTE_BLOCK_PLING.parseSound(), 1.0f, 1.0f); - } - }else{ - this.cancel(); + int duration = 8; + AtomicInteger radius = new AtomicInteger(2); + AtomicReference pitch = new AtomicReference<>(0.6f); + + int task = Bukkit.getScheduler().runTaskTimer(Cosmetics.getInstance(), () -> { + Location loc = winner.getLocation().subtract(0, 1, 0); + List blocks = Utility.getSphere(loc, radius.get()); + for (Block block : blocks) { + if (block.getType() != Material.AIR && block.getType() != XMaterial.PACKED_ICE.parseMaterial() && block.getType() != XMaterial.ICE.parseMaterial()) { + block.setType(XMaterial.ICE.parseMaterial()); } } - }.runTaskTimer(Cosmetics.getInstance(), 0L, 0L); + XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(winner, 1, pitch.get()); + pitch.set(pitch.get() + 0.15f); + radius.addAndGet(1); + }, 0, 10).getTaskId(); + + Bukkit.getScheduler().runTaskLater(Cosmetics.getInstance(), () -> { + Bukkit.getScheduler().cancelTask(task); + }, duration * 20L + 5L); } } diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/DragonRiderDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/DragonRiderDance.java index aee98a10..8e1df6c6 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/DragonRiderDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/DragonRiderDance.java @@ -1,12 +1,11 @@ package me.defender.cosmetics.category.victorydance.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; -import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; +import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/FireworksDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/FireworksDance.java index ce5c97d7..24dd468d 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/FireworksDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/FireworksDance.java @@ -1,12 +1,11 @@ package me.defender.cosmetics.category.victorydance.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; -import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.VictoryDance; +import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; +import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/FloatingLanternDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/FloatingLanternDance.java index 39e3f334..d9a7f68d 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/FloatingLanternDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/FloatingLanternDance.java @@ -2,11 +2,10 @@ import com.cryptomorin.xseries.XMaterial; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; -import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Bat; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/GuardiansDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/GuardiansDance.java index 3e0bc50e..cccc0153 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/GuardiansDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/GuardiansDance.java @@ -4,9 +4,8 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Entity; @@ -66,9 +65,9 @@ public void execute(Player winner) { class GuardianTriangle { private final Player player; - private Location playerLocation; + private final Location playerLocation; private boolean stopped; - private List guardians; + private final List guardians; public GuardianTriangle(Player player1) { this.playerLocation = player1.getLocation(); diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/HauntedDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/HauntedDance.java index 5ba581b5..5593fabf 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/HauntedDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/HauntedDance.java @@ -2,10 +2,9 @@ import com.cryptomorin.xseries.XMaterial; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Color; import org.bukkit.Location; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/NightShiftDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/NightShiftDance.java index 84ae4e8c..244bbb87 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/NightShiftDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/NightShiftDance.java @@ -2,10 +2,9 @@ import com.cryptomorin.xseries.XMaterial; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/NoneDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/NoneDance.java index 4c06cbaf..90ec4cbb 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/NoneDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/NoneDance.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.victorydance.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/RainbowDollyDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/RainbowDollyDance.java index 2d62f383..bc97a301 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/RainbowDollyDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/RainbowDollyDance.java @@ -2,8 +2,8 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.util.MathUtil; import org.bukkit.DyeColor; import org.bukkit.entity.EntityType; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/RainingPigsDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/RainingPigsDance.java index 8a8016b1..791d244e 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/RainingPigsDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/RainingPigsDance.java @@ -2,10 +2,9 @@ import com.cryptomorin.xseries.XMaterial; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; import org.bukkit.Location; import org.bukkit.entity.EntityType; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/ToyStickDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/ToyStickDance.java index a7062770..92b489ef 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/ToyStickDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/ToyStickDance.java @@ -3,9 +3,9 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; import com.hakan.core.utils.ColorUtil; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; -import me.defender.cosmetics.api.cosmetics.RarityType; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/TwerkApocalypseDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/TwerkApocalypseDance.java index b37951f7..ccc29515 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/TwerkApocalypseDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/TwerkApocalypseDance.java @@ -3,17 +3,17 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; import com.hakan.core.skin.Skin; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.victorydance.util.UsefulUtilsVD; -import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.util.MathUtil; import me.defender.cosmetics.util.Utility; import net.citizensnpcs.api.CitizensAPI; -import net.citizensnpcs.api.event.DespawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPCRegistry; import net.citizensnpcs.trait.LookClose; import net.citizensnpcs.trait.SkinTrait; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -77,7 +77,7 @@ public void execute(Player winner) { if(loc.getBlock().getType() == Material.AIR && loc.subtract(0,1,0).getBlock().getType() != Material.AIR) { NPC npc = registry.createNPC(EntityType.PLAYER, winner.getDisplayName()); npc.getOrAddTrait(SkinTrait.class).setTexture(skin.getTexture(), skin.getSignature()); - npc.getOrAddTrait(LookClose.class).lookClose(true); + npc.getOrAddTrait(LookClose.class).lookClose(false); npc.spawn(loc.add(0,1,0)); npcs.add(npc); @@ -90,11 +90,11 @@ public void execute(Player winner) { } }); - HCore.syncScheduler().after(30, TimeUnit.SECONDS).run(() -> { + Bukkit.getScheduler().runTaskLater(HCore.getInstance(), () -> { for (NPC npc : npcs) { - npc.despawn(DespawnReason.PLUGIN); + npc.destroy(); } - }); + }, 20L * 9 + 10L); } } diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/WitherRiderDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/WitherRiderDance.java index a0618e1d..f646a6c7 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/WitherRiderDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/WitherRiderDance.java @@ -4,10 +4,9 @@ import com.hakan.core.HCore; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Wither; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/items/YeeHawDance.java b/src/main/java/me/defender/cosmetics/category/victorydance/items/YeeHawDance.java index 726e23ae..792ac746 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/items/YeeHawDance.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/items/YeeHawDance.java @@ -3,10 +3,9 @@ import com.cryptomorin.xseries.XMaterial; import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.cosmetics.RarityType; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.util.Utility; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Horse; diff --git a/src/main/java/me/defender/cosmetics/category/victorydance/util/UsefulUtilsVD.java b/src/main/java/me/defender/cosmetics/category/victorydance/util/UsefulUtilsVD.java index 396dbc05..2707c829 100644 --- a/src/main/java/me/defender/cosmetics/category/victorydance/util/UsefulUtilsVD.java +++ b/src/main/java/me/defender/cosmetics/category/victorydance/util/UsefulUtilsVD.java @@ -11,7 +11,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.*; -import org.bukkit.entity.Entity; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.SkullMeta; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler1058.java b/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler1058.java index d0160a8c..dd226a63 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler1058.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler1058.java @@ -1,108 +1,66 @@ - - package me.defender.cosmetics.category.woodskin; -import com.andrei1058.bedwars.api.BedWars; -import com.andrei1058.bedwars.api.events.shop.ShopBuyEvent; import com.cryptomorin.xseries.XMaterial; -import com.cryptomorin.xseries.XSound; -import com.cryptomorin.xseries.XTag; -import com.hakan.core.utils.ColorUtil; +import com.andrei1058.bedwars.BedWars; +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.shop.IBuyItem; +import com.andrei1058.bedwars.api.events.shop.ShopBuyEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.CosmeticsType; -import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.Utility; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import java.io.File; - -import static me.defender.cosmetics.util.Utility.plugin; - -public class WoodSkinHandler1058 implements Listener -{ - - @EventHandler - public void onBlockPlace(BlockPlaceEvent e) { - if (e.isCancelled()) return; +public class WoodSkinHandler1058 implements Listener { + @EventHandler + public void onShopBuy(ShopBuyEvent e) { boolean isWoodSkinsEnabled = Cosmetics.getInstance().getConfig().getBoolean("wood-skins.enabled"); if (!isWoodSkinsEnabled) return; - if(!XTag.PLANKS.isTagged(XMaterial.matchXMaterial(e.getBlock().getType())) || !XTag.LOGS.isTagged(XMaterial.matchXMaterial(e.getBlock().getType()))) return; - String selected = new BwcAPI().getSelectedCosmetic(e.getPlayer(), CosmeticsType.WoodSkins); - for(WoodSkin woodSkin : StartupUtils.woodSkinsList){ - if(woodSkin.getIdentifier().equals(selected)){ - ItemStack stack = woodSkin.woodSkin(); - byte data = Byte.parseByte(String.valueOf(stack.getDurability())); - Material type = stack.getType(); - if(e.getBlock().getType() != type) e.getBlock().setType(type); - if(e.getBlock().getData() != data) e.getBlock().setData(data); - } + Player p = e.getBuyer(); + IBuyItem item = e.getCategoryContent().getContentTiers().get(0).getBuyItemsList().get(0); + ItemStack stack = item.getItemStack(); + + if (Utility.isWoodOrLogBlock(stack.getType())) { + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.WoodSkins); + + XMaterial m = XMaterial.matchXMaterial(selected.replace("-", "_").toUpperCase()).get(); + stack.setType(m.parseMaterial()); + stack.setDurability(m.getData()); } } - @EventHandler - public void onBuy1058(ShopBuyEvent e) { + public void onShopOpen(InventoryOpenEvent e) { + Inventory inv = e.getInventory(); - boolean isWoodSkinsEnabled = Cosmetics.getInstance().getConfig().getBoolean("wood-skins.enabled"); - if (!isWoodSkinsEnabled) return; + Player p = (Player) e.getPlayer(); + IArena arena = BedWars.getAPI().getArenaUtil().getArenaByPlayer(p); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.WoodSkins); - Player p = e.getBuyer(); - if (e.getCategoryContent().getItemStack(p).getType() == Material.WOOD) { - String selected = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.WoodSkins); - - BedWars bedwarsAPI = Cosmetics.getInstance().getBedWars1058API(); - String iso = bedwarsAPI.getLangIso(p); - String msg = bedwarsAPI.getLanguageByIso(iso).getString("shop-new-purchase"); - String prefix = bedwarsAPI.getLanguageByIso(iso).getString("prefix"); - String nopemsg = bedwarsAPI.getLanguageByIso(iso).getString("shop-insuff-money"); - - - File sounds = new File(Bukkit.getPluginManager().getPlugin("BedWars1058").getDataFolder(), "sounds.yml"); - FileConfiguration config = YamlConfiguration.loadConfiguration(sounds); - int cost = bedwarsAPI.getConfigs().getShopConfig().getInt("blocks-category.category-content.wood.content-tiers.tier1.tier-settings.cost"); - String currency = bedwarsAPI.getConfigs().getShopConfig().getString("blocks-category.category-content.wood.content-tiers.tier1.tier-settings.currency"); - Material m = bedwarsAPI.getShopUtil().getCurrency(currency); - int have = bedwarsAPI.getShopUtil().calculateMoney(p, m); - String cost1 = cost + ""; - - if(have < cost) { - p.sendMessage(ColorUtil.colored(nopemsg).replace("{prefix}", prefix).replace("{currency}", currency).replace("{amount}", cost1)); - return; - } - bedwarsAPI.getShopUtil().takeMoney(p, m, cost); + if (arena == null) return; - WoodSkin skin = null; - for(WoodSkin woodSkin : StartupUtils.woodSkinsList){ - if(woodSkin.getIdentifier().equals(selected)){ - skin = woodSkin; - } - } - if(skin == null) return; - ItemStack stack = skin.getItem().clone(); - stack.setAmount(16); - p.getInventory().addItem(stack); + boolean isWoodSkinInventory = + e.getView().getTitle().equals(Utility.getMSGLang(p, "shop-items-messages.inventory-name")) + || e.getView().getTitle().equals(Utility.getMSGLang(p, "shop-items-messages.blocks-category.inventory-name")) + || e.getView().getTitle().equals(Utility.getMSGLang(p, "shop-items-messages.quick-buy-add-inventory-name")); - Sound soundz = null; - Sound.valueOf(config.getString("shop-bought.sound")); - assert XSound.ENTITY_LIGHTNING_BOLT_THUNDER.parseSound() != null; - soundz = Sound.valueOf(config.getString("shop-bought.sound", XSound.ENTITY_LIGHTNING_BOLT_THUNDER.parseSound().toString())); + if (isWoodSkinInventory) { + for (ItemStack i : inv.getContents()) { + if (i == null) continue; + if (i.getType() == XMaterial.AIR.parseMaterial()) continue; - p.playSound(p.getLocation(),soundz , config.getInt("shop-bought.volume"), config.getInt("shop-bought.pitch")); - p.sendMessage(ColorUtil.colored(msg.replace("{item}", "Wood").replace("{prefix}", prefix))); - e.setCancelled(true); + if (Utility.isWoodOrLogBlock(i.getType()) && selected != null) { + XMaterial m = XMaterial.matchXMaterial(selected.replace("-", "_").toUpperCase()).get(); + i.setType(m.parseMaterial()); + i.setDurability(m.getData()); + } + } } } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler2023.java b/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler2023.java index 6c5ce0db..0c892f2a 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler2023.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/WoodSkinHandler2023.java @@ -1,102 +1,66 @@ package me.defender.cosmetics.category.woodskin; +import com.tomkeuper.bedwars.api.arena.IArena; import com.cryptomorin.xseries.XMaterial; -import com.cryptomorin.xseries.XSound; -import com.cryptomorin.xseries.XTag; -import com.hakan.core.utils.ColorUtil; +import com.tomkeuper.bedwars.BedWars; +import com.tomkeuper.bedwars.api.arena.shop.IBuyItem; +import com.tomkeuper.bedwars.api.events.shop.ShopBuyEvent; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.CosmeticsType; -import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.Utility; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import java.io.File; - -import static me.defender.cosmetics.util.Utility.plugin; - public class WoodSkinHandler2023 implements Listener { @EventHandler - public void onBlockPlace(BlockPlaceEvent e) { - if (e.isCancelled()) return; - + public void onShopBuy(ShopBuyEvent e) { boolean isWoodSkinsEnabled = Cosmetics.getInstance().getConfig().getBoolean("wood-skins.enabled"); if (!isWoodSkinsEnabled) return; - if(!XTag.PLANKS.isTagged(XMaterial.matchXMaterial(e.getBlock().getType())) || !XTag.LOGS.isTagged(XMaterial.matchXMaterial(e.getBlock().getType()))) return; - String selected = new BwcAPI().getSelectedCosmetic(e.getPlayer(), CosmeticsType.WoodSkins); - for(WoodSkin woodSkin : StartupUtils.woodSkinsList){ - if(woodSkin.getIdentifier().equals(selected)){ - ItemStack stack = woodSkin.woodSkin(); - byte data = Byte.parseByte(String.valueOf(stack.getDurability())); - Material type = stack.getType(); - if(e.getBlock().getType() != type) e.getBlock().setType(type); - if(e.getBlock().getData() != data) e.getBlock().setData(data); - } + Player p = e.getBuyer(); + IBuyItem item = e.getCategoryContent().getContentTiers().get(0).getBuyItemsList().get(0); + ItemStack stack = item.getItemStack(); + + if (Utility.isWoodOrLogBlock(stack.getType())) { + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.WoodSkins); + + XMaterial m = XMaterial.matchXMaterial(selected.replace("-", "_").toUpperCase()).get(); + stack.setType(m.parseMaterial()); + stack.setDurability(m.getData()); } } @EventHandler - public void onBuy2023(com.tomkeuper.bedwars.api.events.shop.ShopBuyEvent e) { + public void onShopOpen(InventoryOpenEvent e) { + Inventory inv = e.getInventory(); - boolean isWoodSkinsEnabled = Cosmetics.getInstance().getConfig().getBoolean("wood-skins.enabled"); - if (!isWoodSkinsEnabled) return; - - Player p = e.getBuyer(); - if (e.getCategoryContent().getItemStack(p).getType() == Material.WOOD) { - String selected = new BwcAPI().getSelectedCosmetic(p, CosmeticsType.WoodSkins); + Player p = (Player) e.getPlayer(); + IArena arena = BedWars.getAPI().getArenaUtil().getArenaByPlayer(p); + String selected = Cosmetics.getInstance().getApi().getSelectedCosmetic(p, CosmeticsType.WoodSkins); - com.tomkeuper.bedwars.api.BedWars bedwarsAPI = Cosmetics.getInstance().getBedWars2023API(); - String iso = bedwarsAPI.getLangIso(p); - String msg = bedwarsAPI.getLanguageByIso(iso).getString("shop-new-purchase"); - String prefix = bedwarsAPI.getLanguageByIso(iso).getString("prefix"); - String nopemsg = bedwarsAPI.getLanguageByIso(iso).getString("shop-insuff-money"); + if (arena == null) return; + boolean isWoodSkinInventory = + e.getView().getTitle().equals(Utility.getMSGLang(p, "shop-items-messages.inventory-name")) + || e.getView().getTitle().equals(Utility.getMSGLang(p, "shop-items-messages.blocks-category.inventory-name")) + || e.getView().getTitle().equals(Utility.getMSGLang(p, "shop-items-messages.quick-buy-add-inventory-name")); - File sounds = new File(Bukkit.getPluginManager().getPlugin("BedWars1058").getDataFolder(), "sounds.yml"); - FileConfiguration config = YamlConfiguration.loadConfiguration(sounds); - int cost = bedwarsAPI.getConfigs().getShopConfig().getInt("blocks-category.category-content.wood.content-tiers.tier1.tier-settings.cost"); - String currency = bedwarsAPI.getConfigs().getShopConfig().getString("blocks-category.category-content.wood.content-tiers.tier1.tier-settings.currency"); - Material m = bedwarsAPI.getShopUtil().getCurrency(currency); - int have = bedwarsAPI.getShopUtil().calculateMoney(p, m); - String cost1 = cost + ""; + if (isWoodSkinInventory) { + for (ItemStack i : inv.getContents()) { + if (i == null) continue; + if (i.getType() == XMaterial.AIR.parseMaterial()) continue; - if(have < cost) { - p.sendMessage(ColorUtil.colored(nopemsg).replace("{prefix}", prefix).replace("{currency}", currency).replace("{amount}", cost1)); - return; - } - bedwarsAPI.getShopUtil().takeMoney(p, m, cost); - - WoodSkin skin = null; - for(WoodSkin woodSkin : StartupUtils.woodSkinsList){ - if(woodSkin.getIdentifier().equals(selected)){ - skin = woodSkin; + if (Utility.isWoodOrLogBlock(i.getType()) && selected != null) { + XMaterial m = XMaterial.matchXMaterial(selected.replace("-", "_").toUpperCase()).get(); + i.setType(m.parseMaterial()); + i.setDurability(m.getData()); } } - if(skin == null) return; - ItemStack stack = skin.getItem().clone(); - stack.setAmount(16); - p.getInventory().addItem(stack); - - Sound soundz; - Sound.valueOf(config.getString("shop-bought.sound")); - assert XSound.ENTITY_LIGHTNING_BOLT_THUNDER.parseSound() != null; - soundz = Sound.valueOf(config.getString("shop-bought.sound", XSound.ENTITY_LIGHTNING_BOLT_THUNDER.parseSound().toString())); - - p.playSound(p.getLocation(),soundz , config.getInt("shop-bought.volume"), config.getInt("shop-bought.pitch")); - p.sendMessage(ColorUtil.colored(msg.replace("{item}", "Wood").replace("{prefix}", prefix))); - e.setCancelled(true); } } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/AcaciaPlank.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/AcaciaPlank.java index b04392e1..fc511e1f 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/AcaciaPlank.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/AcaciaPlank.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/BirchPlank.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/BirchPlank.java index 8407d5db..48f4d0fc 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/BirchPlank.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/BirchPlank.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/DarkOakPlank.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/DarkOakPlank.java index 28d12b25..399978da 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/DarkOakPlank.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/DarkOakPlank.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/JunglePlank.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/JunglePlank.java index e647f5b7..3b2625b7 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/JunglePlank.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/JunglePlank.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/OakPlank.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/OakPlank.java index 600c2fe8..a135ab91 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/OakPlank.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/OakPlank.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/SprucePlank.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/SprucePlank.java index 2afa71bb..07e9002f 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/SprucePlank.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/SprucePlank.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/AcaciaLog.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/AcaciaLog.java index c31fc47f..49cfa24c 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/AcaciaLog.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/AcaciaLog.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items.log; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/BirchLog.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/BirchLog.java index 606b5cf1..7d9bb65c 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/BirchLog.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/BirchLog.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items.log; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/JungleLog.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/JungleLog.java index 52e1e95b..8980ec73 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/JungleLog.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/JungleLog.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items.log; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/OakLog.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/OakLog.java index 1f03c075..53530eee 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/OakLog.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/OakLog.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items.log; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/SpruceLog.java b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/SpruceLog.java index 93fe43c4..93627563 100644 --- a/src/main/java/me/defender/cosmetics/category/woodskin/items/log/SpruceLog.java +++ b/src/main/java/me/defender/cosmetics/category/woodskin/items/log/SpruceLog.java @@ -1,8 +1,8 @@ package me.defender.cosmetics.category.woodskin.items.log; import com.cryptomorin.xseries.XMaterial; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/me/defender/cosmetics/command/MainCommand.java b/src/main/java/me/defender/cosmetics/command/MainCommand.java index e278cde3..c38aceba 100644 --- a/src/main/java/me/defender/cosmetics/command/MainCommand.java +++ b/src/main/java/me/defender/cosmetics/command/MainCommand.java @@ -1,6 +1,5 @@ package me.defender.cosmetics.command; -import com.andrei1058.bedwars.api.server.ISetupSession; import com.andrei1058.bedwars.shop.ShopCache; import com.andrei1058.bedwars.shop.ShopManager; import com.andrei1058.bedwars.shop.quickbuy.PlayerQuickBuyCache; @@ -13,15 +12,15 @@ import me.clip.placeholderapi.PlaceholderAPI; import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.CosmeticsType; -import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.api.BwcAPI; -import me.defender.cosmetics.util.MainMenuUtils; -import me.defender.cosmetics.util.config.ConfigUtils; +import me.defender.cosmetics.api.handler.ISetupSession; +import me.defender.cosmetics.menu.CategoryMenu; import me.defender.cosmetics.menu.MainMenu; +import me.defender.cosmetics.util.MainMenuUtils; +import me.defender.cosmetics.util.StartupUtils; import me.defender.cosmetics.util.Utility; -import me.defender.cosmetics.menu.CategoryMenu; +import me.defender.cosmetics.util.config.ConfigType; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -46,7 +45,7 @@ public class MainCommand { - private Cosmetics plugin; + private final Cosmetics plugin; public MainCommand(Cosmetics plugin) { this.plugin = plugin; @@ -85,45 +84,6 @@ public void helpCommand(CommandSender sender, String[] args) { } } - @SubCommand( - args = "quickbuy", - permission = "bwcosmetics.quickbuy", - permissionMessage = "§cYou don't have permission to do that!" - ) - public void quickbuyCommand(CommandSender sender, String[] args) { - if (sender instanceof Player) { - Player p = (Player) sender; - p.sendMessage(ColorUtil.colored("&cThis command currently doesn't work! use at your own risk.")); - - if (!plugin.isBw2023()){ - new PlayerQuickBuyCache(p); - new ShopCache(p.getUniqueId()); - ShopManager.shop.open(p, PlayerQuickBuyCache.getQuickBuyCache(p.getUniqueId()), true); - } else { - new com.tomkeuper.bedwars.shop.quickbuy.PlayerQuickBuyCache(p); - new com.tomkeuper.bedwars.shop.ShopCache(p.getUniqueId()); - com.tomkeuper.bedwars.shop.ShopManager.shop.open(p, com.tomkeuper.bedwars.shop.quickbuy.PlayerQuickBuyCache.getInstance().getQuickBuyCache(p.getUniqueId()), true); - } - p.setMetadata("bwc_quickbuy", new FixedMetadataValue(Cosmetics.getInstance(), true)); - HCore.registerEvent(InventoryCloseEvent.class).limit(1).consume((event -> { - if(event.getPlayer().hasMetadata("bwc_quickbuy")) { - event.getPlayer().removeMetadata("bwc_quickbuy", Cosmetics.getInstance()); - if (!plugin.isBw2023()) { - PlayerQuickBuyCache.getQuickBuyCache(event.getPlayer().getUniqueId()).pushChangesToDB(); - PlayerQuickBuyCache.getQuickBuyCache(event.getPlayer().getUniqueId()).destroy(); - ShopCache.getShopCache(event.getPlayer().getUniqueId()).destroy(); - } else { - com.tomkeuper.bedwars.shop.quickbuy.PlayerQuickBuyCache.getInstance().getQuickBuyCache(event.getPlayer().getUniqueId()).pushChangesToDB(); - com.tomkeuper.bedwars.shop.quickbuy.PlayerQuickBuyCache.getInstance().getQuickBuyCache(event.getPlayer().getUniqueId()).destroy(); - com.tomkeuper.bedwars.shop.ShopCache.getInstance().getShopCache(event.getPlayer().getUniqueId()).destroy(); - } - } - })); - }else { - sender.sendMessage(ChatColor.RED + "You need to be in-game!"); - } - } - @SubCommand( args = "set", permission = "bwcosmetics.admin", @@ -150,7 +110,7 @@ public void setCommand(CommandSender sender, String[] args) { sender.sendMessage(ChatColor.RED + "Invalid argument: " + String.join(", ", availableArgs)); return; } - new BwcAPI().setSelectedCosmetic(player, CosmeticsType.valueOf(arg), cosmeticID); + plugin.getApi().setSelectedCosmetic(player, CosmeticsType.valueOf(arg), cosmeticID); sender.sendMessage(ColorUtil.colored("&aSuccess! Note, this command will not check if cosmeticsID is valid!")); } @@ -417,65 +377,34 @@ public void setIslandTopperPostion(CommandSender sender, String[] args) { return; } Player p = (Player) sender; - BwcAPI api = new BwcAPI(); + ISetupSession setupSession = plugin.getHandler().getSetupSession(p.getUniqueId()); - if (!plugin.isBw2023()){ - ISetupSession setupSession = plugin.getBedWars1058API().getSetupSession(p.getUniqueId()); - - if(setupSession == null){ - sender.sendMessage(ChatColor.RED + "You need to be in setup when you use this command!"); - return; - } - String teamName = args[1]; - String configPath = "Team." + teamName; - ConfigurationSection section = setupSession.getConfig().getYml().getConfigurationSection("Team." + teamName); - if(section == null){ - sender.sendMessage(ColorUtil.colored("&cYou need to setup teams before you do this command!")); - return; - } - setupSession.getConfig().saveConfigLoc(configPath + ".IslandTopper.location", p.getLocation()); - Set players = new HashSet<>(); - for (Player player : Bukkit.getOnlinePlayers()){ - players.add(player.getUniqueId()); - } - Hologram hologram = new Hologram("hologram_island_topper", p.getLocation().add(0, 3, 0), players, true, 10); - ChatColor color; - if (teamName.toUpperCase().equalsIgnoreCase("Pink")){ - color = ChatColor.LIGHT_PURPLE; - } else { - color = ChatColor.valueOf(teamName.toUpperCase()); - } - hologram.addLine(color + teamName + " " + ChatColor.GOLD + "ISLAND TOPPER SET"); - sender.sendMessage(ChatColor.GREEN + "Done! saved your current location as Island Topper location for team " + teamName ); + if(setupSession == null){ + sender.sendMessage(ChatColor.RED + "You need to be in setup when you use this command!"); + return; + } + String teamName = args[1]; + String configPath = "Team." + teamName; + ConfigurationSection section = setupSession.getConfig().getConfigurationSection("Team." + teamName); + if(section == null){ + sender.sendMessage(ColorUtil.colored("&cYou need to setup teams before you do this command!")); + return; + } + setupSession.saveConfigLoc(configPath + ".IslandTopper.location", p.getLocation()); + Set players = new HashSet<>(); + for (Player player : Bukkit.getOnlinePlayers()){ + players.add(player.getUniqueId()); + } + Hologram hologram = new Hologram("hologram_island_topper", p.getLocation().add(0, 3, 0), players, true, 10); + ChatColor color; + if (teamName.toUpperCase().equalsIgnoreCase("Pink")){ + color = ChatColor.LIGHT_PURPLE; } else { - com.tomkeuper.bedwars.api.server.ISetupSession setupSession = plugin.getBedWars2023API().getSetupSession(p.getUniqueId()); - - if(setupSession == null){ - sender.sendMessage(ChatColor.RED + "You need to be in setup when you use this command!"); - return; - } - String teamName = args[1]; - String configPath = "Team." + teamName; - ConfigurationSection section = setupSession.getConfig().getYml().getConfigurationSection("Team." + teamName); - if(section == null){ - sender.sendMessage(ColorUtil.colored("&cYou need to setup teams before you do this command!")); - return; - } - setupSession.getConfig().saveConfigLoc(configPath + ".IslandTopper.location", p.getLocation()); - Set players = new HashSet<>(); - for (Player player : Bukkit.getOnlinePlayers()){ - players.add(player.getUniqueId()); - } - ChatColor color; - if (teamName.toUpperCase().equalsIgnoreCase("Pink")){ - color = ChatColor.LIGHT_PURPLE; - } else { - color = ChatColor.valueOf(teamName.toUpperCase()); - } - Hologram hologram = new Hologram("hologram_island_topper", p.getLocation().add(0, 3, 0), players, true, 10); - hologram.addLine(color + teamName + " " + ChatColor.GOLD + "ISLAND TOPPER SET"); - sender.sendMessage(ChatColor.GREEN + "Done! saved your current location as Island Topper location for team " + teamName ); + color = ChatColor.valueOf(teamName.toUpperCase()); } + hologram.addLine(color + teamName + " " + ChatColor.GOLD + "ISLAND TOPPER SET"); + sender.sendMessage(ChatColor.GREEN + "Done! saved your current location as Island Topper location for team " + teamName ); + } @SubCommand( diff --git a/src/main/java/me/defender/cosmetics/database/PlayerData.java b/src/main/java/me/defender/cosmetics/data/PlayerData.java similarity index 96% rename from src/main/java/me/defender/cosmetics/database/PlayerData.java rename to src/main/java/me/defender/cosmetics/data/PlayerData.java index 607ace96..b3f5d9f7 100644 --- a/src/main/java/me/defender/cosmetics/database/PlayerData.java +++ b/src/main/java/me/defender/cosmetics/data/PlayerData.java @@ -1,6 +1,5 @@ -package me.defender.cosmetics.database; +package me.defender.cosmetics.data; -import com.zaxxer.hikari.HikariDataSource; import lombok.Getter; import lombok.Setter; import me.defender.cosmetics.Cosmetics; @@ -14,6 +13,7 @@ public class PlayerData { + @Getter private final UUID uuid; @Getter @Setter private String woodSkin, bedDestroy, victoryDance, shopkeeperSkin, glyph, spray, projectileTrail, killMessage, finalKillEffect, islandTopper, deathCry; @@ -21,7 +21,7 @@ public class PlayerData { public PlayerData(UUID uuid) { this.uuid = uuid; - connection = Cosmetics.getInstance().getDataBase().getConnection(); + connection = Cosmetics.getInstance().getRemoteDatabase().getConnection(); load(); } diff --git a/src/main/java/me/defender/cosmetics/database/PlayerOwnedData.java b/src/main/java/me/defender/cosmetics/data/PlayerOwnedData.java similarity index 83% rename from src/main/java/me/defender/cosmetics/database/PlayerOwnedData.java rename to src/main/java/me/defender/cosmetics/data/PlayerOwnedData.java index 8015b81f..d2887b5d 100644 --- a/src/main/java/me/defender/cosmetics/database/PlayerOwnedData.java +++ b/src/main/java/me/defender/cosmetics/data/PlayerOwnedData.java @@ -1,48 +1,35 @@ -package me.defender.cosmetics.database; +package me.defender.cosmetics.data; import lombok.Getter; import lombok.Setter; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.cosmetics.category.BedDestroy; -import me.defender.cosmetics.api.cosmetics.category.DeathCry; -import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; -import me.defender.cosmetics.api.cosmetics.category.Glyph; -import me.defender.cosmetics.api.cosmetics.category.IslandTopper; -import me.defender.cosmetics.api.cosmetics.category.KillMessage; -import me.defender.cosmetics.api.cosmetics.category.ProjectileTrail; -import me.defender.cosmetics.api.cosmetics.category.ShopKeeperSkin; -import me.defender.cosmetics.api.cosmetics.category.Spray; -import me.defender.cosmetics.api.cosmetics.category.VictoryDance; -import me.defender.cosmetics.api.cosmetics.category.WoodSkin; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.cosmetics.category.*; +import me.defender.cosmetics.api.database.IDatabase; import me.defender.cosmetics.util.StartupUtils; import org.bukkit.Bukkit; -import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.UUID; public class PlayerOwnedData{ + @Getter private final UUID uuid; - private final Connection connection; + private final IDatabase remoteDatabase; @Getter @Setter private int bedDestroy, deathCry, finalKillEffect, glyph, islandTopper, killMessage, projectileTrail, shopkeeperSkin, spray, victoryDance, woodSkin; public PlayerOwnedData (UUID uuid) { this.uuid = uuid; - try { - this.connection = Cosmetics.getDB().getConnection(); - } catch (SQLException e) { - throw new RuntimeException(e); - } + this.remoteDatabase = Cosmetics.getInstance().getRemoteDatabase(); load(); } public void load() { try { - PreparedStatement statement = connection.prepareStatement("SELECT * FROM player_owned_data WHERE uuid = ?"); + PreparedStatement statement = remoteDatabase.getConnection().prepareStatement("SELECT * FROM player_owned_data WHERE uuid = ?"); statement.setString(1, uuid.toString()); ResultSet result = statement.executeQuery(); if (result.next()) { @@ -71,7 +58,7 @@ public void demo(){ "VALUES (?, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);"; try{ - PreparedStatement statement = connection.prepareStatement(sql); + PreparedStatement statement = remoteDatabase.getConnection().prepareStatement(sql); statement.setString(1, uuid.toString()); statement.executeUpdate(); statement.close(); @@ -82,7 +69,7 @@ public void demo(){ public void save() { try { - PreparedStatement statement = connection.prepareStatement("UPDATE player_owned_data SET bed_destroy = ?, death_cry = ?, final_kill_effect = ?, glyph = ?, island_topper = ?, kill_message = ?, projectile_trail = ?, shopkeeper_skin = ?, spray = ?, victory_dance = ?, wood_skin = ? WHERE uuid = ?;"); + PreparedStatement statement = remoteDatabase.getConnection().prepareStatement("UPDATE player_owned_data SET bed_destroy = ?, death_cry = ?, final_kill_effect = ?, glyph = ?, island_topper = ?, kill_message = ?, projectile_trail = ?, shopkeeper_skin = ?, spray = ?, victory_dance = ?, wood_skin = ? WHERE uuid = ?;"); statement.setInt(1, bedDestroy); statement.setInt(2, deathCry); statement.setInt(3, finalKillEffect); diff --git a/src/main/java/me/defender/cosmetics/database/mysql/MySQL.java b/src/main/java/me/defender/cosmetics/data/database/MySQL.java similarity index 78% rename from src/main/java/me/defender/cosmetics/database/mysql/MySQL.java rename to src/main/java/me/defender/cosmetics/data/database/MySQL.java index 093fe591..8cd93ae5 100644 --- a/src/main/java/me/defender/cosmetics/database/mysql/MySQL.java +++ b/src/main/java/me/defender/cosmetics/data/database/MySQL.java @@ -1,9 +1,10 @@ -package me.defender.cosmetics.database.mysql; +package me.defender.cosmetics.data.database; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import lombok.Getter; -import me.defender.cosmetics.database.IDatabase; +import me.defender.cosmetics.api.database.DatabaseType; +import me.defender.cosmetics.api.database.IDatabase; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -15,8 +16,6 @@ public class MySQL implements IDatabase { @Getter public HikariDataSource dataSource; - @Getter - public Connection connection; private final JavaPlugin plugin; public MySQL(JavaPlugin plugin){ @@ -29,22 +28,35 @@ public MySQL(JavaPlugin plugin){ createTable(); } + @Override + public DatabaseType getDatabaseType() { + return DatabaseType.MYSQL; + } + public void connect(){ - if(dataSource == null){ + boolean needConnecting = dataSource == null; + if(!needConnecting) { + try (Connection connection = dataSource.getConnection()) { + connection.createStatement(); + } catch (Exception e) { + needConnecting = true; + } + } + if(needConnecting){ String host = plugin.getConfig().getString("mysql.host"); String database = plugin.getConfig().getString("mysql.database"); String username = plugin.getConfig().getString("mysql.username"); String password = plugin.getConfig().getString("mysql.password"); + boolean ssl = plugin.getConfig().getBoolean("mysql.useSSL"); int port = plugin.getConfig().getInt("mysql.port", 3306); int maxpoolsize = plugin.getConfig().getInt("mysql.maxpoolsize", 50); HikariConfig config = new HikariConfig(); - config.setDriverClassName("com.mysql.cj.jdbc.Driver"); - config.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database + "?autoReconnect=true" ); + config.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database + "?autoReconnect=true" + "&enabledTLSProtocols=TLSv1.2" + "&useSSL=" + ssl); config.setPoolName("BW1058Cosmetics-MySQLPool"); config.setMaximumPoolSize(maxpoolsize); - config.setMaxLifetime(1800000); + config.setMaxLifetime(Integer.MAX_VALUE); config.setUsername(username); config.setPassword(password); config.addDataSourceProperty("characterEncoding", "utf8"); @@ -57,7 +69,7 @@ public void connect(){ config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); dataSource = new HikariDataSource(config); try { - connection = dataSource.getConnection(); + dataSource.getConnection(); } catch (SQLException e) { Bukkit.getLogger().severe("There was an issue while getting connection for the database! error: " + e.getMessage()); } @@ -69,8 +81,7 @@ public void connect(){ public void createTable(){ if(dataSource != null){ try { - connection = dataSource.getConnection(); - Statement statement = connection.createStatement(); + Statement statement = getConnection().createStatement(); statement.executeUpdate("CREATE TABLE IF NOT EXISTS cosmetics_player_data (" + "uuid VARCHAR(36) PRIMARY KEY," + "bed_destroy VARCHAR(36)," + @@ -105,4 +116,12 @@ public void createTable(){ } } + @Override + public Connection getConnection() { + try { + return dataSource.getConnection(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } } diff --git a/src/main/java/me/defender/cosmetics/database/sqlite/SQLite.java b/src/main/java/me/defender/cosmetics/data/database/SQLite.java similarity index 73% rename from src/main/java/me/defender/cosmetics/database/sqlite/SQLite.java rename to src/main/java/me/defender/cosmetics/data/database/SQLite.java index 243c4098..54a06d08 100644 --- a/src/main/java/me/defender/cosmetics/database/sqlite/SQLite.java +++ b/src/main/java/me/defender/cosmetics/data/database/SQLite.java @@ -1,9 +1,11 @@ -package me.defender.cosmetics.database.sqlite; +package me.defender.cosmetics.data.database; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import lombok.Getter; -import me.defender.cosmetics.database.IDatabase; +import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.database.DatabaseType; +import me.defender.cosmetics.api.database.IDatabase; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -13,21 +15,33 @@ public class SQLite implements IDatabase { - private final JavaPlugin plugin; + private final Cosmetics plugin; @Getter public HikariDataSource dataSource; - @Getter - public Connection connection; - public SQLite(JavaPlugin plugin){ + public SQLite(Cosmetics plugin){ this.plugin = plugin; connect(); createTable(); } + @Override + public DatabaseType getDatabaseType() { + return DatabaseType.SQLITE; + } + public void connect(){ - if(dataSource == null){ - String jdbcUrl = "jdbc:sqlite:" + plugin.getDataFolder().getPath() + "/playerData.db"; + boolean needConnecting = dataSource == null; + if(!needConnecting){ + try { + dataSource.getConnection().createStatement(); + } catch (SQLException e) { + needConnecting = true; + } + } + + if(needConnecting){ + String jdbcUrl = "jdbc:sqlite:" + plugin.getHandler().getAddonPath() + "/cosmeticsData.db"; try{ Class.forName("org.sqlite.JDBC"); }catch (ClassNotFoundException e) { @@ -38,12 +52,12 @@ public void connect(){ config.setUsername(""); config.setPassword(""); config.setConnectionTestQuery("SELECT 1"); - config.setConnectionTimeout(500000); + config.setConnectionTimeout(Integer.MAX_VALUE); config.setMaximumPoolSize(100); config.setPoolName("COSMETICS-SQLITE"); dataSource = new HikariDataSource(config); try { - connection = dataSource.getConnection(); + dataSource.getConnection(); } catch (SQLException e) { Bukkit.getLogger().severe("There was an error getting the connection for database! error: " + e.getMessage()); } @@ -88,4 +102,12 @@ public void createTable(){ } } + @Override + public Connection getConnection() { + try { + return dataSource.getConnection(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } } diff --git a/src/main/java/me/defender/cosmetics/data/manager/PlayerManager.java b/src/main/java/me/defender/cosmetics/data/manager/PlayerManager.java new file mode 100644 index 00000000..c3318c42 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/data/manager/PlayerManager.java @@ -0,0 +1,48 @@ +package me.defender.cosmetics.data.manager; + +import lombok.Getter; +import me.defender.cosmetics.data.PlayerData; +import me.defender.cosmetics.data.PlayerOwnedData; + +import java.util.HashMap; +import java.util.UUID; + +@Getter +public class PlayerManager { + + private final HashMap playerDataHashMap; + private final HashMap playerOwnedDataHashMap; + + public PlayerManager() { + playerDataHashMap = new HashMap<>(); + playerOwnedDataHashMap = new HashMap<>(); + + } + + + public void addPlayerData(PlayerData playerData) { + playerDataHashMap.put(playerData.getUuid(), playerData); + } + + public void addPlayerOwnedData(PlayerOwnedData playerOwnedData) { + playerOwnedDataHashMap.put(playerOwnedData.getUuid(), playerOwnedData); + } + + public PlayerData getPlayerData(UUID uuid) { + if (!playerDataHashMap.containsKey(uuid)) { + PlayerData playerData = new PlayerData(uuid); + playerData.load(); + playerDataHashMap.put(uuid, playerData); + } + return playerDataHashMap.get(uuid); + } + + public PlayerOwnedData getPlayerOwnedData(UUID uuid) { + if(!playerOwnedDataHashMap.containsKey(uuid)){ + PlayerOwnedData playerOwnedData = new PlayerOwnedData(uuid); + playerOwnedData.load(); + playerOwnedDataHashMap.put(uuid, playerOwnedData); + } + return playerOwnedDataHashMap.get(uuid); + } +} diff --git a/src/main/java/me/defender/cosmetics/listener/CosmeticPurchaseListener.java b/src/main/java/me/defender/cosmetics/listener/CosmeticPurchaseListener.java index 19d5dbd1..579b048f 100644 --- a/src/main/java/me/defender/cosmetics/listener/CosmeticPurchaseListener.java +++ b/src/main/java/me/defender/cosmetics/listener/CosmeticPurchaseListener.java @@ -1,8 +1,7 @@ package me.defender.cosmetics.listener; +import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.event.CosmeticPurchaseEvent; -import me.defender.cosmetics.util.Utility; -import me.defender.cosmetics.database.PlayerOwnedData; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -12,8 +11,10 @@ public class CosmeticPurchaseListener implements Listener { public void onPurchase(CosmeticPurchaseEvent e){ if(e.isCancelled()) return; - PlayerOwnedData ownedData = Utility.playerOwnedDataList.get(e.getPlayer().getUniqueId()); - ownedData.updateOwned(); + Cosmetics.getInstance() + .getPlayerManager() + .getPlayerOwnedData(e.getPlayer().getUniqueId()) + .updateOwned(); } } diff --git a/src/main/java/me/defender/cosmetics/listener/GameListener.java b/src/main/java/me/defender/cosmetics/listener/GameListener.java deleted file mode 100644 index 3da77d79..00000000 --- a/src/main/java/me/defender/cosmetics/listener/GameListener.java +++ /dev/null @@ -1,34 +0,0 @@ -package me.defender.cosmetics.listener; - -import com.andrei1058.bedwars.api.arena.GameState; -import com.andrei1058.bedwars.api.events.gameplay.GameStateChangeEvent; -import me.defender.cosmetics.Cosmetics; -import net.citizensnpcs.api.CitizensAPI; -import net.citizensnpcs.api.npc.NPC; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import static org.bukkit.Bukkit.getServer; - -public class GameListener implements Listener { - - @EventHandler - public void onGameStartEvent(GameStateChangeEvent event){ - if(event.getNewState() != GameState.playing) return; - getServer().getScheduler().runTaskLater(Cosmetics.getInstance(), () -> { - World world = event.getArena().getWorld(); - for (Entity entity : world.getEntities()) { - boolean isCitizensNPC = entity.hasMetadata("NPC"); - if(!entity.isDead() && isCitizensNPC){ - NPC npc = CitizensAPI.getNPCRegistry().getNPC(entity); - npc.data().setPersistent(NPC.Metadata.DEATH_SOUND, ""); - npc.data().setPersistent(NPC.Metadata.AMBIENT_SOUND, ""); - npc.data().setPersistent(NPC.Metadata.HURT_SOUND, ""); - npc.data().setPersistent(NPC.Metadata.SILENT, true); - } - } - }, 40L); - } -} diff --git a/src/main/java/me/defender/cosmetics/listener/PlayerJoinListener.java b/src/main/java/me/defender/cosmetics/listener/PlayerJoinListener.java index dc787d4e..49381a2b 100644 --- a/src/main/java/me/defender/cosmetics/listener/PlayerJoinListener.java +++ b/src/main/java/me/defender/cosmetics/listener/PlayerJoinListener.java @@ -3,7 +3,7 @@ package me.defender.cosmetics.listener; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.category.BedDestroy; import me.defender.cosmetics.api.cosmetics.category.DeathCry; import me.defender.cosmetics.api.cosmetics.category.FinalKillEffect; @@ -15,9 +15,8 @@ import me.defender.cosmetics.api.cosmetics.category.Spray; import me.defender.cosmetics.api.cosmetics.category.VictoryDance; import me.defender.cosmetics.api.cosmetics.category.WoodSkin; -import me.defender.cosmetics.util.Utility; -import me.defender.cosmetics.database.PlayerData; -import me.defender.cosmetics.database.PlayerOwnedData; +import me.defender.cosmetics.data.PlayerData; +import me.defender.cosmetics.data.PlayerOwnedData; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; @@ -30,12 +29,11 @@ public PlayerJoinListener() { @EventHandler public void onJoin(PlayerJoinEvent event) { - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); // Saving for MySQL is different if (api.isMySQL()) { - PlayerData playerData = new PlayerData(event.getPlayer().getUniqueId()); - Utility.playerDataList.put(event.getPlayer().getUniqueId(), playerData); + PlayerData playerData = Cosmetics.getInstance().getPlayerManager().getPlayerData(event.getPlayer().getUniqueId()); if (!playerData.exists()) { playerData.setBedDestroy(BedDestroy.getDefault(event.getPlayer()).getIdentifier()); playerData.setDeathCry(DeathCry.getDefault(event.getPlayer()).getIdentifier()); @@ -50,15 +48,13 @@ public void onJoin(PlayerJoinEvent event) { playerData.setWoodSkin(WoodSkin.getDefault(event.getPlayer()).getIdentifier()); playerData.createData(); } - Utility.playerDataList.put(event.getPlayer().getUniqueId(), playerData); - PlayerOwnedData playerOwnedData = new PlayerOwnedData(event.getPlayer().getUniqueId()); - Utility.playerOwnedDataList.put(event.getPlayer().getUniqueId(), playerOwnedData); + PlayerOwnedData playerOwnedData = Cosmetics.getInstance().getPlayerManager().getPlayerOwnedData(event.getPlayer().getUniqueId()); playerOwnedData.updateOwned(); } // Saving for SQLite is different, workaround for SQLite database is busy if(!api.isMySQL()) { - if (!Utility.playerDataList.containsKey(event.getPlayer().getUniqueId())) { + if (!Cosmetics.getInstance().getPlayerManager().getPlayerDataHashMap().containsKey(event.getPlayer().getUniqueId())) { PlayerData playerData = new PlayerData(event.getPlayer().getUniqueId()); if (!playerData.exists()) { playerData.setBedDestroy(BedDestroy.getDefault(event.getPlayer()).getIdentifier()); @@ -74,15 +70,14 @@ public void onJoin(PlayerJoinEvent event) { playerData.setWoodSkin(WoodSkin.getDefault(event.getPlayer()).getIdentifier()); playerData.createData(); } - Utility.playerDataList.put(event.getPlayer().getUniqueId(), playerData); + Cosmetics.getInstance().getPlayerManager().addPlayerData(playerData); } - if (!Utility.playerOwnedDataList.containsKey(event.getPlayer().getUniqueId())) { - PlayerOwnedData playerOwnedData = new PlayerOwnedData(event.getPlayer().getUniqueId()); - Utility.playerOwnedDataList.put(event.getPlayer().getUniqueId(), playerOwnedData); + if (!Cosmetics.getInstance().getPlayerManager().getPlayerOwnedDataHashMap().containsKey(event.getPlayer().getUniqueId())) { + PlayerOwnedData playerOwnedData = Cosmetics.getInstance().getPlayerManager().getPlayerOwnedData(event.getPlayer().getUniqueId()); playerOwnedData.updateOwned(); } else { - Utility.playerOwnedDataList.get(event.getPlayer().getUniqueId()).updateOwned(); + Cosmetics.getInstance().getPlayerManager().getPlayerOwnedData(event.getPlayer().getUniqueId()).updateOwned(); } } } diff --git a/src/main/java/me/defender/cosmetics/menu/CategoryMenu.java b/src/main/java/me/defender/cosmetics/menu/CategoryMenu.java index 738319b7..e990bd7a 100644 --- a/src/main/java/me/defender/cosmetics/menu/CategoryMenu.java +++ b/src/main/java/me/defender/cosmetics/menu/CategoryMenu.java @@ -7,7 +7,11 @@ import com.hakan.core.ui.inventory.pagination.Pagination; import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; +import me.defender.cosmetics.api.configuration.ConfigManager; +import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.api.cosmetics.RarityType; +import me.defender.cosmetics.api.event.CosmeticPurchaseEvent; import me.defender.cosmetics.category.deathcries.preview.DeathCryPreview; import me.defender.cosmetics.category.finalkilleffects.preview.FinalKillEffectPreview; import me.defender.cosmetics.category.glyphs.preview.GlyphPreview; @@ -15,13 +19,9 @@ import me.defender.cosmetics.category.killmessage.preview.KillMessagePreview; import me.defender.cosmetics.category.shopkeeperskins.preview.ShopKeeperPreview; import me.defender.cosmetics.category.sprays.preview.SprayPreview; -import me.defender.cosmetics.api.cosmetics.CosmeticsType; -import me.defender.cosmetics.api.cosmetics.RarityType; -import me.defender.cosmetics.api.event.CosmeticPurchaseEvent; import me.defender.cosmetics.util.StringUtils; -import me.defender.cosmetics.util.VaultUtils; -import me.defender.cosmetics.api.configuration.ConfigManager; import me.defender.cosmetics.util.Utility; +import me.defender.cosmetics.util.VaultUtils; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; import org.bukkit.Bukkit; @@ -267,7 +267,8 @@ public void addItemsAccordingToRarity(Map rarityMap){ public String getItemStatus(Player p, CosmeticsType type, String unformattedName, int price){ - String selected = new BwcAPI().getSelectedCosmetic(p, type); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); + String selected = api.getSelectedCosmetic(p, type); if(selected.equals(unformattedName)){ return ColorUtil.colored(Utility.getMSGLang(p, "cosmetics.selected")); } @@ -283,7 +284,7 @@ public String getItemStatus(Player p, CosmeticsType type, String unformattedName } } - if(new BwcAPI().getEco().getBalance(p) >= price){ + if(Cosmetics.getInstance().getEconomy().getBalance(p) >= price){ return ColorUtil.colored(Utility.getMSGLang(p, "cosmetics.click-to-purchase")); } @@ -291,7 +292,7 @@ public String getItemStatus(Player p, CosmeticsType type, String unformattedName } public int onClick(Player p, CosmeticsType type, int price, String id, boolean isOnlyForCheck) { - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); String selected = api.getSelectedCosmetic(p, type); String permissionFormat = type.getPermissionFormat(); Economy eco = VaultUtils.getEconomy(); diff --git a/src/main/java/me/defender/cosmetics/menu/MainMenu.java b/src/main/java/me/defender/cosmetics/menu/MainMenu.java index 10e61c0f..b59719c0 100644 --- a/src/main/java/me/defender/cosmetics/menu/MainMenu.java +++ b/src/main/java/me/defender/cosmetics/menu/MainMenu.java @@ -17,7 +17,7 @@ public class MainMenu extends InventoryGui { - FileConfiguration config = Cosmetics.getInstance().menuData.getConfig(); + FileConfiguration config = Cosmetics.getInstance().menuData.getYml(); public MainMenu(Player player) { super("none", Utility.getMSGLang(player, "cosmetics.gui-title") , 6, InventoryType.CHEST); diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java new file mode 100644 index 00000000..aab2327e --- /dev/null +++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058Handler.java @@ -0,0 +1,158 @@ +package me.defender.cosmetics.support.bedwars.handler.bedwars1058; + +import com.andrei1058.bedwars.api.BedWars; +import com.andrei1058.bedwars.api.language.Language; +import com.hakan.core.HCore; +import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.handler.*; +import me.defender.cosmetics.category.bedbreakeffects.BedDestroyHandler1058; +import me.defender.cosmetics.category.deathcries.DeathCryHandler1058; +import me.defender.cosmetics.category.finalkilleffects.FinalKillEffectHandler1058; +import me.defender.cosmetics.category.glyphs.GlyphHandler1058; +import me.defender.cosmetics.category.islandtoppers.IslandTopperHandler1058; +import me.defender.cosmetics.category.killmessage.KillMessageHandler1058; +import me.defender.cosmetics.category.projectiletrails.ProjectileHandler; +import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; +import me.defender.cosmetics.category.sprays.SpraysHandler1058; +import me.defender.cosmetics.category.victorydance.VictoryDanceHandler1058; +import me.defender.cosmetics.category.woodskin.WoodSkinHandler1058; +import org.bukkit.Location; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.util.List; +import java.util.UUID; + +public class BW1058Handler implements IHandler { + + private BedWars api = com.andrei1058.bedwars.BedWars.getAPI(); + + @Override + public void register() { + HCore.registerListeners(new ShopKeeperHandler1058()); + HCore.registerListeners(new GlyphHandler1058()); + HCore.registerListeners(new KillMessageHandler1058()); + HCore.registerListeners(new VictoryDanceHandler1058()); + HCore.registerListeners(new FinalKillEffectHandler1058()); + HCore.registerListeners(new BedDestroyHandler1058()); + HCore.registerListeners(new WoodSkinHandler1058()); + HCore.registerListeners(new IslandTopperHandler1058()); + HCore.registerListeners(new ProjectileHandler(Cosmetics.getInstance())); + HCore.registerListeners(new DeathCryHandler1058()); + HCore.registerListeners(new SpraysHandler1058()); + } + + @Override + public IArenaUtil getArenaUtil() { + return player -> { + if(api.getArenaUtil().getArenaByPlayer(player) == null) return null; + + return (IArenaHandler) player1 -> new ITeamHandler() { + @Override + public Location getBed() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getBed().getBlock().getLocation(); + } + + @Override + public List getPlayers() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getMembers(); + } + + @Override + public String getName() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getName(); + } + + @Override + public Location getTeamUpgrades() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getTeamUpgrades(); + } + + @Override + public Location getShop() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getShop(); + } + + @Override + public Location getSpawn() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getSpawn(); + } + + @Override + public int getSize() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getSize(); + } + }; + }; + } + + @Override + public IScoreboardUtil getScoreboardUtil() { + return new IScoreboardUtil() { + + @Override + public void giveScoreboard(Player player, boolean b) { + api.getScoreboardUtil().givePlayerScoreboard(player, b); + } + + @Override + public void removePlayerScoreboard(Player player) { + api.getScoreboardUtil().removePlayerScoreboard(player); + } + }; + } + + @Override + public ILanguage getLanguageUtil() { + return new ILanguage() { + @Override + public String getMessage(Player player, String path) { + return api.getPlayerLanguage(player).getString(path); + } + + @Override + public List getMessageList(Player player, String path) { + return api.getPlayerLanguage(player).getList(path); + } + + @Override + public void saveIfNotExists(String path, Object data) { + Language.saveIfNotExists(path, data); + } + }; + } + + @Override + public String getAddonPath() { + return api.getAddonsPath().getPath() + File.separator + Cosmetics.getInstance().getDescription().getName(); + } + + @Override + public ISetupSession getSetupSession(UUID playerUUID) { + com.andrei1058.bedwars.api.server.ISetupSession session = api.getSetupSession(playerUUID); + if(session == null) return null; + ISetupSession cosmeticsSessionHandler = new ISetupSession() { + @Override + public UUID getPlayerUUID() { + return session.getPlayer().getUniqueId(); + } + + @Override + public FileConfiguration getConfig() { + return session.getConfig().getYml(); + } + + @Override + public void saveConfigLoc(String path, Location value) { + session.getConfig().saveConfigLoc(path, value); + } + + @Override + public void saveConfig() { + session.getConfig().save(); + } + }; + return cosmeticsSessionHandler; + } +} diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java new file mode 100644 index 00000000..751a7a10 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars1058/BW1058ProxyHandler.java @@ -0,0 +1,59 @@ +package me.defender.cosmetics.support.bedwars.handler.bedwars1058; + +import com.andrei1058.bedwars.proxy.BedWarsProxy; +import com.andrei1058.bedwars.proxy.api.BedWars; +import java.io.File; +import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.handler.*; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.UUID; + +public class BW1058ProxyHandler implements IHandler { + @Override + public void register() { + + } + + @Override + public ISetupSession getSetupSession(UUID playerUUID) { + return null; + } + + @Override + public IScoreboardUtil getScoreboardUtil() { + return null; + } + + @Override + public IArenaUtil getArenaUtil() { + return null; + } + + @Override + public String getAddonPath() { + return BedWarsProxy.getPlugin().getDataFolder() + File.separator + "Addons" + File.separator + Cosmetics.getInstance().getDescription().getName(); + } + + @Override + public ILanguage getLanguageUtil() { + BedWars.LanguageUtil languageUtil = BedWarsProxy.getAPI().getLanguageUtil(); + return new ILanguage() { + @Override + public String getMessage(Player player, String path) { + return languageUtil.getMsg(player, path); + } + + @Override + public List getMessageList(Player player, String path) { + return languageUtil.getList(player, path); + } + + @Override + public void saveIfNotExists(String path, Object data) { + languageUtil.saveIfNotExists(path, data); + } + }; + } +} diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java new file mode 100644 index 00000000..961589f7 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023Handler.java @@ -0,0 +1,161 @@ +package me.defender.cosmetics.support.bedwars.handler.bedwars2023; + +import com.hakan.core.HCore; +import com.tomkeuper.bedwars.api.BedWars; +import com.tomkeuper.bedwars.api.language.Language; +import java.io.File; +import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.handler.*; +import me.defender.cosmetics.category.bedbreakeffects.BedDestroyHandler2023; +import me.defender.cosmetics.category.deathcries.DeathCryHandler2023; +import me.defender.cosmetics.category.finalkilleffects.FinalKillEffectHandler2023; +import me.defender.cosmetics.category.glyphs.GlyphHandler2023; +import me.defender.cosmetics.category.islandtoppers.IslandTopperHandler2023; +import me.defender.cosmetics.category.killmessage.KillMessageHandler2023; +import me.defender.cosmetics.category.projectiletrails.ProjectileHandler; +import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler2023; +import me.defender.cosmetics.category.sprays.SpraysHandler2023; +import me.defender.cosmetics.category.victorydance.VictoryDanceHandler2023; +import me.defender.cosmetics.category.woodskin.WoodSkinHandler2023; +import org.bukkit.Location; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.UUID; + +public class BW2023Handler implements IHandler { + + private BedWars api = com.tomkeuper.bedwars.BedWars.getAPI(); + @Override + public void register() { + BedWars2023 bedWars2023 = new BedWars2023(Cosmetics.getInstance()); + bedWars2023.start(); + + HCore.registerListeners(new ProjectileHandler(Cosmetics.getInstance())); + HCore.registerListeners(new WoodSkinHandler2023()); + HCore.registerListeners(new VictoryDanceHandler2023()); + HCore.registerListeners(new ShopKeeperHandler2023()); + HCore.registerListeners(new KillMessageHandler2023()); + HCore.registerListeners(new IslandTopperHandler2023()); + HCore.registerListeners(new GlyphHandler2023()); + HCore.registerListeners(new FinalKillEffectHandler2023()); + HCore.registerListeners(new BedDestroyHandler2023()); + HCore.registerListeners(new SpraysHandler2023()); + HCore.registerListeners(new DeathCryHandler2023()); + } + + + @Override + public IArenaUtil getArenaUtil() { + return player -> { + if(api.getArenaUtil().getArenaByPlayer(player) == null) return null; + + return (IArenaHandler) player1 -> new ITeamHandler() { + @Override + public Location getBed() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getBed().getBlock().getLocation(); + } + + @Override + public List getPlayers() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getMembers(); + } + + @Override + public String getName() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getName(); + } + + @Override + public Location getTeamUpgrades() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getTeamUpgrades(); + } + + @Override + public Location getShop() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getShop(); + } + + @Override + public Location getSpawn() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getSpawn(); + } + + @Override + public int getSize() { + return api.getArenaUtil().getArenaByPlayer(player1).getTeam(player1).getSize(); + } + }; + }; + } + + @Override + public IScoreboardUtil getScoreboardUtil() { + return new IScoreboardUtil() { + + @Override + public void giveScoreboard(Player player, boolean b) { + api.getScoreboardUtil().givePlayerScoreboard(player, b); + } + + @Override + public void removePlayerScoreboard(Player player) { + api.getScoreboardUtil().removePlayerScoreboard(player); + } + }; + } + + @Override + public ILanguage getLanguageUtil() { + return new ILanguage() { + @Override + public String getMessage(Player player, String path) { + return api.getPlayerLanguage(player).getString(path); + } + + @Override + public List getMessageList(Player player, String path) { + return api.getPlayerLanguage(player).getList(path); + } + + @Override + public void saveIfNotExists(String path, Object data) { + Language.saveIfNotExists(path, data); + } + }; + } + + @Override + public String getAddonPath() { + return api.getAddonsPath().getPath() + File.separator + Cosmetics.getInstance().getDescription().getName(); + } + + @Override + public ISetupSession getSetupSession(UUID playerUUID) { + com.tomkeuper.bedwars.api.server.ISetupSession session = api.getSetupSession(playerUUID); + if(session == null) return null; + ISetupSession cosmeticsSessionHandler = new ISetupSession() { + @Override + public UUID getPlayerUUID() { + return session.getPlayer().getUniqueId(); + } + + @Override + public FileConfiguration getConfig() { + return session.getConfig().getYml(); + } + + @Override + public void saveConfigLoc(String path, Location value) { + session.getConfig().saveConfigLoc(path, value); + } + + @Override + public void saveConfig() { + session.getConfig().save(); + } + }; + return cosmeticsSessionHandler; + } +} diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java new file mode 100644 index 00000000..f75665c2 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BW2023ProxyHandler.java @@ -0,0 +1,59 @@ +package me.defender.cosmetics.support.bedwars.handler.bedwars2023; + +import com.tomkeuper.bedwars.proxy.BedWarsProxy; +import com.tomkeuper.bedwars.proxy.api.BedWars; +import java.io.File; +import me.defender.cosmetics.Cosmetics; +import me.defender.cosmetics.api.handler.*; +import org.bukkit.entity.Player; + +import java.util.List; +import java.util.UUID; + +public class BW2023ProxyHandler implements IHandler { + @Override + public void register() { + // What should be here? + } + + @Override + public String getAddonPath() { + return BedWarsProxy.getPlugin().getDataFolder().getPath() + File.separator + "Addons" + File.separator + Cosmetics.getInstance().getDescription().getName(); + } + + @Override + public ILanguage getLanguageUtil() { + BedWars.LanguageUtil languageUtil = BedWarsProxy.getAPI().getLanguageUtil(); + return new ILanguage() { + @Override + public String getMessage(Player player, String path) { + return languageUtil.getMsg(player, path); + } + + @Override + public List getMessageList(Player player, String path) { + return languageUtil.getList(player, path); + } + + @Override + public void saveIfNotExists(String path, Object data) { + languageUtil.saveIfNotExists(path, data); + } + }; + } + + @Override + public ISetupSession getSetupSession(UUID playerUUID) { + return null; + } + + @Override + public IScoreboardUtil getScoreboardUtil() { + return null; + } + + @Override + public IArenaUtil getArenaUtil() { + return null; + } +} diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/BedWars2023.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BedWars2023.java similarity index 52% rename from src/main/java/me/defender/cosmetics/support/bedwars/BedWars2023.java rename to src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BedWars2023.java index 4eabf3a8..550251dd 100644 --- a/src/main/java/me/defender/cosmetics/support/bedwars/BedWars2023.java +++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BedWars2023.java @@ -1,5 +1,6 @@ -package me.defender.cosmetics.support.bedwars; +package me.defender.cosmetics.support.bedwars.handler.bedwars2023; +import com.tomkeuper.bedwars.BedWars; import me.defender.cosmetics.Cosmetics; import org.bukkit.Bukkit; @@ -12,8 +13,7 @@ public BedWars2023(Cosmetics plugin) { public void start() { if (Bukkit.getPluginManager().getPlugin("BedWars2023") != null) { - plugin.setBedWars2023API(plugin.getServer().getServicesManager().getRegistration(com.tomkeuper.bedwars.api.BedWars.class).getProvider()); - plugin.getBedWars2023API().getAddonsUtil().registerAddon(new BedWars2023Addon(plugin)); + BedWars.getAPI().getAddonsUtil().registerAddon(new BedWars2023Addon(plugin)); } } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/support/bedwars/BedWars2023Addon.java b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BedWars2023Addon.java similarity index 93% rename from src/main/java/me/defender/cosmetics/support/bedwars/BedWars2023Addon.java rename to src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BedWars2023Addon.java index 9331a8ec..a8978f95 100644 --- a/src/main/java/me/defender/cosmetics/support/bedwars/BedWars2023Addon.java +++ b/src/main/java/me/defender/cosmetics/support/bedwars/handler/bedwars2023/BedWars2023Addon.java @@ -1,4 +1,4 @@ -package me.defender.cosmetics.support.bedwars; +package me.defender.cosmetics.support.bedwars.handler.bedwars2023; import com.tomkeuper.bedwars.api.addon.Addon; import me.defender.cosmetics.Cosmetics; diff --git a/src/main/java/me/defender/cosmetics/support/placeholders/Placeholders.java b/src/main/java/me/defender/cosmetics/support/placeholders/Placeholders.java index 2064034b..b8ba2e58 100644 --- a/src/main/java/me/defender/cosmetics/support/placeholders/Placeholders.java +++ b/src/main/java/me/defender/cosmetics/support/placeholders/Placeholders.java @@ -2,11 +2,10 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.data.PlayerOwnedData; import me.defender.cosmetics.util.StartupUtils; -import me.defender.cosmetics.util.Utility; -import me.defender.cosmetics.database.PlayerOwnedData; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -41,8 +40,8 @@ public boolean persist() { public String onPlaceholderRequest(Player player, String placeholder) { - BwcAPI api = new BwcAPI(); - PlayerOwnedData ownedData = Utility.playerOwnedDataList.get(player.getUniqueId()); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); + PlayerOwnedData ownedData = Cosmetics.getInstance().getPlayerManager().getPlayerOwnedData(player.getUniqueId()); switch (placeholder.toLowerCase()) { case "selected_dc": return api.getSelectedCosmetic(player, CosmeticsType.DeathCries); diff --git a/src/main/java/me/defender/cosmetics/support/sounds/GSound.java b/src/main/java/me/defender/cosmetics/support/sounds/GSound.java deleted file mode 100644 index 27f22d7d..00000000 --- a/src/main/java/me/defender/cosmetics/support/sounds/GSound.java +++ /dev/null @@ -1,1069 +0,0 @@ -package me.defender.cosmetics.support.sounds; - -import org.bukkit.Bukkit; -import org.bukkit.Sound; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public enum GSound { - /* - * - * GSound for 1.14 - 1.8 by Gober - * - */ - AMBIENT_CAVE("same", "same", "same", "same", "same", "AMBIENCE_CAVE"), - AMBIENT_UNDERWATER_ENTER("same", "", "", "", "", ""), - AMBIENT_UNDERWATER_EXIT("same", "", "", "", "", ""), - AMBIENT_UNDERWATER_LOOP("same", "", "", "", "", ""), - AMBIENT_UNDERWATER_LOOP_ADDITIONS("same", "", "", "", "", ""), - AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE("same", "", "", "", "", ""), - AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE("same", "", "", "", "", ""), - BLOCK_ANVIL_BREAK("same", "same", "same", "same", "same", "ANVIL_BREAK"), - BLOCK_ANVIL_DESTROY("same", "same", "same", "same", "same", ""), - BLOCK_ANVIL_FALL("same", "same", "same", "same", "same", ""), - BLOCK_ANVIL_HIT("same", "same", "same", "same", "same", "ANVIL_HIT"), - BLOCK_ANVIL_LAND("same", "same", "same", "same", "same", "ANVIL_LAND"), - BLOCK_ANVIL_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_ANVIL_STEP("same", "same", "same", "same", "same", ""), - BLOCK_ANVIL_USE("same", "same", "same", "same", "same", "ANVIL_USE"), - BLOCK_BAMBOO_BREAK("", "", "", "", "", ""), - BLOCK_BAMBOO_FALL("", "", "", "", "", ""), - BLOCK_BAMBOO_HIT("", "", "", "", "", ""), - BLOCK_BAMBOO_PLACE("", "", "", "", "", ""), - BLOCK_BAMBOO_SAPLING_BREAK("", "", "", "", "", ""), - BLOCK_BAMBOO_SAPLING_HIT("", "", "", "", "", ""), - BLOCK_BAMBOO_SAPLING_PLACE("", "", "", "", "", ""), - BLOCK_BAMBOO_STEP("", "", "", "", "", ""), - BLOCK_BARREL_CLOSE("", "", "", "", "", ""), - BLOCK_BARREL_OPEN("", "", "", "", "", ""), - BLOCK_BEACON_ACTIVATE("same", "", "", "", "", ""), - BLOCK_BEACON_AMBIENT("same", "", "", "", "", ""), - BLOCK_BEACON_DEACTIVATE("same", "", "", "", "", ""), - BLOCK_BEACON_POWER_SELECT("same", "", "", "", "", ""), - BLOCK_BELL_RESONATE("", "", "", "", "", ""), - BLOCK_BELL_USE("", "", "", "", "", ""), - BLOCK_BLASTFURNACE_FIRE_CRACKLE("", "", "", "", "", ""), - BLOCK_BREWING_STAND_BREW("same", "same", "same", "same", "same", ""), - BLOCK_BUBBLE_COLUMN_BUBBLE_POP("same", "", "", "", "", ""), - BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT("same", "", "", "", "", ""), - BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE("same", "", "", "", "", ""), - BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT("same", "", "", "", "", ""), - BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE("same", "", "", "", "", ""), - BLOCK_CAMPFIRE_CRACKLE("", "", "", "", "", ""), - BLOCK_CHEST_CLOSE("same", "same", "same", "same", "same", "CHEST_CLOSE"), - BLOCK_CHEST_LOCKED("same", "same", "same", "same", "same", ""), - BLOCK_CHEST_OPEN("same", "same", "same", "same", "same", "CHEST_OPEN"), - BLOCK_CHORUS_FLOWER_DEATH("same", "same", "same", "same", "same", ""), - BLOCK_CHORUS_FLOWER_GROW("same", "same", "same", "same", "same", ""), - BLOCK_COMPARATOR_CLICK("same", "same", "same", "same", "same", ""), - BLOCK_COMPOSTER_EMPTY("", "", "", "", "", ""), - BLOCK_COMPOSTER_FILL("", "", "", "", "", ""), - BLOCK_COMPOSTER_FILL_SUCCESS("", "", "", "", "", ""), - BLOCK_COMPOSTER_READY("", "", "", "", "", ""), - BLOCK_CONDUIT_ACTIVATE("same", "", "", "", "", ""), - BLOCK_CONDUIT_AMBIENT("same", "", "", "", "", ""), - BLOCK_CONDUIT_AMBIENT_SHORT("same", "", "", "", "", ""), - BLOCK_CONDUIT_ATTACK_TARGET("same", "", "", "", "", ""), - BLOCK_CONDUIT_DEACTIVATE("same", "", "", "", "", ""), - BLOCK_CORAL_BLOCK_BREAK("same", "", "", "", "", ""), - BLOCK_CORAL_BLOCK_FALL("same", "", "", "", "", ""), - BLOCK_CORAL_BLOCK_HIT("same", "", "", "", "", ""), - BLOCK_CORAL_BLOCK_PLACE("same", "", "", "", "", ""), - BLOCK_CORAL_BLOCK_STEP("same", "", "", "", "", ""), - BLOCK_CROP_BREAK("", "", "", "", "", ""), - BLOCK_DISPENSER_DISPENSE("same", "same", "same", "same", "same", ""), - BLOCK_DISPENSER_FAIL("same", "same", "same", "same", "same", ""), - BLOCK_DISPENSER_LAUNCH("same", "same", "same", "same", "same", ""), - BLOCK_ENCHANTMENT_TABLE_USE("same", "same", "same", "same", "", ""), - BLOCK_ENDER_CHEST_CLOSE("same", "BLOCK_ENDERCHEST_CLOSE", "BLOCK_ENDERCHEST_CLOSE", "BLOCK_ENDERCHEST_CLOSE", "BLOCK_ENDERCHEST_CLOSE", ""), - BLOCK_ENDER_CHEST_OPEN("same", "BLOCK_ENDERCHEST_OPEN", "BLOCK_ENDERCHEST_OPEN", "BLOCK_ENDERCHEST_OPEN", "BLOCK_ENDERCHEST_OPEN", ""), - BLOCK_END_GATEWAY_SPAWN("same", "same", "same", "same", "same", ""), - BLOCK_END_PORTAL_FRAME_FILL("same", "same", "", "", "", ""), - BLOCK_END_PORTAL_SPAWN("same", "same", "", "", "", ""), - BLOCK_FENCE_GATE_CLOSE("same", "same", "same", "same", "same", ""), - BLOCK_FENCE_GATE_OPEN("same", "same", "same", "same", "same", ""), - BLOCK_FIRE_AMBIENT("same", "same", "same", "same", "same", "FIRE"), - BLOCK_FIRE_EXTINGUISH("same", "same", "same", "same", "same", "FIZZ"), - BLOCK_FURNACE_FIRE_CRACKLE("same", "same", "same", "same", "same", ""), - BLOCK_GLASS_BREAK("same", "same", "same", "same", "same", "GLASS"), - BLOCK_GLASS_FALL("same", "same", "same", "same", "same", ""), - BLOCK_GLASS_HIT("same", "same", "same", "same", "same", ""), - BLOCK_GLASS_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_GLASS_STEP("same", "same", "same", "same", "same", ""), - BLOCK_GRASS_BREAK("same", "same", "same", "same", "same", "DIG_GRASS"), - BLOCK_GRASS_FALL("same", "same", "same", "same", "same", ""), - BLOCK_GRASS_HIT("same", "same", "same", "same", "same", ""), - BLOCK_GRASS_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_GRASS_STEP("same", "same", "same", "same", "same", ""), - BLOCK_GRAVEL_BREAK("same", "same", "same", "same", "same", "DIG_GRAVEL"), - BLOCK_GRAVEL_FALL("same", "same", "same", "same", "same", ""), - BLOCK_GRAVEL_HIT("same", "same", "same", "same", "same", ""), - BLOCK_GRAVEL_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_GRAVEL_STEP("same", "same", "same", "same", "same", "STEP_GRAVEL"), - BLOCK_GRINDSTONE_USE("", "", "", "", "", ""), - BLOCK_IRON_DOOR_CLOSE("same", "same", "same", "same", "same", ""), - BLOCK_IRON_DOOR_OPEN("same", "same", "same", "same", "same", ""), - BLOCK_IRON_TRAPDOOR_CLOSE("same", "same", "same", "same", "same", ""), - BLOCK_IRON_TRAPDOOR_OPEN("same", "same", "same", "same", "same", ""), - BLOCK_LADDER_BREAK("same", "same", "same", "same", "same", ""), - BLOCK_LADDER_FALL("same", "same", "same", "same", "same", ""), - BLOCK_LADDER_HIT("same", "same", "same", "same", "same", ""), - BLOCK_LADDER_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_LADDER_STEP("same", "same", "same", "same", "same", "STEP_LADDER"), - BLOCK_LANTERN_BREAK("", "", "", "", "", ""), - BLOCK_LANTERN_FALL("", "", "", "", "", ""), - BLOCK_LANTERN_HIT("", "", "", "", "", ""), - BLOCK_LANTERN_PLACE("", "", "", "", "", ""), - BLOCK_LANTERN_STEP("", "", "", "", "", ""), - BLOCK_LAVA_AMBIENT("same", "same", "same", "same", "same", "LAVA"), - BLOCK_LAVA_EXTINGUISH("same", "same", "same", "same", "same", "FIZZ"), - BLOCK_LAVA_POP("same", "same", "same", "same", "same", "LAVA_POP"), - BLOCK_LEVER_CLICK("same", "same", "same", "same", "same", ""), - BLOCK_LILY_PAD_PLACE("same", "BLOCK_WATERLILY_PLACE", "BLOCK_WATERLILY_PLACE", "BLOCK_WATERLILY_PLACE", "BLOCK_WATERLILY_PLACE", ""), - BLOCK_METAL_BREAK("same", "same", "same", "same", "same", ""), - BLOCK_METAL_FALL("same", "same", "same", "same", "same", ""), - BLOCK_METAL_HIT("same", "same", "same", "same", "same", ""), - BLOCK_METAL_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF("same", "BLOCK_METAL_PRESSUREPLATE_CLICK_OFF", "BLOCK_METAL_PRESSUREPLATE_CLICK_OFF", "BLOCK_METAL_PRESSUREPLATE_CLICK_OFF", "BLOCK_METAL_PRESSUREPLATE_CLICK_OFF", ""), - BLOCK_METAL_PRESSURE_PLATE_CLICK_ON("same", "BLOCK_METAL_PRESSUREPLATE_CLICK_ON", "BLOCK_METAL_PRESSUREPLATE_CLICK_ON", "BLOCK_METAL_PRESSUREPLATE_CLICK_ON", "BLOCK_METAL_PRESSUREPLATE_CLICK_ON", ""), - BLOCK_METAL_STEP("same", "same", "same", "same", "same", ""), - BLOCK_NETHER_WART_BREAK("", "", "", "", "", ""), - BLOCK_NOTE_BLOCK_BANJO("", "", "", "", "", ""), - BLOCK_NOTE_BLOCK_BASEDRUM("same", "BLOCK_NOTE_BASEDRUM", "BLOCK_NOTE_BASEDRUM", "BLOCK_NOTE_BASEDRUM", "BLOCK_NOTE_BASEDRUM", "NOTE_SNARE_DRUM"), - BLOCK_NOTE_BLOCK_BASS("same", "BLOCK_NOTE_BASS", "BLOCK_NOTE_BASS", "BLOCK_NOTE_BASS", "BLOCK_NOTE_BASS", "NOTE_BASS"), - BLOCK_NOTE_BLOCK_BELL("same", "BLOCK_NOTE_BELL", "", "", "", ""), - BLOCK_NOTE_BLOCK_BIT("", "", "", "", "", ""), - BLOCK_NOTE_BLOCK_CHIME("same", "BLOCK_NOTE_CHIME", "", "", "", ""), - BLOCK_NOTE_BLOCK_COW_BELL("", "", "", "", "", ""), - BLOCK_NOTE_BLOCK_DIDGERIDOO("", "", "", "", "", ""), - BLOCK_NOTE_BLOCK_FLUTE("same", "BLOCK_NOTE_FLUTE", "", "", "", "NOTE_BASS_DRUM"), - BLOCK_NOTE_BLOCK_GUITAR("same", "BLOCK_NOTE_GUITAR", "", "", "", "NOTE_BASS_GUITAR"), - BLOCK_NOTE_BLOCK_HARP("same", "BLOCK_NOTE_HARP", "BLOCK_NOTE_HARP", "BLOCK_NOTE_HARP", "BLOCK_NOTE_HARP", "NOTE_PIANO"), - BLOCK_NOTE_BLOCK_HAT("same", "BLOCK_NOTE_HAT", "BLOCK_NOTE_HAT", "BLOCK_NOTE_HAT", "BLOCK_NOTE_HAT", "NOTE_STICKS"), - BLOCK_NOTE_BLOCK_IRON_XYLOPHONE("", "", "", "", "", ""), - BLOCK_NOTE_BLOCK_PLING("same", "BLOCK_NOTE_PLING", "BLOCK_NOTE_PLING", "BLOCK_NOTE_PLING", "BLOCK_NOTE_PLING", "NOTE_PLING"), - BLOCK_NOTE_BLOCK_SNARE("same", "BLOCK_NOTE_SNARE", "BLOCK_NOTE_SNARE", "BLOCK_NOTE_SNARE", "BLOCK_NOTE_SNARE", "NOTE_SNARE"), - BLOCK_NOTE_BLOCK_XYLOPHONE("same", "BLOCK_NOTE_XYLOPHONE", "", "", "", ""), - BLOCK_PISTON_CONTRACT("same", "same", "same", "same", "same", "PISTON_RETRACT"), - BLOCK_PISTON_EXTEND("same", "same", "same", "same", "same", "PISTON_EXTEND"), - BLOCK_PORTAL_AMBIENT("same", "same", "same", "same", "same", "PORTAL"), - BLOCK_PORTAL_TRAVEL("same", "same", "same", "same", "same", "PORTAL_TRAVEL"), - BLOCK_PORTAL_TRIGGER("same", "same", "same", "same", "same", "PORTAL_TRIGGER"), - BLOCK_PUMPKIN_CARVE("same", "", "", "", "", ""), - BLOCK_REDSTONE_TORCH_BURNOUT("same", "same", "same", "same", "same", ""), - BLOCK_SAND_BREAK("same", "same", "same", "same", "same", "DIG_SAND"), - BLOCK_SAND_FALL("same", "same", "same", "same", "same", ""), - BLOCK_SAND_HIT("same", "same", "same", "same", "same", ""), - BLOCK_SAND_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_SAND_STEP("same", "same", "same", "same", "same", "STEP_SAND"), - BLOCK_SCAFFOLDING_BREAK("", "", "", "", "", ""), - BLOCK_SCAFFOLDING_FALL("", "", "", "", "", ""), - BLOCK_SCAFFOLDING_HIT("", "", "", "", "", ""), - BLOCK_SCAFFOLDING_PLACE("", "", "", "", "", ""), - BLOCK_SCAFFOLDING_STEP("", "", "", "", "", ""), - BLOCK_SHULKER_BOX_CLOSE("same", "same", "same", "", "", ""), - BLOCK_SHULKER_BOX_OPEN("same", "same", "same", "", "", ""), - BLOCK_SLIME_BLOCK_BREAK("same", "BLOCK_SLIME_BREAK", "BLOCK_SLIME_BREAK", "BLOCK_SLIME_BREAK", "BLOCK_SLIME_BREAK", ""), - BLOCK_SLIME_BLOCK_FALL("same", "BLOCK_SLIME_FALL", "BLOCK_SLIME_FALL", "BLOCK_SLIME_FALL", "BLOCK_SLIME_FALL", ""), - BLOCK_SLIME_BLOCK_HIT("same", "BLOCK_SLIME_HIT", "BLOCK_SLIME_HIT", "BLOCK_SLIME_HIT", "BLOCK_SLIME_HIT", ""), - BLOCK_SLIME_BLOCK_PLACE("same", "BLOCK_SLIME_PLACE", "BLOCK_SLIME_PLACE", "BLOCK_SLIME_PLACE", "BLOCK_SLIME_PLACE", ""), - BLOCK_SLIME_BLOCK_STEP("same", "BLOCK_SLIME_STEP", "BLOCK_SLIME_STEP", "BLOCK_SLIME_STEP", "BLOCK_SLIME_STEP", ""), - BLOCK_SMOKER_SMOKE("", "", "", "", "", ""), - BLOCK_SNOW_BREAK("same", "same", "same", "same", "same", "DIG_SNOW"), - BLOCK_SNOW_FALL("same", "same", "same", "same", "same", ""), - BLOCK_SNOW_HIT("same", "same", "same", "same", "same", ""), - BLOCK_SNOW_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_SNOW_STEP("same", "same", "same", "same", "same", "STEP_SNOW"), - BLOCK_STONE_BREAK("same", "same", "same", "same", "same", "DIG_STONE"), - BLOCK_STONE_BUTTON_CLICK_OFF("same", "same", "same", "same", "same", ""), - BLOCK_STONE_BUTTON_CLICK_ON("same", "same", "same", "same", "same", ""), - BLOCK_STONE_FALL("same", "same", "same", "same", "same", ""), - BLOCK_STONE_HIT("same", "same", "same", "same", "same", ""), - BLOCK_STONE_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF("same", "BLOCK_STONE_PRESSUREPLATE_CLICK_OFF", "BLOCK_STONE_PRESSUREPLATE_CLICK_OFF", "BLOCK_STONE_PRESSUREPLATE_CLICK_OFF", "BLOCK_STONE_PRESSUREPLATE_CLICK_OFF", ""), - BLOCK_STONE_PRESSURE_PLATE_CLICK_ON("same", "BLOCK_STONE_PRESSUREPLATE_CLICK_ON", "BLOCK_STONE_PRESSUREPLATE_CLICK_ON", "BLOCK_STONE_PRESSUREPLATE_CLICK_ON", "BLOCK_STONE_PRESSUREPLATE_CLICK_ON", ""), - BLOCK_STONE_STEP("same", "same", "same", "same", "same", "STEP_STONE"), - BLOCK_SWEET_BERRY_BUSH_BREAK("", "", "", "", "", ""), - BLOCK_SWEET_BERRY_BUSH_PLACE("", "", "", "", "", ""), - BLOCK_TRIPWIRE_ATTACH("same", "same", "same", "same", "same", ""), - BLOCK_TRIPWIRE_CLICK_OFF("same", "same", "same", "same", "same", ""), - BLOCK_TRIPWIRE_CLICK_ON("same", "same", "same", "same", "same", ""), - BLOCK_TRIPWIRE_DETACH("same", "same", "same", "same", "same", ""), - BLOCK_WATER_AMBIENT("same", "same", "same", "same", "same", "WATER"), - BLOCK_WET_GRASS_BREAK("same", "", "", "", "", ""), - BLOCK_WET_GRASS_FALL("same", "", "", "", "", ""), - BLOCK_WET_GRASS_HIT("same", "", "", "", "", ""), - BLOCK_WET_GRASS_PLACE("same", "", "", "", "", ""), - BLOCK_WET_GRASS_STEP("same", "", "", "", "", ""), - BLOCK_WOODEN_BUTTON_CLICK_OFF("same", "BLOCK_WOOD_BUTTON_CLICK_OFF", "BLOCK_WOOD_BUTTON_CLICK_OFF", "BLOCK_WOOD_BUTTON_CLICK_OFF", "BLOCK_WOOD_BUTTON_CLICK_OFF", ""), - BLOCK_WOODEN_BUTTON_CLICK_ON("same", "BLOCK_WOOD_BUTTON_CLICK_ON", "BLOCK_WOOD_BUTTON_CLICK_ON", "BLOCK_WOOD_BUTTON_CLICK_ON", "BLOCK_WOOD_BUTTON_CLICK_ON", "WOOD_CLICK"), - BLOCK_WOODEN_DOOR_CLOSE("same", "same", "same", "same", "same", "DOOR_CLOSE"), - BLOCK_WOODEN_DOOR_OPEN("same", "same", "same", "same", "same", "DOOR_OPEN"), - BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF("same", "BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF", "BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF", "BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF", "BLOCK_WOOD_PRESSUREPLATE_CLICK_OFF", ""), - BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON("same", "BLOCK_WOOD_PRESSUREPLATE_CLICK_ON", "BLOCK_WOOD_PRESSUREPLATE_CLICK_ON", "BLOCK_WOOD_PRESSUREPLATE_CLICK_ON", "BLOCK_WOOD_PRESSUREPLATE_CLICK_ON", ""), - BLOCK_WOODEN_TRAPDOOR_CLOSE("same", "same", "same", "same", "same", ""), - BLOCK_WOODEN_TRAPDOOR_OPEN("same", "same", "same", "same", "same", ""), - BLOCK_WOOD_BREAK("same", "same", "same", "same", "same", "DIG_WOOD"), - BLOCK_WOOD_FALL("same", "same", "same", "same", "same", ""), - BLOCK_WOOD_HIT("same", "same", "same", "same", "same", ""), - BLOCK_WOOD_PLACE("same", "same", "same", "same", "same", ""), - BLOCK_WOOD_STEP("same", "same", "same", "same", "same", "STEP_WOOD"), - BLOCK_WOOL_BREAK("same", "BLOCK_CLOTH_BREAK", "BLOCK_CLOTH_BREAK", "BLOCK_CLOTH_BREAK", "BLOCK_CLOTH_BREAK", "DIG_WOOL"), - BLOCK_WOOL_FALL("same", "BLOCK_CLOTH_FALL", "BLOCK_CLOTH_FALL", "BLOCK_CLOTH_FALL", "BLOCK_CLOTH_FALL", ""), - BLOCK_WOOL_HIT("same", "BLOCK_CLOTH_HIT", "BLOCK_CLOTH_HIT", "BLOCK_CLOTH_HIT", "BLOCK_CLOTH_HIT", ""), - BLOCK_WOOL_PLACE("same", "BLOCK_CLOTH_PLACE", "BLOCK_CLOTH_PLACE", "BLOCK_CLOTH_PLACE", "BLOCK_CLOTH_PLACE", ""), - BLOCK_WOOL_STEP("same", "BLOCK_CLOTH_STEP", "BLOCK_CLOTH_STEP", "BLOCK_CLOTH_STEP", "BLOCK_CLOTH_STEP", "STEP_CLOTH"), - ENCHANT_THORNS_HIT("same", "same", "same", "same", "same", ""), - ENTITY_ARMOR_STAND_BREAK("same", "ENTITY_ARMORSTAND_BREAK", "ENTITY_ARMORSTAND_BREAK", "ENTITY_ARMORSTAND_BREAK", "ENTITY_ARMORSTAND_BREAK", ""), - ENTITY_ARMOR_STAND_FALL("same", "ENTITY_ARMORSTAND_FALL", "ENTITY_ARMORSTAND_FALL", "ENTITY_ARMORSTAND_FALL", "ENTITY_ARMORSTAND_FALL", ""), - ENTITY_ARMOR_STAND_HIT("same", "ENTITY_ARMORSTAND_HIT", "ENTITY_ARMORSTAND_HIT", "ENTITY_ARMORSTAND_HIT", "ENTITY_ARMORSTAND_HIT", ""), - ENTITY_ARMOR_STAND_PLACE("same", "ENTITY_ARMORSTAND_PLACE", "ENTITY_ARMORSTAND_PLACE", "ENTITY_ARMORSTAND_PLACE", "ENTITY_ARMORSTAND_PLACE", ""), - ENTITY_ARROW_HIT("same", "same", "same", "same", "same", "ARROW_HIT"), - ENTITY_ARROW_HIT_PLAYER("same", "same", "same", "same", "same", ""), - ENTITY_ARROW_SHOOT("same", "same", "same", "same", "same", "SHOOT_ARROW"), - ENTITY_BAT_AMBIENT("same", "same", "same", "same", "same", "BAT_IDLE"), - ENTITY_BAT_DEATH("same", "same", "same", "same", "same", "BAT_DEATH"), - ENTITY_BAT_HURT("same", "same", "same", "same", "same", "BAT_HURT"), - ENTITY_BAT_LOOP("same", "same", "same", "same", "same", "BAT_LOOP"), - ENTITY_BAT_TAKEOFF("same", "same", "same", "same", "same", "BAT_TAKEOFF"), - ENTITY_BLAZE_AMBIENT("same", "same", "same", "same", "same", "BLAZE_BREATH"), - ENTITY_BLAZE_BURN("same", "same", "same", "same", "same", ""), - ENTITY_BLAZE_DEATH("same", "same", "same", "same", "same", "BLAZE_DEATH"), - ENTITY_BLAZE_HURT("same", "same", "same", "same", "same", "BLAZE_HURT"), - ENTITY_BLAZE_SHOOT("same", "same", "same", "same", "same", ""), - ENTITY_BOAT_PADDLE_LAND("same", "same", "", "", "", ""), - ENTITY_BOAT_PADDLE_WATER("same", "same", "", "", "", ""), - ENTITY_CAT_AMBIENT("same", "same", "same", "same", "same", "CAT_MEOW"), - ENTITY_CAT_BEG_FOR_FOOD("", "", "", "", "", ""), - ENTITY_CAT_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_CAT_EAT("", "", "", "", "", ""), - ENTITY_CAT_HISS("same", "same", "same", "same", "same", "CAT_HISS"), - ENTITY_CAT_HURT("same", "same", "same", "same", "same", "CAT_HIT"), - ENTITY_CAT_PURR("same", "same", "same", "same", "same", "CAT_PURR"), - ENTITY_CAT_PURREOW("same", "same", "same", "same", "same", "CAT_PURREOW"), - ENTITY_CAT_STRAY_AMBIENT("", "", "", "", "", ""), - ENTITY_CHICKEN_AMBIENT("same", "same", "same", "same", "same", "CHICKEN_IDLE"), - ENTITY_CHICKEN_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_CHICKEN_EGG("same", "same", "same", "same", "same", "CHICKEN_EGG_POP"), - ENTITY_CHICKEN_HURT("same", "same", "same", "same", "same", "CHICKEN_HURT"), - ENTITY_CHICKEN_STEP("same", "same", "same", "same", "same", "CHICKEN_WALK"), - ENTITY_COD_AMBIENT("same", "", "", "", "", ""), - ENTITY_COD_DEATH("same", "", "", "", "", ""), - ENTITY_COD_FLOP("same", "", "", "", "", ""), - ENTITY_COD_HURT("same", "", "", "", "", ""), - ENTITY_COW_AMBIENT("same", "same", "same", "same", "same", "COW_IDLE"), - ENTITY_COW_DEATH("same", "same", "same", "same", "same", "COW_DEATH"), - ENTITY_COW_HURT("same", "same", "same", "same", "same", "COW_HURT"), - ENTITY_COW_MILK("same", "same", "same", "same", "same", ""), - ENTITY_COW_STEP("same", "same", "same", "same", "same", "COW_WALK"), - ENTITY_CREEPER_DEATH("same", "same", "same", "same", "same", "CREEPER_DEATH"), - ENTITY_CREEPER_HURT("same", "same", "same", "same", "same", ""), - ENTITY_CREEPER_PRIMED("same", "same", "same", "same", "same", "CREEPER_HISS"), - ENTITY_DOLPHIN_AMBIENT("same", "", "", "", "", ""), - ENTITY_DOLPHIN_AMBIENT_WATER("same", "", "", "", "", ""), - ENTITY_DOLPHIN_ATTACK("same", "", "", "", "", ""), - ENTITY_DOLPHIN_DEATH("same", "", "", "", "", ""), - ENTITY_DOLPHIN_EAT("same", "", "", "", "", ""), - ENTITY_DOLPHIN_HURT("same", "", "", "", "", ""), - ENTITY_DOLPHIN_JUMP("same", "", "", "", "", ""), - ENTITY_DOLPHIN_PLAY("same", "", "", "", "", ""), - ENTITY_DOLPHIN_SPLASH("same", "", "", "", "", ""), - ENTITY_DOLPHIN_SWIM("same", "", "", "", "", ""), - ENTITY_DONKEY_AMBIENT("same", "same", "same", "same", "same", "DONKEY_IDLE"), - ENTITY_DONKEY_ANGRY("same", "same", "same", "same", "same", "DONKEY_ANGRY"), - ENTITY_DONKEY_CHEST("same", "same", "same", "same", "same", ""), - ENTITY_DONKEY_DEATH("same", "same", "same", "same", "same", "DONKEY_DEATH"), - ENTITY_DONKEY_HURT("same", "same", "same", "same", "same", "DONKEY_HIT"), - ENTITY_DRAGON_FIREBALL_EXPLODE("same", "", "", "", "", ""), - ENTITY_DROWNED_AMBIENT("same", "", "", "", "", ""), - ENTITY_DROWNED_AMBIENT_WATER("same", "", "", "", "", ""), - ENTITY_DROWNED_DEATH("same", "", "", "", "", ""), - ENTITY_DROWNED_DEATH_WATER("same", "", "", "", "", ""), - ENTITY_DROWNED_HURT("same", "", "", "", "", ""), - ENTITY_DROWNED_HURT_WATER("same", "", "", "", "", ""), - ENTITY_DROWNED_SHOOT("same", "", "", "", "", ""), - ENTITY_DROWNED_STEP("same", "", "", "", "", ""), - ENTITY_DROWNED_SWIM("same", "", "", "", "", ""), - ENTITY_EGG_THROW("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_AMBIENT_LAND("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_CURSE("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_DEATH_LAND("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_FLOP("same", "same", "same", "", "", ""), - ENTITY_ELDER_GUARDIAN_HURT("same", "same", "same", "same", "same", ""), - ENTITY_ELDER_GUARDIAN_HURT_LAND("same", "same", "same", "same", "same", ""), - ENTITY_ENDERMAN_AMBIENT("same", "ENTITY_ENDERMEN_AMBIENT", "ENTITY_ENDERMEN_AMBIENT", "ENTITY_ENDERMEN_AMBIENT", "ENTITY_ENDERMEN_AMBIENT", "ENDERMAN_IDLE"), - ENTITY_ENDERMAN_DEATH("same", "ENTITY_ENDERMEN_DEATH", "ENTITY_ENDERMEN_DEATH", "ENTITY_ENDERMEN_DEATH", "ENTITY_ENDERMEN_DEATH", "ENDERMAN_DEATH"), - ENTITY_ENDERMAN_HURT("same", "ENTITY_ENDERMEN_HURT", "ENTITY_ENDERMEN_HURT", "ENTITY_ENDERMEN_HURT", "ENTITY_ENDERMEN_HURT", "ENDERMAN_HIT"), - ENTITY_ENDERMAN_SCREAM("same", "ENTITY_ENDERMEN_SCREAM", "ENTITY_ENDERMEN_SCREAM", "ENTITY_ENDERMEN_SCREAM", "ENTITY_ENDERMEN_SCREAM", "ENDERMAN_SCREAM"), - ENTITY_ENDERMAN_STARE("same", "ENTITY_ENDERMEN_STARE", "ENTITY_ENDERMEN_STARE", "ENTITY_ENDERMEN_STARE", "ENTITY_ENDERMEN_STARE", "ENDERMAN_STARE"), - ENTITY_ENDERMAN_TELEPORT("same", "ENTITY_ENDERMEN_TELEPORT", "ENTITY_ENDERMEN_TELEPORT", "ENTITY_ENDERMEN_TELEPORT", "ENTITY_ENDERMEN_TELEPORT", "ENDERMAN_TELEPORT"), - ENTITY_ENDERMITE_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_ENDERMITE_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_ENDERMITE_HURT("same", "same", "same", "same", "same", ""), - ENTITY_ENDERMITE_STEP("same", "same", "same", "same", "same", ""), - ENTITY_ENDER_DRAGON_AMBIENT("same", "ENTITY_ENDERDRAGON_AMBIENT", "ENTITY_ENDERDRAGON_AMBIENT", "ENTITY_ENDERDRAGON_AMBIENT", "ENTITY_ENDERDRAGON_AMBIENT", ""), - ENTITY_ENDER_DRAGON_DEATH("same", "ENTITY_ENDERDRAGON_DEATH", "ENTITY_ENDERDRAGON_DEATH", "ENTITY_ENDERDRAGON_DEATH", "ENTITY_ENDERDRAGON_DEATH", "ENDERDRAGON_DEATH"), - ENTITY_ENDER_DRAGON_FLAP("same", "ENTITY_ENDERDRAGON_FLAP", "ENTITY_ENDERDRAGON_FLAP", "ENTITY_ENDERDRAGON_FLAP", "ENTITY_ENDERDRAGON_FLAP", "ENDERDRAGON_WINGS"), - ENTITY_ENDER_DRAGON_GROWL("same", "ENTITY_ENDERDRAGON_GROWL", "ENTITY_ENDERDRAGON_GROWL", "ENTITY_ENDERDRAGON_GROWL", "ENTITY_ENDERDRAGON_GROWL", "ENDERDRAGON_GROWL"), - ENTITY_ENDER_DRAGON_HURT("same", "ENTITY_ENDERDRAGON_HURT", "ENTITY_ENDERDRAGON_HURT", "ENTITY_ENDERDRAGON_HURT", "ENTITY_ENDERDRAGON_HURT", "ENDERDRAGON_HIT"), - ENTITY_ENDER_DRAGON_SHOOT("same", "ENTITY_ENDERDRAGON_SHOOT", "ENTITY_ENDERDRAGON_SHOOT", "ENTITY_ENDERDRAGON_SHOOT", "ENTITY_ENDERDRAGON_SHOOT", ""), - ENTITY_ENDER_EYE_DEATH("same", "ENTITY_ENDEREYE_DEATH", "", "", "", ""), - ENTITY_ENDER_EYE_LAUNCH("same", "ENTITY_ENDEREYE_LAUNCH", "ENTITY_ENDEREYE_LAUNCH", "ENTITY_ENDEREYE_LAUNCH", "ENTITY_ENDEREYE_LAUNCH", ""), - ENTITY_ENDER_PEARL_THROW("same", "ENTITY_ENDERPEARL_THROW", "ENTITY_ENDERPEARL_THROW", "ENTITY_ENDERPEARL_THROW", "ENTITY_ENDERPEARL_THROW", ""), - ENTITY_EVOKER_AMBIENT("same", "ENTITY_EVOCATION_ILLAGER_AMBIENT", "ENTITY_EVOCATION_ILLAGER_AMBIENT", "", "", ""), - ENTITY_EVOKER_CAST_SPELL("same", "ENTITY_EVOCATION_ILLAGER_CAST_SPELL", "ENTITY_EVOCATION_ILLAGER_CAST_SPELL", "", "", ""), - ENTITY_EVOKER_CELEBRATE("", "", "", "", "", ""), - ENTITY_EVOKER_DEATH("same", "ENTITY_EVOCATION_ILLAGER_DEATH", "ENTITY_EVOCATION_ILLAGER_DEATH", "", "", ""), - ENTITY_EVOKER_FANGS_ATTACK("same", "ENTITY_EVOCATION_FANGS_ATTACK", "ENTITY_EVOCATION_FANGS_ATTACK", "", "", ""), - ENTITY_EVOKER_HURT("same", "ENTITY_EVOCATION_ILLAGER_HURT", "ENTITY_EVOCATION_ILLAGER_HURT", "", "", ""), - ENTITY_EVOKER_PREPARE_ATTACK("same", "ENTITY_EVOCATION_ILLAGER_PREPARE_ATTACK", "ENTITY_EVOCATION_ILLAGER_PREPARE_ATTACK", "", "", ""), - ENTITY_EVOKER_PREPARE_SUMMON("same", "ENTITY_EVOCATION_ILLAGER_PREPARE_SUMMON", "ENTITY_EVOCATION_ILLAGER_PREPARE_SUMMON", "", "", ""), - ENTITY_EVOKER_PREPARE_WOLOLO("same", "ENTITY_EVOCATION_ILLAGER_PREPARE_WOLOLO", "ENTITY_EVOCATION_ILLAGER_PREPARE_WOLOLO", "", "", ""), - ENTITY_EXPERIENCE_BOTTLE_THROW("same", "same", "same", "same", "same", ""), - ENTITY_EXPERIENCE_ORB_PICKUP("same", "same", "same", "same", "same", "ORB_PICKUP"), - ENTITY_FIREWORK_ROCKET_BLAST("same", "ENTITY_FIREWORK_BLAST", "ENTITY_FIREWORK_BLAST", "ENTITY_FIREWORK_BLAST", "ENTITY_FIREWORK_BLAST", "FIREWORK_BLAST"), - ENTITY_FIREWORK_ROCKET_BLAST_FAR("same", "ENTITY_FIREWORK_BLAST_FAR", "ENTITY_FIREWORK_BLAST_FAR", "ENTITY_FIREWORK_BLAST_FAR", "ENTITY_FIREWORK_BLAST_FAR", "FIREWORK_BLAST2"), - ENTITY_FIREWORK_ROCKET_LARGE_BLAST("same", "ENTITY_FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_LARGE_BLAST", "FIREWORK_LARGE_BLAST"), - ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR("same", "ENTITY_FIREWORK_LARGE_BLAST_FAR", "ENTITY_FIREWORK_LARGE_BLAST_FAR", "ENTITY_FIREWORK_LARGE_BLAST_FAR", "ENTITY_FIREWORK_LARGE_BLAST_FAR", "FIREWORK_LARGE_BLAST2"), - ENTITY_FIREWORK_ROCKET_LAUNCH("same", "ENTITY_FIREWORK_LAUNCH", "ENTITY_FIREWORK_LAUNCH", "ENTITY_FIREWORK_LAUNCH", "ENTITY_FIREWORK_LAUNCH", "FIREWORK_LAUNCH"), - ENTITY_FIREWORK_ROCKET_SHOOT("same", "ENTITY_FIREWORK_SHOOT", "ENTITY_FIREWORK_SHOOT", "ENTITY_FIREWORK_SHOOT", "ENTITY_FIREWORK_SHOOT", ""), - ENTITY_FIREWORK_ROCKET_TWINKLE("same", "ENTITY_FIREWORK_TWINKLE", "ENTITY_FIREWORK_TWINKLE", "ENTITY_FIREWORK_TWINKLE", "ENTITY_FIREWORK_TWINKLE", "FIREWORK_TWINKLE"), - ENTITY_FIREWORK_ROCKET_TWINKLE_FAR("same", "ENTITY_FIREWORK_TWINKLE_FAR", "ENTITY_FIREWORK_TWINKLE_FAR", "ENTITY_FIREWORK_TWINKLE_FAR", "ENTITY_FIREWORK_TWINKLE_FAR", "FIREWORK_TWINKLE2"), - ENTITY_FISHING_BOBBER_RETRIEVE("same", "ENTITY_BOBBER_RETRIEVE", "", "", "", ""), - ENTITY_FISHING_BOBBER_SPLASH("same", "ENTITY_BOBBER_SPLASH", "ENTITY_BOBBER_SPLASH", "ENTITY_BOBBER_SPLASH", "ENTITY_BOBBER_SPLASH", "SPLASH2"), - ENTITY_FISHING_BOBBER_THROW("same", "ENTITY_BOBBER_THROW", "ENTITY_BOBBER_THROW", "ENTITY_BOBBER_THROW", "ENTITY_BOBBER_THROW", ""), - ENTITY_FISH_SWIM("same", "", "", "", "", ""), - ENTITY_FOX_AGGRO("", "", "", "", "", ""), - ENTITY_FOX_AMBIENT("", "", "", "", "", ""), - ENTITY_FOX_BITE("", "", "", "", "", ""), - ENTITY_FOX_DEATH("", "", "", "", "", ""), - ENTITY_FOX_EAT("", "", "", "", "", ""), - ENTITY_FOX_HURT("", "", "", "", "", ""), - ENTITY_FOX_SCREECH("", "", "", "", "", ""), - ENTITY_FOX_SLEEP("", "", "", "", "", ""), - ENTITY_FOX_SNIFF("", "", "", "", "", ""), - ENTITY_FOX_SPIT("", "", "", "", "", ""), - ENTITY_GENERIC_BIG_FALL("same", "same", "same", "same", "same", "FALL_BIG"), - ENTITY_GENERIC_BURN("same", "same", "same", "same", "same", ""), - ENTITY_GENERIC_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_GENERIC_DRINK("same", "same", "same", "same", "same", "DRINK"), - ENTITY_GENERIC_EAT("same", "same", "same", "same", "same", "EAT"), - ENTITY_GENERIC_EXPLODE("same", "same", "same", "same", "same", "EXPLODE"), - ENTITY_GENERIC_EXTINGUISH_FIRE("same", "same", "same", "same", "same", "FIZZ"), - ENTITY_GENERIC_HURT("same", "same", "same", "same", "same", ""), - ENTITY_GENERIC_SMALL_FALL("same", "same", "same", "same", "same", "FALL_SMALL"), - ENTITY_GENERIC_SPLASH("same", "same", "same", "same", "same", "SPLASH"), - ENTITY_GENERIC_SWIM("same", "same", "same", "same", "same", "SWIM"), - ENTITY_GHAST_AMBIENT("same", "same", "same", "same", "same", "GHAST_MOAN"), - ENTITY_GHAST_DEATH("same", "same", "same", "same", "same", "GHAST_DEATH"), - ENTITY_GHAST_HURT("same", "same", "same", "same", "same", "GHAST_SCREAM2"), - ENTITY_GHAST_SCREAM("same", "same", "same", "same", "same", "GHAST_SCREAM"), - ENTITY_GHAST_SHOOT("same", "same", "same", "same", "same", "GHAST_FIREBALL"), - ENTITY_GHAST_WARN("same", "same", "same", "same", "same", "GHAST_CHARGE"), - ENTITY_GUARDIAN_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_AMBIENT_LAND("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_ATTACK("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_DEATH_LAND("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_FLOP("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_HURT("same", "same", "same", "same", "same", ""), - ENTITY_GUARDIAN_HURT_LAND("same", "same", "same", "same", "same", ""), - ENTITY_HORSE_AMBIENT("same", "same", "same", "same", "same", "HORSE_IDLE"), - ENTITY_HORSE_ANGRY("same", "same", "same", "same", "same", "HORSE_ANGRY"), - ENTITY_HORSE_ARMOR("same", "same", "same", "same", "same", "HORSE_ARMOR"), - ENTITY_HORSE_BREATHE("same", "same", "same", "same", "same", "HORSE_BREATHE"), - ENTITY_HORSE_DEATH("same", "same", "same", "same", "same", "HORSE_DEATH"), - ENTITY_HORSE_EAT("same", "same", "same", "same", "same", ""), - ENTITY_HORSE_GALLOP("same", "same", "same", "same", "same", "HORSE_GALLOP"), - ENTITY_HORSE_HURT("same", "same", "same", "same", "same", "HORSE_HIT"), - ENTITY_HORSE_JUMP("same", "same", "same", "same", "same", "HORSE_JUMP"), - ENTITY_HORSE_LAND("same", "same", "same", "same", "same", "HORSE_LAND"), - ENTITY_HORSE_SADDLE("same", "same", "same", "same", "same", "HORSE_SADDLE"), - ENTITY_HORSE_STEP("same", "same", "same", "same", "same", "HORSE_SOFT"), - ENTITY_HORSE_STEP_WOOD("same", "same", "same", "same", "same", "HORSE_WOOD"), - ENTITY_HOSTILE_BIG_FALL("same", "same", "same", "same", "same", ""), - ENTITY_HOSTILE_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_HOSTILE_HURT("same", "same", "same", "same", "same", ""), - ENTITY_HOSTILE_SMALL_FALL("same", "same", "same", "same", "same", ""), - ENTITY_HOSTILE_SPLASH("same", "same", "same", "same", "same", ""), - ENTITY_HOSTILE_SWIM("same", "same", "same", "same", "same", ""), - ENTITY_HUSK_AMBIENT("same", "same", "same", "same", "", ""), - ENTITY_HUSK_CONVERTED_TO_ZOMBIE("same", "", "", "", "", ""), - ENTITY_HUSK_DEATH("same", "same", "same", "same", "", ""), - ENTITY_HUSK_HURT("same", "same", "same", "same", "", ""), - ENTITY_HUSK_STEP("same", "same", "same", "same", "", ""), - ENTITY_ILLUSIONER_AMBIENT("same", "ENTITY_ILLUSION_ILLAGER_AMBIENT", "", "", "", ""), - ENTITY_ILLUSIONER_CAST_SPELL("same", "ENTITY_ILLUSION_ILLAGER_CAST_SPELL", "", "", "", ""), - ENTITY_ILLUSIONER_DEATH("same", "ENTITY_ILLUSION_ILLAGER_DEATH", "", "", "", ""), - ENTITY_ILLUSIONER_HURT("same", "ENTITY_ILLUSION_ILLAGER_HURT", "", "", "", ""), - ENTITY_ILLUSIONER_MIRROR_MOVE("same", "ENTITY_ILLUSION_ILLAGER_MIRROR_MOVE", "", "", "", ""), - ENTITY_ILLUSIONER_PREPARE_BLINDNESS("same", "ENTITY_ILLUSION_ILLAGER_PREPARE_BLINDNESS", "", "", "", ""), - ENTITY_ILLUSIONER_PREPARE_MIRROR("same", "ENTITY_ILLUSION_ILLAGER_PREPARE_MIRROR", "", "", "", ""), - ENTITY_IRON_GOLEM_ATTACK("same", "ENTITY_IRONGOLEM_ATTACK", "ENTITY_IRONGOLEM_ATTACK", "ENTITY_IRONGOLEM_ATTACK", "ENTITY_IRONGOLEM_ATTACK", "IRONGOLEM_THROW"), - ENTITY_IRON_GOLEM_DEATH("same", "ENTITY_IRONGOLEM_DEATH", "ENTITY_IRONGOLEM_DEATH", "ENTITY_IRONGOLEM_DEATH", "ENTITY_IRONGOLEM_DEATH", "IRONGOLEM_DEATH"), - ENTITY_IRON_GOLEM_HURT("same", "ENTITY_IRONGOLEM_HURT", "ENTITY_IRONGOLEM_HURT", "ENTITY_IRONGOLEM_HURT", "ENTITY_IRONGOLEM_HURT", "IRONGOLEM_HIT"), - ENTITY_IRON_GOLEM_STEP("same", "ENTITY_IRONGOLEM_STEP", "ENTITY_IRONGOLEM_STEP", "ENTITY_IRONGOLEM_STEP", "ENTITY_IRONGOLEM_STEP", "IRONGOLEM_WALK"), - ENTITY_ITEM_BREAK("same", "same", "same", "same", "same", "ITEM_BREAK"), - ENTITY_ITEM_FRAME_ADD_ITEM("same", "ENTITY_ITEMFRAME_ADD_ITEM", "ENTITY_ITEMFRAME_ADD_ITEM", "ENTITY_ITEMFRAME_ADD_ITEM", "ENTITY_ITEMFRAME_ADD_ITEM", ""), - ENTITY_ITEM_FRAME_BREAK("same", "ENTITY_ITEMFRAME_BREAK", "ENTITY_ITEMFRAME_BREAK", "ENTITY_ITEMFRAME_BREAK", "ENTITY_ITEMFRAME_BREAK", ""), - ENTITY_ITEM_FRAME_PLACE("same", "ENTITY_ITEMFRAME_PLACE", "ENTITY_ITEMFRAME_PLACE", "ENTITY_ITEMFRAME_PLACE", "ENTITY_ITEMFRAME_PLACE", ""), - ENTITY_ITEM_FRAME_REMOVE_ITEM("same", "ENTITY_ITEMFRAME_REMOVE_ITEM", "ENTITY_ITEMFRAME_REMOVE_ITEM", "ENTITY_ITEMFRAME_REMOVE_ITEM", "ENTITY_ITEMFRAME_REMOVE_ITEM", ""), - ENTITY_ITEM_FRAME_ROTATE_ITEM("same", "ENTITY_ITEMFRAME_ROTATE_ITEM", "ENTITY_ITEMFRAME_ROTATE_ITEM", "ENTITY_ITEMFRAME_ROTATE_ITEM", "ENTITY_ITEMFRAME_ROTATE_ITEM", ""), - ENTITY_ITEM_PICKUP("same", "same", "same", "same", "same", "ITEM_PICKUP"), - ENTITY_LEASH_KNOT_BREAK("same", "ENTITY_LEASHKNOT_BREAK", "ENTITY_LEASHKNOT_BREAK", "ENTITY_LEASHKNOT_BREAK", "ENTITY_LEASHKNOT_BREAK", ""), - ENTITY_LEASH_KNOT_PLACE("same", "ENTITY_LEASHKNOT_PLACE", "ENTITY_LEASHKNOT_PLACE", "ENTITY_LEASHKNOT_PLACE", "ENTITY_LEASHKNOT_PLACE", ""), - ENTITY_LIGHTNING_BOLT_IMPACT("same", "ENTITY_LIGHTNING_IMPACT", "ENTITY_LIGHTNING_IMPACT", "ENTITY_LIGHTNING_IMPACT", "ENTITY_LIGHTNING_IMPACT", ""), - ENTITY_LIGHTNING_BOLT_THUNDER("same", "ENTITY_LIGHTNING_THUNDER", "ENTITY_LIGHTNING_THUNDER", "ENTITY_LIGHTNING_THUNDER", "ENTITY_LIGHTNING_THUNDER", "AMBIENCE_THUNDER"), - ENTITY_LINGERING_POTION_THROW("same", "ENTITY_LINGERINGPOTION_THROW", "ENTITY_LINGERINGPOTION_THROW", "ENTITY_LINGERINGPOTION_THROW", "ENTITY_LINGERINGPOTION_THROW", ""), - ENTITY_LLAMA_AMBIENT("same", "same", "same", "", "", ""), - ENTITY_LLAMA_ANGRY("same", "same", "same", "", "", ""), - ENTITY_LLAMA_CHEST("same", "same", "same", "", "", ""), - ENTITY_LLAMA_DEATH("same", "same", "same", "", "", ""), - ENTITY_LLAMA_EAT("same", "same", "same", "", "", ""), - ENTITY_LLAMA_HURT("same", "same", "same", "", "", ""), - ENTITY_LLAMA_SPIT("same", "same", "same", "", "", ""), - ENTITY_LLAMA_STEP("same", "same", "same", "", "", ""), - ENTITY_LLAMA_SWAG("same", "same", "same", "", "", ""), - ENTITY_MAGMA_CUBE_DEATH("same", "ENTITY_MAGMACUBE_DEATH", "ENTITY_MAGMACUBE_DEATH", "ENTITY_MAGMACUBE_DEATH", "ENTITY_MAGMACUBE_DEATH", ""), - ENTITY_MAGMA_CUBE_DEATH_SMALL("same", "ENTITY_MAGMACUBE_DEATH", "ENTITY_MAGMACUBE_DEATH", "ENTITY_MAGMACUBE_DEATH", "ENTITY_MAGMACUBE_DEATH", ""), - ENTITY_MAGMA_CUBE_HURT("same", "ENTITY_MAGMACUBE_HURT", "ENTITY_MAGMACUBE_HURT", "ENTITY_MAGMACUBE_HURT", "ENTITY_MAGMACUBE_HURT", ""), - ENTITY_MAGMA_CUBE_HURT_SMALL("same", "ENTITY_MAGMACUBE_HURT", "ENTITY_MAGMACUBE_HURT", "ENTITY_MAGMACUBE_HURT", "ENTITY_MAGMACUBE_HURT", ""), - ENTITY_MAGMA_CUBE_JUMP("same", "ENTITY_MAGMACUBE_JUMP", "ENTITY_MAGMACUBE_JUMP", "ENTITY_MAGMACUBE_JUMP", "ENTITY_MAGMACUBE_JUMP", "MAGMACUBE_JUMP"), - ENTITY_MAGMA_CUBE_SQUISH("same", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMACUBE_SQUISH", "MAGMACUBE_WALK"), - ENTITY_MAGMA_CUBE_SQUISH_SMALL("same", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMACUBE_SQUISH", "MAGMACUBE_WALK2"), - ENTITY_MINECART_INSIDE("same", "same", "same", "same", "same", "MINECART_BASE"), - ENTITY_MINECART_RIDING("same", "same", "same", "same", "same", "MINECART_RIDING"), - ENTITY_MOOSHROOM_CONVERT("", "", "", "", "", ""), - ENTITY_MOOSHROOM_EAT("", "", "", "", "", ""), - ENTITY_MOOSHROOM_MILK("", "", "", "", "", ""), - ENTITY_MOOSHROOM_SHEAR("same", "same", "same", "same", "same", ""), - ENTITY_MOOSHROOM_SUSPICIOUS_MILK("", "", "", "", "", ""), - ENTITY_MULE_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_MULE_CHEST("same", "same", "same", "", "", ""), - ENTITY_MULE_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_MULE_HURT("same", "same", "same", "same", "same", ""), - ENTITY_OCELOT_AMBIENT("", "", "", "", "", ""), - ENTITY_OCELOT_DEATH("", "", "", "", "", ""), - ENTITY_OCELOT_HURT("", "", "", "", "", ""), - ENTITY_PAINTING_BREAK("same", "same", "same", "same", "same", ""), - ENTITY_PAINTING_PLACE("same", "same", "same", "same", "same", ""), - ENTITY_PANDA_AGGRESSIVE_AMBIENT("", "", "", "", "", ""), - ENTITY_PANDA_AMBIENT("", "", "", "", "", ""), - ENTITY_PANDA_BITE("", "", "", "", "", ""), - ENTITY_PANDA_CANT_BREED("", "", "", "", "", ""), - ENTITY_PANDA_DEATH("", "", "", "", "", ""), - ENTITY_PANDA_EAT("", "", "", "", "", ""), - ENTITY_PANDA_HURT("", "", "", "", "", ""), - ENTITY_PANDA_PRE_SNEEZE("", "", "", "", "", ""), - ENTITY_PANDA_SNEEZE("", "", "", "", "", ""), - ENTITY_PANDA_STEP("", "", "", "", "", ""), - ENTITY_PANDA_WORRIED_AMBIENT("", "", "", "", "", ""), - ENTITY_PARROT_AMBIENT("same", "same", "", "", "", ""), - ENTITY_PARROT_DEATH("same", "same", "", "", "", ""), - ENTITY_PARROT_EAT("same", "same", "", "", "", ""), - ENTITY_PARROT_FLY("same", "same", "", "", "", ""), - ENTITY_PARROT_HURT("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_BLAZE("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_CREEPER("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_DROWNED("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_ELDER_GUARDIAN("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ENDERMAN("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ENDERMITE("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ENDER_DRAGON("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_EVOKER("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_GHAST("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_GUARDIAN("", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_HUSK("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ILLUSIONER("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_MAGMA_CUBE("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_PANDA("", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_PHANTOM("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_PILLAGER("", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_POLAR_BEAR("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_RAVAGER("", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_SHULKER("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_SILVERFISH("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_SKELETON("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_SLIME("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_SPIDER("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_STRAY("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_VEX("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_VINDICATOR("same", "", "", "", "", ""), - ENTITY_PARROT_IMITATE_WITCH("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_WITHER("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_WITHER_SKELETON("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_WOLF("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ZOMBIE("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ZOMBIE_PIGMAN("same", "same", "", "", "", ""), - ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER("same", "same", "", "", "", ""), - ENTITY_PARROT_STEP("same", "same", "", "", "", ""), - ENTITY_PHANTOM_AMBIENT("same", "", "", "", "", ""), - ENTITY_PHANTOM_BITE("same", "", "", "", "", ""), - ENTITY_PHANTOM_DEATH("same", "", "", "", "", ""), - ENTITY_PHANTOM_FLAP("same", "", "", "", "", ""), - ENTITY_PHANTOM_HURT("same", "", "", "", "", ""), - ENTITY_PHANTOM_SWOOP("same", "", "", "", "", ""), - ENTITY_PIG_AMBIENT("same", "same", "same", "same", "same", "PIG_IDLE"), - ENTITY_PIG_DEATH("same", "same", "same", "same", "same", "PIG_DEATH"), - ENTITY_PIG_HURT("same", "same", "same", "same", "same", ""), - ENTITY_PIG_SADDLE("same", "same", "same", "same", "same", ""), - ENTITY_PIG_STEP("same", "same", "same", "same", "same", "PIG_WALK"), - ENTITY_PILLAGER_AMBIENT("", "", "", "", "", ""), - ENTITY_PILLAGER_CELEBRATE("", "", "", "", "", ""), - ENTITY_PILLAGER_DEATH("", "", "", "", "", ""), - ENTITY_PILLAGER_HURT("", "", "", "", "", ""), - ENTITY_PLAYER_ATTACK_CRIT("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_ATTACK_KNOCKBACK("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_ATTACK_NODAMAGE("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_ATTACK_STRONG("same", "same", "same", "same", "same", "SUCCESSFUL_HIT"), - ENTITY_PLAYER_ATTACK_SWEEP("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_ATTACK_WEAK("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_BIG_FALL("same", "same", "same", "same", "same", "FALL_BIG"), - ENTITY_PLAYER_BREATH("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_BURP("same", "same", "same", "same", "same", "BURP"), - ENTITY_PLAYER_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_HURT("same", "same", "same", "same", "same", "HURT_FLESH"), - ENTITY_PLAYER_HURT_DROWN("same", "same", "", "", "", ""), - ENTITY_PLAYER_HURT_ON_FIRE("same", "same", "", "", "", ""), - ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH("", "", "", "", "", ""), - ENTITY_PLAYER_LEVELUP("same", "same", "same", "same", "same", "LEVELUP"), - ENTITY_PLAYER_SMALL_FALL("same", "same", "same", "same", "same", "FALL_SMALL"), - ENTITY_PLAYER_SPLASH("same", "same", "same", "same", "same", ""), - ENTITY_PLAYER_SPLASH_HIGH_SPEED("same", "", "", "", "", ""), - ENTITY_PLAYER_SWIM("same", "same", "same", "same", "same", ""), - ENTITY_POLAR_BEAR_AMBIENT("same", "same", "same", "same", "", ""), - ENTITY_POLAR_BEAR_AMBIENT_BABY("same", "", "", "", "", ""), - ENTITY_POLAR_BEAR_DEATH("same", "same", "same", "same", "", ""), - ENTITY_POLAR_BEAR_HURT("same", "same", "same", "same", "", ""), - ENTITY_POLAR_BEAR_STEP("same", "same", "same", "same", "", ""), - ENTITY_POLAR_BEAR_WARNING("same", "same", "same", "same", "", ""), - ENTITY_PUFFER_FISH_AMBIENT("same", "", "", "", "", ""), - ENTITY_PUFFER_FISH_BLOW_OUT("same", "", "", "", "", ""), - ENTITY_PUFFER_FISH_BLOW_UP("same", "", "", "", "", ""), - ENTITY_PUFFER_FISH_DEATH("same", "", "", "", "", ""), - ENTITY_PUFFER_FISH_FLOP("same", "", "", "", "", ""), - ENTITY_PUFFER_FISH_HURT("same", "", "", "", "", ""), - ENTITY_PUFFER_FISH_STING("same", "", "", "", "", ""), - ENTITY_RABBIT_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_RABBIT_ATTACK("same", "same", "same", "same", "same", ""), - ENTITY_RABBIT_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_RABBIT_HURT("same", "same", "same", "same", "same", ""), - ENTITY_RABBIT_JUMP("same", "same", "same", "same", "same", ""), - ENTITY_RAVAGER_AMBIENT("", "", "", "", "", ""), - ENTITY_RAVAGER_ATTACK("", "", "", "", "", ""), - ENTITY_RAVAGER_CELEBRATE("", "", "", "", "", ""), - ENTITY_RAVAGER_DEATH("", "", "", "", "", ""), - ENTITY_RAVAGER_HURT("", "", "", "", "", ""), - ENTITY_RAVAGER_ROAR("", "", "", "", "", ""), - ENTITY_RAVAGER_STEP("", "", "", "", "", ""), - ENTITY_RAVAGER_STUNNED("", "", "", "", "", ""), - ENTITY_SALMON_AMBIENT("same", "", "", "", "", ""), - ENTITY_SALMON_DEATH("same", "", "", "", "", ""), - ENTITY_SALMON_FLOP("same", "", "", "", "", ""), - ENTITY_SALMON_HURT("same", "", "", "", "", ""), - ENTITY_SHEEP_AMBIENT("same", "same", "same", "same", "same", "SHEEP_IDLE"), - ENTITY_SHEEP_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_SHEEP_HURT("same", "same", "same", "same", "same", ""), - ENTITY_SHEEP_SHEAR("same", "same", "same", "same", "same", "SHEEP_SHEAR"), - ENTITY_SHEEP_STEP("same", "same", "same", "same", "same", "SHEEP_WALK"), - ENTITY_SHULKER_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_BULLET_HIT("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_BULLET_HURT("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_CLOSE("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_HURT("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_HURT_CLOSED("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_OPEN("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_SHOOT("same", "same", "same", "same", "same", ""), - ENTITY_SHULKER_TELEPORT("same", "same", "same", "same", "same", ""), - ENTITY_SILVERFISH_AMBIENT("same", "same", "same", "same", "same", "SILVERFISH_IDLE"), - ENTITY_SILVERFISH_DEATH("same", "same", "same", "same", "same", "SILVERFISH_KILL"), - ENTITY_SILVERFISH_HURT("same", "same", "same", "same", "same", "SILVERFISH_HIT"), - ENTITY_SILVERFISH_STEP("same", "same", "same", "same", "same", "SILVERFISH_WALK"), - ENTITY_SKELETON_AMBIENT("same", "same", "same", "same", "same", "SKELETON_IDLE"), - ENTITY_SKELETON_DEATH("same", "same", "same", "same", "same", "SKELETON_DEATH"), - ENTITY_SKELETON_HORSE_AMBIENT("same", "same", "same", "same", "same", "HORSE_SKELETON_AMBIENT"), - ENTITY_SKELETON_HORSE_AMBIENT_WATER("same", "", "", "", "", ""), - ENTITY_SKELETON_HORSE_DEATH("same", "same", "same", "same", "same", "HORSE_SKELETON_DEATH"), - ENTITY_SKELETON_HORSE_GALLOP_WATER("same", "", "", "", "", ""), - ENTITY_SKELETON_HORSE_HURT("same", "same", "same", "same", "same", "HORSE_SKELETON_HIT"), - ENTITY_SKELETON_HORSE_JUMP_WATER("same", "", "", "", "", ""), - ENTITY_SKELETON_HORSE_STEP_WATER("same", "", "", "", "", ""), - ENTITY_SKELETON_HORSE_SWIM("same", "", "", "", "", ""), - ENTITY_SKELETON_HURT("same", "same", "same", "same", "same", "SKELETON_HURT"), - ENTITY_SKELETON_SHOOT("same", "same", "same", "same", "same", ""), - ENTITY_SKELETON_STEP("same", "same", "same", "same", "same", "SKELETON_WALK"), - ENTITY_SLIME_ATTACK("same", "same", "same", "same", "same", "SLIME_ATTACK"), - ENTITY_SLIME_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_SLIME_DEATH_SMALL("same", "", "", "", "", ""), - ENTITY_SLIME_HURT("same", "same", "same", "same", "same", ""), - ENTITY_SLIME_HURT_SMALL("same", "", "", "", "", ""), - ENTITY_SLIME_JUMP("same", "same", "same", "same", "same", "SLIME_WALK"), - ENTITY_SLIME_JUMP_SMALL("same", "", "", "", "", ""), - ENTITY_SLIME_SQUISH("same", "same", "same", "same", "same", "SLIME_WALK2"), - ENTITY_SLIME_SQUISH_SMALL("same", "", "", "", "", ""), - ENTITY_SNOWBALL_THROW("same", "same", "same", "same", "same", ""), - ENTITY_SNOW_GOLEM_AMBIENT("same", "ENTITY_SNOWMAN_AMBIENT", "ENTITY_SNOWMAN_AMBIENT", "ENTITY_SNOWMAN_AMBIENT", "ENTITY_SNOWMAN_AMBIENT", ""), - ENTITY_SNOW_GOLEM_DEATH("same", "ENTITY_SNOWMAN_DEATH", "ENTITY_SNOWMAN_DEATH", "ENTITY_SNOWMAN_DEATH", "ENTITY_SNOWMAN_DEATH", ""), - ENTITY_SNOW_GOLEM_HURT("same", "ENTITY_SNOWMAN_HURT", "ENTITY_SNOWMAN_HURT", "ENTITY_SNOWMAN_HURT", "ENTITY_SNOWMAN_HURT", ""), - ENTITY_SNOW_GOLEM_SHOOT("same", "ENTITY_SNOWMAN_SHOOT", "ENTITY_SNOWMAN_SHOOT", "ENTITY_SNOWMAN_SHOOT", "ENTITY_SNOWMAN_SHOOT", ""), - ENTITY_SPIDER_AMBIENT("same", "same", "same", "same", "same", "SPIDER_IDLE"), - ENTITY_SPIDER_DEATH("same", "same", "same", "same", "same", "SPIDER_DEATH"), - ENTITY_SPIDER_HURT("same", "same", "same", "same", "same", ""), - ENTITY_SPIDER_STEP("same", "same", "same", "same", "same", "SPIDER_WALK"), - ENTITY_SPLASH_POTION_BREAK("same", "same", "same", "same", "same", ""), - ENTITY_SPLASH_POTION_THROW("same", "same", "same", "same", "same", ""), - ENTITY_SQUID_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_SQUID_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_SQUID_HURT("same", "same", "same", "same", "same", ""), - ENTITY_SQUID_SQUIRT("same", "", "", "", "", ""), - ENTITY_STRAY_AMBIENT("same", "same", "same", "same", "", ""), - ENTITY_STRAY_DEATH("same", "same", "same", "same", "", ""), - ENTITY_STRAY_HURT("same", "same", "same", "same", "", ""), - ENTITY_STRAY_STEP("same", "same", "same", "same", "", ""), - ENTITY_TNT_PRIMED("same", "same", "same", "same", "same", "FUSE"), - ENTITY_TROPICAL_FISH_AMBIENT("same", "", "", "", "", ""), - ENTITY_TROPICAL_FISH_DEATH("same", "", "", "", "", ""), - ENTITY_TROPICAL_FISH_FLOP("same", "", "", "", "", ""), - ENTITY_TROPICAL_FISH_HURT("same", "", "", "", "", ""), - ENTITY_TURTLE_AMBIENT_LAND("same", "", "", "", "", ""), - ENTITY_TURTLE_DEATH("same", "", "", "", "", ""), - ENTITY_TURTLE_DEATH_BABY("same", "", "", "", "", ""), - ENTITY_TURTLE_EGG_BREAK("same", "", "", "", "", ""), - ENTITY_TURTLE_EGG_CRACK("same", "", "", "", "", ""), - ENTITY_TURTLE_EGG_HATCH("same", "", "", "", "", ""), - ENTITY_TURTLE_HURT("same", "", "", "", "", ""), - ENTITY_TURTLE_HURT_BABY("same", "", "", "", "", ""), - ENTITY_TURTLE_LAY_EGG("same", "", "", "", "", ""), - ENTITY_TURTLE_SHAMBLE("same", "", "", "", "", ""), - ENTITY_TURTLE_SHAMBLE_BABY("same", "", "", "", "", ""), - ENTITY_TURTLE_SWIM("same", "", "", "", "", ""), - ENTITY_VEX_AMBIENT("same", "same", "same", "", "", ""), - ENTITY_VEX_CHARGE("same", "same", "same", "", "", ""), - ENTITY_VEX_DEATH("same", "same", "same", "", "", ""), - ENTITY_VEX_HURT("same", "same", "same", "", "", ""), - ENTITY_VILLAGER_AMBIENT("same", "same", "same", "same", "same", "VILLAGER_IDLE"), - ENTITY_VILLAGER_CELEBRATE("", "", "", "", "", ""), - ENTITY_VILLAGER_DEATH("same", "same", "same", "same", "same", "VILLAGER_DEATH"), - ENTITY_VILLAGER_HURT("same", "same", "same", "same", "same", "VILLAGER_HIT"), - ENTITY_VILLAGER_NO("same", "same", "same", "same", "same", "VILLAGER_NO"), - ENTITY_VILLAGER_TRADE("same", "ENTITY_VILLAGER_TRADING", "ENTITY_VILLAGER_TRADING", "ENTITY_VILLAGER_TRADING", "ENTITY_VILLAGER_TRADING", "VILLAGER_HAGGLE"), - ENTITY_VILLAGER_WORK_ARMORER("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_BUTCHER("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_CARTOGRAPHER("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_CLERIC("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_FARMER("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_FISHERMAN("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_FLETCHER("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_LEATHERWORKER("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_LIBRARIAN("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_MASON("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_SHEPHERD("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_TOOLSMITH("", "", "", "", "", ""), - ENTITY_VILLAGER_WORK_WEAPONSMITH("", "", "", "", "", ""), - ENTITY_VILLAGER_YES("same", "same", "same", "same", "same", "VILLAGER_YES"), - ENTITY_VINDICATOR_AMBIENT("same", "ENTITY_VINDICATION_ILLAGER_AMBIENT", "ENTITY_VINDICATION_ILLAGER_AMBIENT", "", "", ""), - ENTITY_VINDICATOR_CELEBRATE("", "", "", "", "", ""), - ENTITY_VINDICATOR_DEATH("same", "ENTITY_VINDICATION_ILLAGER_DEATH", "ENTITY_VINDICATION_ILLAGER_DEATH", "", "", ""), - ENTITY_VINDICATOR_HURT("same", "ENTITY_VINDICATION_ILLAGER_HURT", "ENTITY_VINDICATION_ILLAGER_HURT", "", "", ""), - ENTITY_WANDERING_TRADER_AMBIENT("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_DEATH("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_DISAPPEARED("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_DRINK_MILK("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_DRINK_POTION("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_HURT("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_NO("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_REAPPEARED("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_TRADE("", "", "", "", "", ""), - ENTITY_WANDERING_TRADER_YES("", "", "", "", "", ""), - ENTITY_WITCH_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_WITCH_CELEBRATE("", "", "", "", "", ""), - ENTITY_WITCH_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_WITCH_DRINK("same", "same", "same", "same", "same", ""), - ENTITY_WITCH_HURT("same", "same", "same", "same", "same", ""), - ENTITY_WITCH_THROW("same", "same", "same", "same", "same", ""), - ENTITY_WITHER_AMBIENT("same", "same", "same", "same", "same", "WITHER_IDLE"), - ENTITY_WITHER_BREAK_BLOCK("same", "same", "same", "same", "same", ""), - ENTITY_WITHER_DEATH("same", "same", "same", "same", "same", "WITHER_DEATH"), - ENTITY_WITHER_HURT("same", "same", "same", "same", "same", "WITHER_HURT"), - ENTITY_WITHER_SHOOT("same", "same", "same", "same", "same", "WITHER_SHOOT"), - ENTITY_WITHER_SKELETON_AMBIENT("same", "same", "same", "same", "", ""), - ENTITY_WITHER_SKELETON_DEATH("same", "same", "same", "same", "", ""), - ENTITY_WITHER_SKELETON_HURT("same", "same", "same", "same", "", ""), - ENTITY_WITHER_SKELETON_STEP("same", "same", "same", "same", "", ""), - ENTITY_WITHER_SPAWN("same", "same", "same", "same", "same", "WITHER_SPAWN"), - ENTITY_WOLF_AMBIENT("same", "same", "same", "same", "same", "WOLF_BARK"), - ENTITY_WOLF_DEATH("same", "same", "same", "same", "same", "WOLF_DEATH"), - ENTITY_WOLF_GROWL("same", "same", "same", "same", "same", "WOLF_GROWL"), - ENTITY_WOLF_HOWL("same", "same", "same", "same", "same", "WOLF_HOWL"), - ENTITY_WOLF_HURT("same", "same", "same", "same", "same", "WOLF_HURT"), - ENTITY_WOLF_PANT("same", "same", "same", "same", "same", "WOLF_PANT"), - ENTITY_WOLF_SHAKE("same", "same", "same", "same", "same", "WOLF_SHAKE"), - ENTITY_WOLF_STEP("same", "same", "same", "same", "same", "WOLF_WALK"), - ENTITY_WOLF_WHINE("same", "same", "same", "same", "same", "WOLF_WHINE"), - ENTITY_ZOMBIE_AMBIENT("same", "same", "same", "same", "same", "ZOMBIE_IDLE"), - ENTITY_ZOMBIE_ATTACK_IRON_DOOR("same", "same", "same", "same", "same", "ZOMBIE_METAL"), - ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR("same", "ENTITY_ZOMBIE_ATTACK_DOOR_WOOD", "ENTITY_ZOMBIE_ATTACK_DOOR_WOOD", "ENTITY_ZOMBIE_ATTACK_DOOR_WOOD", "ENTITY_ZOMBIE_ATTACK_DOOR_WOOD", "ZOMBIE_WOOD"), - ENTITY_ZOMBIE_BREAK_WOODEN_DOOR("same", "ENTITY_ZOMBIE_BREAK_DOOR_WOOD", "ENTITY_ZOMBIE_BREAK_DOOR_WOOD", "ENTITY_ZOMBIE_BREAK_DOOR_WOOD", "ENTITY_ZOMBIE_BREAK_DOOR_WOOD", "ZOMBIE_WOODBREAK"), - ENTITY_ZOMBIE_CONVERTED_TO_DROWNED("same", "", "", "", "", ""), - ENTITY_ZOMBIE_DEATH("same", "same", "same", "same", "same", "ZOMBIE_DEATH"), - ENTITY_ZOMBIE_DESTROY_EGG("same", "", "", "", "", ""), - ENTITY_ZOMBIE_HORSE_AMBIENT("same", "same", "same", "same", "same", "HORSE_ZOMBIE_IDLE"), - ENTITY_ZOMBIE_HORSE_DEATH("same", "same", "same", "same", "same", "HORSE_ZOMBIE_DEATH"), - ENTITY_ZOMBIE_HORSE_HURT("same", "same", "same", "same", "same", "HORSE_ZOMBIE_HIT"), - ENTITY_ZOMBIE_HURT("same", "same", "same", "same", "same", "ZOMBIE_HURT"), - ENTITY_ZOMBIE_INFECT("same", "same", "same", "same", "same", "ZOMBIE_INFECT"), - ENTITY_ZOMBIE_PIGMAN_AMBIENT("same", "ENTITY_ZOMBIE_PIG_AMBIENT", "ENTITY_ZOMBIE_PIG_AMBIENT", "ENTITY_ZOMBIE_PIG_AMBIENT", "ENTITY_ZOMBIE_PIG_AMBIENT", "ZOMBIE_PIG_IDLE"), - ENTITY_ZOMBIE_PIGMAN_ANGRY("same", "ENTITY_ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIG_ANGRY", "ZOMBIE_PIG_ANGRY"), - ENTITY_ZOMBIE_PIGMAN_DEATH("same", "ENTITY_ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIG_DEATH", "ZOMBIE_PIG_DEATH"), - ENTITY_ZOMBIE_PIGMAN_HURT("same", "ENTITY_ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIG_HURT", "ZOMBIE_PIG_HURT"), - ENTITY_ZOMBIE_STEP("same", "same", "same", "same", "same", "ZOMBIE_WALK"), - ENTITY_ZOMBIE_VILLAGER_AMBIENT("same", "same", "same", "same", "same", ""), - ENTITY_ZOMBIE_VILLAGER_CONVERTED("same", "same", "same", "same", "same", "ZOMBIE_UNFECT"), - ENTITY_ZOMBIE_VILLAGER_CURE("same", "same", "same", "same", "same", "ZOMBIE_REMEDY"), - ENTITY_ZOMBIE_VILLAGER_DEATH("same", "same", "same", "same", "same", ""), - ENTITY_ZOMBIE_VILLAGER_HURT("same", "same", "same", "same", "same", ""), - ENTITY_ZOMBIE_VILLAGER_STEP("same", "same", "same", "same", "same", ""), - EVENT_RAID_HORN("", "", "", "", "", ""), - ITEM_ARMOR_EQUIP_CHAIN("same", "same", "same", "same", "same", ""), - ITEM_ARMOR_EQUIP_DIAMOND("same", "same", "same", "same", "same", ""), - ITEM_ARMOR_EQUIP_ELYTRA("same", "same", "same", "", "", ""), - ITEM_ARMOR_EQUIP_GENERIC("same", "same", "same", "same", "same", ""), - ITEM_ARMOR_EQUIP_GOLD("same", "same", "same", "same", "same", ""), - ITEM_ARMOR_EQUIP_IRON("same", "same", "same", "same", "same", ""), - ITEM_ARMOR_EQUIP_LEATHER("same", "same", "same", "same", "same", ""), - ITEM_ARMOR_EQUIP_TURTLE("same", "", "", "", "", ""), - ITEM_AXE_STRIP("same", "", "", "", "", ""), - ITEM_BOOK_PAGE_TURN("", "", "", "", "", ""), - ITEM_BOOK_PUT("", "", "", "", "", ""), - ITEM_BOTTLE_EMPTY("same", "same", "same", "", "", ""), - ITEM_BOTTLE_FILL("same", "same", "same", "same", "same", ""), - ITEM_BOTTLE_FILL_DRAGONBREATH("same", "same", "same", "same", "same", ""), - ITEM_BUCKET_EMPTY("same", "same", "same", "same", "same", ""), - ITEM_BUCKET_EMPTY_FISH("same", "", "", "", "", ""), - ITEM_BUCKET_EMPTY_LAVA("same", "same", "same", "same", "same", ""), - ITEM_BUCKET_FILL("same", "same", "same", "same", "same", ""), - ITEM_BUCKET_FILL_FISH("same", "", "", "", "", ""), - ITEM_BUCKET_FILL_LAVA("same", "same", "same", "same", "same", ""), - ITEM_CHORUS_FRUIT_TELEPORT("same", "same", "same", "same", "same", ""), - ITEM_CROP_PLANT("", "", "", "", "", ""), - ITEM_CROSSBOW_HIT("", "", "", "", "", ""), - ITEM_CROSSBOW_LOADING_END("", "", "", "", "", ""), - ITEM_CROSSBOW_LOADING_MIDDLE("", "", "", "", "", ""), - ITEM_CROSSBOW_LOADING_START("", "", "", "", "", ""), - ITEM_CROSSBOW_QUICK_CHARGE_1("", "", "", "", "", ""), - ITEM_CROSSBOW_QUICK_CHARGE_2("", "", "", "", "", ""), - ITEM_CROSSBOW_QUICK_CHARGE_3("", "", "", "", "", ""), - ITEM_CROSSBOW_SHOOT("", "", "", "", "", ""), - ITEM_ELYTRA_FLYING("same", "same", "same", "same", "same", ""), - ITEM_FIRECHARGE_USE("same", "same", "same", "same", "same", ""), - ITEM_FLINTANDSTEEL_USE("same", "same", "same", "same", "same", "FIRE_IGNITE"), - ITEM_HOE_TILL("same", "same", "same", "same", "same", ""), - ITEM_NETHER_WART_PLANT("", "", "", "", "", ""), - ITEM_SHIELD_BLOCK("same", "same", "same", "same", "same", ""), - ITEM_SHIELD_BREAK("same", "same", "same", "same", "same", ""), - ITEM_SHOVEL_FLATTEN("same", "same", "same", "same", "same", ""), - ITEM_SWEET_BERRIES_PICK_FROM_BUSH("", "", "", "", "", ""), - ITEM_TOTEM_USE("same", "same", "same", "", "", ""), - ITEM_TRIDENT_HIT("same", "", "", "", "", ""), - ITEM_TRIDENT_HIT_GROUND("same", "", "", "", "", ""), - ITEM_TRIDENT_RETURN("same", "", "", "", "", ""), - ITEM_TRIDENT_RIPTIDE_1("same", "", "", "", "", ""), - ITEM_TRIDENT_RIPTIDE_2("same", "", "", "", "", ""), - ITEM_TRIDENT_RIPTIDE_3("same", "", "", "", "", ""), - ITEM_TRIDENT_THROW("same", "", "", "", "", ""), - ITEM_TRIDENT_THUNDER("same", "", "", "", "", ""), - MUSIC_CREATIVE("same", "same", "same", "same", "same", ""), - MUSIC_CREDITS("same", "same", "same", "same", "same", ""), - MUSIC_DISC_11("same", "RECORD_11", "RECORD_11", "RECORD_11", "RECORD_11", ""), - MUSIC_DISC_13("same", "RECORD_13", "RECORD_13", "RECORD_13", "RECORD_13", ""), - MUSIC_DISC_BLOCKS("same", "RECORD_BLOCKS", "RECORD_BLOCKS", "RECORD_BLOCKS", "RECORD_BLOCKS", ""), - MUSIC_DISC_CAT("same", "RECORD_CAT", "RECORD_CAT", "RECORD_CAT", "RECORD_CAT", ""), - MUSIC_DISC_CHIRP("same", "RECORD_CHIRP", "RECORD_CHIRP", "RECORD_CHIRP", "RECORD_CHIRP", ""), - MUSIC_DISC_FAR("same", "RECORD_FAR", "RECORD_FAR", "RECORD_FAR", "RECORD_FAR", ""), - MUSIC_DISC_MALL("same", "RECORD_MALL", "RECORD_MALL", "RECORD_MALL", "RECORD_MALL", ""), - MUSIC_DISC_MELLOHI("same", "RECORD_MELLOHI", "RECORD_MELLOHI", "RECORD_MELLOHI", "RECORD_MELLOHI", ""), - MUSIC_DISC_STAL("same", "RECORD_STAL", "RECORD_STAL", "RECORD_STAL", "RECORD_STAL", ""), - MUSIC_DISC_STRAD("same", "RECORD_STRAD", "RECORD_STRAD", "RECORD_STRAD", "RECORD_STRAD", ""), - MUSIC_DISC_WAIT("same", "RECORD_WAIT", "RECORD_WAIT", "RECORD_WAIT", "RECORD_WAIT", ""), - MUSIC_DISC_WARD("same", "RECORD_WARD", "RECORD_WARD", "RECORD_WARD", "RECORD_WARD", ""), - MUSIC_DRAGON("same", "same", "same", "same", "same", ""), - MUSIC_END("same", "same", "same", "same", "same", ""), - MUSIC_GAME("same", "same", "same", "same", "same", ""), - MUSIC_MENU("same", "same", "same", "same", "same", ""), - MUSIC_NETHER("same", "same", "same", "same", "same", ""), - MUSIC_UNDER_WATER("same", "", "", "", "", ""), - UI_BUTTON_CLICK("same", "same", "same", "same", "same", "CLICK"), - UI_CARTOGRAPHY_TABLE_TAKE_RESULT("", "", "", "", "", ""), - UI_LOOM_SELECT_PATTERN("", "", "", "", "", ""), - UI_LOOM_TAKE_RESULT("", "", "", "", "", ""), - UI_STONECUTTER_SELECT_RECIPE("", "", "", "", "", ""), - UI_STONECUTTER_TAKE_RESULT("", "", "", "", "", ""), - UI_TOAST_CHALLENGE_COMPLETE("same", "same", "", "", "", ""), - UI_TOAST_IN("same", "same", "", "", "", ""), - UI_TOAST_OUT("same", "same", "", "", "", ""), - WEATHER_RAIN("same", "same", "same", "same", "same", "AMBIENCE_RAIN"), - WEATHER_RAIN_ABOVE("same", "same", "same", "same", "same", ""); - private final ArrayList snds = new ArrayList(); - GSound(String... sounds) { - for (String str : sounds) { - if (str.equals("same")) { - snds.add(this.toString()); - continue; - } - snds.add(str); - continue; - } - } - public ArrayList getSoundArrays() { - return this.snds; - } - - /** - * Credit to MrIvanPlays - */ - public static GSound matchStrong(String val) { - String upperCase = val.toUpperCase(); - for (GSound gsound : GSound.values()) { - List sounds = gsound.getSoundArrays(); - for (String sound : sounds) { - if (!sound.equalsIgnoreCase(upperCase)) { - if (upperCase.contains(" ")) { - String[] split = upperCase.split(" "); - for (int i = 0; i < split.length; i++) { - if (split.length < i + 1) { - if (sound.contains(split[i])) { - return gsound; - } - } - if (sound.contains(split[i]) && sound.contains(split[i + 1])) { - return gsound; - } - } - } else { - matchStrong(upperCase.replace("_", " ")); - } - } else { - return gsound; - } - } - } - return null; - } - @Nullable - public static GSound match(String val) { - val = val.toUpperCase(); - for (GSound gs : GSound.values()) { - ArrayList snds = gs.getSoundArrays(); - for (String str : snds) { - if (!str.equals(val)) continue; - return gs; - } - } - return null; - } - @Nullable - public Sound parseSound() { - Sound test = sounds.get(this); - if (test != null) { - return test; - } - switch (serverVersion) { - case UNKNOWN: - case V1_8: - { - String val = this.getSoundArrays().get(5); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - case V1_9: - { - String val = this.getSoundArrays().get(4); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - case V1_10: - { - String val = this.getSoundArrays().get(3); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - case V1_11: - { - String val = this.getSoundArrays().get(2); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - case V1_12: - { - String val = this.getSoundArrays().get(1); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - case V1_13: - { - String val = this.getSoundArrays().get(0); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - case V1_14: - { - String val = this.toString(); - Sound soun = null; - try { - soun = Sound.valueOf(val); - } catch (IllegalArgumentException e) { - soun = this.tryAll(); - } - if (soun == null) { - return null; - } - sounds.put(this,soun); - return soun; - } - } - return null; - } - @Nullable - private Sound tryAll() { - String lm = this.toString(); - Sound x = null; - try { - x = Sound.valueOf(lm); - } catch (IllegalArgumentException e) { - - } - if (x != null) { - return x; - } - for (String str : this.getSoundArrays()) { - if (str.isEmpty()) continue; - Sound s = null; - try { - s = Sound.valueOf(str); - } catch (IllegalArgumentException e) { - continue; - } - return s; - } - return null; - } - public enum MinecraftVersion { - UNKNOWN, - V1_8, - V1_9, - V1_10, - V1_11, - V1_12, - V1_13, - V1_14; - - public static final MinecraftVersion[] VALUES = MinecraftVersion.values(); - } - /* - * - * Minecraft Versions and enum values - * WEATHER_RAIN("same", "same", "same", "same", "same", ""), - * V1_14 V1_13 V1_12 V1_11 V1_10 V1_9 V1_8 - */ - static { - String ver = Bukkit.getVersion(); - boolean found = false; - if (ver.contains("1.14")) { - serverVersion = MinecraftVersion.V1_14; - found = true; - } - if (!found && ver.contains("1.13")) { - serverVersion = MinecraftVersion.V1_13; - found = true; - } - if (!found && ver.contains("1.12")) { - serverVersion = MinecraftVersion.V1_12; - found = true; - } - if (!found && ver.contains("1.11")) { - serverVersion = MinecraftVersion.V1_11; - found = true; - } - if (!found && ver.contains("1.10")) { - serverVersion = MinecraftVersion.V1_10; - found = true; - } - if (!found && ver.contains("1.9")) { - serverVersion = MinecraftVersion.V1_9; - found = true; - } - if (!found && ver.contains("1.8")) { - serverVersion = MinecraftVersion.V1_8; - found = true; - } - if (!found) { - serverVersion = MinecraftVersion.UNKNOWN; - } - } - public static MinecraftVersion getServerVersion() { - return serverVersion; - } - private static MinecraftVersion serverVersion; - private static final HashMap sounds = new HashMap(); - -} \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/util/BedWarsWrapper.java b/src/main/java/me/defender/cosmetics/util/BedWarsWrapper.java new file mode 100644 index 00000000..cfe6bf75 --- /dev/null +++ b/src/main/java/me/defender/cosmetics/util/BedWarsWrapper.java @@ -0,0 +1,88 @@ +package me.defender.cosmetics.util; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import me.defender.cosmetics.api.handler.ITeamHandler; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import java.util.List; + +public class BedWarsWrapper { + + public static ITeamHandler wrap(com.tomkeuper.bedwars.api.arena.team.ITeam team){ + return new ITeamHandler() { + @Override + public Location getBed() { + return team.getBed(); + } + + @Override + public List getPlayers() { + return team.getMembers(); + } + + @Override + public String getName() { + return team.getName(); + } + + @Override + public Location getTeamUpgrades() { + return team.getTeamUpgrades(); + } + + @Override + public Location getShop() { + return team.getShop(); + } + + @Override + public Location getSpawn() { + return team.getSpawn(); + } + + @Override + public int getSize() { + return team.getSize(); + } + }; + } + public static ITeamHandler wrap(ITeam team){ + return new ITeamHandler() { + @Override + public Location getBed() { + return team.getBed(); + } + + @Override + public List getPlayers() { + return team.getMembers(); + } + + @Override + public String getName() { + return team.getName(); + } + + @Override + public Location getTeamUpgrades() { + return team.getTeamUpgrades(); + } + + @Override + public Location getShop() { + return team.getShop(); + } + + @Override + public Location getSpawn() { + return team.getSpawn(); + } + + @Override + public int getSize() { + return team.getSize(); + } + }; + } +} diff --git a/src/main/java/me/defender/cosmetics/util/MainMenuUtils.java b/src/main/java/me/defender/cosmetics/util/MainMenuUtils.java index 4d671cac..f3e0d044 100644 --- a/src/main/java/me/defender/cosmetics/util/MainMenuUtils.java +++ b/src/main/java/me/defender/cosmetics/util/MainMenuUtils.java @@ -4,12 +4,12 @@ import me.clip.placeholderapi.PlaceholderAPI; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigUtils; import me.defender.cosmetics.api.cosmetics.CosmeticsType; +import me.defender.cosmetics.data.PlayerOwnedData; import me.defender.cosmetics.menu.CategoryMenu; -import me.defender.cosmetics.database.PlayerOwnedData; +import me.defender.cosmetics.util.config.ConfigUtils; import org.bukkit.Bukkit; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; @@ -87,8 +87,8 @@ public static void saveLores() { public static List formatLore(List lores, Player p){ - BwcAPI api = new BwcAPI(); - PlayerOwnedData ownedData = Utility.playerOwnedDataList.get(p.getUniqueId()); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); + PlayerOwnedData ownedData = Cosmetics.getInstance().getPlayerManager().getPlayerOwnedData(p.getUniqueId()); try { lores = lores.stream() @@ -126,7 +126,7 @@ public static List formatLore(List lores, Player p){ public static void openMenus(Player p, String name){ String title = null; - Boolean placeholder = Cosmetics.isPlaceholderAPI(); + boolean placeholder = Cosmetics.isPlaceholderAPI(); switch (name) { case "Sprays": title = CosmeticsType.Sprays.getFormatedName(); @@ -147,7 +147,7 @@ public static void openMenus(Player p, String name){ if (placeholder){ title = PlaceholderAPI.setPlaceholders(p, title); } - new CategoryMenu(CosmeticsType.FinalKillEffects, title).open(p);; + new CategoryMenu(CosmeticsType.FinalKillEffects, title).open(p); break; case "Kill-Messages": title = CosmeticsType.KillMessage.getFormatedName(); @@ -206,7 +206,7 @@ public static void openMenus(Player p, String name){ new CategoryMenu(CosmeticsType.DeathCries, title).open(p); break; case "Back": - String command = Cosmetics.getInstance().menuData.getConfig().getString("Main-Menu.Back.custom-command"); + String command = Cosmetics.getInstance().menuData.getString("Main-Menu.Back.custom-command"); if(command == null) { p.getOpenInventory().close(); }else{ diff --git a/src/main/java/me/defender/cosmetics/util/StartupUtils.java b/src/main/java/me/defender/cosmetics/util/StartupUtils.java index b3ee20a5..b5bb2125 100644 --- a/src/main/java/me/defender/cosmetics/util/StartupUtils.java +++ b/src/main/java/me/defender/cosmetics/util/StartupUtils.java @@ -8,44 +8,26 @@ import com.comphenix.protocol.events.PacketEvent; import com.hakan.core.HCore; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.api.cosmetics.category.*; -import me.defender.cosmetics.category.bedbreakeffects.BedDestroyHandler1058; -import me.defender.cosmetics.category.bedbreakeffects.BedDestroyHandler2023; +import me.defender.cosmetics.api.handler.IHandler; import me.defender.cosmetics.category.bedbreakeffects.items.*; -import me.defender.cosmetics.category.deathcries.DeathCryHandler1058; -import me.defender.cosmetics.category.deathcries.DeathCryHandler2023; import me.defender.cosmetics.category.deathcries.items.DeathCryItems; -import me.defender.cosmetics.category.finalkilleffects.FinalKillEffectHandler1058; -import me.defender.cosmetics.category.finalkilleffects.FinalKillEffectHandler2023; import me.defender.cosmetics.category.finalkilleffects.items.*; -import me.defender.cosmetics.category.glyphs.GlyphHandler1058; -import me.defender.cosmetics.category.glyphs.GlyphHandler2023; import me.defender.cosmetics.category.glyphs.items.GlyphItems; -import me.defender.cosmetics.category.islandtoppers.IslandTopperHandler1058; -import me.defender.cosmetics.category.islandtoppers.IslandTopperHandler2023; import me.defender.cosmetics.category.islandtoppers.items.IslandTopperItems; -import me.defender.cosmetics.category.killmessage.KillMessageHandler1058; -import me.defender.cosmetics.category.killmessage.KillMessageHandler2023; import me.defender.cosmetics.category.killmessage.items.KillMessageItems; -import me.defender.cosmetics.category.projectiletrails.ProjectileHandler; import me.defender.cosmetics.category.projectiletrails.items.ProjectileTrailItems; -import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler1058; -import me.defender.cosmetics.category.shopkeeperskins.ShopKeeperHandler2023; import me.defender.cosmetics.category.shopkeeperskins.items.ShopKeeperItems; -import me.defender.cosmetics.category.sprays.SpraysHandler1058; -import me.defender.cosmetics.category.sprays.SpraysHandler2023; import me.defender.cosmetics.category.sprays.items.SprayItems; -import me.defender.cosmetics.category.victorydance.VictoryDanceHandler1058; -import me.defender.cosmetics.category.victorydance.VictoryDanceHandler2023; import me.defender.cosmetics.category.victorydance.items.*; -import me.defender.cosmetics.category.woodskin.WoodSkinHandler1058; -import me.defender.cosmetics.category.woodskin.WoodSkinHandler2023; import me.defender.cosmetics.category.woodskin.items.*; import me.defender.cosmetics.category.woodskin.items.log.*; import me.defender.cosmetics.listener.CosmeticPurchaseListener; -import me.defender.cosmetics.listener.GameListener; import me.defender.cosmetics.listener.PlayerJoinListener; +import me.defender.cosmetics.support.bedwars.handler.bedwars1058.BW1058Handler; +import me.defender.cosmetics.support.bedwars.handler.bedwars1058.BW1058ProxyHandler; +import me.defender.cosmetics.support.bedwars.handler.bedwars2023.BW2023ProxyHandler; import me.defender.cosmetics.support.placeholders.Placeholders; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -82,46 +64,14 @@ public class StartupUtils public static List shopKeeperSkinList; public static List islandTopperList; - public static boolean isBw2023 = false; + public static boolean isBw2023 = Bukkit.getPluginManager().getPlugin("BedWars2023") != null || + Bukkit.getPluginManager().getPlugin("BWProxy2023") != null; /** - This method is used to register all events for the plugin. - It includes registering listeners for the ShopKeeperSkin, GlyphHandler, KillMessageHandler, ProjectileHandler, - VictoryDanceHandler, FinalKillEffectHandler, BedDestroyHandler, WoodSkins, IslandTopperHandler, PlayerLeaveListener, - CosmeticPurchaseListener, PlayerJoinListener, DeathCryHandler and SpraysHandler classes. - @author defender + Register events and handler + @author defender */ public static void registerEvents() { - if(!new BwcAPI().isProxy()){ - if (!Cosmetics.getInstance().isBw2023()){ - HCore.registerListeners(new ShopKeeperHandler1058()); - HCore.registerListeners(new GlyphHandler1058()); - HCore.registerListeners(new KillMessageHandler1058()); - HCore.registerListeners(new VictoryDanceHandler1058()); - HCore.registerListeners(new FinalKillEffectHandler1058()); - HCore.registerListeners(new BedDestroyHandler1058()); - HCore.registerListeners(new WoodSkinHandler1058()); - HCore.registerListeners(new IslandTopperHandler1058()); - HCore.registerListeners(new GameListener()); - } else { - HCore.registerListeners(new WoodSkinHandler2023()); - HCore.registerListeners(new VictoryDanceHandler2023()); - HCore.registerListeners(new ShopKeeperHandler2023()); - HCore.registerListeners(new KillMessageHandler2023()); - HCore.registerListeners(new IslandTopperHandler2023()); - HCore.registerListeners(new GlyphHandler2023()); - HCore.registerListeners(new FinalKillEffectHandler2023()); - HCore.registerListeners(new BedDestroyHandler2023()); - } - HCore.registerListeners(new ProjectileHandler(Cosmetics.getInstance())); - } - if (!Cosmetics.getInstance().isBw2023()){ - HCore.registerListeners(new DeathCryHandler1058()); - HCore.registerListeners(new SpraysHandler1058()); - } else { - HCore.registerListeners(new SpraysHandler2023()); - HCore.registerListeners(new DeathCryHandler2023()); - } HCore.registerListeners(new CosmeticPurchaseListener()); HCore.registerListeners(new PlayerJoinListener()); } @@ -133,15 +83,15 @@ public static void registerEvents() { If the folders do not exist, they will be created. */ public static void createFolders() { - File spraysFolder = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/" + Cosmetics.getInstance().getConfig().getString("Spray-Dir")); + File spraysFolder = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/" + Cosmetics.getInstance().getConfig().getString("Spray-Dir")); if (!spraysFolder.exists()) { spraysFolder.mkdirs(); } - File islandToppersFolder = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/IslandToppers"); + File islandToppersFolder = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/IslandToppers"); if (!islandToppersFolder.exists()) { islandToppersFolder.mkdirs(); } - File cubeFile = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/IslandToppers/cube.schematic"); + File cubeFile = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/IslandToppers/cube.schematic"); // Save if not found if(cubeFile.exists()) return; try { @@ -157,17 +107,17 @@ public static void createFolders() { * in the folder and remove the temp.zip. */ public static void downloadGlyphs() { - File folder = new File(Cosmetics.getInstance().getDataFolder().getPath() + "/Glyphs"); + File folder = new File(Cosmetics.getInstance().getHandler().getAddonPath() + "/Glyphs"); if (!folder.exists()) { folder.mkdirs(); } - final String temp = Cosmetics.getInstance().getDataFolder().getPath() + "/Glyphs/temp.zip"; + final String temp = Cosmetics.getInstance().getHandler().getAddonPath() + "/Glyphs/temp.zip"; final File tempFile = new File(temp); if (tempFile.exists()) { tempFile.delete(); } String[] filesInFolder = folder.list(); - if (filesInFolder != null && filesInFolder.length == 0) { + if (filesInFolder != null && filesInFolder.length != 0) { return; } JavaPlugin plugin = Cosmetics.getInstance(); @@ -219,7 +169,7 @@ public static void updateConfigs(){ public static boolean checkDependencies(){ Logger log = Bukkit.getLogger(); if (Bukkit.getPluginManager().getPlugin("BedWars2023") == null) { - if(!isPluginEnabled("BedWars1058") && !new BwcAPI().isProxy()){ + if(!isPluginEnabled("BedWars1058") && !Cosmetics.getInstance().getApi().isProxy()){ log.severe("Cosmetics addon requires BedWars1058, BedWars2023, or BedWarsProxy to work!"); return false; } @@ -290,7 +240,7 @@ public static void loadCosmetics(){ //Items From Config new DeathCryItems().registerConfigItems(); new GlyphItems().registerConfigItems(); - if(isPluginEnabled("WorldEdit")) { + if(isPluginEnabled("WorldEdit") || isPluginEnabled("FastAsyncWorldEdit")) { new IslandTopperItems().registerItems(); }else{ Bukkit.getLogger().warning("Can't find worldedit! IslandTopper will not load!"); diff --git a/src/main/java/me/defender/cosmetics/util/Utility.java b/src/main/java/me/defender/cosmetics/util/Utility.java index fa5d4676..956efeff 100644 --- a/src/main/java/me/defender/cosmetics/util/Utility.java +++ b/src/main/java/me/defender/cosmetics/util/Utility.java @@ -3,36 +3,35 @@ package me.defender.cosmetics.util; -import com.andrei1058.bedwars.api.language.Language; -import com.andrei1058.bedwars.proxy.BedWarsProxy; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.hakan.core.utils.ColorUtil; import me.defender.cosmetics.Cosmetics; -import me.defender.cosmetics.api.BwcAPI; +import me.defender.cosmetics.api.CosmeticsAPI; import me.defender.cosmetics.menu.MainMenu; -import me.defender.cosmetics.database.PlayerData; -import me.defender.cosmetics.database.PlayerOwnedData; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import java.io.*; import java.net.URL; import java.nio.file.Files; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; public class Utility { - public static Map playerDataList; - public static Map playerOwnedDataList; - - /** * @param s the main string for example "Click me" * @param st the message when they hover. @@ -44,24 +43,19 @@ public static TextComponent hoverablemsg(String s, String st) { return message; } - /** - * Planned to be removed - * @return JavaPlugin class of Cosmetics.class - * @deprecated use {@link Cosmetics#getInstance()} - */ - @Deprecated - public static Cosmetics plugin() { - return Cosmetics.getPlugin(Cosmetics.class); - } /** * Open's the main menu for the given player * @param p player object */ - public static void openMainMenu(Player p){ + public static void openMainMenu(Player p) { new MainMenu(p).open(p); } + @Deprecated + private static String c(String s) { + return ChatColor.translateAlternateColorCodes('&', s); + } /** * Get Message from Language file of bedwars1058 for player object, works with Bedwars1058 and BedwarsProxy * @param p player object @@ -69,19 +63,8 @@ public static void openMainMenu(Player p){ * @return the result */ public static String getMSGLang(Player p, String path) { - BwcAPI api = new BwcAPI(); - if (api.isProxy()) { - if (!Cosmetics.getInstance().isBw2023()){ - return com.andrei1058.bedwars.proxy.language.Language.getMsg(p, path); - } else { - return com.tomkeuper.bedwars.api.language.Language.getMsg(p, path); - } - } - if (!Cosmetics.getInstance().isBw2023()){ - return Language.getMsg(p, path); - } else { - return com.tomkeuper.bedwars.api.language.Language.getMsg(p, path); - } + CosmeticsAPI api = Cosmetics.getInstance().getApi(); + return ColorUtil.colored(api.getHandler().getLanguageUtil().getMessage(p, path)); } /** @@ -91,15 +74,9 @@ public static String getMSGLang(Player p, String path) { * @return the result */ public static List getListLang(Player p, String path) { - BwcAPI api = new BwcAPI(); - if (api.isProxy()) { - return BedWarsProxy.getAPI().getLanguageUtil().getList(p, path); - } - if (!Cosmetics.getInstance().isBw2023()){ - return Language.getList(p, path); - } else { - return com.tomkeuper.bedwars.api.language.Language.getList(p, path); - } + CosmeticsAPI api = Cosmetics.getInstance().getApi(); + return api.getHandler().getLanguageUtil().getMessageList(p, path) + .stream().map(ColorUtil::colored).collect(Collectors.toList()); } /** @@ -108,16 +85,8 @@ public static List getListLang(Player p, String path) { * @param ob object */ public static void saveIfNotExistsLang(String path, Object ob) { - BwcAPI api = new BwcAPI(); - if (api.isProxy()) { - BedWarsProxy.getAPI().getLanguageUtil().saveIfNotExists(path, ob); - return; - } - if (!Cosmetics.getInstance().isBw2023()){ - Language.saveIfNotExists(path, ob); - } else { - com.tomkeuper.bedwars.api.language.Language.saveIfNotExists(path, ob); - } + CosmeticsAPI api = Cosmetics.getInstance().getApi(); + api.getHandler().getLanguageUtil().saveIfNotExists(path, ob); } /** @@ -126,14 +95,10 @@ public static void saveIfNotExistsLang(String path, Object ob) { * @return true if player is in arena, false otherwise. */ public static boolean isInArena(Player p) { - BwcAPI api = new BwcAPI(); + CosmeticsAPI api = Cosmetics.getInstance().getApi(); if (api.isProxy()) return false; - if (!Cosmetics.getInstance().isBw2023()){ - return Cosmetics.getInstance().getBedWars1058API().getArenaUtil().getArenaByPlayer(p) != null; - } else { - return Cosmetics.getInstance().getBedWars2023API().getArenaUtil().getArenaByPlayer(p) != null; - } + return Cosmetics.getInstance().getHandler().getArenaUtil().getArenaByPlayer(p) != null; } @@ -156,7 +121,7 @@ public static String[] getFromName(String name) { return new String[]{texture, signature}; } catch (IOException e) { - System.err.println("Could not get skin data from session servers!"); + Cosmetics.getInstance().getLogger().severe("Could not get skin data from session servers!"); e.printStackTrace(); return null; } @@ -197,4 +162,22 @@ public static void entityForPlayerOnly(Entity entityToHide, Player player){ } } } + + public static boolean isWoodOrLogBlock(Material mat) { + return (mat.toString().contains("WOOD") || mat.toString().contains("PLANKS") || mat.toString().contains("LOG")) && mat.isBlock(); + } + + public static List getSphere(Location loc, int radius) { + List blocks = new ArrayList<>(); + for (int x = -radius; x <= radius; x++) { + for (int y = -radius; y <= radius; y++) { + for (int z = -radius; z <= radius; z++) { + if (Math.sqrt(x * x + y * y + z * z) <= radius) { + blocks.add(loc.clone().add(x, y, z).getBlock()); + } + } + } + } + return blocks; + } } \ No newline at end of file diff --git a/src/main/java/me/defender/cosmetics/util/config/ConfigType.java b/src/main/java/me/defender/cosmetics/util/config/ConfigType.java index bc4a0a47..8a21fd93 100644 --- a/src/main/java/me/defender/cosmetics/util/config/ConfigType.java +++ b/src/main/java/me/defender/cosmetics/util/config/ConfigType.java @@ -13,7 +13,8 @@ public enum ConfigType { VICTORY_DANCES("VictoryDances"), WOOD_SKINS("WoodSkins"), - Main_Config("config"); + Main_Config("config"), + Main_Menu("MainMenu"); private final String fileName; diff --git a/src/main/java/me/defender/cosmetics/util/config/ConfigUtils.java b/src/main/java/me/defender/cosmetics/util/config/ConfigUtils.java index 197950bc..37b14c14 100644 --- a/src/main/java/me/defender/cosmetics/util/config/ConfigUtils.java +++ b/src/main/java/me/defender/cosmetics/util/config/ConfigUtils.java @@ -3,7 +3,6 @@ import me.defender.cosmetics.Cosmetics; import me.defender.cosmetics.api.configuration.ConfigManager; -import me.defender.cosmetics.util.config.ConfigType; import me.defender.cosmetics.api.cosmetics.CosmeticsType; import me.defender.cosmetics.util.Utility; @@ -13,47 +12,47 @@ public class ConfigUtils { public static ConfigManager getBedDestroys() { - return new ConfigManager(Cosmetics.getInstance(), "BedBreakEffect", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "BedBreakEffect", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getDeathCries() { - return new ConfigManager(Cosmetics.getInstance(), "DeathCries", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "DeathCries", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getFinalKillEffects() { - return new ConfigManager(Cosmetics.getInstance(), "FinalKillEffects", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "FinalKillEffects", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getGlyphs() { - return new ConfigManager(Cosmetics.getInstance(), "Glyphs", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "Glyphs", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getIslandToppers() { - return new ConfigManager(Cosmetics.getInstance(), "IslandToppers", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "IslandToppers", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getKillMessages() { - return new ConfigManager(Cosmetics.getInstance(), "KillMessages", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "KillMessages", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getProjectileTrails() { - return new ConfigManager(Cosmetics.getInstance(), "ProjectileTrails", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "ProjectileTrails", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getShopKeeperSkins() { - return new ConfigManager(Cosmetics.getInstance(), "ShopKeeperSkins", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "ShopKeeperSkins", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getSprays() { - return new ConfigManager(Cosmetics.getInstance(), "Sprays", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "Sprays", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getVictoryDances() { - return new ConfigManager(Cosmetics.getInstance(), "VictoryDances", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "VictoryDances", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getWoodSkins() { - return new ConfigManager(Cosmetics.getInstance(), "WoodSkins", Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + return new ConfigManager(Cosmetics.getInstance(), "WoodSkins", Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } @@ -61,11 +60,14 @@ public static ConfigManager get(ConfigType configType){ if(configType == ConfigType.Main_Config){ return getMainConfig(); } - return new ConfigManager(Cosmetics.getInstance(), configType.getFileName(), Cosmetics.getInstance().getDataFolder().getPath() + "/Categories"); + if(configType == ConfigType.Main_Menu){ + return Cosmetics.getInstance().menuData; + } + return new ConfigManager(Cosmetics.getInstance(), configType.getFileName(), Cosmetics.getInstance().getHandler().getAddonPath() + "/Categories"); } public static ConfigManager getMainConfig(){ - return new ConfigManager(Cosmetics.getInstance(), "config", Cosmetics.getInstance().getDataFolder().getPath()); + return new ConfigManager(Cosmetics.getInstance(), "config", Cosmetics.getInstance().getHandler().getAddonPath()); } public static void saveIfNotFound(ConfigType configType, String path ,Object data){ diff --git a/src/main/java/me/defender/cosmetics/util/config/MainMenuData.java b/src/main/java/me/defender/cosmetics/util/config/MainMenuData.java deleted file mode 100644 index 522e81c3..00000000 --- a/src/main/java/me/defender/cosmetics/util/config/MainMenuData.java +++ /dev/null @@ -1,65 +0,0 @@ - - -package me.defender.cosmetics.util.config; - -import me.defender.cosmetics.Cosmetics; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.logging.Level; - -public class MainMenuData -{ - private final Cosmetics plugin; - private FileConfiguration datacfg; - private File cfgfile; - - public MainMenuData(final Cosmetics plugin) { - this.plugin = plugin; - this.savedefaultcfg(); - } - - public void reloadcfg() { - if (this.cfgfile == null) { - this.cfgfile = new File(this.plugin.getDataFolder(), "MainMenu.yml"); - } - this.datacfg = YamlConfiguration.loadConfiguration(this.cfgfile); - final InputStream defaultStream = this.plugin.getResource("MainMenu.yml"); - if (defaultStream != null) { - final YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(defaultStream)); - this.datacfg.setDefaults(defaultConfig); - } - } - - public FileConfiguration getConfig() { - if (this.datacfg == null) { - this.reloadcfg(); - } - return this.datacfg; - } - - public void savecfg() { - if (this.datacfg == null || this.cfgfile == null) { - return; - } - try { - this.getConfig().save(this.cfgfile); - } - catch (final IOException e) { - this.plugin.getLogger().log(Level.SEVERE, "Could not save the data file! contact the dev!" + this.cfgfile, e); - } - } - - public void savedefaultcfg() { - if (this.cfgfile == null) { - this.cfgfile = new File(this.plugin.getDataFolder(), "MainMenu.yml"); - } - if (!this.cfgfile.exists()) { - this.plugin.saveResource("MainMenu.yml", false); - } - } -} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8ae16576..9b318647 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -10,6 +10,7 @@ mysql: database: "name" username: "root" password: "none" + useSSL: false maxpoolsize: 50 cosmetic-preview: cosmetic-location: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a42043a0..0a9cc0c3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,9 +1,11 @@ -name: BW1058-Cosmetics +name: Cosmetics version: '1.4.6' main: me.defender.cosmetics.Cosmetics -prefix: BW1058-Cosmetics -softdepend: [ BedWars1058, BedWars2023, BedwarsProxy] -depend: [Vault, Citizens, PlaceholderAPI, WorldEdit] +prefix: BedWars-Cosmetics +softdepend: [ BedWars1058, BedWars2023, BedwarsProxy, WorldEdit, FastAsyncWorldEdit] +depend: [Vault, Citizens, PlaceholderAPI, ProtocolLib] author: IamTheDefender (iamthedefender) description: This addon adds a set of various cosmetics to your bedwars server website: https://github.com/IamTheDefender/BW1058-Cosmetics +libraries: + - mysql:mysql-connector-java:8.0.29 \ No newline at end of file