diff --git a/README.md b/README.md index b6994178c..6e6f553bb 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ Maven repository: Maven: ``` - elitemobs-repo/id> + elitemobs-repo https://s01.oss.sonatype.org/content/repositories/snapshots com.magmaguy EliteMobs - 8.7.4-SNAPSHOT + 9.0.2-SNAPSHOT provided ``` @@ -43,7 +43,7 @@ repositories { dependencies{ //EliteMobs - compileOnly group: 'com.magmaguy', name: 'EliteMobs', version: '8.7.4-SNAPSHOT' + compileOnly group: 'com.magmaguy', name: 'EliteMobs', version: '9.0.2-SNAPSHOT' } ``` diff --git a/build.gradle b/build.gradle index 000c6649d..da02e0566 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,8 @@ -import org.apache.tools.ant.filters.ReplaceTokens - plugins { id 'java-library' id 'idea' id 'maven-publish' - id "com.github.johnrengelman.shadow" version "7.0.0" + id("io.github.goooler.shadow") version "8.1.8" id 'signing' } @@ -12,7 +10,13 @@ plugins { compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" -//Fixes issues with utf-8 in the translations files. Why? Don't know. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + +//Fixes issues with utf-8 in the translations files. processResources { def props = [version: version] inputs.properties props @@ -23,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '8.7.16-SNAPSHOT' +version '9.1.8' repositories { maven { @@ -42,13 +46,16 @@ repositories { mavenLocal() //Spigot API & CloudCommands - maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } - //maven { url = 'https://oss.sonatype.org/content/repositories/central' } - maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots" } - //FreeMinecraftModels - maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } + //MagmaCore + maven { + url = 'https://repo.magmaguy.com/releases' + } + //MagmaCore + maven { + url = 'https://repo.magmaguy.com/snapshots' + } //Bstats API maven { url = 'https://repo.codemc.org/repository/maven-public' } @@ -61,10 +68,8 @@ repositories { maven { url = 'https://repo.md-5.net/content/groups/public/' } //PlaceholderAPI maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' } - //WorldGuard API maven { url = 'https://maven.enginehub.org/repo/' } - //Model Engine maven { url = 'https://mvn.lumine.io/repository/maven-public/' @@ -72,27 +77,13 @@ repositories { artifact() } } - } dependencies { //Spigot API - compileOnly "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT" - // The full CraftBukkit server with no shadowing. Requires mavenLocal. - //BStats API - implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' + compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' - //WorldEdit API - compileOnly group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.2.12' - //CloudCommands - implementation group: 'cloud.commandframework', name: 'cloud-paper', version: '1.7.1' - //CloudCommands Minecraft Extras module - implementation group: 'cloud.commandframework', name: 'cloud-minecraft-extras', version: '1.7.0' - //CloudCommands Adventure Platform module - implementation('net.kyori:adventure-platform-bukkit:4.1.1') - //I can't remember what this was for but it's in CloudCommands - implementation group: 'io.leangen.geantyref', name: 'geantyref', version: '1.3.4' //Vault compileOnly("com.github.MilkBowl:VaultAPI:1.7") { exclude group: 'org.bukkit', module: 'bukkit' @@ -102,34 +93,29 @@ dependencies { //SQLite compileOnly group: 'org.xerial', name: 'sqlite-jdbc', version: '3.32.3' //MySQL - implementation 'mysql:mysql-connector-java:8.0.33' + compileOnly 'mysql:mysql-connector-java:8.0.33' //LibsDisguises compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '4.7.0' compileOnly group: 'LibsDisguises', name: 'LibsDisguises', version: '10.0.26' //PlaceholderAPI compileOnly group: 'me.clip', name: 'placeholderapi', version: '2.10.9' - - implementation group: 'commons-io', name: 'commons-io', version: '2.7' - implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' - - //reflections - used for config initialization - implementation group: 'org.reflections', name: 'reflections', version: '0.10.2' - //lombok - compileOnly 'org.projectlombok:lombok:1.18.24' - annotationProcessor 'org.projectlombok:lombok:1.18.24' - + compileOnly 'org.projectlombok:lombok:1.18.34' + annotationProcessor 'org.projectlombok:lombok:1.18.34' //Model Engine - legacy compileOnly "com.ticxo.modelengine:api:R3.1.7" - //Free Minecraft Models - compileOnly group: 'com.magmaguy', name: 'FreeMinecraftModels', version: '1.3.0-SNAPSHOT' - - //Advanced AI goals - implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.11.2-SNAPSHOT' - + compileOnly group: 'com.magmaguy', name: 'FreeMinecraftModels', version: '1.4.2' // Mythic Mobs integration - currently only for arenas compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' + + ///Shaded in + implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' + implementation group: 'commons-io', name: 'commons-io', version: '2.7' + implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.13.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' + } artifacts { // task 'build' runs generates uberjar @@ -146,57 +132,22 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') - relocate('cloud.commandframework', packagePath + '.cloud') - relocate('net.kyori', packagePath + '.adventure-platform-bukkit') - relocate('io.leangen.geantyref', packagePath + '.geantyref') - relocate('org.reflections', packagePath + '.reflections') } archiveClassifier.set(null) archiveFileName.set(project.name + ".jar") destinationDirectory.set(new File("testbed/plugins")) } -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -ext { - resourceTokens = [ - 'Version': version - ] -} - -processResources { - filter ReplaceTokens, tokens: resourceTokens -} - -//sonatype repo -task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc -} - -task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource -} - -artifacts { - archives javadocJar, sourcesJar -} - -ext.isReleaseVersion = !version.contains("SNAPSHOT") - publishing { repositories { maven { - def releaseRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/" - url = isReleaseVersion ? releaseRepo : snapshotRepo + name = "EliteMobs" + url = "http://magmaguy.com:50001/releases" credentials { username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" } + allowInsecureProtocol = true } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a254..a59520664 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java deleted file mode 100644 index ef5b50091..000000000 --- a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.magmaguy.elitemobs; - -import org.bukkit.ChatColor; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by MagmaGuy on 13/05/2017. - */ -public class ChatColorConverter { - - private ChatColorConverter() { - } - - public static String convert(String string) { - if (string == null) return ""; - return ChatColor.translateAlternateColorCodes('&', string); - } - - public static List convert(List list) { - if (list == null)return new ArrayList<>(); - List convertedList = new ArrayList<>(); - for (Object value : list) - convertedList.add(convert(value + "")); - return convertedList; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 851495ecf..e57279907 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -6,7 +6,6 @@ import com.magmaguy.easyminecraftgoals.NMSManager; import com.magmaguy.elitemobs.commands.CommandHandler; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -26,28 +25,29 @@ import com.magmaguy.elitemobs.config.powers.PowersConfig; import com.magmaguy.elitemobs.config.wormholes.WormholeConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.economy.VaultCompatibility; import com.magmaguy.elitemobs.entitytracker.CustomProjectileData; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.events.ActionEvent; import com.magmaguy.elitemobs.events.TimedEvent; import com.magmaguy.elitemobs.explosionregen.Explosion; -import com.magmaguy.elitemobs.gamemodes.nightmaremodeworld.DaylightWatchdog; -import com.magmaguy.elitemobs.gamemodes.zoneworld.Grid; import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.items.LootTables; import com.magmaguy.elitemobs.items.customenchantments.CustomEnchantment; import com.magmaguy.elitemobs.items.customitems.CustomItem; import com.magmaguy.elitemobs.menus.ProceduralShopMenu; import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; +import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; +import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomMusic; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; -import com.magmaguy.elitemobs.mobs.passive.EggRunnable; -import com.magmaguy.elitemobs.mobs.passive.PassiveEliteMobDeathHandler; import com.magmaguy.elitemobs.npcs.NPCEntity; +import com.magmaguy.elitemobs.pathfinding.Navigation; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.elitemobs.powers.scripts.ScriptAction; import com.magmaguy.elitemobs.powerstances.MajorPowerStanceMath; import com.magmaguy.elitemobs.powerstances.MinorPowerStanceMath; import com.magmaguy.elitemobs.quests.DynamicQuest; @@ -59,16 +59,15 @@ import com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.InfoMessage; +import com.magmaguy.elitemobs.utils.BossBarUtil; import com.magmaguy.elitemobs.utils.ServerTime; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.versionnotifier.VersionChecker; -import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import com.magmaguy.elitemobs.wormhole.Wormhole; +import com.magmaguy.magmacore.MagmaCore; +import com.magmaguy.magmacore.util.Logger; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.World; -import org.bukkit.entity.EntityType; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; @@ -82,72 +81,65 @@ public class EliteMobs extends JavaPlugin { public static List validWorldList = new ArrayList(); public static boolean worldGuardIsEnabled = false; - public static List zoneBasedSpawningWorlds = new ArrayList<>(); - public static List nightmareWorlds = new ArrayList<>(); public static Metrics metrics; public Object placeholders = null; public static void initializeConfigs() { //Initialized translations - DefaultConfig.initializeConfig(); - SchematicsFolderConfig.initializeConfigs(); - ResourcePackDataConfig.initializeConfig(); - ItemSettingsConfig.initializeConfig(); - ProceduralItemGenerationSettingsConfig.initializeConfig(); + new DefaultConfig(); + new ItemSettingsConfig(); + new ProceduralItemGenerationSettingsConfig(); PotionEffectsConfig.initializeConfigs(); - EconomySettingsConfig.initializeConfig(); - EventsConfig.initializeConfig(); + new EconomySettingsConfig(); + new EventsConfig(); new EnchantmentsConfig(); - AntiExploitConfig.initializeConfig(); - CombatTagConfig.initializeConfig(); - AntiExploitConfig.initializeConfig(); - AdventurersGuildConfig.initializeConfig(); - ValidWorldsConfig.initializeConfig(); + new AntiExploitConfig(); + new CombatTagConfig(); + new AntiExploitConfig(); + new AdventurersGuildConfig(); + new ValidWorldsConfig(); new MenusConfig(); new PowersConfig(); MobPropertiesConfig.initializeConfigs(); CustomEnchantment.initializeCustomEnchantments(); - MobCombatSettingsConfig.initializeConfig(); + new MobCombatSettingsConfig(); CommandsConfig.initializeConfigs(); - DiscordSRVConfig.initializeConfig(); - ItemUpgradeSystemConfig.initializeConfig(); + new DiscordSRVConfig(); new CustomEventsConfig(); - QuestsConfig.initializeConfig(); - WormholesConfig.initializeConfig(); - ArenasConfig.initializeConfig(); - //SoundsConfig.initializeConfig(); + new QuestsConfig(); + new WormholesConfig(); + new ArenasConfig(); //ModelsConfig.initializeConfig(); - DungeonsConfig.initializeConfig(); + new DungeonsConfig(); + new SoundsConfig(); } public static void worldScanner() { for (World world : Bukkit.getWorlds()) - if (ValidWorldsConfig.getFileConfiguration().getBoolean("Valid worlds." + world.getName())) { + if (ValidWorldsConfig.getInstance().getFileConfiguration().getBoolean("Valid worlds." + world.getName())) { validWorldList.add(world); - if (ValidWorldsConfig.getZoneBasedWorlds().contains(world.getName())) - zoneBasedSpawningWorlds.add(world); - if (ValidWorldsConfig.getNightmareWorlds().contains(world.getName())) { - nightmareWorlds.add(world); - DaylightWatchdog.preventDaylight(world); - } } } @Override public void onEnable() { - Bukkit.getLogger().info(" _____ _ _____ _____ ________ ______________ _____"); Bukkit.getLogger().info("| ___| | |_ _|_ _| ___| \\/ | _ | ___ \\/ ___|"); Bukkit.getLogger().info("| |__ | | | | | | | |__ | . . | | | | |_/ /\\ `--."); Bukkit.getLogger().info("| __|| | | | | | | __|| |\\/| | | | | ___ \\ `--. \\"); Bukkit.getLogger().info("| |___| |_____| |_ | | | |___| | | \\ \\_/ / |_/ //\\__/ /"); Bukkit.getLogger().info("\\____/\\_____/\\___/ \\_/ \\____/\\_| |_/\\___/\\____/ \\____/"); - MetadataHandler.PLUGIN = this; Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion()); + if (VersionChecker.serverVersionOlderThan(21, 0)) { + Logger.warn("You are running a Minecraft version older than 1.21.0! EliteMobs 9.0 and later are only compatible with Minecraft 1.21.0 or later, if you are running an older Minecraft version you will need to use a pre-9.0 version of EliteMobs."); + Bukkit.getPluginManager().disablePlugin(this); + return; + } + ServerTime.startTickCounter(); NMSManager.initializeAdapter(this); @@ -157,9 +149,9 @@ public void onEnable() { try { File spigotConfigContainer = new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getParentFile().getCanonicalFile().getParentFile().toString() + "/spigot.yml").toString()); Bukkit.getServer().spigot().getConfig().save(spigotConfigContainer); - new InfoMessage("New default max health set correctly!"); + Logger.info("New default max health set correctly!"); } catch (IOException e) { - new WarningMessage("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000); + Logger.warn("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000); } } @@ -178,14 +170,14 @@ public void onEnable() { //Reserves ModelEngine addresses if present ModelEngineReservedAddresses.reserve(); - if (worldGuardIsEnabled) Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is enabled!"); - else Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is not enabled!"); + if (worldGuardIsEnabled) Logger.info("WorldGuard compatibility is enabled!"); + else Logger.info("WorldGuard compatibility is not enabled!"); //Enable Vault try { VaultCompatibility.vaultSetup(); } catch (Exception e) { - Bukkit.getLogger().warning("[EliteMobs] Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error."); + Logger.warn("Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error."); VaultCompatibility.VAULT_ENABLED = false; } @@ -193,7 +185,7 @@ public void onEnable() { EventsRegistrer.registerEvents(); //Launch the local data cache - DatabaseConfig.initializeConfig(); + new DatabaseConfig(); PlayerData.initializeDatabaseConnection(); ElitePlayerInventory.initialize(); @@ -218,11 +210,6 @@ public void onEnable() { MinorPowerStanceMath.initializeVectorCache(); MajorPowerStanceMath.initializeVectorCache(); - /* - Scan for loaded SuperMobs - */ - PassiveEliteMobDeathHandler.SuperMobScanner.scanSuperMobs(); - // Small check to make sure that PlaceholderAPI is installed if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { Placeholders placeholders = new Placeholders(); @@ -236,7 +223,8 @@ public void onEnable() { new CustomCharts(); //Imports custom configurations and mindungeons from the import folder - ConfigurationImporter.initializeConfigs(); +// ConfigurationImporter.initializeConfigs(); + MagmaCore.initializeImporter(); ConfigurationExporter.initializeConfigs(); //Import custom items after potentially importing new items @@ -246,17 +234,6 @@ public void onEnable() { //Initialize em package content, such as world loading new DungeonPackagerConfig(); - //Load Adventurer's Guild - if (AdventurersGuildConfig.isGuildWorldIsEnabled()) { - try { - CustomWorldLoading.startupWorldInitialization(); - AdventurersGuildCommand.defineTeleportLocation(); - if (AdventurersGuildConfig.getGuildWorldLocation() == null) AdventurersGuildConfig.toggleGuildInstall(); - } catch (Exception e) { - AdventurersGuildConfig.toggleGuildInstall(); - new WarningMessage("Failed to initialize the Adventurer's Guild Hub! It is now disabled. You can try to" + "reenable it in /em setup"); - } - } //Initialize custom & regional bosses new CustomBossesConfig(); @@ -274,7 +251,7 @@ public void onEnable() { try { if (emPackage.isInstalled()) emPackage.initializeContent(); } catch (Exception exception) { - new WarningMessage("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !"); + Logger.warn("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !"); exception.printStackTrace(); } @@ -283,17 +260,18 @@ public void onEnable() { try { new CustomSpawnConfig(); } catch (Exception ex) { - new WarningMessage("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version" + + Logger.warn("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version" + " you are running."); - new WarningMessage(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus)."); + Logger.warn(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus)."); } new CustomQuestsConfig(); //Commands - new CommandHandler(); +// new CommandHandler(); + CommandHandler.registerCommands(); - SpecialItemSystemsConfig.initializeConfig(); + new SpecialItemSystemsConfig(); /* Check for new plugin version or for dungeon updates @@ -301,15 +279,20 @@ public void onEnable() { VersionChecker.check(); DynamicQuest.startRandomizingQuests(); + CustomBossEntity.startUpdatingDynamicLevels(); } @Override public void onLoad() { + //Initializes some core utilities that are shared across MagmaGuy's plugins + MetadataHandler.PLUGIN = this; + MagmaCore.createInstance(this); + //WorldGuard hook try { worldGuardIsEnabled = WorldGuardCompatibility.initialize(); } catch (NoClassDefFoundError | IllegalStateException ex) { - Bukkit.getLogger().warning("[EliteMobs] Error loading WorldGuard. EliteMob-specific flags will not work." + " Except if you just reloaded the plugin, in which case they will totally work."); + Logger.warn("Error loading WorldGuard. EliteMob-specific flags will not work." + " Except if you just reloaded the plugin, in which case they will totally work."); worldGuardIsEnabled = false; } if (!worldGuardIsEnabled) @@ -319,43 +302,22 @@ public void onLoad() { @Override public void onDisable() { - - new InfoMessage("Starting EliteMobs shutdown sequence..."); - - new InfoMessage("Regenerating exploded blocks..."); + Logger.info("Starting EliteMobs shutdown sequence..."); Explosion.regenerateAllPendingBlocks(); - - new InfoMessage("Cancelling tasks..."); Bukkit.getServer().getScheduler().cancelTasks(MetadataHandler.PLUGIN); - - new InfoMessage("Closing wormholes..."); Wormhole.shutdown(); - - new InfoMessage("Spinning Regional Bosses down..."); - //save all pending respawns RegionalBossEntity.save(); RegionalBossEntity.getTrackableCustomBosses().clear(); RegionalBossEntity.getRegionalBossEntitySet().clear(); InstancedBossEntity.shutdown(); NPCEntity.shutdown(); - - new InfoMessage("Wiping Elite entities clean..."); PersistentObjectHandler.shutdown(); EntityTracker.wipeShutdown(); - - new InfoMessage("Clearing events..."); TimedEvent.shutdown(); ActionEvent.shutdown(); - - new InfoMessage("Clearing valid worlds..."); validWorldList.clear(); - new InfoMessage("Clearing zone based worlds..."); - zoneBasedSpawningWorlds.clear(); - new InfoMessage("Clearing config regional elites..."); CustomBossesConfigFields.getRegionalElites().clear(); - new InfoMessage("Clearing custom enchantments..."); CustomEnchantment.getCustomEnchantmentMap().clear(); - new InfoMessage("Clearing custom items..."); CustomItem.getCustomItems().clear(); CustomItem.getCustomItemStackList().clear(); CustomItem.getCustomItemStackShopList().clear(); @@ -364,46 +326,32 @@ public void onDisable() { CustomItem.getFixedItems().clear(); CustomItem.getTieredLoot().clear(); CustomItem.getWeighedFixedItems().clear(); - new InfoMessage("Clearing Minidungeons..."); EMPackage.shutdown(); RegionalBossEntity.regionalBossesShutdown(); - - new InfoMessage("Unregistering placeholders..."); if (this.placeholders != null) ((Placeholders) placeholders).unregister(); - - new InfoMessage("Unregistering handlers..."); HandlerList.unregisterAll(MetadataHandler.PLUGIN); - - new InfoMessage("Clearing Treasure Chests..."); TreasureChest.clearTreasureChests(); - - new InfoMessage("Untracking quests..."); QuestTracking.clear(); - MatchInstance.shutdown(); - CustomProjectileData.shutdown(); - DynamicQuest.shutdown(); - ProceduralShopMenu.shutdown(); - - //save cached data - Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); + EliteMobsWorld.shutdown(); + Navigation.shutdown(); + BossBarUtil.shutdown(); + ScriptAction.shutdown(); + CustomMusic.shutdown(); + CustomBossEntity.shutdown(); + Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); - Bukkit.getLogger().info("[EliteMobs] All done! Good night."); - + MagmaCore.shutdown(); + Logger.info("All done! Good night."); } /* Repeating tasks that run as long as the server is on */ private void launchRunnables() { - if (!zoneBasedSpawningWorlds.isEmpty()) Grid.initializeGrid(); - int eggTimerInterval = 20 * 60 * 10 / DefaultConfig.getSuperMobStackAmount(); - if (MobPropertiesConfig.getMobProperties().get(EntityType.CHICKEN).isEnabled() && DefaultConfig.getSuperMobStackAmount() > 0) { - new EggRunnable().runTaskTimer(this, eggTimerInterval, eggTimerInterval); - } //save regional bosses when the files update RegionalBossEntity.regionalDataSaver(); } diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 12d8569d8..246e9a667 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -16,11 +16,10 @@ import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig; import com.magmaguy.elitemobs.config.powers.PowersConfig; +import com.magmaguy.elitemobs.dungeons.DungeonProtector; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.events.ActionEvent; import com.magmaguy.elitemobs.explosionregen.Explosion; -import com.magmaguy.elitemobs.gamemodes.nightmaremodeworld.DaylightWatchdog; -import com.magmaguy.elitemobs.gamemodes.zoneworld.ZoneWarner; import com.magmaguy.elitemobs.initialsetup.FirstTimeSetup; import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.instanced.arena.ArenaInstance; @@ -29,12 +28,10 @@ import com.magmaguy.elitemobs.items.customenchantments.*; import com.magmaguy.elitemobs.items.potioneffects.PlayerPotionEffects; import com.magmaguy.elitemobs.menus.*; -import com.magmaguy.elitemobs.mobconstructor.MergeHandler; import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; import com.magmaguy.elitemobs.mobconstructor.custombosses.*; import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBossBlock; -import com.magmaguy.elitemobs.mobs.passive.*; import com.magmaguy.elitemobs.mobspawning.NaturalMobSpawnEventHandler; import com.magmaguy.elitemobs.npcs.NPCDamageEvent; import com.magmaguy.elitemobs.npcs.NPCEntity; @@ -91,8 +88,6 @@ public static void registerEvents() { register(new Navigation()); - register(new ResourcePackDataConfig.ResourcePackDataConfigEvents()); - register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener()); register(new VersionChecker.VersionCheckerEvents()); @@ -102,21 +97,17 @@ public static void registerEvents() { register(new PlayerStatsTracker()); register(new PlayerQuestCooldownsLogout()); - register(new ChickenHandler()); - register(new CowHandler()); - register(new MushroomCowHandler()); - register(new PassiveEliteMobDeathHandler()); - register(new PigHandler()); - register(new SheepHandler()); - register(new FindSuperMobs()); if (ItemSettingsConfig.isPreventEliteItemEnchantment()) register(new ItemEnchantmentPrevention()); if (ItemSettingsConfig.isPreventEliteItemDisenchantment()) register(new ItemDisenchantPrevention()); - if (!VersionChecker.serverVersionOlderThan(15, 2)) - if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) - register(new PreventUpgradeDiamondToNetherite()); + if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) + register(new PreventUpgradeDiamondToNetherite()); + + register(new FixPlayerOnLoginOrRespawn()); + register(new EnvironmentalDungeonDamage()); + register(new PlayerQuitCleanup()); //Mob damage register(new EliteMobGenericDamagedHandler()); @@ -149,7 +140,6 @@ public static void registerEvents() { register(new EliteMobEnterCombatEvent.EliteMobEnterCombatEventFilter()); register(new PlayerPreTeleportEvent.PlayerPreTeleportEventEvents()); register(new PlayerTeleportEvent.PlayerTeleportEventExecutor()); - register(new SuperMobDamageEvent.SuperMobDamageEventFilter()); register(new EliteMobDamagedByPlayerEvent.EliteMobDamagedByPlayerEventFilter()); register(new EliteExplosionEvent.EliteExplosionEvents()); @@ -223,7 +213,6 @@ public static void registerEvents() { register(new PersistentObjectHandler.PersistentObjectHandlerEvents()); register(new CustomBossTaunts()); register(new PhaseBossEntity.PhaseBossEntityListener()); - register(new RegionalBossEntity.RegionalBossEntityEvents()); register(new AdvancedAggroManager()); register(new TransitiveBossBlock()); register(new TransitiveBlockCommand.TemporaryBossBlockCommandEvents()); @@ -232,9 +221,6 @@ public static void registerEvents() { //Metadata (player purger) register(new MetadataHandler()); - //Mob merger - register(new MergeHandler()); - //Natural EliteMobs Spawning register(new EntityTracker()); //Fix lingering entity after crashes @@ -278,10 +264,7 @@ public static void registerEvents() { register(new LootMenu.LootMenuEvents()); //Minecraft behavior canceller - if (DefaultConfig.isPreventCreeperDamageToPassiveMobs()) - register(new PreventCreeperPassiveEntityDamage()); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - register(new PreventEliteBeeHiveEnter()); + register(new PreventEliteBeeHiveEnter()); register(new EnderDragonUnstuck()); if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities()) register(new VanillaReinforcementsCanceller()); @@ -290,6 +273,7 @@ public static void registerEvents() { register(new AlternativeDurabilityLoss()); register(new EnderCrystalDamageProtectionBypass()); register(new NPCsBecomeWitches()); + register(new PreventEliteSilverfishBlockEnter()); //Antiexploits @@ -301,9 +285,7 @@ public static void registerEvents() { register(new PreventItemPickupByMobs()); if (AntiExploitConfig.isAmbientDamageExploit()) register(new AmbientDamageExploit()); - if (!VersionChecker.serverVersionOlderThan(14, 0)) { - register(new HoneyBlockJumpExploit()); - } + register(new HoneyBlockJumpExploit()); register(new EliteMobDamagedByPlayerAntiExploitListener()); if (AntiExploitConfig.isNoPathExploit()) register(new PreventPathfindingExploit()); @@ -344,6 +326,9 @@ public static void registerEvents() { register(new QuestInventoryMenu.QuestInventoryMenuEvents()); register(new ArenaCompleteEvent.ArenaCompleteEventHandler()); + //Songs + register(new CustomMusic.CustomMusicEvents()); + //Arenas register(new ArenaMenu.ArenaMenuEvents()); register(new ArenaInstance.ArenaInstanceEvents()); @@ -372,6 +357,7 @@ public static void registerEvents() { register(new WorldGuardDungeonFlag()); register(new WorldGuardExplosionBlockDamageFlag()); } + register(new DungeonProtector()); register(new EntityTransformHandler()); register(new EliteBlazeWaterDamagePrevention()); @@ -382,10 +368,6 @@ public static void registerEvents() { register(new TreasureChest.TreasureChestEvents()); - //Zone based spawning - register(new ZoneWarner()); - register(new DaylightWatchdog()); - //On death commands register(new OnDeathCommands()); diff --git a/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java b/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java index a0a785dc6..69083d1e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java @@ -1,8 +1,7 @@ package com.magmaguy.elitemobs; -import org.bukkit.Bukkit; import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPlugin; /** * Created by MagmaGuy on 26/04/2017. @@ -20,8 +19,7 @@ public class MetadataHandler implements Listener { //third party compatibility public final static String BETTERDROPS_COMPATIBILITY_MD = "betterdrops_ignore"; //plugin getter - public static Plugin PLUGIN = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS); - + public static JavaPlugin PLUGIN; public static int signatureID = 31173; diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java index a45629ebf..ead9234e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.config.AdventurersGuildConfig; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.playerdata.database.PlayerData; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.Round; import org.bukkit.attribute.Attribute; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 9c7724ecd..3d2525113 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,12 +1,13 @@ package com.magmaguy.elitemobs.adventurersguild; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; +import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; +import com.magmaguy.elitemobs.config.SoundsConfig; import com.magmaguy.elitemobs.config.menus.premade.GuildRankMenuConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -20,15 +21,14 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; public class GuildRankMenuHandler implements Listener { private static final HashSet inventories = new HashSet<>(); - private static final ArrayList rankSlots = new ArrayList<>(Arrays.asList( - 4, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42)); + private static final ArrayList rankSlots = new ArrayList<>(new ArrayList<>(List.of( + 4, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42))); private static final int prestigeRankSlot = 49; private static void selectUnlockedRank(Player player, int guildRank) { @@ -61,6 +61,7 @@ private static void selectRankToUnlock(Player player, int guildRank) { command.replace("$player", player.getName()) .replace("$prestigeRank", GuildRank.getActiveGuildRank(player) + "") .replace("$activeRank", GuildRank.getGuildPrestigeRank(player) + "")); + player.playSound(player.getLocation(), SoundsConfig.guildRankUpSound, 1, 1); } private static void selectPrestigeUnlock(Player player) { @@ -94,6 +95,7 @@ private static void selectPrestigeUnlock(Player player) { command.replace("$player", player.getName()) .replace("$prestigeRank", GuildRank.getActiveGuildRank(player) + "") .replace("$activeRank", GuildRank.getGuildPrestigeRank(player) + "")); + player.playSound(player.getLocation(), SoundsConfig.guildPrestigeSound, 1, 1); } /** @@ -111,7 +113,7 @@ private static void selectPrestigeUnlock(Player player) { */ public static Inventory initializeGuildRankMenu(Player player) { String menuName = GuildRankMenuConfig.getMenuName(); - if (ResourcePackDataConfig.displayCustomMenuUnicodes) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDA90\uDEFA\uF805 " + menuName; Inventory difficultyMenu = Bukkit.createInventory(player, 54, menuName); difficultyMenu = populateInventory(difficultyMenu, player); @@ -276,14 +278,14 @@ private static String healthBonusString(int prestigeLevel, int guildRank) { private static String critBonusString(int prestigeLevel, int guildRank) { if (!AdventurersGuildConfig.isAddMaxHealth()) return null; - if (prestigeLevel < 3) + if (prestigeLevel < 2) return null; return GuildRankMenuConfig.getCritBonusMessage().replace("$amount", GuildRank.critBonusValue(prestigeLevel, guildRank) + ""); } private static String dodgeBonusString(int prestigeLevel, int guildRank) { if (!AdventurersGuildConfig.isAddMaxHealth()) return null; - if (prestigeLevel < 4) + if (prestigeLevel < 3) return null; return GuildRankMenuConfig.getDodgeBonusMessage().replace("$amount", GuildRank.dodgeBonusValue(prestigeLevel, guildRank) + ""); } diff --git a/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java b/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java index f998b6b59..a3b7e0a85 100644 --- a/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java +++ b/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.announcements; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.EventsConfig; import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java index eb97e1867..83d11f928 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java @@ -8,12 +8,11 @@ public class EliteDamageEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); + private final Event event; private boolean isCancelled = false; @Getter private double damage; - private final Event event; - /** * Classes that deal with damage in EliteMobs extend this class in order to inherit modifiable and cancellable behavior. * This is purely just used for API purposes, such as with the Elite Scripting system. Does not do anything on its own. diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 1b4323c62..a86da6566 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -6,6 +6,7 @@ import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.entitytracker.CustomProjectileData; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; @@ -15,8 +16,7 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker; import com.magmaguy.elitemobs.utils.EntityFinder; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.Round; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.Round; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -135,13 +135,13 @@ private static double secondaryEnchantmentDamageIncrease(Player player, LivingEn if (ItemSettingsConfig.isUseEliteEnchantments()) return 0D; if (livingEntity instanceof Spider || livingEntity instanceof Silverfish) { int level = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).mainhand.getDamageArthropodsLevel(player.getInventory().getItemInMainHand(), false); - level -= Enchantment.DAMAGE_ARTHROPODS.getMaxLevel(); + level -= Enchantment.BANE_OF_ARTHROPODS.getMaxLevel(); if (level < 1) return 0D; return level * 2.5D; } - if (livingEntity instanceof Zombie || livingEntity instanceof Skeleton || livingEntity instanceof Wither || livingEntity instanceof SkeletonHorse || livingEntity instanceof ZombieHorse || !VersionChecker.serverVersionOlderThan(16, 0) && livingEntity.getType().equals(EntityType.ZOMBIFIED_PIGLIN)) { + if (livingEntity instanceof Zombie || livingEntity instanceof Skeleton || livingEntity instanceof Wither || livingEntity instanceof SkeletonHorse || livingEntity instanceof ZombieHorse || livingEntity.getType().equals(EntityType.ZOMBIFIED_PIGLIN)) { int level = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).mainhand.getDamageUndeadLevel(player.getInventory().getItemInMainHand(), false); - level -= Enchantment.DAMAGE_UNDEAD.getMaxLevel(); + level -= Enchantment.SMITE.getMaxLevel(); if (level < 1) return 0D; return level * 2.5D; } @@ -256,9 +256,10 @@ else if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE)) } private void runAntiexploit(EliteEntity eliteEntity, EntityDamageByEntityEvent event, EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent) { + if (EliteMobsWorld.isEliteMobsWorld(event.getDamager().getWorld().getUID())) return; if (EliteMobs.worldGuardIsEnabled) { Boolean regionQuery = WorldGuardFlagChecker.checkNullableFlag(eliteEntity.getLocation(), WorldGuardCompatibility.getELITEMOBS_ANTIEXPLOIT()); - if (regionQuery != null && regionQuery == false) return; + if (regionQuery != null && !regionQuery) return; } if (event.getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK && event.getCause() != EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK && diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java index 89309699c..888ce2e4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.api; import com.magmaguy.elitemobs.EliteMobs; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; @@ -59,6 +60,8 @@ public void onEntityDamagedEvent(EntityDamageEvent event) { //happens if it dies if (!eliteEntity.isValid()) return; + if (EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return; + if (EliteMobs.worldGuardIsEnabled && !WorldGuardFlagChecker.checkFlag(eliteEntity.getLivingEntity().getLocation(), WorldGuardCompatibility.getELITEMOBS_ANTIEXPLOIT())) return; diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java index 87ffd7097..70e38bffd 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java @@ -120,8 +120,8 @@ private static double eliteToPlayerDamageFormula(Player player, EliteEntity elit double customBossDamageMultiplier = eliteEntity.getDamageMultiplier(); double potionEffectDamageReduction = 0; - if (player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) - potionEffectDamageReduction = (player.getPotionEffect(PotionEffectType.DAMAGE_RESISTANCE). + if (player.hasPotionEffect(PotionEffectType.RESISTANCE)) + potionEffectDamageReduction = (player.getPotionEffect(PotionEffectType.RESISTANCE). getAmplifier() + 1) * MobCombatSettingsConfig.getResistanceDamageMultiplier(); double finalDamage; @@ -197,8 +197,8 @@ else if (event.getDamager() instanceof Projectile && ((Projectile) event.getDama ItemMeta itemMeta = player.getInventory().getItemInOffHand().getItemMeta(); org.bukkit.inventory.meta.Damageable damageable = (Damageable) itemMeta; - if (player.getInventory().getItemInOffHand().getItemMeta().hasEnchant(Enchantment.DURABILITY) && - player.getInventory().getItemInOffHand().getItemMeta().getEnchantLevel(Enchantment.DURABILITY) / 20D > ThreadLocalRandom.current().nextDouble()) + if (player.getInventory().getItemInOffHand().getItemMeta().hasEnchant(Enchantment.UNBREAKING) && + player.getInventory().getItemInOffHand().getItemMeta().getEnchantLevel(Enchantment.UNBREAKING) / 20D > ThreadLocalRandom.current().nextDouble()) damageable.setDamage(damageable.getDamage() + 5); player.getInventory().getItemInOffHand().setItemMeta(itemMeta); if (Material.SHIELD.getMaxDurability() < damageable.getDamage()) diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java index b1983fd1d..1974d0b5b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.api; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.CombatTagConfig; import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.magmacore.util.ChatColorConverter; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Location; diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index e5a62b28f..05177dd22 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,16 +1,12 @@ package com.magmaguy.elitemobs.api; -import com.magmaguy.elitemobs.config.AdventurersGuildConfig; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.WorldPackage; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.utils.EventCaller; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.*; -import java.util.Objects; - public class PlayerTeleportEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); @@ -68,17 +64,10 @@ public Location getOriginalLocation() { } public void executeTeleport() { + if (!EliteMobsWorld.isEliteMobsWorld(player.getLocation().getWorld().getUID())) + PlayerData.setBackTeleportLocation(player, originalLocation); + player.teleport(destination); - for (EMPackage emPackage : EMPackage.getEmPackages().values()) - if (emPackage.isInstalled() && - emPackage instanceof WorldPackage && - ((WorldPackage) emPackage).getWorld() == destination.getWorld()) - return; - - if (AdventurersGuildConfig.getGuildWorldLocation() != null && - Objects.equals(AdventurersGuildConfig.getGuildWorldLocation().getWorld(), originalLocation.getWorld())) - return; - PlayerData.setBackTeleportLocation(player, originalLocation); } public static class PlayerTeleportEventExecutor implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java index 3ed1bbf62..3e3cce76c 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java @@ -1,10 +1,11 @@ package com.magmaguy.elitemobs.api; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.QuestsConfig; +import com.magmaguy.elitemobs.config.SoundsConfig; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.CustomQuest; import com.magmaguy.elitemobs.quests.Quest; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -62,6 +63,8 @@ public void onQuestAccept(QuestAcceptEvent event) { ChatColorConverter.convert(QuestsConfig.getQuestStartSubtitle().replace("$questName", event.getQuest().getQuestName())), 20, 60, 20); + boolean playedCustomSound = false; + if (event.getQuest() instanceof CustomQuest customQuest) { customQuest.applyTemporaryPermissions(event.getPlayer()); @@ -71,15 +74,19 @@ public void onQuestAccept(QuestAcceptEvent event) { for (String dialog : customQuest.getCustomQuestsConfigFields().getQuestAcceptDialog()) event.getPlayer().sendMessage(dialog); - if (customQuest.getCustomQuestsConfigFields().getQuestAcceptSound() != null) + if (customQuest.getCustomQuestsConfigFields().getQuestAcceptSound() != null) { Bukkit.getPlayer(customQuest.getPlayerUUID()).playSound( Bukkit.getPlayer(customQuest.getPlayerUUID()), customQuest.getCustomQuestsConfigFields().getQuestAcceptSound(), 1f, 1f); + playedCustomSound = true; + } } if (!QuestsConfig.isAutoTrackQuestsOnAccept()) event.getQuest().getQuestObjectives().displayTemporaryObjectivesScoreboard(event.getPlayer()); PlayerData.addQuest(event.getPlayer().getUniqueId(), event.getQuest()); + if (!playedCustomSound) + event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questAcceptSound, 1, 1); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java index 8dc1db498..1422c3de3 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.api; +import com.magmaguy.elitemobs.config.SoundsConfig; import com.magmaguy.elitemobs.quests.CustomQuest; import com.magmaguy.elitemobs.quests.Quest; import com.magmaguy.elitemobs.utils.EventCaller; @@ -50,6 +51,8 @@ public void onQuestComplete(QuestCompleteEvent event) { Bukkit.getPlayer(customQuest.getPlayerUUID()), customQuest.getCustomQuestsConfigFields().getQuestCompleteSound(), 1f, 1f); + else + event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questCompleteSound, 1, 1); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java index 32af2bc8e..57f8bf775 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.QuestsConfig; +import com.magmaguy.elitemobs.config.SoundsConfig; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.CustomQuest; import com.magmaguy.elitemobs.quests.Quest; @@ -55,6 +56,8 @@ public void onQuestLeave(QuestLeaveEvent event) { questTracking.stop(); } } + + event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questAbandonSound, 1, 1); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java index df2993bac..4b617ee6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.api; import com.magmaguy.elitemobs.config.QuestsConfig; +import com.magmaguy.elitemobs.config.SoundsConfig; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.Quest; import com.magmaguy.elitemobs.quests.QuestTracking; @@ -42,6 +43,7 @@ public void onQuestProgression(QuestProgressionEvent event) { if (!QuestTracking.isTracking(event.player)) event.getQuest().getQuestObjectives().displayTemporaryObjectivesScoreboard(event.getPlayer()); PlayerData.updateQuestStatus(event.getPlayer().getUniqueId(), event.getQuest()); + event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questProgressionSound, 1, 1); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java index 9a0eebdd2..c7a929cbb 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.api; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.QuestsConfig; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.Quest; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.entity.Player; import org.bukkit.event.Event; diff --git a/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java new file mode 100644 index 000000000..2c9d55bb7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.api; + +import com.magmaguy.elitemobs.mobconstructor.EliteEntity; +import lombok.Getter; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ScriptZoneEnterEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + @Getter + private final EliteEntity eliteEntity; + @Getter + private final LivingEntity entity; + + public ScriptZoneEnterEvent(EliteEntity customBossEntity, LivingEntity entity) { + this.eliteEntity = customBossEntity; + this.entity = entity; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java new file mode 100644 index 000000000..6e2505042 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.api; + +import com.magmaguy.elitemobs.mobconstructor.EliteEntity; +import lombok.Getter; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ScriptZoneLeaveEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + @Getter + private final EliteEntity eliteEntity; + @Getter + private final LivingEntity entity; + + public ScriptZoneLeaveEvent(EliteEntity customBossEntity, LivingEntity entity) { + this.eliteEntity = customBossEntity; + this.entity = entity; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java deleted file mode 100644 index 10c701992..000000000 --- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.magmaguy.elitemobs.api; - -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.utils.EventCaller; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.*; -import org.bukkit.event.entity.EntityDamageEvent; - -public class SuperMobDamageEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - private final LivingEntity livingEntity; - private final EntityDamageEvent entityDamageEvent; - private boolean cancelled = false; - - public SuperMobDamageEvent(LivingEntity livingEntity, EntityDamageEvent entityDamageEvent) { - this.livingEntity = livingEntity; - this.entityDamageEvent = entityDamageEvent; - } - - public static void callEvent(LivingEntity livingEntity, EntityDamageEvent entityDamageEvent) { - new EventCaller(new SuperMobDamageEvent(livingEntity, entityDamageEvent)); - } - - public static HandlerList getHandlerList() { - return handlers; - } - - /** - * Returns the entity being converted to an EliteMobEntity - * - * @return Entity being converted into an Elite Mob - */ - public LivingEntity getLivingEntity() { - return this.livingEntity; - } - - public EntityDamageEvent getEntityDamageEvent() { - return this.entityDamageEvent; - } - - /** - * Returns a list of handlers - * - * @return List of handlers - */ - @Override - public HandlerList getHandlers() { - return handlers; - } - - @Override - public boolean isCancelled() { - return this.cancelled; - } - - @Override - public void setCancelled(boolean cancel) { - this.cancelled = cancel; - } - - public static class SuperMobDamageEventFilter implements Listener { - @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) - public void superMobDamageFilter(EntityDamageEvent event) { - if (!EntityTracker.isSuperMob(event.getEntity())) return; - SuperMobDamageEvent superMobDamageEvent = new SuperMobDamageEvent((LivingEntity) event.getEntity(), event); - new EventCaller(superMobDamageEvent); - if (superMobDamageEvent.isCancelled()) event.setCancelled(true); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java deleted file mode 100644 index 3dd5bda68..000000000 --- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.magmaguy.elitemobs.api; - -import com.magmaguy.elitemobs.api.internal.RemovalReason; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.utils.EventCaller; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.Event; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDeathEvent; - -public class SuperMobDeathEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - private final LivingEntity livingEntity; - - public SuperMobDeathEvent(LivingEntity livingEntity) { - this.livingEntity = livingEntity; - new SuperMobRemoveEvent(livingEntity, RemovalReason.DEATH); - } - - public static void callEvent(LivingEntity livingEntity) { - new EventCaller(new SuperMobDeathEvent(livingEntity)); - } - - public static HandlerList getHandlerList() { - return handlers; - } - - /** - * Returns the entity being converted to an EliteMobEntity - * - * @return Entity being converted into an Elite Mob - */ - public LivingEntity getLivingEntity() { - return this.livingEntity; - } - - /** - * Returns a list of handlers - * - * @return List of handlers - */ - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static class SuperMobDeathEventFilter implements Listener { - @EventHandler - public void onMobDeath(EntityDeathEvent event) { - if (!EntityTracker.isSuperMob(event.getEntity())) return; - new EventCaller(new SuperMobDeathEvent(event.getEntity())); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java deleted file mode 100644 index fba138a9d..000000000 --- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.magmaguy.elitemobs.api; - -import com.magmaguy.elitemobs.api.internal.RemovalReason; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.utils.EventCaller; -import lombok.Getter; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class SuperMobRemoveEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - @Getter - private final LivingEntity livingEntity; - - public SuperMobRemoveEvent(LivingEntity livingEntity, RemovalReason removalReason) { - this.livingEntity = livingEntity; - EntityTracker.unregister(livingEntity, removalReason); - } - - public static void callEvent(LivingEntity livingEntity, RemovalReason removalReason) { - new EventCaller(new SuperMobRemoveEvent(livingEntity, removalReason)); - } - - public static HandlerList getHandlerList() { - return handlers; - } - - /** - * Returns a list of handlers - * - * @return List of handlers - */ - @Override - public HandlerList getHandlers() { - return handlers; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java deleted file mode 100644 index bbf6ab762..000000000 --- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.magmaguy.elitemobs.api; - -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class SuperMobSpawnEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - private final LivingEntity livingEntity; - private boolean isCancelled = false; - - public SuperMobSpawnEvent(LivingEntity livingEntity) { - this.livingEntity = livingEntity; - } - - public static HandlerList getHandlerList() { - return handlers; - } - - /** - * Returns the entity being converted to an EliteMobEntity - * - * @return Entity being converted into an Elite Mob - */ - public LivingEntity getLivingEntity() { - return this.livingEntity; - } - - /** - * Returns if the event is cancelled - * - * @return If the event is cancelled - */ - @Override - public boolean isCancelled() { - return this.isCancelled; - } - - /** - * Cancels the event. This will cancel the formation of the Elite Mob and remove the living entity. Once cancelled it can't be uncancelled. - * - * @param cancel Cancels the event - */ - @Override - public void setCancelled(boolean cancel) { - this.isCancelled = cancel; - } - - /** - * Returns a list of handlers - * - * @return List of handlers - */ - @Override - public HandlerList getHandlers() { - return handlers; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java index 8d0122de3..e60e5268b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java @@ -8,8 +8,8 @@ public class MatchInstantiateEvent extends Event implements MatchEvent, Cancellable { private static final HandlerList handlers = new HandlerList(); - private boolean cancelled = false; private final MatchInstance matchInstance; + private boolean cancelled = false; public MatchInstantiateEvent(MatchInstance matchInstance) { this.matchInstance = matchInstance; diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java index 09448ca25..1378d400f 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java @@ -9,9 +9,9 @@ public class MatchJoinEvent extends Event implements MatchEvent, MatchPlayerEvent, Cancellable { private static final HandlerList handlers = new HandlerList(); - private boolean cancelled = false; private final MatchInstance matchInstance; private final Player player; + private boolean cancelled = false; public MatchJoinEvent(MatchInstance matchInstance, Player player) { this.matchInstance = matchInstance; diff --git a/src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java b/src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java deleted file mode 100644 index 6d5f59eb3..000000000 --- a/src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.magmaguy.elitemobs.api.internal; - -import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicDungeonPackage; -import lombok.Getter; -import org.bukkit.Location; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.jetbrains.annotations.NotNull; - - -public class NewSchematicPackageRelativeBossLocationEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - @Getter - private final SchematicDungeonPackage schematicDungeonPackage; - @Getter - private final Location relativeLocation; - @Getter - private final Location realLocation; - @Getter - private final CustomBossesConfigFields customBossesConfigFields; - private boolean isCancelled = false; - - public NewSchematicPackageRelativeBossLocationEvent(SchematicDungeonPackage schematicDungeonPackage, - Location relativeLocation, - Location realLocation, - CustomBossesConfigFields customBossesConfigFields) { - this.schematicDungeonPackage = schematicDungeonPackage; - this.relativeLocation = relativeLocation; - this.realLocation = realLocation; - this.customBossesConfigFields = customBossesConfigFields; - if (relativeLocation == null) setCancelled(true); - } - - public static HandlerList getHandlerList() { - return handlers; - } - - @Override - public boolean isCancelled() { - return this.isCancelled; - } - - @Override - public void setCancelled(boolean b) { - this.isCancelled = b; - } - - @NotNull - @Override - public HandlerList getHandlers() { - return null; - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java index 1dca78eac..a6457ac7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java +++ b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java @@ -163,20 +163,20 @@ public static double getEliteDamageFromEliteAttributes(@Nullable ItemStack itemS public static double getEliteDamageFromEnchantments(@Nullable ItemStack itemStack) { if (itemStack == null) return 0; //Elite Items may have elite enchantments associated to an item - int enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.DAMAGE_ALL.getKey()); + int enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.SHARPNESS.getKey()); if (enchantmentLevel > 0 && ItemSettingsConfig.isUseEliteEnchantments()) { - enchantmentLevel -= Enchantment.DAMAGE_ALL.getMaxLevel(); + enchantmentLevel -= Enchantment.SHARPNESS.getMaxLevel(); if (enchantmentLevel < 0) enchantmentLevel = 0; } else { - enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.ARROW_DAMAGE.getKey()); + enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.POWER.getKey()); if (enchantmentLevel > 0 && ItemSettingsConfig.isUseEliteEnchantments()) - enchantmentLevel -= Enchantment.ARROW_DAMAGE.getMaxLevel(); + enchantmentLevel -= Enchantment.POWER.getMaxLevel(); if (enchantmentLevel < 0) enchantmentLevel = 0; } if (enchantmentLevel < 1) //Note: this means sharpness works on bows and that power works on weapons. By default, this state is not reachable, so it doesn't really matter. - enchantmentLevel += itemStack.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) + itemStack.getEnchantmentLevel(Enchantment.DAMAGE_ALL); + enchantmentLevel += itemStack.getEnchantmentLevel(Enchantment.POWER) + itemStack.getEnchantmentLevel(Enchantment.SHARPNESS); if (enchantmentLevel == 0) return 0; //This is how vanilla sharpness works. Might as well use it for everything. return 1 + enchantmentLevel * 0.5; @@ -222,7 +222,7 @@ public static double getArmorLevel(@Nullable ItemStack itemStack) { public static double getBonusEliteDefense(@Nullable ItemStack itemStack) { if (itemStack == null || itemStack.getItemMeta() == null) return 0D; int enchantmentLevel = 0; - enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION_ENVIRONMENTAL.getKey()); + enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION.getKey()); return enchantmentLevel * .25; } @@ -253,7 +253,7 @@ public static boolean isWeapon(@Nullable ItemStack itemStack) { itemStack.getType().equals(Material.STONE_HOE) || itemStack.getType().equals(Material.IRON_HOE) || itemStack.getType().equals(Material.DIAMOND_HOE) || - itemStack.getType().equals(Material.NETHERITE_HOE) )) + itemStack.getType().equals(Material.NETHERITE_HOE))) return true; return getWeaponLevel(itemStack) > 3.0; } @@ -266,11 +266,11 @@ public static void setEliteLevel(@Nullable ItemStack itemStack, int level) { if (itemStack == null) return; registerEliteItem(itemStack); if (isWeapon(itemStack)) { - double damage = calculateEliteBonus(itemStack,level); + double damage = calculateEliteBonus(itemStack, level); if (damage > 0) ItemTagger.setEliteDamageAttribute(itemStack, damage); } else if (isArmor(itemStack)) { - double defense = calculateEliteBonus(itemStack,level); + double defense = calculateEliteBonus(itemStack, level); if (defense > 0) ItemTagger.setEliteDefenseAttribute(itemStack, defense); } @@ -281,15 +281,16 @@ public static void setEliteLevel(@Nullable ItemStack itemStack, int level) { * This returns how much elite damage an item would give, based on a level. This should be used when a level wants to * be calculated instead of read, which should only be true when you're doing something tricky like temporarily limiting * the level of items for instanced dungeons + * * @param itemStack ItemStack to check the level of - * @param level Level to calculate + * @param level Level to calculate * @return Amount of damage an elite weapon of that level would deal */ - public static double calculateEliteBonus(ItemStack itemStack, int level){ + public static double calculateEliteBonus(ItemStack itemStack, int level) { if (isWeapon(itemStack)) { return level * CombatSystem.DPS_PER_LEVEL / 1 / getAttackSpeed(itemStack) - getBaseDamage(itemStack); } else if (isArmor(itemStack)) { - return (level - CombatSystem.getMaterialTier(itemStack.getType())) / 4D; + return (level - CombatSystem.getMaterialTier(itemStack.getType())) / 4D; } return 0; } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 0eaf6afa7..f805347df 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -1,19 +1,14 @@ package com.magmaguy.elitemobs.collateralminecraftchanges; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.items.ItemTagger; -import com.magmaguy.elitemobs.utils.EntityFinder; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerItemDamageEvent; import org.bukkit.inventory.ItemStack; @@ -21,6 +16,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class AlternativeDurabilityLoss implements Listener { @@ -30,7 +26,7 @@ private static double durabilityLoss(ItemStack itemStack) { int maxDurability = itemStack.getType().getMaxDurability() > (isWeaponMaterial ? 2000 : 1000) ? (isWeaponMaterial ? 2000 : 1000) : itemStack.getType().getMaxDurability(); double baseModifier = isWeaponMaterial ? 2000 : 1000; double durabilityLoss = ((baseModifier - maxDurability) / baseModifier) * ItemSettingsConfig.getEliteDurabilityMultiplier(); - double durabilityLevel = 1 + (ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.DURABILITY.getKey()) / 4d); + double durabilityLevel = 1 + (ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.UNBREAKING.getKey()) / 4d); double defaultMultiplier = 0.5; //just tweaking defaults return durabilityLoss / durabilityLevel * defaultMultiplier; } @@ -46,7 +42,7 @@ private static boolean isOnLastDamage(ItemStack itemStack) { public static void doDurabilityLoss(Player player) { if (!ItemSettingsConfig.isEliteDurability()) return; - ArrayList itemsList = new ArrayList<>(Arrays.asList(player.getInventory().getArmorContents())); + List itemsList = new ArrayList<>(Arrays.stream(player.getInventory().getArmorContents()).toList()); itemsList.add(player.getInventory().getItemInMainHand()); itemsList.add(player.getInventory().getItemInOffHand()); @@ -65,8 +61,9 @@ public static void doDurabilityLoss(Player player) { if (ItemSettingsConfig.isPreventEliteItemsFromBreaking()) { damageable.setDamage(maxDurability - 1); itemStack.setItemMeta(damageable); - } else + } else { itemStack.setAmount(0); + } } } @@ -82,32 +79,10 @@ public void onPlayerDeath(PlayerDeathEvent event) { doDurabilityLoss(event.getEntity()); } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onPlayerDamaged(EntityDamageEvent event) { - if (!event.getEntity().getType().equals(EntityType.PLAYER)) return; - //citizens spams this really hard for some reason - if (event.getEntity().hasMetadata("NPC")) return; - Player player = (Player) event.getEntity(); - for (ItemStack itemStack : player.getInventory().getArmorContents()) - if (isOnLastDamage(itemStack)) { - player.getWorld().dropItem(player.getLocation(), itemStack.clone()); - itemStack.setAmount(0); - player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getLowArmorDurabilityItemDropMessage())); - } + @EventHandler(priority = EventPriority.LOWEST) + public void onPlayerShoot(EntityShootBowEvent event) { + if (!EliteItemManager.isEliteMobsItem(event.getBow())) return; + if (isOnLastDamage(event.getBow())) event.setCancelled(true); } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onPlayerDamage(EntityDamageByEntityEvent event) { - LivingEntity livingEntity = EntityFinder.filterRangedDamagers(event.getDamager()); - if (livingEntity == null) return; - if (!livingEntity.getType().equals(EntityType.PLAYER)) return; - Player player = (Player) livingEntity; - ItemStack itemStack = player.getInventory().getItemInMainHand(); - if (isOnLastDamage(itemStack)) { - player.getWorld().dropItem(player.getLocation(), itemStack.clone()); - itemStack.setAmount(0); - player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getLowWeaponDurabilityItemDropMessage())); - event.setCancelled(true); - } - } } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java index 720a51bc9..5655c3116 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java @@ -1,55 +1,14 @@ package com.magmaguy.elitemobs.collateralminecraftchanges; -import com.magmaguy.elitemobs.api.EliteMobDeathEvent; -import com.magmaguy.elitemobs.config.powers.PowersConfigFields; -import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardSpawnEventBypasser; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.MagmaCube; -import org.bukkit.entity.Slime; +import com.magmaguy.elitemobs.entitytracker.EntityTracker; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.CreatureSpawnEvent; - -import java.util.HashSet; -import java.util.concurrent.ThreadLocalRandom; +import org.bukkit.event.entity.SlimeSplitEvent; public class EliteSlimeDeathSplit implements Listener { - @EventHandler - public void EliteMobDeathEvent(EliteMobDeathEvent event) { - if (!event.getEntity().getType().equals(EntityType.SLIME) && - !event.getEntity().getType().equals(EntityType.MAGMA_CUBE)) return; - Slime slime = (Slime) event.getEntity(); - int size = slime.getSize() / 2; - if (size < 1) return; - slime.setSize(1); - for (int i = 0; i < ThreadLocalRandom.current().nextInt(2) + 2; i++) { - WorldGuardSpawnEventBypasser.forceSpawn(); - Slime newSlime; - if (event.getEntity().getType() == EntityType.SLIME) - newSlime = (Slime) slime.getLocation().getWorld().spawnEntity(slime.getLocation(), EntityType.SLIME); - else - newSlime = (MagmaCube) slime.getLocation().getWorld().spawnEntity(slime.getLocation(), EntityType.MAGMA_CUBE); - newSlime.setSize(size); - EliteEntity eliteEntity = new EliteEntity(); - eliteEntity.setLevel(event.getEliteEntity().getLevel()); - eliteEntity.setLivingEntity(newSlime, CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); - EliteMobProperties.getPluginData(EntityType.SLIME); - eliteEntity.setDamageMultiplier(eliteEntity.getDamageMultiplier() / 2D); - eliteEntity.setHealthMultiplier(eliteEntity.getHealthMultiplier() / 2D); - eliteEntity.setVanillaLoot(event.getEliteEntity().isVanillaLoot()); - eliteEntity.setEliteLoot(event.getEliteEntity().isEliteLoot()); - eliteEntity.setRandomLoot(event.getEliteEntity().isRandomLoot()); - - //refreshes the max health - eliteEntity.setMaxHealth(); - HashSet powersConfigFields = new HashSet<>(); - event.getEliteEntity().getElitePowers().forEach(elitePower -> { - if (elitePower.getPowersConfigFields() instanceof PowersConfigFields powersConfigFields1) - powersConfigFields.add(powersConfigFields1); - }); - eliteEntity.applyPowers(powersConfigFields); - } + @EventHandler (ignoreCancelled = true, priority = EventPriority.HIGHEST) + public void SlimeSplitEvent(SlimeSplitEvent event){ + if (EntityTracker.isEliteMob(event.getEntity())) event.setCancelled(true); } } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java index 75f6b4f94..cd1b6ca52 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java @@ -11,7 +11,7 @@ public class EnderCrystalDamageProtectionBypass implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) { - if (!event.getEntity().getType().equals(EntityType.ENDER_CRYSTAL)) return; + if (!event.getEntity().getType().equals(EntityType.END_CRYSTAL)) return; LivingEntity entity = EntityFinder.filterRangedDamagers(event.getDamager()); if (entity == null || !entity.getType().equals(EntityType.PLAYER)) return; event.setCancelled(false); diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java new file mode 100644 index 000000000..347370d56 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java @@ -0,0 +1,20 @@ +package com.magmaguy.elitemobs.collateralminecraftchanges; + +import com.magmaguy.elitemobs.config.DungeonsConfig; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent; + +public class EnvironmentalDungeonDamage implements Listener { + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onDamage(EntityDamageEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return; + switch (event.getCause()) { + case POISON -> event.setDamage(event.getDamage() * DungeonsConfig.getPoisonDamageMultiplier()); + case WITHER -> event.setDamage(event.getDamage() * DungeonsConfig.getWitherDamageMultiplier()); + case FIRE_TICK -> event.setDamage(event.getDamage() * DungeonsConfig.getFireDamageMultiplier()); + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java deleted file mode 100644 index 5e14a0ac8..000000000 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.magmaguy.elitemobs.collateralminecraftchanges; - -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.world.ChunkLoadEvent; - -public class FindSuperMobs implements Listener { - - @EventHandler - public void findSuperMob(ChunkLoadEvent event) { - for (Entity entity : event.getChunk().getEntities()) - if (SuperMobProperties.isValidSuperMobType(entity)) - if (((LivingEntity) entity).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() == - SuperMobProperties.getDataInstance(entity).getSuperMobMaxHealth()) - if (!EntityTracker.isSuperMob(entity)) - EntityTracker.registerSuperMob((LivingEntity) entity); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java new file mode 100644 index 000000000..7293e3822 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.collateralminecraftchanges; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import org.bukkit.attribute.Attribute; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class FixPlayerOnLoginOrRespawn implements Listener { + @EventHandler + public void onPlayerRespawn(PlayerRespawnEvent event) { + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0)); + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0)); + if (DefaultConfig.isResetPlayerScaleOnLogin()) + event.getPlayer().getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f); + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) { + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0)); + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0)); + if (DefaultConfig.isResetPlayerScaleOnLogin()) + event.getPlayer().getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java index 464bbdf7b..36e73ea9b 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.collateralminecraftchanges; import com.magmaguy.elitemobs.items.ItemTagger; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index bd7a645b4..a3566e5c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -10,9 +10,9 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; public class LightningImmunity implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onLightningStrike(EntityDamageByEntityEvent event){ - if (!event.getDamager().getType().equals(EntityType.LIGHTNING)) return; + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onLightningStrike(EntityDamageByEntityEvent event) { + if (!event.getDamager().getType().equals(EntityType.LIGHTNING_BOLT)) return; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity()); if (eliteEntity == null) return; if (eliteEntity.hasPower(PowersConfig.getPower("attack_lightning.yml")) || diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java index 0da51884d..e102cee26 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java @@ -24,7 +24,7 @@ public static void bypass() { @EventHandler(priority = EventPriority.HIGHEST) public void onLightningSpawn(EntitySpawnEvent event) { if (!bypass) return; - if (!event.getEntity().getType().equals(EntityType.LIGHTNING)) return; + if (!event.getEntity().getType().equals(EntityType.LIGHTNING_BOLT)) return; bypass = true; event.setCancelled(false); } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java index b63e8168d..b3e8ea913 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.collateralminecraftchanges; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.playerdata.PlayerStatsTracker; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java new file mode 100644 index 000000000..3a88714f5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java @@ -0,0 +1,14 @@ +package com.magmaguy.elitemobs.collateralminecraftchanges; + +import com.magmaguy.elitemobs.powers.scripts.ScriptAction; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +public class PlayerQuitCleanup implements Listener { + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer())) + event.getPlayer().setInvulnerable(false); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java deleted file mode 100644 index 5ea4bc713..000000000 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.magmaguy.elitemobs.collateralminecraftchanges; - -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; -import org.bukkit.entity.*; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageEvent; - -/** - * Created by MagmaGuy on 22/04/2017. - */ -public class PreventCreeperPassiveEntityDamage implements Listener { - - //This cancels all creeper and entity-caused explosion damage on passive mobs - @EventHandler (ignoreCancelled = true) - public void superCreeperCollateralDamageAvoider(EntityDamageEvent event) { - - if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) { - - if (SuperMobProperties.isValidSuperMobType(event.getEntityType()) || - event.getEntity() instanceof Horse || event.getEntity() instanceof Villager || - event.getEntity() instanceof Bat || event.getEntity() instanceof ArmorStand || - event.getEntity() instanceof Rabbit) { - - event.setDamage(0); - - } - - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index 631dbe4b2..3de63fa7d 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java @@ -1,8 +1,7 @@ package com.magmaguy.elitemobs.collateralminecraftchanges; import com.magmaguy.elitemobs.items.ItemTagger; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -14,9 +13,8 @@ public void UpgradeItemEvent(PrepareSmithingEvent event) { if (!ItemTagger.isEliteItem(event.getInventory().getItem(0)) && !ItemTagger.isEliteItem(event.getInventory().getItem(1))) return; - if (VersionChecker.serverVersionOlderThan(20, 0) || - event.getInventory().getItem(0) != null && - event.getInventory().getItem(0).getType().equals(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE)) + if (event.getInventory().getItem(0) != null && + event.getInventory().getItem(0).getType().equals(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE)) event.setResult(ItemStackGenerator.generateItemStack(Material.AIR)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java index 871d11266..16fe8fbe2 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.combatsystem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; public class CombatSystem { @@ -55,11 +54,10 @@ public static int getMaterialTier(Material material) { case TURTLE_HELMET: return GOLD_WOOD_LEATHER_TIER_LEVEL; default: - if (!VersionChecker.serverVersionOlderThan(16, 0) && - (material.equals(Material.NETHERITE_HELMET) || - material.equals(Material.NETHERITE_CHESTPLATE) || - material.equals(Material.NETHERITE_LEGGINGS) || - material.equals(Material.NETHERITE_BOOTS))) + if (material.equals(Material.NETHERITE_HELMET) || + material.equals(Material.NETHERITE_CHESTPLATE) || + material.equals(Material.NETHERITE_LEGGINGS) || + material.equals(Material.NETHERITE_BOOTS)) return CombatSystem.NETHERITE_TIER_LEVEL; } return 0; diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java index 741dfd3df..11bc31e52 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java @@ -8,7 +8,7 @@ public class EliteMobDamagedByEliteMobHandler implements Listener { - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onIronGolemDamage(EliteMobDamagedByEliteMobEvent event) { if (event.getDamager().getLivingEntity() == null || event.getDamagee().getLivingEntity() == null) return; diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java index a9f963907..8401ac810 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java @@ -22,6 +22,7 @@ public static Projectile create(EntityType entityType, Entity shooter, Entity vi projectile.setShooter((ProjectileSource) shooter); projectile.setVelocity(shotVector); projectile.setGravity(gravity); + projectile.setPersistent(false); EntityTracker.registerProjectileEntity(projectile); return projectile; } @@ -37,6 +38,7 @@ public static Projectile create(EntityType entityType, Entity shooter, Vector ta projectile.setShooter((ProjectileSource) shooter); projectile.setVelocity(targetterToTargetted); projectile.setGravity(gravity); + projectile.setPersistent(false); EntityTracker.registerProjectileEntity(projectile); return projectile; } diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java index 114fffe5c..05cd00243 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java @@ -7,7 +7,7 @@ public class AmbientDamageExploit implements Listener { - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onDamage(GenericAntiExploitEvent event) { if (!event.getEliteMobEntity().getLivingEntity().hasAI()) return; if (!(event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.HOT_FLOOR) || diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java index 1f9cb2187..51ee70bd9 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.api.GenericAntiExploitEvent; import com.magmaguy.elitemobs.config.AntiExploitConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -12,7 +11,6 @@ public class HoneyBlockJumpExploit implements Listener { @EventHandler public void onDamage(GenericAntiExploitEvent event) { if (!AntiExploitConfig.isHoneyBlockExploit()) return; - if (VersionChecker.serverVersionOlderThan(15, 0)) return; if (event.ground == null) return; if (!event.ground.equals(Material.HONEY_BLOCK)) return; event.getEliteMobEntity().incrementAntiExploit(5, "honeyexploit"); diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java index e8de64095..c6f537c58 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java @@ -19,7 +19,7 @@ public void onEntityDamage(EliteMobDamagedByPlayerAntiExploitEvent event) { private void antiHopper(EliteMobDamagedByPlayerAntiExploitEvent event) { if (!AntiExploitConfig.isLargeDarkroomAntiExploit1()) return; - if (event.getEliteMobEntity().getLivingEntity().getLocation().getBlock().getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.HOPPER) ) { + if (event.getEliteMobEntity().getLivingEntity().getLocation().getBlock().getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.HOPPER)) { event.getEliteMobEntity().incrementAntiExploit(5, "largeRoomAntiExploit1"); event.setTriggered(true); } diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java index c33e151cf..741ba3d44 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.spigotmc.event.entity.EntityMountEvent; +import org.bukkit.event.entity.EntityMountEvent; public class PreventMountExploit implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java index 5d5f049e8..a1e9652a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java @@ -2,6 +2,8 @@ import com.magmaguy.easyminecraftgoals.NMSManager; import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; +import org.bukkit.entity.Mob; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -11,8 +13,11 @@ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent if (event.isCancelled()) return; if (event.getEliteMobEntity().getLivingEntity() == null) return; if (!NMSManager.isEnabled()) return; + //Only mobs pathfind + if (!(event.getEliteMobEntity().getLivingEntity() instanceof Mob)) return; if (NMSManager.getAdapter().canReach(event.getEliteMobEntity().getLivingEntity(), event.getEliteMobDamagedByPlayerEvent().getPlayer().getLocation())) return; + if (EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return; event.getEliteMobEntity().incrementAntiExploit(5, "no path to player"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java index 1c5589c79..adedaeaea 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java @@ -56,7 +56,7 @@ public void run() { cancel(); if (player.isOnGround()) { cancel(); - player.removePotionEffect(PotionEffectType.SLOW); + player.removePotionEffect(PotionEffectType.SLOWNESS); } } }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index a53f51b46..2426f38f3 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java @@ -10,14 +10,15 @@ import com.magmaguy.elitemobs.items.customenchantments.CriticalStrikesEnchantment; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.utils.DialogArmorStand; -import com.magmaguy.elitemobs.utils.Round; -import com.magmaguy.elitemobs.utils.VisualArmorStand; +import com.magmaguy.elitemobs.utils.VisualDisplay; +import com.magmaguy.magmacore.util.Round; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; +import org.bukkit.entity.TextDisplay; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -64,7 +65,7 @@ public void onHit(EliteMobDamagedByPlayerEvent event) { } DialogArmorStand.createDialogArmorStand(event.getEliteMobEntity().getUnsyncedLivingEntity(), ChatColor.RED + - colorPrefix + "" + ChatColor.BOLD + "" + Round.twoDecimalPlaces(event.getDamage()) + "", offset); + colorPrefix + ChatColor.BOLD + Round.twoDecimalPlaces(event.getDamage()), offset); } @@ -89,7 +90,7 @@ private void resistArmorStandCreator(EliteEntity eliteEntity, Player player, Mat if (!eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld())) return; - ArmorStand armorStand = VisualArmorStand.VisualArmorStand(getResistLocation(player, eliteEntity), "Resist"); + ArmorStand armorStand = VisualDisplay.generateTemporaryArmorStand(getResistLocation(player, eliteEntity), "Resist"); armorStand.getEquipment().setItemInMainHand(new ItemStack(material)); armorStand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING); armorStand.setRightArmPose(new EulerAngle(Math.PI / 2d, Math.PI + Math.PI / 2d, Math.PI)); @@ -125,9 +126,9 @@ private void weakArmorStandCreator(EliteEntity eliteEntity, Player player, Mater if (!eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld())) return; - ArmorStand[] armorStands = new ArmorStand[2]; - armorStands[0] = generateWeakArmorStand(player, eliteEntity, material, -1); - armorStands[1] = generateWeakArmorStand(player, eliteEntity, material, 1); + TextDisplay[] textDisplays = new TextDisplay[2]; + textDisplays[0] = generateWeakArmorStand(player, eliteEntity, material, -1); + textDisplays[1] = generateWeakArmorStand(player, eliteEntity, material, 1); new BukkitRunnable() { int counter = 0; @@ -135,12 +136,12 @@ private void weakArmorStandCreator(EliteEntity eliteEntity, Player player, Mater @Override public void run() { if (counter > 10 || !eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld())) { - EntityTracker.unregister(armorStands[0], RemovalReason.EFFECT_TIMEOUT); - EntityTracker.unregister(armorStands[1], RemovalReason.EFFECT_TIMEOUT); + EntityTracker.unregister(textDisplays[0], RemovalReason.EFFECT_TIMEOUT); + EntityTracker.unregister(textDisplays[1], RemovalReason.EFFECT_TIMEOUT); cancel(); return; } - for (ArmorStand armorStand : armorStands) + for (TextDisplay armorStand : textDisplays) armorStand.teleport(armorStand.getLocation().add(eliteEntity.getLocation().add(new Vector(0, 0, 0)) .subtract(armorStand.getLocation()).toVector().normalize().multiply(.4))); counter++; @@ -148,15 +149,11 @@ public void run() { }.runTaskTimer(MetadataHandler.PLUGIN, 1, 1); } - private ArmorStand generateWeakArmorStand(Player player, EliteEntity eliteEntity, Material material, int offset) { + private TextDisplay generateWeakArmorStand(Player player, EliteEntity eliteEntity, Material material, int offset) { Vector armorsStandVector = player.getLocation().clone().add(new Vector(0, 2, 0)).subtract(eliteEntity.getLocation()).toVector().normalize().multiply(3.0).rotateAroundY(Math.PI / 8 * offset); Location armorStandLocation = eliteEntity.getLocation().add(armorsStandVector); armorStandLocation.setDirection(armorsStandVector.multiply(-1)); - ArmorStand armorStand = VisualArmorStand.VisualArmorStand(armorStandLocation, "Weak"); - armorStand.getEquipment().setHelmet(new ItemStack(material)); - armorStand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING); - armorStand.setHeadPose(new EulerAngle(-Math.PI - Math.PI / 4D, Math.PI / 4D, 0)); - return armorStand; + return VisualDisplay.generateTemporaryTextDisplay(armorStandLocation, "Weak"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java deleted file mode 100644 index 419fafcc7..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ /dev/null @@ -1,983 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.Command; -import cloud.commandframework.arguments.CommandArgument; -import cloud.commandframework.arguments.standard.*; -import cloud.commandframework.bukkit.BukkitCommandManager; -import cloud.commandframework.meta.CommandMeta; -import cloud.commandframework.types.tuples.Triplet; -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.api.utils.EliteItemManager; -import com.magmaguy.elitemobs.commands.admin.*; -import com.magmaguy.elitemobs.commands.quests.QuestCommand; -import com.magmaguy.elitemobs.commands.setup.SetupMenu; -import com.magmaguy.elitemobs.config.ConfigurationExporter; -import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; -import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig; -import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig; -import com.magmaguy.elitemobs.config.npcs.NPCsConfig; -import com.magmaguy.elitemobs.config.translations.TranslationsConfig; -import com.magmaguy.elitemobs.config.wormholes.WormholeConfig; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.events.TimedEvent; -import com.magmaguy.elitemobs.items.ItemTagger; -import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; -import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.menus.CustomShopMenu; -import com.magmaguy.elitemobs.menus.GetLootMenu; -import com.magmaguy.elitemobs.menus.ProceduralShopMenu; -import com.magmaguy.elitemobs.menus.SellMenu; -import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; -import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; -import com.magmaguy.elitemobs.powers.meta.ElitePower; -import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; -import com.magmaguy.elitemobs.utils.DebugMessage; -import com.magmaguy.elitemobs.utils.DiscordLinks; -import com.magmaguy.elitemobs.wormhole.Wormhole; -import io.leangen.geantyref.TypeToken; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Fireball; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -public class AdminCommands { - - public AdminCommands(BukkitCommandManager manager, Command.Builder builder) { - - // /em setup - manager.command(builder.literal("setup") - .meta(CommandMeta.DESCRIPTION, "Opens the main setup menu") - .senderType(Player.class) - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SetupHandler.setupMenuCommand((Player) commandContext.getSender()))); - - // /em setup done - manager.command(builder.literal("setup") - .literal("done") - .meta(CommandMeta.DESCRIPTION, "Stops showing messages on admin login.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - DefaultConfig.toggleSetupDone(); - if (DefaultConfig.isSetupDone()) - commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aEliteMobs" + - " will no longer send messages on login. You can do [/em setup done] again to revert this.")); - else commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aEliteMobs" + - " will once again send messages on login. You can do [/em setup done] again to revert this.")); - })); - - // /em setup minidungeon - manager.command(builder.literal("setup") - .literal("minidungeon") - .argument(StringArgument.newBuilder("minidungeonName"), ArgumentDescription.of("minidungeon name")) - .meta(CommandMeta.DESCRIPTION, "Installs a Minidungeon") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SetupHandler.setupMinidungeonCommand((Player) commandContext.getSender(), commandContext.get("minidungeonName")))); - - // /em setup minidungeonNoPaste - manager.command(builder.literal("setup") - .literal("minidungeonNoPaste") - .argument(StringArgument.newBuilder("minidungeonName"), ArgumentDescription.of("minidungeon name")) - .meta(CommandMeta.DESCRIPTION, "Installs a Minidungeon without pasting the WorldEdit schematic") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SetupHandler.setupMinidungeonNoPasteCommand((Player) commandContext.getSender(), commandContext.get("minidungeonName")))); - - // /em setup unminidungeon - manager.command(builder.literal("setup") - .literal("unminidungeon") - .argument(StringArgument.newBuilder("minidungeonName"), ArgumentDescription.of("minidungeon name")) - .meta(CommandMeta.DESCRIPTION, "Uninstalls a Minidungeon") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SetupHandler.setupUnminidungeonCommand((Player) commandContext.getSender(), commandContext.get("minidungeonName")))); - - - // /em setup area - manager.command(builder.literal("setup") - .literal("area") - .argument(StringArgument.newBuilder("areaName"), ArgumentDescription.of("WorldGuard region name")) - .meta(CommandMeta.DESCRIPTION, "Protects an area using WorldGuard, used for Minidungeons and the Adventurer's World Hub") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SetupHandler.setupAreaCommand((Player) commandContext.getSender(), commandContext.get("areaName")))); - - ArrayList powers = new ArrayList<>(); - for (String filename : ElitePower.getElitePowers().keySet()) - powers.add(filename); - powers.add("custom"); - - // /em spawnelite - manager.command(builder.literal("spawnelite") - .argument(EnumArgument.newBuilder(EntityType.class, "entityType"), - ArgumentDescription.of("Minecraft Entity Type, must be a valid type for an Elite")) - .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level")) - .argument(StringArrayArgument.optional("powers", ((commandContext, lastString) -> powers)), - ArgumentDescription.of("List of powers")) - .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnEliteEntityTypeCommand( - (Player) commandContext.getSender(), - commandContext.get("entityType"), - commandContext.get("eliteLevel"), - commandContext.getOptional("powers")))); - - // /em spawnlocationelite - manager.command(builder.literal("spawnlocationelite") - .argument(EnumArgument.newBuilder(EntityType.class, "entityType"), - ArgumentDescription.of("Minecraft Entity Type, must be a valid type for an Elite")) - .argument(StringArgument.newBuilder("worldName"), ArgumentDescription.of("Name of the world")) - .argumentTriplet("coords", - TypeToken.get(Vector.class), - Triplet.of("x", "y", "z"), - Triplet.of(Integer.class, Integer.class, Integer.class), - (sender, triplet) -> new Vector(triplet.getFirst(), triplet.getSecond(), triplet.getThird()), - ArgumentDescription.of("Coordinates")) - .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level")) - .argument(StringArrayArgument.optional("powers", ((commandContext, lastString) -> powers)), - ArgumentDescription.of("List of powers")) - .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type and location.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnEliteEntityTypeCommand( - commandContext.getSender(), - commandContext.get("entityType"), - commandContext.get("worldName"), - commandContext.get("coords"), - commandContext.get("eliteLevel"), - commandContext.getOptional("powers")))); - - ArrayList customBosses = new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()); - ArrayList regionalBosses = new ArrayList<>(CustomBossesConfigFields.getRegionalElites().keySet()); - - // /em spawncustom - manager.command(builder.literal("spawncustom", "spawncustomboss") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnCustomBossCommand( - (Player) commandContext.getSender(), - commandContext.get("fileName")))); - - // /em spawncustomlevel - manager.command(builder.literal("spawncustomlevel", "spawncustombosslevel") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level")) - .meta(CommandMeta.DESCRIPTION, "Spawns a Custom Boss at a specific level.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnCustomBossCommand( - (Player) commandContext.getSender(), - commandContext.get("fileName"), - commandContext.get("eliteLevel")))); - - // /em spawnlocationcustom - manager.command(builder.literal("spawnlocationcustom", "spawnlocationcustomboss") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .argument(StringArgument.newBuilder("worldName"), ArgumentDescription.of("Name of the world")) - .argumentTriplet("coords", - TypeToken.get(Vector.class), - Triplet.of("x", "y", "z"), - Triplet.of(Integer.class, Integer.class, Integer.class), - (sender, triplet) -> new Vector(triplet.getFirst(), triplet.getSecond(), triplet.getThird()), - ArgumentDescription.of("Coordinates")) - .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type and location.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnCustomBossCommand( - commandContext.getSender(), - commandContext.get("fileName"), - commandContext.get("worldName"), - commandContext.get("coords")))); - - // /em spawnlocationcustomlevel - manager.command(builder.literal("spawnlocationcustomlevel", "spawnlocationcustombosslevel") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level")) - .argument(StringArgument.newBuilder("worldName"), ArgumentDescription.of("Name of the world")) - .argumentTriplet("coords", - TypeToken.get(Vector.class), - Triplet.of("x", "y", "z"), - Triplet.of(Integer.class, Integer.class, Integer.class), - (sender, triplet) -> new Vector(triplet.getFirst(), triplet.getSecond(), triplet.getThird()), - ArgumentDescription.of("Coordinates")) - .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type and location.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnCustomBossCommand( - commandContext.getSender(), - commandContext.get("fileName"), - commandContext.get("worldName"), - commandContext.get("coords"), - commandContext.get("eliteLevel")))); - - // /em spawnsuper - manager.command(builder.literal("spawnsuper", "spawnsupermob") - .argument(EnumArgument.newBuilder(EntityType.class, "entityType"), - ArgumentDescription.of("Minecraft Entity Type, must be a valid type for a Super Mob")) - .meta(CommandMeta.DESCRIPTION, "Spawns a Super Mob based on the entity type.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SpawnCommand.spawnSuperMobCommand( - (Player) commandContext.getSender(), - commandContext.get("entityType")))); - - // /em addSpawnLocation - manager.command(builder.literal("addSpawnLocation", "asp") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> regionalBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> CustomBossCommandHandler.addSpawnLocation( - commandContext.get("fileName"), (Player) commandContext.getSender()))); - - List treasureChestFilenames = new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet()); - - // /em addTreasureChest - manager.command(builder.literal("addTreasureChest", "atc") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> treasureChestFilenames)), - ArgumentDescription.of("Treasure Chest configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Adds a location to a Treasure Chest.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> CustomTreasureChestsConfig.addTreasureChestEntry( - (Player) commandContext.getSender(), commandContext.get("fileName")))); - - ArrayList minidungeonFileNames = new ArrayList<>(EMPackage.getEmPackages().keySet()); - - // /em addRelativeSpawnLocation - manager.command(builder.literal("addRelativeSpawnLocation", "arsp") - .argument(StringArgument.newBuilder("bossFileName").withSuggestionsProvider(((objectCommandContext, s) -> regionalBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .argument(StringArgument.newBuilder("minidungeonFileName").withSuggestionsProvider(((objectCommandContext, s) -> minidungeonFileNames)), - ArgumentDescription.of("Minidungeon configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> CustomBossCommandHandler.addRelativeSpawnLocation( - (Player) commandContext.getSender(), commandContext.get("bossFileName"), commandContext.get("minidungeonFileName")))); - - // /em addRelativeTreasureChest - manager.command(builder.literal("addRelativeTreasureChest", "artc") - .argument(StringArgument.newBuilder("treasureChestFilename").withSuggestionsProvider(((objectCommandContext, s) -> treasureChestFilenames)), - ArgumentDescription.of("Treasure Chest configuration file name")) - .argument(StringArgument.newBuilder("minidungeonFileName").withSuggestionsProvider(((objectCommandContext, s) -> minidungeonFileNames)), - ArgumentDescription.of("Minidungeon configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> TreasureChestCommands.addRelativeTreasureChest( - (Player) commandContext.getSender(), commandContext.get("treasureChestFilename"), commandContext.get("minidungeonFileName")))); - - // /em setLeashRadius - manager.command(builder.literal("setLeashRadius") - .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> regionalBosses)), - ArgumentDescription.of("Custom Boss configuration file name")) - .argument(DoubleArgument.newBuilder("radius"), ArgumentDescription.of("Radius of the Regional Boss leash")) - .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> CustomBossCommandHandler.setLeashRadius( - commandContext.get("fileName"), commandContext.getSender(), commandContext.get("radius")))); - - // /em remove - manager.command(builder.literal("remove", "r") - .meta(CommandMeta.DESCRIPTION, "Permanently removes an Elite Mob entity. Elite/Regional/Super/NPCs all work.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> RemoveCommand.remove((Player) commandContext.getSender()))); - - - // /em debug - manager.command(builder.literal("debug", "d") - .argument(StringArgument.newBuilder("argument").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList((Collection) regionalBosses.clone()); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })), - ArgumentDescription.of("Player name or regional boss file name")) - .meta(CommandMeta.DESCRIPTION, "Opens a debug screen for players or regional bosses.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> DebugScreen.open((Player) commandContext.getSender(), commandContext.get("argument")))); - - ArrayList events = new ArrayList<>(); - TimedEvent.getBlueprintEvents().stream().forEach(event -> events.add(event.getCustomEventsConfigFields().getFilename())); - - // /em event - manager.command(builder.literal("event") - .argument(StringArgument.newBuilder("events").withSuggestionsProvider(((objectCommandContext, s) -> events)), - ArgumentDescription.of("Custom Boss configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Opens a debug screen for players or regional bosses.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> EventCommand.trigger(commandContext.getSender(), commandContext.get("events")))); - - ArrayList npcs = new ArrayList<>(NPCsConfig.npcEntities.keySet()); - - // /em spawnnpc - manager.command(builder.literal("spawnnpc") - .argument(StringArgument.newBuilder("npcFileName").withSuggestionsProvider(((objectCommandContext, s) -> npcs)), - ArgumentDescription.of("Custom Boss configuration file name")) - .meta(CommandMeta.DESCRIPTION, "Spawns an NPC") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> NPCCommands.set((Player) commandContext.getSender(), commandContext.get("npcFileName")))); - - // /em stats - manager.command(builder.literal("stats") - .meta(CommandMeta.DESCRIPTION, "Gets the stats for the currently active EliteMobs entities and players.") - .senderType(CommandSender.class) - .permission("elitemobs.stats") - .handler(commandContext -> StatsCommand.statsHandler(commandContext.getSender()))); - - // /em getloot - manager.command(builder.literal("getloot") - .meta(CommandMeta.DESCRIPTION, "Opens a menu where you can get any Custom Loot") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> new GetLootMenu((Player) commandContext.getSender()))); - - ArrayList customItems = new ArrayList<>(CustomItem.getCustomItems().keySet()); - - // /em getloot - manager.command(builder.literal("getloot") - .argument(StringArgument.newBuilder("customItem").withSuggestionsProvider(((objectCommandContext, s) -> customItems)), - ArgumentDescription.of("File name of the custom item")) - .meta(CommandMeta.DESCRIPTION, "Gets a specific custom item") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> LootCommand.get((Player) commandContext.getSender(), commandContext.get("customItem")))); - - // /em give - manager.command(builder.literal("give") - .argument(StringArgument.newBuilder("customItem").withSuggestionsProvider(((objectCommandContext, s) -> customItems)), - ArgumentDescription.of("File name of the custom item")) - .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })), - ArgumentDescription.of("Name of the player that will get the custom item")) - .meta(CommandMeta.DESCRIPTION, "Gives a specific custom item to a player.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> LootCommand.give(commandContext.getSender(), - commandContext.get("player"), - commandContext.get("customItem")))); - - // /em simloot - manager.command(builder.literal("simloot") - .argument(IntegerArgument.newBuilder("level"), - ArgumentDescription.of("Level of Elite Mob to simulate")) - .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SimLootCommand.run((Player) commandContext.getSender(), commandContext.get("level"), true))); - - // /em randomloot - manager.command(builder.literal("randomloot") - .argument(IntegerArgument.newBuilder("level"), - ArgumentDescription.of("Level of Elite Mob to randomize")) - .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })), - ArgumentDescription.of("Name of the player that will get the custom item")) - .meta(CommandMeta.DESCRIPTION, "Randomizes drops from an Elite Mob from the set level") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> SimLootCommand.forcePositiveLoot(commandContext.getSender(), commandContext.get("player"), commandContext.get("level")))); - - // /em simloot - manager.command(builder.literal("simloot") - .argument(IntegerArgument.newBuilder("level"), - ArgumentDescription.of("Level of Elite Mob to simulate")) - .argument(IntegerArgument.newBuilder("times"), - ArgumentDescription.of("Number of times that the simulation will run")) - .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier a set amount of times") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SimLootCommand.runMultipleTimes( - (Player) commandContext.getSender(), - commandContext.get("level"), - commandContext.get("times")))); - - // /em simlootspecial - manager.command(builder.literal("simlootspecial") - .argument(IntegerArgument.newBuilder("times"), - ArgumentDescription.of("Number of times that the simulation will run")) - .meta(CommandMeta.DESCRIPTION, "Simulates special drops from an Elite Mob a set amount of times") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> SimLootCommand.simulateSpecialLoot( - (Player) commandContext.getSender(), - commandContext.get("times")))); - - // /em simlootother - manager.command(builder.literal("simlootother") - .argument(IntegerArgument.newBuilder("level"), - ArgumentDescription.of("Level of Elite Mob to simulate")) - .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier") - .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })), - ArgumentDescription.of("Name of the player that will get the custom item")) - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> SimLootCommand.run(commandContext.getSender(), commandContext.get("level"), commandContext.get("player")))); - - // /em simlootothermultiple - manager.command(builder.literal("simlootothermultiple") - .argument(IntegerArgument.newBuilder("level"), - ArgumentDescription.of("Level of Elite Mob to simulate")) - .argument(IntegerArgument.newBuilder("times"), - ArgumentDescription.of("Number of times that the simulation will run")) - .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier a set amount of times") - .argument(StringArgument.newBuilder("target").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })), - ArgumentDescription.of("Name of the player that will get the custom item")) - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> SimLootCommand.runMultipleTimes( - commandContext.getSender(), - commandContext.get("level"), - commandContext.get("times"), - commandContext.get("target")))); - - // /em version - manager.command(builder.literal("version") - .meta(CommandMeta.DESCRIPTION, "Gets the version of the plugin") - .senderType(CommandSender.class) - .permission("elitemobs.version") - .handler(commandContext -> VersionCommand.getVersion(commandContext.getSender()))); - - // /em reload - manager.command(builder.literal("reload") - .meta(CommandMeta.DESCRIPTION, "Reloads the plugin. Works almost every time.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> ReloadCommand.reload(commandContext.getSender()))); - - // /em killaggressive - manager.command(builder.literal("killaggressive") - .meta(CommandMeta.DESCRIPTION, "Kills all aggressive Elite Mobs.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> KillHandler.killAggressiveMobs(commandContext.getSender()))); - - // /em killaggressive - manager.command(builder.literal("killaggressive") - .argument(IntegerArgument.newBuilder("radius"), - ArgumentDescription.of("Distance to kill aggressive elite mobs in")) - .meta(CommandMeta.DESCRIPTION, "Kills all aggressive Elite Mobs in a radius.") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> KillHandler.radiusKillAggressiveMobs((Player) commandContext.getSender(), commandContext.get("radius")))); - - // /em killpassive - manager.command(builder.literal("killpassive") - .meta(CommandMeta.DESCRIPTION, "Kills all passive Super Mobs") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> KillHandler.killPassiveMobs(commandContext.getSender()))); - - // /em killpassive - manager.command(builder.literal("killpassive") - .argument(IntegerArgument.newBuilder("radius"), - ArgumentDescription.of("Distance to kill aggressive elite mobs in")) - .meta(CommandMeta.DESCRIPTION, "Kills all passive Super Mobs in a radius") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> KillHandler.radiusKillPassiveMobs((Player) commandContext.getSender(), commandContext.get("radius")))); - - - // /em killtype - manager.command(builder.literal("killtype") - .argument(EnumArgument.newBuilder(EntityType.class, "entityType"), - ArgumentDescription.of("Minecraft Entity Type to kill")) - .meta(CommandMeta.DESCRIPTION, "Kills all elites of a specific type") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> KillHandler.killEntityType(commandContext.getSender(), commandContext.get("entityType")))); - - // /em killtype - manager.command(builder.literal("killtype") - .argument(EnumArgument.newBuilder(EntityType.class, "entityType"), - ArgumentDescription.of("Minecraft Entity Type to kill")) - .argument(IntegerArgument.newBuilder("radius"), - ArgumentDescription.of("Distance to kill aggressive elite mobs in")) - .meta(CommandMeta.DESCRIPTION, "Kills all elites of a specific type in a radius") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> KillHandler.radiusKillSpecificMobs((Player) commandContext.getSender(), - commandContext.get("entityType"), - commandContext.get("radius")))); - - // /em gettier - manager.command(builder.literal("gettier") - .argument(IntegerArgument.newBuilder("tier"), - ArgumentDescription.of("Tier of the item to get")) - .meta(CommandMeta.DESCRIPTION, "Gets debug items for testing purposes") - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> GetTierCommand.get((Player) commandContext.getSender(), commandContext.get("tier")))); - - - CommandArgument onlinePlayers = StringArgument.newBuilder("onlinePlayer") - .withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })).build(); - - // /em money add - manager.command(builder.literal("money") - .literal("add") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .argument(IntegerArgument.newBuilder("amount"), ArgumentDescription.of("Amount of money to add")) - .meta(CommandMeta.DESCRIPTION, "Adds a set amount of money to a player") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> CurrencyCommandsHandler.addCommand(commandContext.getSender(), - commandContext.get("onlinePlayer"), - commandContext.get("amount")))); - - // /em money addall - manager.command(builder.literal("money") - .literal("addall") - .argument(IntegerArgument.newBuilder("amount"), ArgumentDescription.of("Amount of money to add")) - .meta(CommandMeta.DESCRIPTION, "Adds a set amount of money to all online players") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> CurrencyCommandsHandler.addAllCommand(commandContext.getSender(), - commandContext.get("amount")))); - - // /em money remove - manager.command(builder.literal("money") - .literal("remove") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .argument(IntegerArgument.newBuilder("amount"), ArgumentDescription.of("Amount of money to add")) - .meta(CommandMeta.DESCRIPTION, "Removes a set amount of money from a player") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> CurrencyCommandsHandler.subtractCommand(commandContext.getSender(), - commandContext.get("onlinePlayer"), - commandContext.get("amount")))); - - // /em money set - manager.command(builder.literal("money") - .literal("set") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .argument(DoubleArgument.newBuilder("amount"), ArgumentDescription.of("Amount to be set")) - .meta(CommandMeta.DESCRIPTION, "Sets the total currency amount of a player") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> CurrencyCommandsHandler.setCommand(commandContext.getSender(), - commandContext.get("onlinePlayer"), - commandContext.get("amount")))); - - // /em setrank - manager.command(builder.literal("setrank") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .argument(IntegerArgument.newBuilder("prestigeRank"), ArgumentDescription.of("Prestige rank, 0-10")) - .argument(IntegerArgument.newBuilder("guildRank"), ArgumentDescription.of("Guild rank, 0-20")) - .meta(CommandMeta.DESCRIPTION, "Sets the guild rank of a player.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> GuildRankCommands.setGuildRank(commandContext.getSender(), - commandContext.get("onlinePlayer"), - commandContext.get("prestigeRank"), - commandContext.get("guildRank")))); - - // /em discord - manager.command(builder.literal("discord") - .meta(CommandMeta.DESCRIPTION, "Gets the link for the support Discord server.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> commandContext.getSender().sendMessage( - ChatColorConverter.convert("&8[EliteMobs] &6Discord room for support & downloads: &9" + DiscordLinks.mainLink)))); - - // /em discord - manager.command(builder.literal("discord") - .argument(StringArgument.newBuilder("message").greedy().build(), - ArgumentDescription.of("Message to be sent to Discord")) - .meta(CommandMeta.DESCRIPTION, "Posts a debug message on Discord if DiscordSRV is configured correctly.") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - new DiscordSRVAnnouncement(commandContext.get("message")); - commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aAttempted to send a message to Discord!")); - })); - - // /em forceunbind - manager.command(builder.literal("forceunbind") - .senderType(Player.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Unbinds a held soulbound item.") - .handler(commandContext -> { - ItemStack itemStack = ((Player) commandContext.getSender()).getInventory().getItemInMainHand(); - if (ItemTagger.isEliteItem(itemStack)) - SoulbindEnchantment.removeEnchantment(itemStack); - })); - - // /em relativecoords - manager.command(builder.literal("relativecoords") - .argument(StringArgument.newBuilder("minidungeonFileName").withSuggestionsProvider(((objectCommandContext, s) -> minidungeonFileNames)), - ArgumentDescription.of("Minidungeon configuration file name")) - .senderType(Player.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Gets the relative coordinated to an installed dungeon.") - .handler(commandContext -> RelativeCoordinatesCommand.get((Player) commandContext.getSender(), commandContext.get("minidungeonFileName")))); - - // /em wallet - manager.command(builder.literal("wallet") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .senderType(CommandSender.class) - .permission("elitemobs.currency.check.others") - .meta(CommandMeta.DESCRIPTION, "Checks the currency of a specific player.") - .handler(commandContext -> CurrencyCommandsHandler.checkCommand(commandContext.getSender(), commandContext.get("onlinePlayer")))); - - // /em fireball - manager.command(builder.literal("fireball") - .senderType(Player.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Fires a test Elite Fireball for explosion protection and regeneration testing purposes.") - .handler(commandContext -> testFireball((Player) commandContext.getSender()))); - - List blockTransitionPhases = new ArrayList<>(Arrays.asList("ON_SPAWN", "ON_REMOVE")); - - // /em registerblocks - manager.command(builder.literal("registerblocks") - .senderType(Player.class) - .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Regional Boss configuration file name")) - .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)), - ArgumentDescription.of("Block transition phase")) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Registers transitive blocks for use by regional bosses.") - .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(), - commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), false))); - - // /em registerblocksedit - manager.command(builder.literal("registerblocksedit") - .senderType(Player.class) - .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Regional Boss configuration file name")) - .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)), - ArgumentDescription.of("Block transition phase")) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Registers transitive blocks for use by regional bosses.") - .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(), - commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), true))); - - // /em registerblocksarea - manager.command(builder.literal("registerblocksarea") - .senderType(Player.class) - .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Regional Boss configuration file name")) - .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)), - ArgumentDescription.of("Block transition phase")) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Registers large transitive blocks areas for use by regional bosses.") - .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(), - commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), false, true))); - - // /em registerblocksareaedit - manager.command(builder.literal("registerblocksareaedit") - .senderType(Player.class) - .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)), - ArgumentDescription.of("Regional Boss configuration file name")) - .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)), - ArgumentDescription.of("Block transition phase")) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Edits large transitive blocks areas for use by regional bosses.") - .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(), - commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), true, true))); - - // /em cancelblocks - manager.command(builder.literal("cancelblocks") - .senderType(Player.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Cancels transitive block registration for a player.") - .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender()))); - - // /em debugmode - manager.command(builder.literal("debugmode") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Toggles debug messages off and on.") - .handler(commandContext -> DebugMessage.toggleDebugMode(commandContext.getSender()))); - - // /em trace - manager.command(builder.literal("trace") - .senderType(CommandSender.class) - .argument(StringArgument.newBuilder("uuid"), - ArgumentDescription.of("EliteMobs UUID of the Custom Boss")) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Traces the life of a custom boss entity. Used by the debug menu.") - .handler(commandContext -> { - for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) - if (eliteEntity.getEliteUUID().toString().equals(commandContext.get("uuid"))) - if (eliteEntity instanceof CustomBossEntity) { - ((CustomBossEntity) eliteEntity).getBossTrace().postLog((Player) commandContext.getSender()); - return; - } - })); - - // /em debugtp - manager.command(builder.literal("debugtp") - .senderType(CommandSender.class) - .argument(StringArgument.newBuilder("uuid"), - ArgumentDescription.of("EliteMobs UUID of the Custom Boss")) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Traces the life of a custom boss entity. Used by the debug menu.") - .handler(commandContext -> { - for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) - if (eliteEntity.getEliteUUID().toString().equals(commandContext.get("uuid"))) - if (eliteEntity instanceof CustomBossEntity) { - if (eliteEntity.getLocation() != null) - ((Player) commandContext.getSender()).teleport(eliteEntity.getLocation()); - return; - } - })); - - // /em generateresourcepack - manager.command(builder.literal("generateresourcepack") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Generates a resource pack for EliteMobs using ModelEngine") - .handler(commandContext -> ConfigurationExporter.createResourcePack(commandContext.getSender()))); - - // /em quest reset player - manager.command(builder.literal("quest") - .literal("reset") - .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - }))) - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Resets player quest progress.") - .handler(commandContext -> QuestCommand.resetQuests(commandContext.getSender(), commandContext.get("player")))); - - List questFilenames = new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet()); - - // /em quest reset player questname - manager.command(builder.literal("quest") - .literal("reset") - .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - }))) - .argument(StringArgument.newBuilder("questName").withSuggestionsProvider((objectCommandContext, s) -> questFilenames), ArgumentDescription.of("Quest name")) - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Resets a specific quest for a player.") - .handler(commandContext -> QuestCommand.resetQuest(commandContext.getSender(), commandContext.get("player"), commandContext.get("questName")))); - - // /em quest forcecomplete - manager.command(builder.literal("quest") - .literal("forcecomplete") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Forces completion of all player quests.") - .handler(commandContext -> QuestCommand.completeQuest((Player) commandContext.getSender()))); - - // /em quest bypass - manager.command(builder.literal("quest") - .literal("bypass") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Allows admins to temporarily bypass permission and previous quest requirements for quests.") - .handler(commandContext -> QuestCommand.bypassQuestRequirements((Player) commandContext.getSender()))); - - // /em forceresourcepack - manager.command(builder.literal("forceresourcepack") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .meta(CommandMeta.DESCRIPTION, "Forces server resource packs to be used in your server.") - .handler(commandContext -> SetupMenu.forceResourcePack((Player) commandContext.getSender()))); - - // /em opendyamicshop - manager.command(builder.literal("opendynamicshop") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .meta(CommandMeta.DESCRIPTION, "Opens the dynamic shop for a player") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - try { - ProceduralShopMenu.shopConstructor(Bukkit.getPlayer((String) commandContext.get("onlinePlayer"))); - } catch (Exception ex) { - commandContext.getSender().sendMessage("Failed to get player with that username!"); - } - })); - - - // /em opencustomshop - manager.command(builder.literal("opencustomshop") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .meta(CommandMeta.DESCRIPTION, "Opens the custom shop for a player") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - try { - CustomShopMenu.customShopConstructor(Bukkit.getPlayer((String) commandContext.get("onlinePlayer"))); - } catch (Exception ex) { - commandContext.getSender().sendMessage("Failed to get player with that username!"); - } - })); - - // /em opensellshop - manager.command(builder.literal("opensellshop") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .meta(CommandMeta.DESCRIPTION, "Opens the dynamic shop for a player") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - SellMenu sellMenu = new SellMenu(); - try { - sellMenu.constructSellMenu(Bukkit.getPlayer((String) commandContext.get("onlinePlayer"))); - } catch (Exception ex) { - commandContext.getSender().sendMessage("Failed to get player with that username!"); - } - })); - - manager.command(builder.literal("itemstats") - .meta(CommandMeta.DESCRIPTION, "Debug command to check item stats") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - Player player = ((Player) commandContext.getSender()); - ItemStack item = player.getInventory().getItemInMainHand(); - double attackSpeed = EliteItemManager.getAttackSpeed(item); - double damage = EliteItemManager.getBaseDamage(item); - double dps = EliteItemManager.getDPS(item); - double itemLevel = EliteItemManager.getWeaponLevel(item); - double bonusEDPS = EliteItemManager.getTotalDPS(item); - commandContext.getSender().sendMessage("[EliteMobs] Item Stats:"); - commandContext.getSender().sendMessage("Item attack speed: " + attackSpeed); - commandContext.getSender().sendMessage("Item damage: " + damage); - commandContext.getSender().sendMessage("Item EDPS: " + dps); - commandContext.getSender().sendMessage("Item level: " + itemLevel); - commandContext.getSender().sendMessage("Item bonus EDPS: " + bonusEDPS); - }) - ); - - List wormholeList = new ArrayList<>(WormholeConfig.getWormholes().keySet()); - List wormholeOptions = new ArrayList<>(Arrays.asList("1", "2")); - - // /em setwormhole <1/2> - manager.command(builder.literal("setwormhole") - .argument(StringArgument.newBuilder("wormholeFilename").withSuggestionsProvider(((objectCommandContext, s) -> wormholeList)), - ArgumentDescription.of("Wormhole filename")) - .argument(StringArgument.newBuilder("wormholeOption").withSuggestionsProvider(((objectCommandContext, s) -> wormholeOptions)), - ArgumentDescription.of("Wormhole option")) - .senderType(Player.class) - .permission("elitemobs.*") - .handler(commandContext -> { - for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(commandContext.get("wormholeFilename"))) - switch ((String) commandContext.get("wormholeOption")) { - case "1": - wormhole.getWormholeEntry1().updateLocation((Player) commandContext.getSender()); - return; - case "2": - wormhole.getWormholeEntry2().updateLocation((Player) commandContext.getSender()); - return; - default: - commandContext.getSender().sendMessage("[EliteMobs] Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); - } - } - commandContext.getSender().sendMessage("[EliteMobs] Failed to set location for this wormhole."); - })); - - List languages = new ArrayList<>(TranslationsConfig.getTranslationConfigs().keySet()); - languages.add("english"); - - // /em language - manager.command(builder.literal("language") - .argument(StringArgument.newBuilder("language").withSuggestionsProvider(((objectCommandContext, s) -> languages)), - ArgumentDescription.of("Filename of the translation file to use")) - .meta(CommandMeta.DESCRIPTION, "Sets the language of the plugin!") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - if (languages.contains(commandContext.get("language"))) { - DefaultConfig.setLanguage(commandContext.getSender(), commandContext.get("language")); - commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Language set to " + commandContext.get("language") + " ! &4Translations are created and manged for free by the community through crowdin ( https://crowdin.com/project/elitemobs ), use at your own discretion!")); - } else { - String files = ""; - for (String language : languages) - files += language + " "; - commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cNot a valid language! Valid language files: " + files)); - } - }) - ); - - // /em package - manager.command(builder.literal("package") - .argument(StringArgument.newBuilder("dungeonName"), ArgumentDescription.of("Name of the dungeon to create")) - .argument(StringArgument.newBuilder("dungeonVersion"), ArgumentDescription.of("Version of the dungeon")) - .meta(CommandMeta.DESCRIPTION, "Packages a dungeon for distribution!") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - new PackageCommand(commandContext.getSender(), commandContext.get("dungeonName"), commandContext.get("dungeonVersion")); - }) - ); - - // /em forcerespawn - manager.command(builder.literal("forcerespawn") - .meta(CommandMeta.DESCRIPTION, "Resets spawn cooldowns") - .senderType(CommandSender.class) - .permission("elitemobs.*") - .handler(commandContext -> { - RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> { - if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn(); - }); - }) - ); - - } - - private void testFireball(Player player) { - Fireball fireball = (Fireball) player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL); - fireball.setDirection(player.getLocation().getDirection().normalize()); - fireball.setShooter(player); - fireball.setYield(3F); - EntityTracker.registerProjectileEntity(fireball); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java new file mode 100644 index 000000000..5ecc8de73 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class AdventurersGuildArgCommand extends AdvancedCommand { + public AdventurersGuildArgCommand() { + super(List.of("ag", "adventurersguild")); + setUsage("/em adventurersguild"); + setPermission("elitemobs.adventurersguild.command"); + setSenderType(SenderType.PLAYER); + setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + } + + @Override + public void execute(CommandData commandData) { + com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java new file mode 100644 index 000000000..1c6f75897 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; + +public class AdventurersGuildCommand extends AdvancedCommand { + public AdventurersGuildCommand() { + super(new ArrayList<>()); + setUsage("/em adventurersguild"); + setPermission("elitemobs.adventurersguild.command"); + setSenderType(SenderType.PLAYER); + setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + } + + @Override + public void execute(CommandData commandData) { + com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java new file mode 100644 index 000000000..4a6f18b00 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class AltCommand extends AdvancedCommand { + public AltCommand() { + super(List.of("alt")); + setUsage("/em alt"); + setDescription("Changes the style of the /em menu."); + setPermission("elitemobs.alt"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + PlayerData.setUseBookMenus(commandData.getPlayerSender(), !PlayerData.getUseBookMenus(commandData.getPlayerSender().getUniqueId())); + Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getSwitchEMStyleMessage()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java new file mode 100644 index 000000000..9c97bb5ab --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.ArenaMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class ArenaCommand extends AdvancedCommand { + public ArenaCommand() { + super(List.of("arena")); + addArgument("arenaID", new ArrayList<>()); + setUsage("/em arena "); + setPermission("elitemobs.arena.start"); + setDescription("Open the Arena menu."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + new ArenaMenu().constructArenaMenu(commandData.getPlayerSender(), commandData.getStringArgument("arenaID")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java deleted file mode 100644 index 9a1c4cd86..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.menus.ArenaMenu; -import org.bukkit.entity.Player; - -public class ArenaCommands { - public static void openArenaMenu(Player player, String arenaFilename) { - ArenaMenu arenaMenu = new ArenaMenu(); - arenaMenu.constructArenaMenu(player, arenaFilename); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 2a5faef8b..dfe83b9f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -1,144 +1,106 @@ package com.magmaguy.elitemobs.commands; -import cloud.commandframework.Command; -import cloud.commandframework.CommandTree; -import cloud.commandframework.arguments.standard.StringArgument; -import cloud.commandframework.bukkit.BukkitCommandManager; -import cloud.commandframework.execution.CommandExecutionCoordinator; -import cloud.commandframework.meta.CommandMeta; -import cloud.commandframework.minecraft.extras.MinecraftExceptionHandler; -import cloud.commandframework.minecraft.extras.MinecraftHelp; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; -import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.items.ShareItem; -import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; -import com.magmaguy.elitemobs.utils.WarningMessage; -import net.kyori.adventure.platform.bukkit.BukkitAudiences; -import net.kyori.adventure.text.format.NamedTextColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.lang.reflect.Method; -import java.util.function.Function; - -import static net.kyori.adventure.text.Component.text; - -/** - * Created by MagmaGuy on 21/01/2017. - */ +import com.magmaguy.magmacore.command.CommandManager; public class CommandHandler { - - private BukkitCommandManager manager; - //private CommandConfirmationManager paymentConfirmationManager; - private MinecraftHelp minecraftHelp; - private BukkitAudiences bukkitAudiences; - - /* - Commands powered by Cloud - */ - - public CommandHandler() { - Function commandExecutionCoordinator = null; - try { - Class c = Class.forName("cloud.commandframework.execution.CommandExecutionCoordinator"); - Method method = c.getDeclaredMethod("simpleCoordinator"); - commandExecutionCoordinator = (Function) method.invoke(Function.class); - } catch (Exception e) { - e.printStackTrace(); - } - try { - manager = new BukkitCommandManager( - /* Owning plugin */ MetadataHandler.PLUGIN, - /* Coordinator function */ commandExecutionCoordinator, - /* Command Sender -> C */ Function.identity(), - /* C -> Command Sender */ Function.identity() - ); - } catch (final Exception e) { - new WarningMessage("Failed to initialize the command manager"); - /* Disable the plugin */ - MetadataHandler.PLUGIN.getServer().getPluginManager().disablePlugin(MetadataHandler.PLUGIN); - return; - } - - //try { - // manager.registerBrigadier(); - //} catch (final Exception e) { - // new WarningMessage("Failed to initialize Brigadier support: " + e.getMessage()); - //} - - // Create a BukkitAudiences instance (adventure) in order to use the minecraft-extras help system - bukkitAudiences = BukkitAudiences.create(MetadataHandler.PLUGIN); - - minecraftHelp = new MinecraftHelp( - "/elitemobs help", - bukkitAudiences::sender, - manager - ); - - // Override the default exception handlers - new MinecraftExceptionHandler() - .withInvalidSyntaxHandler() - .withInvalidSenderHandler() - .withNoPermissionHandler() - .withArgumentParsingHandler() - .withCommandExecutionHandler() - .withDecorator( - component -> text() - .append(text("[", NamedTextColor.DARK_GRAY)) - .append(text("EliteMobs", NamedTextColor.GOLD)) - .append(text("] ", NamedTextColor.DARK_GRAY)) - .append(component).build() - ).apply(manager, bukkitAudiences::sender); - - constructCommands(); + private static CommandManager emCommand; + private static CommandManager adventurersGuildCommand; + private CommandHandler() { } - public void constructCommands() { - - // /ag - final Command.Builder agBuilder = manager.commandBuilder("adventurersguild", "ag"); - manager.command(agBuilder.meta(CommandMeta.DESCRIPTION, "Teleports players to the Adventurers' Guild Hub") - .senderType(Player.class) - //permission is dealt inside of the command - .handler(commandContext -> { - if (DefaultConfig.isEmLeadsToStatusMenu()) - AdventurersGuildCommand.adventurersGuildCommand((Player) commandContext.getSender()); - })); - - // /shareitem - final Command.Builder shareItemBuilder = manager.commandBuilder("shareitem"); - manager.command(shareItemBuilder.meta(CommandMeta.DESCRIPTION, "Shares a held Elite item on chat.") - .senderType(Player.class) - //permission is dealt inside of the command - .permission("elitemobs.shareitem") - .handler(commandContext -> ShareItem.showOnChat((Player) commandContext.getSender()))); - - // Base command builder - final Command.Builder builder = manager.commandBuilder("elitemobs", "em"); - - manager.command(builder.literal("help") - .argument(StringArgument.optional("query", StringArgument.StringMode.GREEDY)) - .handler(context -> { - minecraftHelp.queryCommands(context.getOrDefault("query", ""), context.getSender()); - })); - - //// Create a world argument - //final CommandArgument worldArgument = WorldArgument.of("world"); - - // /em - manager.command(builder - .meta(CommandMeta.DESCRIPTION, "Opens the main player interface") - .senderType(Player.class) - .handler(commandContext -> { - if (DefaultConfig.isEmLeadsToStatusMenu()) - new PlayerStatusScreen((Player) commandContext.getSender()); - })); - - new AdminCommands(manager, builder); - new UserCommands(manager, builder); - + public static void registerCommands() { + emCommand = new CommandManager(MetadataHandler.PLUGIN, "elitemobs"); + + //Admin commands + emCommand.registerCommand(new SetupCommand()); + emCommand.registerCommand(new SetupDoneCommand()); + emCommand.registerCommand(new SetupToggleCommand()); + emCommand.registerCommand(new SpawnBossCommand()); + emCommand.registerCommand(new SpawnBossLevelCommand()); + emCommand.registerCommand(new SpawnBossAtCommand()); + emCommand.registerCommand(new SpawnBossLevelAtCommand()); + emCommand.registerCommand(new PlaceBossCommand()); + emCommand.registerCommand(new PlaceTreasureChestCommand()); + emCommand.registerCommand(new PlaceNPCCommand()); + emCommand.registerCommand(new RemoveCommand()); + emCommand.registerCommand(new DebugCommand()); + emCommand.registerCommand(new EventCommand()); + emCommand.registerCommand(new StatsCommand()); + emCommand.registerCommand(new LootMenuCommand()); + emCommand.registerCommand(new LootGiveCommand()); + emCommand.registerCommand(new LootRandomCommand()); + emCommand.registerCommand(new LootSimulateMultipleCommand()); + emCommand.registerCommand(new LootSimulateCommand()); + emCommand.registerCommand(new VersionCommand()); + emCommand.registerCommand(new ReloadCommand()); + emCommand.registerCommand(new KillCommand()); + emCommand.registerCommand(new KillRadiusCommand()); + emCommand.registerCommand(new KillTypeCommand()); + emCommand.registerCommand(new KillTypeRadiusCommand()); + emCommand.registerCommand(new LootDebugCommand()); + emCommand.registerCommand(new MoneyAddCommand()); + emCommand.registerCommand(new MoneyAddAllCommand()); + emCommand.registerCommand(new MoneySetCommand()); + emCommand.registerCommand(new MoneyCheckPlayerCommand()); + emCommand.registerCommand(new UnbindForceCommand()); + emCommand.registerCommand(new FireballCommand()); + emCommand.registerCommand(new RespawnAllCommand()); + emCommand.registerCommand(new PackageDungeonCommand()); + emCommand.registerCommand(new LanguageCommand()); + emCommand.registerCommand(new PlaceWormholeCommand()); + emCommand.registerCommand(new LootStats()); + emCommand.registerCommand(new ShopProceduralOtherCommand()); + emCommand.registerCommand(new ShopCustomOtherCommand()); + emCommand.registerCommand(new ShopSellOtherCommand()); + emCommand.registerCommand(new QuestBypassCommand()); + emCommand.registerCommand(new QuestCompleteCommand()); + emCommand.registerCommand(new QuestCompleteQuestCommand()); + emCommand.registerCommand(new QuestResetCommand()); + emCommand.registerCommand(new QuestResetAllCommand()); + emCommand.registerCommand(new TransitiveBlocksCancelCommand()); + emCommand.registerCommand(new TransitiveBlocksRegisterCommand()); + emCommand.registerCommand(new TransitiveBlocksEditCommand()); + emCommand.registerCommand(new TransitiveBlocksRegisterAreaCommand()); + emCommand.registerCommand(new TransitiveBlocksEditAreaCommand()); + emCommand.registerCommand(new RankSetCommand()); + emCommand.registerCommand(new SpawnElite()); + emCommand.registerCommand(new SpawnEliteAtCommand()); + emCommand.registerCommand(new DiscordMessageCommand()); + emCommand.registerCommand(new DiscordCommand()); + emCommand.registerCommand(new MoneyRemoveCommand()); + emCommand.registerCommand(new ProtectionBypassCommand()); + + //User commands +// emCommand.registerCommand(new AdventurersGuildCommand()); + emCommand.registerCommand(new ShareItemCommand()); + emCommand.registerCommand(new ShopDynamicCommand()); + emCommand.registerCommand(new ShopCustomCommand()); + emCommand.registerCommand(new RepairCommand()); + emCommand.registerCommand(new EnchantCommand()); + emCommand.registerCommand(new ScrapCommand()); + emCommand.registerCommand(new UnbindCommand()); + emCommand.registerCommand(new MoneyCheckCommand()); + emCommand.registerCommand(new QuestAcceptCommand()); + emCommand.registerCommand(new QuestTrackCommand()); + emCommand.registerCommand(new QuestLeaveCommand()); + emCommand.registerCommand(new RankCommand()); + emCommand.registerCommand(new LootCommand()); + emCommand.registerCommand(new QuitCommand()); + emCommand.registerCommand(new StartCommand()); + emCommand.registerCommand(new ArenaCommand()); + emCommand.registerCommand(new DismissCommand()); + emCommand.registerCommand(new AltCommand()); + emCommand.registerCommand(new SpawnTeleportCommand()); + emCommand.registerCommand(new DungeonTeleportCommand()); + emCommand.registerCommand(new TrackBossCommand()); + emCommand.registerCommand(new PayCommand()); + emCommand.registerCommand(new AdventurersGuildArgCommand()); + + emCommand.registerCommand(new EliteMobsCommand()); + emCommand.registerCommand(new HelpCommand()); + + adventurersGuildCommand =new CommandManager(MetadataHandler.PLUGIN, "adventurersguild"); + adventurersGuildCommand.registerCommand(new AdventurersGuildCommand()); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index 82373bb98..e11cdfd9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Round; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -81,7 +81,7 @@ public static void addCommand(Player player, double amount) { EconomyHandler.addCurrency(player.getUniqueId(), amount); } - public static void addCommand(CommandSender commandSender, String onlinePlayer, int amount) { + public static void addCommand(CommandSender commandSender, String onlinePlayer, double amount) { Player player = Bukkit.getPlayer(onlinePlayer); if (player == null) { commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + onlinePlayer + " &4is not valid!")); @@ -92,7 +92,7 @@ public static void addCommand(CommandSender commandSender, String onlinePlayer, commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2They now have " + EconomyHandler.checkCurrency(player.getUniqueId()))); } - public static void addAllCommand(CommandSender commandSender, int amount) { + public static void addAllCommand(CommandSender commandSender, double amount) { for (Player player : Bukkit.getOnlinePlayers()) addCommand(player, amount); commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2You have added " + amount + " to all online players.")); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java index 13f259eb9..71fbd2efb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java @@ -1,11 +1,9 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicDungeonPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.utils.DebugBlockLocation; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -42,28 +40,6 @@ public static void addSpawnLocation(String customBossConfigFieldsString, Player } } - public static void addRelativeSpawnLocation(Player player, String customBossConfigFieldsString, String minidungeonString) { - EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonString); - if (emPackage == null) { - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Minidungeon is not valid!")); - return; - } - if (!(emPackage instanceof SchematicDungeonPackage)) { - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Target EM package was not a schematic dungeon so this command won't work!")); - return; - } - CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString); - if (customBossesConfigFields == null) - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Custom boss is not valid!")); - else { - Location safeSpawnLocation = autoSeekSafeSpawnLocation(player.getLocation()); - if (safeSpawnLocation == null) - player.sendMessage("[EliteMobs] No safe spawn location found! Make sure the area is passable!"); - else - ((SchematicDungeonPackage) emPackage).addBoss(customBossesConfigFields, safeSpawnLocation); - } - } - public static void setLeashRadius(String customBossConfigFieldsString, CommandSender commandSender, int leashRadius) { CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString); if (customBossesConfigFields == null) { diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java new file mode 100644 index 000000000..34f06fa3b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.DebugScreen; +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class DebugCommand extends AdvancedCommand { + public DebugCommand() { + super(List.of("debug")); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + setUsage("/em debug "); + setPermission("elitemobs.debug"); + setSenderType(SenderType.PLAYER); + setDescription("Debug bosses or players."); + } + + @Override + public void execute(CommandData commandData) { + DebugScreen.open(commandData.getPlayerSender(), commandData.getStringArgument("filename")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java new file mode 100644 index 000000000..b06eb76f3 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class DiscordCommand extends AdvancedCommand { + public DiscordCommand() { + super(List.of("discord")); + setUsage("/em discord"); + setPermission("elitemobs.discord.link"); + setDescription("Links to the EliteMobs discord."); + } + + @Override + public void execute(CommandData commandData) { + Logger.sendMessage(commandData.getPlayerSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java new file mode 100644 index 000000000..64988902c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; + +import java.util.ArrayList; +import java.util.List; + +public class DiscordMessageCommand extends AdvancedCommand { + public DiscordMessageCommand() { + super(List.of("discord")); + addArgument("message", new ArrayList<>()); + setUsage("/em discord "); + setPermission("elitemobs.discord.message"); + setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes"); + } + + @Override + public void execute(CommandData commandData) { + new DiscordSRVAnnouncement(commandData.getStringSequenceArgument("message")); + Logger.sendMessage(commandData.getCommandSender(), "&aAttempted to send a message to Discord!"); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java new file mode 100644 index 000000000..bb1b02fd4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class DismissCommand extends AdvancedCommand { + public DismissCommand() { + super(List.of("dismiss")); + setDescription("Dismisses /em menu message."); + setUsage("/em dismiss"); + setPermission("elitemobs.dismiss"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + PlayerData.setDismissEMStatusScreenMessage(commandData.getPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(commandData.getPlayerSender().getUniqueId())); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java index db1ec3dc1..4cbe96b1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java @@ -5,6 +5,7 @@ import com.magmaguy.elitemobs.dungeons.WorldInstancedDungeonPackage; import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.menus.InstancedDungeonBrowser; +import com.magmaguy.elitemobs.wormhole.Wormhole; import org.bukkit.entity.Player; public class DungeonCommands { @@ -24,8 +25,10 @@ public static void teleport(Player player, String minidungeonName) { if (emPackage instanceof WorldInstancedDungeonPackage) new InstancedDungeonBrowser(player, emPackage.getDungeonPackagerConfigFields().getFilename()); else { - if (emPackage.getDungeonPackagerConfigFields().getTeleportLocation() != null) + if (emPackage.getDungeonPackagerConfigFields().getTeleportLocation() != null) { PlayerPreTeleportEvent.teleportPlayer(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation()); + Wormhole.addPlayerToCooldowns(player); + } else player.sendMessage("[EliteMobs] Can't teleport you to the dungeon because the teleport location isn't set!" + " Ask an admin to reinstall the dungeon!"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java new file mode 100644 index 000000000..5c71e0f63 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class DungeonTeleportCommand extends AdvancedCommand { + public DungeonTeleportCommand() { + super(List.of("dungeontp")); + addArgument("dungeonID", new ArrayList<>()); + setPermission("elitemobs.dungeon.tp"); + setDescription("Teleports players to Lairs, Minidungeons and Dungeons."); + setUsage("/em dungeontp "); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + DungeonCommands.teleport(commandData.getPlayerSender(), commandData.getStringArgument("dungeonID")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java new file mode 100644 index 000000000..c41a1a6b2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; + +public class EliteMobsCommand extends AdvancedCommand { + public EliteMobsCommand() { + super(new ArrayList<>()); + setDescription("The main command for EliteMobs, opens the main menu."); + setUsage("/em"); + setPermission("elitemobs.command"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + if (DefaultConfig.isEmLeadsToStatusMenu()) + new PlayerStatusScreen(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java new file mode 100644 index 000000000..1e7bfa81c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.elitemobs.menus.ItemEnchantmentMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class EnchantCommand extends AdvancedCommand { + public EnchantCommand() { + super(List.of("enchant")); + setUsage("/em enchant"); + setPermission("elitemobs.enchant.command"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the enchantment menu or teleports the player to the Adventurer's Guild Hub"); + } + + @Override + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) + new ItemEnchantmentMenu(commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java new file mode 100644 index 000000000..61a496b6d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.events.TimedEvent; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class EventCommand extends AdvancedCommand { + public EventCommand() { + super(List.of("event")); + addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList()); + setUsage("/em event "); + setPermission("elitemobs.event.start"); + setSenderType(SenderType.PLAYER); + setDescription("Triggers a timed event to start at the next available time and place."); + } + + @Override + public void execute(CommandData commandData) { + com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(commandData.getCommandSender(), commandData.getStringArgument("filename")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java new file mode 100644 index 000000000..f15b47354 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.entitytracker.EntityTracker; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Fireball; + +import java.util.List; + +public class FireballCommand extends AdvancedCommand { + public FireballCommand() { + super(List.of("fireball")); + setUsage("/em fireball"); + setPermission("elitemobs.fireball"); + setDescription("Shoots a fireball, to test terrain protections and explosion regeneration."); + } + + @Override + public void execute(CommandData commandData) { + Fireball fireball = (Fireball) commandData.getPlayerSender().getWorld().spawnEntity(commandData.getPlayerSender().getLocation(), EntityType.FIREBALL); + fireball.setDirection(commandData.getPlayerSender().getLocation().getDirection().normalize()); + fireball.setShooter(commandData.getPlayerSender()); + fireball.setYield(3F); + EntityTracker.registerProjectileEntity(fireball); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java index 76afff26c..7764a5f4b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.adventurersguild.GuildRank; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java new file mode 100644 index 000000000..c2b49187d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -0,0 +1,33 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.CommandManager; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.entity.Player; + +import java.util.List; + +public class HelpCommand extends AdvancedCommand { + public HelpCommand() { + super(List.of("help")); + setUsage("/em help"); + setPermission("elitemobs.help"); + setDescription("Lists all commands."); + } + + @Override + public void execute(CommandData commandData) { + Logger.sendMessage(commandData.getCommandSender(), "Commands:"); + for (CommandManager commandManager : CommandManager.getCommandManagers()) { + commandManager.commands.forEach(command -> { + if (commandData.getCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.getUsage(), command.getDescription())); + } else { + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getUsage()); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getDescription()); + } + }); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java new file mode 100644 index 000000000..70c740edd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.List; + +public class KillCommand extends AdvancedCommand { + public KillCommand() { + super(List.of("kill")); + setUsage("/em kill"); + setPermission("elitemobs.kill.command"); + setDescription("Kills all elites."); + } + + @Override + public void execute(CommandData commandData) { + KillHandler.killAggressiveMobs(commandData.getCommandSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java new file mode 100644 index 000000000..978c494a7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class KillRadiusCommand extends AdvancedCommand { + public KillRadiusCommand() { + super(List.of("kill")); + addArgument("radius", new ArrayList<>()); + setUsage("/em kill "); + setPermission("elitemobs.kill.command"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites in the specified radius."); + } + + @Override + public void execute(CommandData commandData) { + KillHandler.radiusKillAggressiveMobs(commandData.getPlayerSender(), commandData.getIntegerArgument("radius")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java new file mode 100644 index 000000000..03b0ffdc6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import org.bukkit.entity.EntityType; + +import java.util.ArrayList; +import java.util.List; + +public class KillTypeCommand extends AdvancedCommand { + public KillTypeCommand() { + super(List.of("kill")); + addLiteral("type"); + addArgument("type", new ArrayList<>()); + setUsage("/em kill type "); + setPermission("elitemobs.kill.command"); + setDescription("Kills all elites of the specified type."); + } + + @Override + public void execute(CommandData commandData) { + KillHandler.killEntityType(commandData.getCommandSender(), EntityType.valueOf(commandData.getStringArgument("type"))); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java new file mode 100644 index 000000000..33cd0d2e8 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import org.bukkit.entity.EntityType; + +import java.util.ArrayList; +import java.util.List; + +public class KillTypeRadiusCommand extends AdvancedCommand { + public KillTypeRadiusCommand() { + super(List.of("kill")); + addLiteral("type"); + addArgument("type", new ArrayList<>()); + addArgument("range", new ArrayList<>()); + setUsage("/em kill type "); + setPermission("elitemobs.kill.command"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites of the specified type within the specified radius."); + } + + @Override + public void execute(CommandData commandData) { + KillHandler.radiusKillSpecificMobs(commandData.getPlayerSender(), + EntityType.valueOf(commandData.getStringArgument("type")), + commandData.getIntegerArgument("range")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java new file mode 100644 index 000000000..57d0aee9a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -0,0 +1,35 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.config.translations.TranslationsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; + +import java.util.ArrayList; +import java.util.List; + +public class LanguageCommand extends AdvancedCommand { + public LanguageCommand() { + super(List.of("language")); + List suggestions = new ArrayList<>(TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); + suggestions.add("english"); + addArgument("language", suggestions); + setUsage("/em language "); + setPermission("elitemobs.language"); + setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + } + + @Override + public void execute(CommandData commandData) { + String language = commandData.getStringArgument("language"); + if (!TranslationsConfig.getTranslationConfigs().containsKey(language) && !language.equals("english")) { + Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key)); + return; + } + DefaultConfig.setLanguage(commandData.getCommandSender(), language); + Logger.sendMessage(commandData.getCommandSender(), "&2Language set to " + language + + " ! &4Translations are created and manged for free by the community through Crowdin ( https://crowdin.com/project/elitemobs ), use at your own discretion!"); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java new file mode 100644 index 000000000..d1035a41f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.LootMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class LootCommand extends AdvancedCommand { + public LootCommand() { + super(List.of("loot")); + setUsage("/em loot"); + setDescription("Open the loot menu for group loot."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + LootMenu.openMenu(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java new file mode 100644 index 000000000..ada2a14e9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.GetTierCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class LootDebugCommand extends AdvancedCommand { + public LootDebugCommand() { + super(List.of("loot")); + addLiteral("debug"); + addArgument("level", new ArrayList<>()); + setUsage("/em loot debug "); + setPermission("elitemobs.loot.debug"); + setSenderType(SenderType.PLAYER); + setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes."); + } + + @Override + public void execute(CommandData commandData) { + GetTierCommand.get(commandData.getPlayerSender(), commandData.getIntegerArgument("level")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java new file mode 100644 index 000000000..5938e9cfb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.LootCommand; +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class LootGiveCommand extends AdvancedCommand { + public LootGiveCommand() { + super(List.of("loot")); + addLiteral("give"); + addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot give "); + setPermission("elitemobs.loot.admin"); + setDescription("Gives the specified loot to a specific player."); + } + + @Override + public void execute(CommandData commandData) { + LootCommand.give(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getStringArgument("filename")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java new file mode 100644 index 000000000..9126a677b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.GetLootMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class LootMenuCommand extends AdvancedCommand { + public LootMenuCommand() { + super(List.of("loot")); + addLiteral("menu"); + setUsage("/em loot menu"); + setPermission("elitemobs.loot.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the loot menu."); + } + + @Override + public void execute(CommandData commandData) { + new GetLootMenu(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java new file mode 100644 index 000000000..60c979976 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.SimLootCommand; +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class LootRandomCommand extends AdvancedCommand { + public LootRandomCommand() { + super(List.of("loot")); + addLiteral("random"); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em loot random "); + setPermission("elitemobs.loot.admin"); + setDescription("Gives the player random loot of the specified level."); + } + + @Override + public void execute(CommandData commandData) { + SimLootCommand.forcePositiveLoot(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getIntegerArgument("level")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java new file mode 100644 index 000000000..9dbd97527 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -0,0 +1,31 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.SimLootCommand; +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class LootSimulateCommand extends AdvancedCommand { + public LootSimulateCommand() { + super(List.of("loot")); + addLiteral("simulate"); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em loot simulate "); + setPermission("elitemobs.loot.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified level and player."); + } + + @Override + public void execute(CommandData commandData) { + SimLootCommand.run( + commandData.getPlayerSender(), + commandData.getIntegerArgument("level"), + commandData.getStringArgument("playerName")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java new file mode 100644 index 000000000..a38e117cb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -0,0 +1,33 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.SimLootCommand; +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class LootSimulateMultipleCommand extends AdvancedCommand { + public LootSimulateMultipleCommand() { + super(List.of("loot")); + addLiteral("simulate"); + addArgument("level", new ArrayList<>()); + addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot simulate "); + setPermission("elitemobs.loot.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute(CommandData commandData) { + SimLootCommand.runMultipleTimes( + commandData.getPlayerSender(), + commandData.getIntegerArgument("level"), + commandData.getIntegerArgument("times"), + commandData.getStringArgument("playerName")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java new file mode 100644 index 000000000..9e81fb2f6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -0,0 +1,38 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.api.utils.EliteItemManager; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import java.util.List; + +public class LootStats extends AdvancedCommand { + public LootStats() { + super(List.of("loot")); + addLiteral("stats"); + setUsage("/em loot stats"); + setPermission("elitemobs.loot.stats"); + setSenderType(SenderType.PLAYER); + setDescription("Provides EliteMobs stats for the currently held item."); + } + + @Override + public void execute(CommandData commandData) { + Player player = commandData.getPlayerSender(); + ItemStack item = player.getInventory().getItemInMainHand(); + double attackSpeed = EliteItemManager.getAttackSpeed(item); + double damage = EliteItemManager.getBaseDamage(item); + double dps = EliteItemManager.getDPS(item); + double itemLevel = EliteItemManager.getWeaponLevel(item); + double bonusEDPS = EliteItemManager.getTotalDPS(item); + player.sendMessage("[EliteMobs] Item Stats:"); + player.sendMessage("Item attack speed: " + attackSpeed); + player.sendMessage("Item damage: " + damage); + player.sendMessage("Item EDPS: " + dps); + player.sendMessage("Item level: " + itemLevel); + player.sendMessage("Item bonus EDPS: " + bonusEDPS); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java new file mode 100644 index 000000000..176e7f042 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class MoneyAddAllCommand extends AdvancedCommand { + public MoneyAddAllCommand() { + super(List.of("money")); + addLiteral("addAll"); + addArgument("amount", new ArrayList<>()); + setUsage("/em money addAll "); + setPermission("elitemobs.money.admin"); + setDescription("Gives every player on the server the specified amount of money."); + } + + @Override + public void execute(CommandData commandData) { + CurrencyCommandsHandler.addAllCommand( + commandData.getCommandSender(), + commandData.getDoubleArgument("amount")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java new file mode 100644 index 000000000..e7089faa2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class MoneyAddCommand extends AdvancedCommand { + public MoneyAddCommand() { + super(List.of("money")); + addLiteral("add"); + addArgument("player", new ArrayList<>()); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money add "); + setPermission("elitemobs.money.admin"); + setDescription("Gives the specified amount of money to the designated player."); + } + + @Override + public void execute(CommandData commandData) { + CurrencyCommandsHandler.addCommand( + commandData.getCommandSender(), + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java new file mode 100644 index 000000000..14cee4268 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class MoneyCheckCommand extends AdvancedCommand { + public MoneyCheckCommand() { + super(List.of("money")); + addLiteral("check"); + setUsage("/em money check"); + setPermission("elitemobs.money.check.self"); + setSenderType(SenderType.PLAYER); + setDescription("Checks your EliteMobs currency."); + } + + @Override + public void execute(CommandData commandData) { + if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) + new PlayerStatusScreen(commandData.getPlayerSender()); + else + CurrencyCommandsHandler.walletCommand(commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java new file mode 100644 index 000000000..a73f8def9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class MoneyCheckPlayerCommand extends AdvancedCommand { + public MoneyCheckPlayerCommand() { + super(List.of("money")); + addLiteral("check"); + addArgument("player", new ArrayList<>()); + setUsage("/em money check "); + setPermission("elitemobs.money.check.others"); + setDescription("Checks the currency of the specified player."); + } + + @Override + public void execute(CommandData commandData) { + CurrencyCommandsHandler.checkCommand( + commandData.getCommandSender(), + commandData.getStringArgument("player")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java new file mode 100644 index 000000000..3bb188cd2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class MoneyRemoveCommand extends AdvancedCommand { + public MoneyRemoveCommand() { + super(List.of("money")); + addLiteral("remove"); + addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money remove "); + setPermission("elitemobs.money.admin"); + setDescription("Deducts the specified amount of currency from a player."); + } + + @Override + public void execute(CommandData commandData) { + CurrencyCommandsHandler.subtractCommand( + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java new file mode 100644 index 000000000..5a1c9802d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class MoneySetCommand extends AdvancedCommand { + public MoneySetCommand() { + super(List.of("money")); + addLiteral("set"); + addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money set "); + setPermission("elitemobs.money.admin"); + setDescription("Sets the specified amount of currency for the specified player."); + } + + @Override + public void execute(CommandData commandData) { + CurrencyCommandsHandler.setCommand( + commandData.getCommandSender(), + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java index d1786284a..4a9c8131e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.utils.ZipFile; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.ZipFile; import org.bukkit.command.CommandSender; import java.io.File; @@ -103,7 +103,7 @@ private void recursivelyGetFiles(File scannedFile, File destination) { } else Files.copy(scannedFile.toPath(), Path.of(destination.getAbsolutePath() + File.separatorChar + scannedFile.getName()), StandardCopyOption.REPLACE_EXISTING); } catch (Exception exception) { - new WarningMessage("Failed to recursively pack dungeon!"); + Logger.warn("Failed to recursively pack dungeon!"); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java new file mode 100644 index 000000000..1e867ea92 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class PackageDungeonCommand extends AdvancedCommand { + public PackageDungeonCommand() { + super(List.of("package")); + addArgument("dungeonName", new ArrayList<>()); + addArgument("version", new ArrayList<>()); + setUsage("/em package "); + setPermission("elitemobs.package"); + setDescription("Packages an EliteMobs dungeon for distribution."); + } + + @Override + public void execute(CommandData commandData) { + new PackageCommand(commandData.getCommandSender(), + commandData.getStringArgument("dungeonName"), + commandData.getStringArgument("version")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java new file mode 100644 index 000000000..fdd48e0a0 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class PayCommand extends AdvancedCommand { + public PayCommand() { + super(List.of("pay")); + addArgument("player", new ArrayList<>()); + addArgument("amount", new ArrayList<>()); + setDescription("Send money to a player, minus tax."); + setUsage("/em pay "); + setPermission("elitemobs.money.pay"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + CurrencyCommandsHandler.payCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java new file mode 100644 index 000000000..2a65ae715 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -0,0 +1,32 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class PlaceBossCommand extends AdvancedCommand { + public PlaceBossCommand() { + super(List.of("place")); + addLiteral("boss"); + List regionalBosses = new ArrayList<>(); + for (Map.Entry entry : CustomBossesConfig.getCustomBosses().entrySet()) + if (entry.getValue().isRegionalBoss()) + regionalBosses.add(entry.getKey()); + addArgument("filename", regionalBosses); + setUsage("/em place boss "); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Add a spawn location for the specified boss at your current location."); + } + + @Override + public void execute(CommandData commandData) { + CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java new file mode 100644 index 000000000..c1f31c9cd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.NPCCommands; +import com.magmaguy.elitemobs.config.npcs.NPCsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class PlaceNPCCommand extends AdvancedCommand { + public PlaceNPCCommand() { + super(List.of("place")); + addLiteral("npc"); + addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet())); + setUsage("/em place npc "); + setPermission("elitemobs.place.npc"); + setSenderType(SenderType.PLAYER); + setDescription("Permanently adds an npc to the location the user is standing on."); + } + + @Override + public void execute(CommandData commandData) { + NPCCommands.set(commandData.getPlayerSender(), commandData.getStringArgument("filename")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java new file mode 100644 index 000000000..b47ae3621 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class PlaceTreasureChestCommand extends AdvancedCommand { + public PlaceTreasureChestCommand() { + super(List.of("place")); + addLiteral("treasureChest"); + addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); + setUsage("/em place treasureChest "); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Permanently adds a treasure chest to the location the user is standing on."); + } + + @Override + public void execute(CommandData commandData) { + CustomTreasureChestsConfig.addTreasureChestEntry(commandData.getPlayerSender(), commandData.getStringArgument("filename")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java new file mode 100644 index 000000000..04cb8aa06 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -0,0 +1,42 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.wormholes.WormholeConfig; +import com.magmaguy.elitemobs.wormhole.Wormhole; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.util.Logger; + +import java.util.ArrayList; +import java.util.List; + +public class PlaceWormholeCommand extends AdvancedCommand { + public PlaceWormholeCommand() { + super(List.of("place")); + addLiteral("wormhole"); + addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); + addArgument("wormholeOption", List.of(1, 2)); + setUsage("/em place wormhole <1/2>"); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Place a wormhole teleport at your current location."); + } + + @Override + public void execute(CommandData commandData) { + for (Wormhole wormhole : Wormhole.getWormholes()) { + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename"))) + switch (commandData.getStringArgument("wormholeOption")) { + case "1": + wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); + return; + case "2": + wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender()); + return; + default: + Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + } + } + Logger.sendMessage(commandData.getCommandSender(), "Failed to set location for this wormhole."); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java new file mode 100644 index 000000000..89e65f2ed --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.dungeons.DungeonProtector; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class ProtectionBypassCommand extends AdvancedCommand { + public ProtectionBypassCommand() { + super(List.of("protection")); + addLiteral("bypass"); + setPermission("elitemobs.protection.bypass"); + setDescription("Allows admins to toggle bypassing protections"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + boolean outcome = DungeonProtector.toggleBypass(commandData.getPlayerSender().getUniqueId()); + Logger.sendMessage(commandData.getCommandSender(), "Bypassing dungeon protections is now " + outcome); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java new file mode 100644 index 000000000..e5526ea69 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class QuestAcceptCommand extends AdvancedCommand { + public QuestAcceptCommand() { + super(List.of("quest")); + addLiteral("accept"); + addArgument("questID", new ArrayList<>()); + setUsage("/em quest accept "); + setPermission("elitemobs.quest.accept"); + setSenderType(SenderType.PLAYER); + setDescription("Accepts a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.joinQuest(commandData.getStringArgument("questID"), commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java new file mode 100644 index 000000000..83619bbae --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class QuestBypassCommand extends AdvancedCommand { + public QuestBypassCommand() { + super(List.of("quest")); + addLiteral("bypass"); + setUsage("/em quest bypass"); + setPermission("elitemobs.quest.bypass"); + setSenderType(SenderType.PLAYER); + setDescription("Bypasses permission restrictions for elite quests."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.bypassQuestRequirements(commandData.getPlayerSender()); + if (PlayerQuestCooldowns.bypassesQuestRestrictions(commandData.getPlayerSender())) + Logger.sendMessage(commandData.getCommandSender(), "Now bypassing quest permission requirements!"); + else + Logger.sendMessage(commandData.getCommandSender(), "No longer bypassing quest permission requirements!"); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java new file mode 100644 index 000000000..232fb266a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class QuestCompleteCommand extends AdvancedCommand { + public QuestCompleteCommand() { + super(List.of("quest")); + addLiteral("complete"); + setUsage("/em quest complete"); + setPermission("elitemobs.quest.complete.force"); + setSenderType(SenderType.PLAYER); + setDescription("Forces all of your currently active elite quests to be completed. For debugging use only."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.completeQuest(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java new file mode 100644 index 000000000..be7f31614 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class QuestCompleteQuestCommand extends AdvancedCommand { + public QuestCompleteQuestCommand() { + super(List.of("quest")); + addLiteral("complete"); + addArgument("id", new ArrayList<>()); + setUsage("/em quest complete"); + setPermission("elitemobs.quest.complete"); + setSenderType(SenderType.PLAYER); + setDescription("Completes a quest for a player. Meant to be used via menu, not directly."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.completeQuest(commandData.getStringArgument("id"), commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java new file mode 100644 index 000000000..3472647ca --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class QuestLeaveCommand extends AdvancedCommand { + public QuestLeaveCommand() { + super(List.of("quest")); + addLiteral("leave"); + addArgument("questID", new ArrayList<>()); + setUsage("/em quest leave"); + setPermission("elitemobs.quest.leave"); + setSenderType(SenderType.PLAYER); + setDescription("Leaves a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.leaveQuest(commandData.getPlayerSender(), commandData.getStringArgument("questID")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java new file mode 100644 index 000000000..18b968908 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class QuestResetAllCommand extends AdvancedCommand { + public QuestResetAllCommand() { + super(List.of("quest")); + addLiteral("resetAll"); + addArgument("player", new ArrayList<>()); + setUsage("/em quest resetAll "); + setPermission("elitemobs.quest.reset.all"); + setDescription("Resets all quests for a specific player."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.resetQuests(commandData.getCommandSender(), commandData.getStringArgument("player")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java new file mode 100644 index 000000000..f57951bbd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class QuestResetCommand extends AdvancedCommand { + public QuestResetCommand() { + super(List.of("quest")); + addLiteral("reset"); + addArgument("player", new ArrayList<>()); + addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); + setUsage("/em quest reset "); + setPermission("elitemobs.quest.reset"); + setDescription("Resets a specific quest for a specific player."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.resetQuest(commandData.getCommandSender(), commandData.getStringArgument("player"), commandData.getStringArgument("questName")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java new file mode 100644 index 000000000..207a34243 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class QuestTrackCommand extends AdvancedCommand { + public QuestTrackCommand() { + super(List.of("quest")); + addLiteral("track"); + addArgument("questID", new ArrayList<>()); + setUsage("/em quest track "); + setPermission("elitemobs.quest.track"); + setSenderType(SenderType.PLAYER); + setDescription("Tracks a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute(CommandData commandData) { + QuestCommand.trackQuest(commandData.getStringArgument("questID"), commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java new file mode 100644 index 000000000..148b2b2bf --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.instanced.MatchInstance; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class QuitCommand extends AdvancedCommand { + public QuitCommand() { + super(List.of("quit")); + setDescription("When in instanced content, makes the player leave the instance."); + setUsage("/em quit"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender()); + if (matchInstance != null) + matchInstance.removeAnyKind(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java new file mode 100644 index 000000000..b85485726 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class RankCommand extends AdvancedCommand { + public RankCommand() { + super(List.of("rank")); + setUsage("/em rank"); + setDescription("Opens the EliteMobs rank menu or teleports you to the Adventurer's Guild."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) + AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java new file mode 100644 index 000000000..b4730d04b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.ArrayList; +import java.util.List; + +public class RankSetCommand extends AdvancedCommand { + public RankSetCommand() { + super(List.of("rank")); + addArgument("player", new ArrayList<>()); + addArgument("prestigeLevel", new ArrayList<>()); + addArgument("guildLevel", new ArrayList<>()); + setUsage("/em rank "); + setPermission("elitemobs.rank.set"); + setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified."); + } + + @Override + public void execute(CommandData commandData) { + GuildRankCommands.setGuildRank(commandData.getCommandSender(), + commandData.getStringArgument("player"), + commandData.getIntegerArgument("prestigeLevel"), + commandData.getIntegerArgument("guildLevel")); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java new file mode 100644 index 000000000..efc3774b9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.command.CommandSender; + +import java.util.List; + +public class ReloadCommand extends AdvancedCommand { + public ReloadCommand() { + super(List.of("reload")); + setUsage("/em reload"); + setPermission("elitemobs.reload"); + setDescription("Reloads EliteMobs."); + } + + public static void reload(CommandSender commandSender) { + MetadataHandler.PLUGIN.onDisable(); + MetadataHandler.PLUGIN.onLoad(); + MetadataHandler.PLUGIN.onEnable(); + Logger.sendMessage(commandSender, "Plugin reloaded!"); + } + + @Override + public void execute(CommandData commandData) { + reload(commandData.getCommandSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java new file mode 100644 index 000000000..2110beb14 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class RemoveCommand extends AdvancedCommand { + public RemoveCommand() { + super(List.of("remove")); + setUsage("/em remove"); + setPermission("elitemobs.remove"); + setSenderType(SenderType.PLAYER); + setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content."); + } + + @Override + public void execute(CommandData commandData) { + com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java new file mode 100644 index 000000000..a1d6adeab --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.elitemobs.menus.RepairMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class RepairCommand extends AdvancedCommand { + public RepairCommand() { + super(List.of("repair")); + setUsage("/em repair"); + setPermission("elitemobs.repair.command"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the repair item menu or teleports the player to the Adventurer's Guild Hub."); + } + + @Override + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { + RepairMenu repairMenu = new RepairMenu(); + repairMenu.constructRepairMenu(commandData.getPlayerSender()); + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java new file mode 100644 index 000000000..63766ad2d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; + +import java.util.List; + +public class RespawnAllCommand extends AdvancedCommand { + public RespawnAllCommand() { + super(List.of("respawn")); + addLiteral("all"); + setUsage("/em respawn all"); + setPermission("elitemobs.respawn.force"); + setDescription("Forces all regional bosses to respawn."); + } + + @Override + public void execute(CommandData commandData) { + RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> { + if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn(); + }); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java new file mode 100644 index 000000000..534216f7e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.elitemobs.menus.ScrapperMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class ScrapCommand extends AdvancedCommand { + public ScrapCommand() { + super(List.of("scrap")); + setUsage("/em scrap"); + setPermission("elitemobs.scrap.command"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the scrap menu or teleports the player to the Adventurer's Guild Hub."); + } + + @Override + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { + ScrapperMenu scrapperMenu = new ScrapperMenu(); + scrapperMenu.constructScrapMenu(commandData.getPlayerSender()); + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java new file mode 100644 index 000000000..743545e32 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.setup.SetupMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class SetupCommand extends AdvancedCommand { + public SetupCommand() { + super(List.of("setup")); + setPermission("elitemobs.setup"); + setSenderType(SenderType.PLAYER); + setDescription("The main command for setting up EliteMobs!"); + setUsage("/em setup"); + } + + @Override + public void execute(CommandData commandData) { + new SetupMenu(commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java new file mode 100644 index 000000000..c94084e30 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class SetupDoneCommand extends AdvancedCommand { + public SetupDoneCommand() { + super(List.of("setup")); + addLiteral("done"); + setUsage("/em setup done"); + setPermission("elitemobs.setup"); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute(CommandData commandData) { + DefaultConfig.toggleSetupDone(); + if (DefaultConfig.isSetupDone()) + Logger.sendMessage(commandData.getCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this."); + else + Logger.sendMessage(commandData.getCommandSender(), "&aEliteMobs will once again send messages on login. You can do [/em setup done] again to revert this."); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java deleted file mode 100644 index 190fb6ea4..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.EliteMobs; -import com.magmaguy.elitemobs.commands.setup.SetupMenu; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - -public class SetupHandler { - - public static void setupMenuCommand(Player player) { - new SetupMenu(player); - } - - public static void setupMinidungeonCommand(Player player, String minidungeonName) { - EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonName); - emPackage.install(player, true); - } - - public static void setupMinidungeonNoPasteCommand(Player player, String minidungeonName) { - EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonName); - emPackage.install(player, false); - } - - public static void setupUnminidungeonCommand(Player player, String minidungeonName) { - EMPackage minidungeon = EMPackage.getEmPackages().get(minidungeonName); - minidungeon.uninstall(player); - player.performCommand("/undo"); - } - - public static void setupAreaCommand(Player player, String regionName) { - if (!EliteMobs.worldGuardIsEnabled) { - player.sendMessage("[EliteMobs] You don't have WorldGuard installed! It is not possible to correctly set " + - "up a lair/minidungeon/dungeon without that plugin!"); - return; - } - if (!WorldGuardCompatibility.protectMinidungeonArea(regionName, player.getLocation())) { - player.sendMessage(ChatColorConverter.convert("&4[EliteMobs] Failed to protect region! Was the region name correct?")); - //worldguardextraflags - if (Bukkit.getPluginManager().isPluginEnabled("WorldGuardExtraFlags")) { - commandPackage("&2", "fly", "deny", player, regionName); - } else { - player.sendMessage(ChatColor.RED + "[EliteMobs] Warning: the WorldGuardExtraFlags plugin is not present. It is recommended for the use of the anti-flight flag."); - } - - player.performCommand("rg info"); - } else - player.sendMessage(ChatColorConverter.convert("&2[EliteMobs] Set all WorldGuard flags correctly!")); - - } - - private static void commandPackage(String colorCode, String flagString, String state, Player player, String regionName) { - player.sendMessage(flagString(colorCode + flagString, player)); - player.performCommand(commandString(flagString, state, player, regionName)); - } - - private static String flagString(String flagString, Player player) { - return ChatColorConverter.convert("&a[EliteMobs] Adding flag " + flagString); - } - - private static String commandString(String flagString, String state, Player player, String regionName) { - return "region flag " + regionName + " " + flagString + " " + state; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java new file mode 100644 index 000000000..89082a29f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -0,0 +1,35 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; +import java.util.stream.Collectors; + +public class SetupToggleCommand extends AdvancedCommand { + public SetupToggleCommand() { + super(List.of("setup")); + addLiteral("toggle"); + addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); + setUsage("/em setup toggle "); + setPermission("elitemobs.setup"); + setDescription("Allows you to toggle the installation of specified EliteMobs content."); + } + + @Override + public void execute(CommandData commandData) { + String dungeon = commandData.getStringArgument("empackages"); + if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) + Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!"); + EMPackage emPackage = EMPackage.getEmPackages().get(dungeon); + if (emPackage.install()) { + if (emPackage.isInstalled()) + Logger.sendMessage(commandData.getCommandSender(), "Successfully installed content!"); + else + Logger.sendMessage(commandData.getCommandSender(), "Successfully uninstalled content!"); + + } + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java new file mode 100644 index 000000000..46b26dea2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.items.ShareItem; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class ShareItemCommand extends AdvancedCommand { + public ShareItemCommand() { + super(List.of("shareItem")); + setUsage("/em shareItem"); + setPermission("elitemobs.shareitem"); + setSenderType(SenderType.PLAYER); + setDescription("Shares the stats of the currently held EliteMobs item in chat."); + } + + @Override + public void execute(CommandData commandData) { + ShareItem.showOnChat(commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java new file mode 100644 index 000000000..51d1ee9db --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.elitemobs.menus.CustomShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class ShopCustomCommand extends AdvancedCommand { + public ShopCustomCommand() { + super(List.of("shop")); + addLiteral("custom"); + setUsage("/em shop custom"); + setPermission("elitemobs.shop.command"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); + } + + @Override + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) + CustomShopMenu.customShopInitializer(commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java new file mode 100644 index 000000000..2d005cc46 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.CustomShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.Bukkit; + +import java.util.ArrayList; +import java.util.List; + +public class ShopCustomOtherCommand extends AdvancedCommand { + public ShopCustomOtherCommand() { + super(List.of("shop")); + addLiteral("custom"); + addArgument("player", new ArrayList<>()); + setUsage("/em shop custom "); + setPermission("elitemobs.shop.custom.other"); + setDescription("Opens the EliteMobs shop for custom items for the specified player."); + } + + @Override + public void execute(CommandData commandData) { + try { + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!"); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java new file mode 100644 index 000000000..a4c047071 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.elitemobs.menus.ProceduralShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class ShopDynamicCommand extends AdvancedCommand { + public ShopDynamicCommand() { + super(List.of("shop")); + addLiteral("dynamic"); + setUsage("/em shop dynamic"); + setPermission("elitemobs.shop.dynamic"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); + } + + @Override + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) + ProceduralShopMenu.shopInitializer(commandData.getPlayerSender()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java new file mode 100644 index 000000000..5984710df --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.ProceduralShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.Bukkit; + +import java.util.ArrayList; +import java.util.List; + +public class ShopProceduralOtherCommand extends AdvancedCommand { + public ShopProceduralOtherCommand() { + super(List.of("shop")); + addLiteral("procedural"); + addArgument("player", new ArrayList<>()); + setUsage("/em shop procedural "); + setPermission("elitemobs.*"); + setDescription("Opens the EliteMobs shop for procedurally generated items."); + } + + @Override + public void execute(CommandData commandData) { + try { + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!"); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java new file mode 100644 index 000000000..f4af0c02d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -0,0 +1,31 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.SellMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.Bukkit; + +import java.util.ArrayList; +import java.util.List; + +public class ShopSellOtherCommand extends AdvancedCommand { + public ShopSellOtherCommand() { + super(List.of("shop")); + addLiteral("sell"); + addArgument("player", new ArrayList<>()); + setUsage("/em shop sell "); + setPermission("elitemobs.shop.sell.other"); + setDescription("Opens the EliteMobs shop sell menu for the specified player."); + } + + @Override + public void execute(CommandData commandData) { + SellMenu sellMenu = new SellMenu(); + try { + sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!"); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java new file mode 100644 index 000000000..8f2871d95 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -0,0 +1,39 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import org.bukkit.Bukkit; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.Vector; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class SpawnBossAtCommand extends AdvancedCommand { + public SpawnBossAtCommand() { + super(List.of("spawn")); + addLiteral("bossAt"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + addArgument("worldName", Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toList())); + addArgument("x", new ArrayList<>()); + addArgument("y", new ArrayList<>()); + addArgument("z", new ArrayList<>()); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.place.admin"); + setDescription("Spawns a custom boss at the specified location."); + } + + @Override + public void execute(CommandData commandData) { + SpawnCommand.spawnCustomBossCommand( + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), + new Vector( + commandData.getDoubleArgument("x"), + commandData.getDoubleArgument("y"), + commandData.getDoubleArgument("z"))); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java new file mode 100644 index 000000000..2deb74068 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class SpawnBossCommand extends AdvancedCommand { + public SpawnBossCommand() { + super(List.of("spawn")); + addLiteral("boss"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + setUsage("/em spawn boss "); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute(CommandData commandData) { + SpawnCommand.spawnCustomBossCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("filename")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java new file mode 100644 index 000000000..1fe0eecfc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -0,0 +1,41 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import org.bukkit.Bukkit; +import org.bukkit.generator.WorldInfo; +import org.bukkit.util.Vector; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class SpawnBossLevelAtCommand extends AdvancedCommand { + public SpawnBossLevelAtCommand() { + super(List.of("spawn")); + addLiteral("bossAt"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + addArgument("worldName", Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toList())); + addArgument("x", new ArrayList<>()); + addArgument("y", new ArrayList<>()); + addArgument("z", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.place.admin"); + setDescription("Spawns a custom boss at the specified location with the specified level."); + } + + @Override + public void execute(CommandData commandData) { + SpawnCommand.spawnCustomBossCommand( + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), + new Vector( + commandData.getDoubleArgument("x"), + commandData.getDoubleArgument("y"), + commandData.getDoubleArgument("z")), + commandData.getIntegerArgument("level")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java new file mode 100644 index 000000000..cb6a6515e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class SpawnBossLevelCommand extends AdvancedCommand { + public SpawnBossLevelCommand() { + super(List.of("spawn")); + addLiteral("boss"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + addArgument("level", List.of("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19")); + setUsage("/em spawn boss "); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); + } + + @Override + public void execute(CommandData commandData) { + SpawnCommand.spawnCustomBossCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getIntegerArgument("level")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java index ef7ed08ba..322e88eeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -1,17 +1,15 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.CustomConfigFields; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import com.magmaguy.elitemobs.config.powers.PowersConfig; import com.magmaguy.elitemobs.config.powers.PowersConfigFields; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.mobconstructor.SuperMobConstructor; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.CommandSender; @@ -29,13 +27,14 @@ */ public class SpawnCommand { - public static void spawnEliteEntityTypeCommand(Player player, EntityType entityType, Integer level, Optional powers) { + public static void spawnEliteEntityTypeCommand(Player player, EntityType entityType, Integer level, Optional powers) { LivingEntity livingEntity = (LivingEntity) player.getLocation().getWorld().spawnEntity(getLocation(player), entityType); EliteEntity eliteEntity = new EliteEntity(); eliteEntity.setLevel(level); - if (powers.isPresent()){ - HashSet mobPowers = getPowers(powers.get(), player); + if (powers.isPresent()) { + String[] powersArray = powers.get().split(" "); + HashSet mobPowers = getPowers(powersArray, player); eliteEntity.applyPowers(mobPowers); } else { eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity)); @@ -48,7 +47,7 @@ public static void spawnEliteEntityTypeCommand(CommandSender commandSender, String world, Vector coords, Integer level, - Optional powers) { + Optional powers) { try { Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ()); spawnEliteEntityTypeCommand(commandSender, @@ -65,14 +64,17 @@ public static void spawnEliteEntityTypeCommand(CommandSender commandSender, Location location, EntityType entityType, Integer level, - Optional powers) { + Optional powers) { if (!EliteMobProperties.getValidMobTypes().contains(entityType)) { commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Entity type " + entityType.toString() + " can't be an Elite!")); return; } LivingEntity livingEntity = (LivingEntity) location.getWorld().spawnEntity(location, entityType); HashSet mobPowers = new HashSet<>(); - if (powers.isPresent()) mobPowers = getPowers(powers.get(), commandSender); + if (powers.isPresent()) { + String[] powersArray = powers.get().split(" "); + mobPowers = getPowers(powersArray, commandSender); + } EliteEntity eliteEntity = new EliteEntity(); eliteEntity.setLevel(level); eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM); @@ -145,12 +147,6 @@ public static void spawnCustomBossCommand(Player player, String fileName) { customBossEntity.spawn(false); } - public static void spawnSuperMobCommand(Player player, EntityType entityType) { - if (SuperMobProperties.isValidSuperMobType(entityType)) - spawnSuperMob(entityType, getLocation(player)); - else - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Entity type " + entityType.toString() + " can't be a Super Mob!")); - } private static Location getLocation(Player player) { return player.getTargetBlock(null, 30).getLocation().add(0.5, 1, 0.5); @@ -160,25 +156,20 @@ private static HashSet getPowers(String[] mobPowers, Command HashSet elitePowers = new HashSet<>(); - if (mobPowers.length > 0) - for (String string : mobPowers) { - PowersConfigFields powersConfigFields = PowersConfig.getPower(string); - if (powersConfigFields == null) { - commandSender.sendMessage("[EliteMobs] Power " + string + " is not a valid power! Valid powers:"); - StringBuilder allPowers = new StringBuilder(); - for (CustomConfigFields iteratedField : ElitePower.getElitePowers().values()) - allPowers.append(iteratedField.getFilename()).append(", "); - allPowers.append("custom"); - commandSender.sendMessage(allPowers.toString()); - return new HashSet<>(); - } - elitePowers.add(powersConfigFields); + for (String string : mobPowers) { + PowersConfigFields powersConfigFields = PowersConfig.getPower(string); + if (powersConfigFields == null) { + commandSender.sendMessage("[EliteMobs] Power " + string + " is not a valid power! Valid powers:"); + StringBuilder allPowers = new StringBuilder(); + for (CustomConfigFields iteratedField : ElitePower.getElitePowers().values()) + allPowers.append(iteratedField.getFilename()).append(", "); + allPowers.append("custom"); + commandSender.sendMessage(allPowers.toString()); + return new HashSet<>(); } + elitePowers.add(powersConfigFields); + } return elitePowers; } - private static void spawnSuperMob(EntityType entityType, Location location) { - SuperMobConstructor.constructSuperMob((LivingEntity) location.getWorld().spawnEntity(location, entityType)); - } - } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java new file mode 100644 index 000000000..4823c0c5e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -0,0 +1,34 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import org.bukkit.entity.EntityType; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class SpawnElite extends AdvancedCommand { + public SpawnElite() { + super(List.of("spawn")); + addLiteral("elite"); + addArgument("entityType", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); + setUsage("/em spawn elite <...>"); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + } + + @Override + public void execute(CommandData commandData) { + SpawnCommand.spawnEliteEntityTypeCommand( + commandData.getPlayerSender(), + EntityType.valueOf(commandData.getStringArgument("entityType")), + commandData.getIntegerArgument("level"), + Optional.of(commandData.getStringSequenceArgument("powers"))); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java new file mode 100644 index 000000000..502bb1811 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -0,0 +1,44 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import org.bukkit.entity.EntityType; +import org.bukkit.util.Vector; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class SpawnEliteAtCommand extends AdvancedCommand { + public SpawnEliteAtCommand() { + super(List.of("spawn")); + addLiteral("eliteAt"); + addArgument("world", new ArrayList<>()); + addArgument("x", new ArrayList<>()); + addArgument("y", new ArrayList<>()); + addArgument("z", new ArrayList<>()); + addArgument("entityType", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); + setUsage("/em spawn eliteAt <...>"); + setPermission("elitemobs.place.admin"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns an elite of the specified type and level, optionally with specified powers, at the chosen location."); + } + + @Override + public void execute(CommandData commandData) { + SpawnCommand.spawnEliteEntityTypeCommand( + commandData.getPlayerSender(), + EntityType.valueOf(commandData.getStringArgument("entityType")), + commandData.getStringArgument("world"), + new Vector( + commandData.getIntegerArgument("x"), + commandData.getIntegerArgument("y"), + commandData.getIntegerArgument("z")), + commandData.getIntegerArgument("level"), + Optional.of(commandData.getStringSequenceArgument("powers"))); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java new file mode 100644 index 000000000..d0e40f1d6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.api.PlayerPreTeleportEvent; +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class SpawnTeleportCommand extends AdvancedCommand { + public SpawnTeleportCommand() { + super(List.of("spawntp")); + setPermission("elitemobs.teleport.spawn"); + setUsage("/em spawntp"); + setDescription("Teleports players to the server spawn."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + if (DefaultConfig.getDefaultSpawnLocation() != null) + PlayerPreTeleportEvent.teleportPlayer(commandData.getPlayerSender(), DefaultConfig.getDefaultSpawnLocation()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java new file mode 100644 index 000000000..35f3162fe --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.instanced.MatchInstance; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class StartCommand extends AdvancedCommand { + public StartCommand() { + super(List.of("start")); + setUsage("/em start"); + setDescription("When in instanced content, makes the player start the instance."); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.instance.start"); + } + + @Override + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(commandData.getPlayerSender()); + if (matchInstance != null) { + matchInstance.countdownMatch(); + } else + Logger.sendMessage(commandData.getCommandSender(), "You are not queued for instanced content!"); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java new file mode 100644 index 000000000..db5660270 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class StatsCommand extends AdvancedCommand { + public StatsCommand() { + super(List.of("stats")); + setUsage("/em stats"); + setPermission("elitemobs.stats"); + setSenderType(SenderType.PLAYER); + setDescription("Displays EliteMobs server stats."); + } + + @Override + public void execute(CommandData commandData) { + com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(commandData.getCommandSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java new file mode 100644 index 000000000..02a58b06b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -0,0 +1,39 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.util.Logger; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class TrackBossCommand extends AdvancedCommand { + public TrackBossCommand() { + super(List.of("track")); + addLiteral("boss"); + addArgument("id", new ArrayList<>()); + setDescription("Tracks a Custom Boss."); + setUsage("/em track boss "); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.boss.track"); + } + + @Override + public void execute(CommandData commandData) { + try { + for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) + if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandData.getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(commandData.getPlayerSender()); + return; + } + Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + } catch (Exception ex) { + //happens when players try to track an entity that has despawned for any reason + Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java new file mode 100644 index 000000000..5a321f703 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class TransitiveBlocksCancelCommand extends AdvancedCommand { + public TransitiveBlocksCancelCommand() { + super(List.of("transitiveBlocks")); + addLiteral("cancel"); + setUsage("/em transitiveBlocks cancel"); + setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); + } + + @Override + public void execute(CommandData commandData) { + TransitiveBlockCommand.processCommand(commandData.getPlayerSender()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java new file mode 100644 index 000000000..d1a14a2b8 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -0,0 +1,32 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class TransitiveBlocksEditAreaCommand extends AdvancedCommand { + public TransitiveBlocksEditAreaCommand() { + super(List.of("transitiveBlocks")); + addLiteral("editArea"); + addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); + addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); + setUsage("/em transitiveBlocks editArea "); + setPermission("elitemobs.transitiveblocks"); + setDescription("Edits large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute(CommandData commandData) { + TransitiveBlockCommand.processCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("type"), + true, + true); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java new file mode 100644 index 000000000..db6a54c7f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -0,0 +1,31 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class TransitiveBlocksEditCommand extends AdvancedCommand { + public TransitiveBlocksEditCommand() { + super(List.of("transitiveBlocks")); + addLiteral("edit"); + addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); + addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); + setUsage("/em transitiveBlocks edit "); + setDescription("Edits transitive blocks for use by regional bosses."); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); + } + + @Override + public void execute(CommandData commandData) { + TransitiveBlockCommand.processCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("type"), + true); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java new file mode 100644 index 000000000..c68cb1115 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -0,0 +1,32 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class TransitiveBlocksRegisterAreaCommand extends AdvancedCommand { + public TransitiveBlocksRegisterAreaCommand() { + super(List.of("transitiveBlocks")); + addLiteral("registerArea"); + addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); + addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); + setUsage("/em transitiveBlocks registerArea "); + setDescription("Registers large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); + } + + @Override + public void execute(CommandData commandData) { + TransitiveBlockCommand.processCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("type"), + false, + true); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java new file mode 100644 index 000000000..22504ebed --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class TransitiveBlocksRegisterCommand extends AdvancedCommand { + public TransitiveBlocksRegisterCommand() { + super(List.of("transitiveBlocks")); + addLiteral("register"); + addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); + addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); + setUsage("/em transitiveBlocks register "); + setDescription("Registers transitive blocks for use by regional bosses."); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); + } + + @Override + public void execute(CommandData commandData) { + TransitiveBlockCommand.processCommand( + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("type"), false); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TreasureChestCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/TreasureChestCommands.java deleted file mode 100644 index 4670729a3..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/TreasureChestCommands.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicDungeonPackage; -import org.bukkit.entity.Player; - -public class TreasureChestCommands { - private TreasureChestCommands() { - } - - public static void addRelativeTreasureChest(Player player, String treasureChestFilename, String minidungeonName) { - EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonName); - if (emPackage == null) { - player.sendMessage("Invalid minidungeon name!"); - return; - } - if (!(emPackage instanceof SchematicDungeonPackage)) { - player.sendMessage("The dungeon needs to be a schematic dungeon package!"); - return; - } - ((SchematicDungeonPackage) emPackage).addChest(treasureChestFilename, player.getLocation().getBlock().getLocation()); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java new file mode 100644 index 000000000..742eb9385 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.elitemobs.menus.UnbindMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class UnbindCommand extends AdvancedCommand { + public UnbindCommand() { + super(List.of("unbind")); + setUsage("/em unbind"); + setPermission("elitemobs.unbind.command"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the unbind menu or teleports the player to the Adventurer's Guild Hub."); + } + + @Override + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { + UnbindMenu unbindMenu = new UnbindMenu(); + unbindMenu.constructUnbinderMenu(commandData.getPlayerSender()); + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java new file mode 100644 index 000000000..f853fa85b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -0,0 +1,28 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.items.ItemTagger; +import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.command.SenderType; +import org.bukkit.inventory.ItemStack; + +import java.util.List; + +public class UnbindForceCommand extends AdvancedCommand { + public UnbindForceCommand() { + super(List.of("unbind")); + addLiteral("force"); + setUsage("/em unbind force"); + setSenderType(SenderType.PLAYER); + setPermission("elitemobs.unbind.force"); + setDescription("Forcefully unbinds a held item."); + } + + @Override + public void execute(CommandData commandData) { + ItemStack itemStack = commandData.getPlayerSender().getInventory().getItemInMainHand(); + if (ItemTagger.isEliteItem(itemStack)) + SoulbindEnchantment.removeEnchantment(itemStack); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UserCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/UserCommands.java deleted file mode 100644 index 28c9e8071..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/UserCommands.java +++ /dev/null @@ -1,358 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.Command; -import cloud.commandframework.arguments.CommandArgument; -import cloud.commandframework.arguments.standard.DoubleArgument; -import cloud.commandframework.arguments.standard.StringArgument; -import cloud.commandframework.bukkit.BukkitCommandManager; -import cloud.commandframework.extra.confirmation.CommandConfirmationManager; -import cloud.commandframework.meta.CommandMeta; -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.api.PlayerPreTeleportEvent; -import com.magmaguy.elitemobs.commands.admin.CheckTierOthersCommand; -import com.magmaguy.elitemobs.commands.combat.CheckTierCommand; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; -import com.magmaguy.elitemobs.commands.quests.QuestCommand; -import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.config.EconomySettingsConfig; -import com.magmaguy.elitemobs.instanced.MatchInstance; -import com.magmaguy.elitemobs.items.EliteItemLore; -import com.magmaguy.elitemobs.items.ShareItem; -import com.magmaguy.elitemobs.menus.*; -import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.playerdata.database.PlayerData; -import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -public class UserCommands { - - public UserCommands(BukkitCommandManager manager, Command.Builder builder) { - // /em adventurersguild - manager.command(builder.literal("adventurersguild", "ag") - .meta(CommandMeta.DESCRIPTION, "Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu.") - .senderType(Player.class) - .permission("elitemobs.adventurersguild.command") - //permission is dealt inside of the command - .handler(commandContext -> { - AdventurersGuildCommand.adventurersGuildCommand((Player) commandContext.getSender()); - })); - - // /em shareitem - manager.command(builder.literal("shareitem") - .meta(CommandMeta.DESCRIPTION, "Shares a held Elite item on chat") - .senderType(Player.class) - .permission("elitemobs.shareitem") - .handler(commandContext -> ShareItem.showOnChat((Player) commandContext.getSender()))); - - // /em shop - manager.command(builder.literal("shop") - .meta(CommandMeta.DESCRIPTION, "Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub") - .senderType(Player.class) - .permission("elitemobs.shop.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) - ProceduralShopMenu.shopInitializer((Player) commandContext.getSender()); - })); - - // /em customshop - manager.command(builder.literal("customshop") - .meta(CommandMeta.DESCRIPTION, "Opens the custom item shop or teleports the player to the Adventurer's Guild Hub") - .senderType(Player.class) - .permission("elitemobs.customshop.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) - CustomShopMenu.customShopInitializer((Player) commandContext.getSender()); - })); - - // /em repair - manager.command(builder.literal("repair") - .meta(CommandMeta.DESCRIPTION, "Opens the custom item shop or teleports the player to the Adventurer's Guild Hub") - .senderType(Player.class) - .permission("elitemobs.repair.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) { - RepairMenu repairMenu = new RepairMenu(); - repairMenu.constructRepairMenu((Player) commandContext.getSender()); - } - })); - - // /em enchant - manager.command(builder.literal("enchant") - .meta(CommandMeta.DESCRIPTION, "Opens the enchantment menu or teleports the player to the Adventurer's Guild Hub") - .senderType(CommandSender.class) - .permission("elitemobs.enchant.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) { - new ItemEnchantmentMenu((Player) commandContext.getSender()); - } - })); - - // /em scrap - manager.command(builder.literal("scrap") - .meta(CommandMeta.DESCRIPTION, "Opens the custom item shop or teleports the player to the Adventurer's Guild Hub") - .senderType(Player.class) - .permission("elitemobs.scrap.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) { - ScrapperMenu scrapperMenu = new ScrapperMenu(); - scrapperMenu.constructScrapMenu((Player) commandContext.getSender()); - } - })); - - // /em unbind - manager.command(builder.literal("unbind") - .meta(CommandMeta.DESCRIPTION, "Opens the custom item shop or teleports the player to the Adventurer's Guild Hub") - .senderType(Player.class) - .permission("elitemobs.unbind.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) { - UnbindMenu unbindMenu = new UnbindMenu(); - unbindMenu.constructUnbinderMenu((Player) commandContext.getSender()); - } - })); - - // /em wallet - manager.command(builder.literal("wallet") - .meta(CommandMeta.DESCRIPTION, "Checks the EliteMobs currency") - .senderType(Player.class) - .permission("elitemobs.currency.check") - .handler(commandContext -> { - if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) - new PlayerStatusScreen((Player) commandContext.getSender()); - else - CurrencyCommandsHandler.walletCommand((Player) commandContext.getSender()); - })); - - // /em quest accept - manager.command(builder.literal("quest") - .literal("accept") - .argument(StringArgument.newBuilder("questID"), ArgumentDescription.of("Quest ID")) - .meta(CommandMeta.DESCRIPTION, "Accepts a quest") - .senderType(Player.class) - .permission("elitemobs.quest.command") - .handler(commandContext -> { - QuestCommand.joinQuest(commandContext.get("questID"), (Player) commandContext.getSender()); - })); - - // /em quest track - manager.command(builder.literal("quest") - .literal("track") - .argument(StringArgument.newBuilder("questID"), ArgumentDescription.of("Quest ID")) - .meta(CommandMeta.DESCRIPTION, "Toggles quest tracking") - .senderType(Player.class) - .permission("elitemobs.quest.command") - .handler(commandContext -> { - QuestCommand.trackQuest(commandContext.get("questID"), (Player) commandContext.getSender()); - })); - - // /em quest complete - manager.command(builder.literal("quest") - .literal("complete") - .argument(StringArgument.newBuilder("questID"), ArgumentDescription.of("Quest ID")) - .meta(CommandMeta.DESCRIPTION, "Completes a quest") - .senderType(Player.class) - .permission("elitemobs.quest.command") - .handler(commandContext -> { - QuestCommand.completeQuest(commandContext.get("questID"), (Player) commandContext.getSender()); - })); - - - // /em quest leave - manager.command(builder.literal("quest") - .literal("leave") - .argument(StringArgument.newBuilder("questID"), ArgumentDescription.of("Quest ID")) - .meta(CommandMeta.DESCRIPTION, "Leaves a quest") - .senderType(Player.class) - .permission("elitemobs.quest.command") - .handler(commandContext -> QuestCommand.leaveQuest((Player) commandContext.getSender(), commandContext.get("questID")))); - - CommandArgument onlinePlayers = StringArgument.newBuilder("onlinePlayer") - .withSuggestionsProvider(((objectCommandContext, s) -> { - ArrayList arrayList = new ArrayList<>(); - Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName())); - return arrayList; - })).build(); - - - // Create the confirmation manager. This allows us to require certain commands to be - // confirmed before they can be executed - CommandConfirmationManager paymentConfirmationManager = new CommandConfirmationManager<>( - /* Timeout */ 30L, - /* Timeout unit */ TimeUnit.SECONDS, - /* Action when confirmation is required */ context -> context.getCommandContext().getSender().sendMessage( - ChatColorConverter.convert(EconomySettingsConfig.getEconomyTaxMessage() - .replace("$command", "/em confirm") - .replace("$percentage", (EconomySettingsConfig.getPlayerToPlayerTaxes() * 100) + ""))), - /* Action when no confirmation is pending */ sender -> sender.sendMessage( - ChatColorConverter.convert(DefaultConfig.getNoPendingCommands())) - ); - - // Register the confirmation processor. This will enable confirmations for commands that require it - paymentConfirmationManager.registerConfirmationProcessor(manager); - - // Add a confirmation command - manager.command(builder.literal("confirm") - .meta(CommandMeta.DESCRIPTION, "Confirm a pending command") - .handler(paymentConfirmationManager.createConfirmationExecutionHandler())); - - // /em pay - manager.command(builder.literal("pay") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .argument(DoubleArgument.newBuilder("amount"), ArgumentDescription.of("Amount to pay")) - .meta(CommandMeta.DESCRIPTION, "Pays an amount of currency to another player") - .meta(CommandConfirmationManager.META_CONFIRMATION_REQUIRED, true) - .senderType(Player.class) - .permission("elitemobs.currency.pay") - .handler(commandContext -> { - paymentConfirmationManager.createConfirmationExecutionHandler(); - CurrencyCommandsHandler.payCommand( - (Player) commandContext.getSender(), - commandContext.get("onlinePlayer"), - commandContext.get("amount")); - })); - - - // /em rank - manager.command(builder.literal("rank") - .meta(CommandMeta.DESCRIPTION, "Opens the EliteMobs rank menu.") - .senderType(Player.class) - .permission("elitemobs.rank.command") - .handler(commandContext -> { - if (!AdventurersGuildCommand.adventurersGuildTeleport((Player) commandContext.getSender())) - AdventurersGuildCommand.adventurersGuildCommand((Player) commandContext.getSender()); - })); - - // /em menu - manager.command(builder.literal("menu") - .meta(CommandMeta.DESCRIPTION, "Opens the EliteMobs status screen.") - .senderType(Player.class) - .handler(commandContext -> new PlayerStatusScreen((Player) commandContext.getSender()))); - - // /em rank - manager.command(builder.literal("checktier") - .meta(CommandMeta.DESCRIPTION, "Checks your equipped EliteMobs gear tier.") - .senderType(Player.class) - .handler(commandContext -> { - if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) - new PlayerStatusScreen((Player) commandContext.getSender()); - else new CheckTierCommand((Player) commandContext.getSender()); - })); - - // /em checktier - manager.command(builder.literal("checktier") - .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name")) - .meta(CommandMeta.DESCRIPTION, "Checks the equipped EliteMobs gear tier of another player.") - .senderType(CommandSender.class) - .permission("elitemobs.checktier.others") - .handler(commandContext -> new CheckTierOthersCommand(commandContext.getSender(), commandContext.get("onlinePlayer")))); - - // /em trackcustomboss uuid - manager.command(builder.literal("trackcustomboss") - .argument(StringArgument.newBuilder("uuid"), ArgumentDescription.of("UUID of the custom boss to track.")) - .meta(CommandMeta.DESCRIPTION, "Tracks a Custom Boss.") - .senderType(Player.class) - .handler(commandContext -> { - try { - for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) - if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandContext.get("uuid")))) { - customBossEntity.getCustomBossBossBar().addTrackingPlayer((Player) commandContext.getSender()); - return; - } - commandContext.getSender().sendMessage(DefaultConfig.getBossAlreadyGoneMessage()); - } catch (Exception ex) { - //happens when players try to track an entity that has despawned for any reason - commandContext.getSender().sendMessage(DefaultConfig.getBossAlreadyGoneMessage()); - } - })); - - // /em updateitem - manager.command(builder.literal("updateitem") - .meta(CommandMeta.DESCRIPTION, "Manually updates the lore of an item. Used for debugging purposes.") - .senderType(Player.class) - .handler(commandContext -> { - new EliteItemLore(((Player) commandContext.getSender()).getItemInHand(), false); - })); - - // /em dungeontp - manager.command(builder.literal("dungeontp") - .argument(StringArgument.newBuilder("dungeonid"), ArgumentDescription.of("ID of the dungeon to teleport to.")) - .meta(CommandMeta.DESCRIPTION, "Teleports players to Lairs, Minidungeons and Dungeons.") - .permission("elitemobs.dungeontp") - .senderType(Player.class) - .handler(commandContext -> DungeonCommands.teleport((Player) commandContext.getSender(), commandContext.get("dungeonid")))); - - // /em spawntp - manager.command(builder.literal("spawntp") - .meta(CommandMeta.DESCRIPTION, "Teleports players to the server spawn.") - .senderType(Player.class) - .permission("elitemobs.spawntp") - .handler(commandContext -> { - if (DefaultConfig.getDefaultSpawnLocation() != null) - PlayerPreTeleportEvent.teleportPlayer((Player) commandContext.getSender(), DefaultConfig.getDefaultSpawnLocation()); - })); - - // /em alt - manager.command(builder.literal("alt") - .meta(CommandMeta.DESCRIPTION, "Changes the style of the /em menu.") - .senderType(Player.class) - .handler(commandContext -> { - PlayerData.setUseBookMenus(((Player) commandContext.getSender()), !PlayerData.getUseBookMenus(((Player) commandContext.getSender()).getUniqueId())); - commandContext.getSender().sendMessage(DefaultConfig.getSwitchEMStyleMessage()); - })); - - // /em dismiss - manager.command(builder.literal("dismiss") - .meta(CommandMeta.DESCRIPTION, "Dismisses /em menu message.") - .senderType(Player.class) - .handler(commandContext -> { - PlayerData.setDismissEMStatusScreenMessage(((Player) commandContext.getSender()), !PlayerData.getDismissEMStatusScreenMessage(((Player) commandContext.getSender()).getUniqueId())); - })); - - // /em arena - manager.command(builder.literal("arena") - .meta(CommandMeta.DESCRIPTION, "Opens the arena menu.") - .argument(StringArgument.newBuilder("arenaid"), ArgumentDescription.of("Name of the arena to go to.")) - .senderType(Player.class) - .handler(commandContext -> { - ArenaCommands.openArenaMenu(((Player) commandContext.getSender()), commandContext.get("arenaid")); - })); - - // /em start - this is for instanced content - manager.command(builder.literal("start") - .meta(CommandMeta.DESCRIPTION, "When in instanced content, starts the countdown to start doing the content.") - .senderType(Player.class) - .handler(commandContext -> { - MatchInstance matchInstance = MatchInstance.getPlayerInstance(((Player) commandContext.getSender())); - if (matchInstance != null) { - matchInstance.countdownMatch(); - } else - commandContext.getSender().sendMessage("[EliteMobs] You are not queued for instanced content!"); - })); - - // /em quit - this is for instanced content - manager.command(builder.literal("quit") - .meta(CommandMeta.DESCRIPTION, "When in instanced content, makes the player leave the instance.") - .senderType(Player.class) - .handler(commandContext -> { - MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(((Player) commandContext.getSender())); - if (matchInstance != null) - matchInstance.removeAnyKind((Player) commandContext.getSender()); - })); - - // /em loot - manager.command(builder.literal("loot") - .meta(CommandMeta.DESCRIPTION, "Open the loot menu for group loot.") - .senderType(Player.class) - .handler(commandContext -> { - LootMenu.openMenu((Player) commandContext.getSender()); - })); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java new file mode 100644 index 000000000..3a7669ba6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; + +import java.util.List; + +public class VersionCommand extends AdvancedCommand { + public VersionCommand() { + super(List.of("version")); + setUsage("/em version"); + setPermission("elitemobs.version"); + setDescription("Checks the server's EliteMobs plugin version."); + } + + @Override + public void execute(CommandData commandData) { + Logger.sendMessage( + commandData.getCommandSender(), + ChatColor.WHITE + " version " + ChatColor.GREEN + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/CheckTierOthersCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/CheckTierOthersCommand.java deleted file mode 100644 index 60bcfaae4..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/CheckTierOthersCommand.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.magmaguy.elitemobs.commands.admin; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.adventurersguild.GuildRank; -import com.magmaguy.elitemobs.config.commands.premade.CheckTierOthersConfig; -import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class CheckTierOthersCommand { - - public CheckTierOthersCommand(CommandSender commandSender, String playerName) { - - Player player = Bukkit.getPlayer(playerName); - if (player == null) { - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Invalid player name!")); - return; - } - - double gearTier = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true); - double guildRank = GuildRank.getActiveGuildRank(player); - if (guildRank == 0) - guildRank = -10; - else - guildRank--; - guildRank = (guildRank * 0.2); - - commandSender.sendMessage(CheckTierOthersConfig.message1.replace("$player", player.getDisplayName()).replace("$tier", gearTier + "")); - commandSender.sendMessage(CheckTierOthersConfig.message2.replace("$player", player.getDisplayName()).replace("$tier", guildRank + "")); - commandSender.sendMessage(CheckTierOthersConfig.message3.replace("$player", player.getDisplayName()).replace("$tier", (gearTier + guildRank) + "")); - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java index 0490b6f92..e39885c30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -1,13 +1,13 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; import com.magmaguy.elitemobs.utils.BookMaker; -import com.magmaguy.elitemobs.utils.SpigotMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.SpigotMessage; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java index e0301dcb7..4c0f6bafb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.events.TimedEvent; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.command.CommandSender; public class EventCommand { diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 27f12930b..8cbeb76d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -9,8 +9,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import java.util.HashMap; - public class GetTierCommand { private GetTierCommand() { } @@ -44,7 +42,7 @@ public static void get(Player player, int tierLevel) { EliteItemManager.setEliteLevel(cheatSword, tierLevel); ItemMeta cheatItemMeta = cheatSword.getItemMeta(); cheatItemMeta.setDisplayName("CHEAT SWORD"); - ItemTagger.registerEnchantment(cheatItemMeta, Enchantment.DAMAGE_ALL.getKey(), 100); + ItemTagger.registerEnchantment(cheatItemMeta, Enchantment.SHARPNESS.getKey(), 100); cheatSword.setItemMeta(cheatItemMeta); new EliteItemLore(helmet, false); @@ -57,23 +55,24 @@ public static void get(Player player, int tierLevel) { new EliteItemLore(bow, false); - - player.getInventory().addItem(helmet); - player.getInventory().addItem(chestplate); - player.getInventory().addItem(leggings); - player.getInventory().addItem(boots); + player.getInventory().setHelmet(helmet); + player.getInventory().setChestplate(chestplate); + player.getInventory().setLeggings(leggings); + player.getInventory().setBoots(boots); player.getInventory().addItem(sword); player.getInventory().addItem(axe); player.getInventory().addItem(bow); player.getInventory().addItem(cheatSword); + player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 64)); + player.getInventory().addItem(new ItemStack(Material.ARROW, 64)); + player.getInventory().addItem(new ItemStack(Material.ARROW, 64)); + player.getInventory().addItem(new ItemStack(Material.SHIELD)); } - private static void addDurability(ItemStack itemStack){ + private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); - HashMap enchantmentIntegerHashMap = new HashMap<>(); - enchantmentIntegerHashMap.put(Enchantment.DURABILITY, 5); - ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); + itemMeta.addEnchant(Enchantment.UNBREAKING, 5, true); itemStack.setItemMeta(itemMeta); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java index 11f4770cc..fa37074fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java @@ -1,15 +1,13 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import java.util.ArrayList; @@ -27,16 +25,6 @@ public static void killAggressiveMobs(CommandSender commandSender) { commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs.")); } - - public static void killPassiveMobs(CommandSender commandSender) { - int counter = 0; - for (LivingEntity superMobEntity : EntityTracker.getSuperMobs()) { - superMobEntity.remove(); - counter++; - } - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Super Mobs.")); - } - public static void killEntityType(CommandSender commandSender, EntityType entityType) { if (EliteMobProperties.getValidMobTypes().contains(entityType)) { int counter = 0; @@ -46,14 +34,6 @@ public static void killEntityType(CommandSender commandSender, EntityType entity counter++; } commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite " + entityType.toString() + ".")); - } else if (SuperMobProperties.superMobTypeList.contains(entityType)) { - int counter = 0; - for (LivingEntity superMobEntity : EntityTracker.getSuperMobs()) { - if (!superMobEntity.getType().equals(entityType)) continue; - superMobEntity.remove(); - counter++; - } - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Super " + entityType.toString() + ".")); } else commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cNot a valid entity type for EliteMobs!")); } @@ -68,16 +48,6 @@ public static void radiusKillAggressiveMobs(Player player, int radius) { player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs.")); } - public static void radiusKillPassiveMobs(Player player, int radius) { - int counter = 0; - for (Entity entity : player.getNearbyEntities(radius, radius, radius)) - if (EntityTracker.isSuperMob(entity)) { - entity.remove(); - counter++; - } - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Super Mobs.")); - } - public static void radiusKillSpecificMobs(Player player, EntityType entityType, int radius) { int counter = 0; for (Entity entity : player.getNearbyEntities(radius, radius, radius)) { @@ -86,9 +56,6 @@ public static void radiusKillSpecificMobs(Player player, EntityType entityType, if (eliteEntity != null) { ((EliteEntity) entity).remove(RemovalReason.OTHER); counter++; - } else if (EntityTracker.isSuperMob(entity)){ - EntityTracker.unregister(entity, RemovalReason.OTHER); - counter++; } } player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs.")); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java index 5b7d4f686..77871fb0e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.items.customitems.CustomItem; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java index 76e718b25..d9bcc72f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.npcs.NPCsConfig; import com.magmaguy.elitemobs.config.npcs.NPCsConfigFields; import com.magmaguy.elitemobs.npcs.NPCEntity; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.Round; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java index a0001b6a4..ebbf4f598 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java @@ -1,9 +1,8 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -22,11 +21,6 @@ public static void get(Player player, String minidungeonString) { return; } - if (!(emPackage instanceof SchematicPackage)) { - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Content is not a schematic minidungeon! Run this command for schematic minidungeons only!")); - return; - } - Location anchorpoint = emPackage.getDungeonPackagerConfigFields().getAnchorPoint(); if (anchorpoint == null) { diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/ReloadCommand.java deleted file mode 100644 index d29dc169a..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/ReloadCommand.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.magmaguy.elitemobs.commands.admin; - -import com.magmaguy.elitemobs.MetadataHandler; -import org.bukkit.command.CommandSender; - -public class ReloadCommand { - public static void reload(CommandSender commandSender) { - MetadataHandler.PLUGIN.onDisable(); - MetadataHandler.PLUGIN.onLoad(); - MetadataHandler.PLUGIN.onEnable(); - commandSender.sendMessage("[EliteMobs] Reload attempted. This may not 100% work. Restart instead if it didn't!!"); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java index cc533cde0..e752f0de5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java @@ -1,15 +1,12 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.internal.RemovalReason; -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicDungeonPackage; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; import com.magmaguy.elitemobs.treasurechest.TreasureChest; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -40,7 +37,7 @@ public static void remove(Player player) { } public static class RemoveCommandEvents implements Listener { - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void quitEvent(PlayerQuitEvent event) { removingPlayers.remove(event.getPlayer().getUniqueId()); } @@ -49,7 +46,7 @@ public void quitEvent(PlayerQuitEvent event) { public void removeEliteEntity(EntityDamageByEntityEvent event) { if (!removingPlayers.contains(event.getDamager().getUniqueId())) return; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity()); - if (eliteEntity == null){ + if (eliteEntity == null) { event.getDamager().sendMessage(ChatColorConverter.convert("&8[EliteMobs] The entity you just removed was not an EliteMobs entity. EliteMobs will still attempt to remove it though.")); event.getDamager().sendMessage(ChatColorConverter.convert("&8[EliteMobs] If the entity is supposed to be an EliteMobs entity, it is highly likely some other plugin hijacked the entity and changed it in a way that made EliteMobs unable to recognize it anymore.")); event.getEntity().remove(); @@ -59,11 +56,6 @@ public void removeEliteEntity(EntityDamageByEntityEvent event) { event.getDamager().sendMessage(ChatColorConverter.convert( "&8[EliteMobs] &cRemoved a spawn location for boss " + ((RegionalBossEntity) eliteEntity).getCustomBossesConfigFields().getFilename())); - if (eliteEntity instanceof RegionalBossEntity && - ((CustomBossEntity) eliteEntity).getEmPackage() != null && - ((CustomBossEntity) eliteEntity).getEmPackage().getDungeonPackagerConfigFields().getDungeonLocationType() - .equals(DungeonPackagerConfigFields.DungeonLocationType.SCHEMATIC)) - ((SchematicDungeonPackage) ((CustomBossEntity) eliteEntity).getEmPackage()).removeBoss((RegionalBossEntity) eliteEntity); eliteEntity.remove(RemovalReason.REMOVE_COMMAND); event.setCancelled(true); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java index fd0bec2e2..19552c6e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java @@ -1,10 +1,10 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.items.EliteItemLore; import com.magmaguy.elitemobs.items.LootTables; -import com.magmaguy.elitemobs.utils.InfoMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -27,7 +27,7 @@ public static void forcePositiveLoot(CommandSender commandSender, String playerN counter++; if (run(player, level, false)) break; if (counter > 1000) { - new InfoMessage("Failed to generate loot within 1000 attempts! This is almost certainly an issue with the way the loot is configured in your server."); + Logger.info("Failed to generate loot within 1000 attempts! This is almost certainly an issue with the way the loot is configured in your server."); break; } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java index a8f0725b9..d3c5bd302 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -1,13 +1,13 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.EliteMobs; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Round; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.CommandSender; @@ -37,12 +37,6 @@ public static void statsHandler(CommandSender commandSender) { entitiesCounted.put(livingEntity.getType(), 1); else entitiesCounted.put(livingEntity.getType(), entitiesCounted.get(livingEntity.getType()) + 1); - } else if (EntityTracker.isSuperMob(livingEntity)) { - passiveCount++; - if (!entitiesCounted.containsKey(livingEntity.getType())) - entitiesCounted.put(livingEntity.getType(), 1); - else - entitiesCounted.put(livingEntity.getType(), entitiesCounted.get(livingEntity.getType()) + 1); } StringBuilder breakdownString = new StringBuilder("&2Breakdown: &a"); @@ -97,7 +91,6 @@ public static void statsHandler(CommandSender commandSender) { "§5§m-----------------------------------------------------")); commandSender.sendMessage("Tracked boss count: " + EntityTracker.getEliteMobEntities().size()); commandSender.sendMessage("Tracked NPC count: " + EntityTracker.getNpcEntities().size()); - commandSender.sendMessage("Tracked visual item count: " + EntityTracker.getItemVisualEffects().size()); int loadedCounter = 0; for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities()) if (regionalBossEntity.isValid()) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/VersionCommand.java deleted file mode 100644 index b32342c74..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/VersionCommand.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.magmaguy.elitemobs.commands.admin; - -import com.magmaguy.elitemobs.MetadataHandler; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - -public class VersionCommand { - - private VersionCommand() { - } - - public static void getVersion(CommandSender commandSender) { - commandSender.sendMessage(ChatColor.DARK_GREEN + "[EliteMobs]" + ChatColor.WHITE + " version " + ChatColor.GREEN + - Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion()); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/combat/CheckTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/combat/CheckTierCommand.java deleted file mode 100644 index 1dfce03ab..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/combat/CheckTierCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.magmaguy.elitemobs.commands.combat; - -import com.magmaguy.elitemobs.adventurersguild.GuildRank; -import com.magmaguy.elitemobs.config.commands.premade.CheckTierConfig; -import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; -import org.bukkit.entity.Player; - -public class CheckTierCommand { - - public CheckTierCommand(Player player) { - - double gearTier = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true); - double guildRank = GuildRank.getActiveGuildRank(player); - if (guildRank == 0) - guildRank = -10; - else - guildRank--; - guildRank = (guildRank * 0.2); - - player.sendMessage(CheckTierConfig.message1.replace("$tier", gearTier + "")); - player.sendMessage(CheckTierConfig.message2.replace("$tier", guildRank + "")); - player.sendMessage(CheckTierConfig.message3.replace("$tier", (gearTier + guildRank) + "")); - - } - - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java index 412016c15..2c0be348f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java @@ -5,10 +5,8 @@ import com.magmaguy.elitemobs.api.PlayerTeleportEvent; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; import com.magmaguy.elitemobs.config.CombatTagConfig; +import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.EventCaller; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.entity.Player; public class AdventurersGuildCommand { @@ -24,57 +22,16 @@ public static void adventurersGuildCommand(Player player) { public static boolean adventurersGuildTeleport(Player player) { if (!player.hasPermission("elitemobs.adventurersguild.teleport")) return false; if (!AdventurersGuildConfig.isAgTeleport()) return false; - if (AdventurersGuildConfig.getGuildWorldLocation() == null) - defineTeleportLocation(); - if (AdventurersGuildConfig.getGuildWorldLocation() == null) return false; + + EMPackage emPackage = EMPackage.getEmPackages().get("adventurers_guild_hub.yml"); + if (!emPackage.isInstalled()) return false; if (CombatTagConfig.isEnableCombatTag()) - new EventCaller(new PlayerPreTeleportEvent(player, AdventurersGuildConfig.getGuildWorldLocation())); + new EventCaller(new PlayerPreTeleportEvent(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation())); else - new EventCaller(new PlayerTeleportEvent(player, AdventurersGuildConfig.getGuildWorldLocation())); + new EventCaller(new PlayerTeleportEvent(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation())); return true; - - } - - public static Location defineTeleportLocation() { - - for (World world : Bukkit.getWorlds()) - if (world.getName().equals(AdventurersGuildConfig.getGuildWorldName())) { - double x = 0, y = 0, z = 0; - float yaw = 0, pitch = 0; - int counter = 0; - - for (String substring : AdventurersGuildConfig.getGuildLocationString().split(",")) { - switch (counter) { - case 0: - x = Double.parseDouble(substring); - break; - case 1: - y = Double.parseDouble(substring); - break; - case 2: - z = Double.parseDouble(substring); - break; - case 3: - yaw = Float.parseFloat(substring); - break; - case 4: - pitch = Float.parseFloat(substring); - break; - } - counter++; - - } - - Location location = new Location(world, x, y, z, yaw, pitch); - AdventurersGuildConfig.setGuildWorldLocation(location); - return location; - - } - - return null; - } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java index d8aa49803..459eaa264 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,16 +1,10 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.api.PlayerTeleportEvent; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; -import com.magmaguy.elitemobs.config.AdventurersGuildConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.*; -import com.magmaguy.elitemobs.worlds.CustomWorldLoading; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -28,20 +22,18 @@ public class SetupMenu { - public static Map setupMenus = new HashMap<>(); - - Inventory inventory; - Player player; private static final int nextIcon = 35; private static final int infoIcon = 4; + public static Map setupMenus = new HashMap<>(); private static List emPackages = new ArrayList<>(); - ArrayList validSlots = new ArrayList<>(Arrays.asList(10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, - 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 46, 47, 48, 49, 50, 51, 52)); private final int previousIcon = 27; + Inventory inventory; + Player player; + ArrayList validSlots = new ArrayList<>(new ArrayList<>(List.of(10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, + 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 46, 47, 48, 49, 50, 51, 52))); HashMap minidungeonHashMap = new HashMap<>(); @Getter private int currentPage = 1; - boolean adventurersGuildIsDownloaded = false; public SetupMenu(Player player) { this.inventory = Bukkit.createInventory(player, 54, "Setup menu"); @@ -57,13 +49,43 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup return; } - if (ResourcePackDataConfig.isEliteMobsResourcePackEnabled()) { - //Case for if it is downloaded - ResourcePackDataConfig.toggleEliteMobsResourcePackStatus(false); - } else { - ResourcePackDataConfig.toggleEliteMobsResourcePackStatus(true); - player.spigot().sendMessage(SpigotMessage.simpleMessage("&8[EliteMobs] &2The EliteMobs resource pack has been installed!")); - player.spigot().sendMessage(SpigotMessage.commandHoverMessage("&eBefore you go! &fDo you want to force players to use the resource pack? This is necessary if you plan to use &cModelEngine for the custom boss models. &aClick here if you want to force resource packs. &eIgnore this message if you don't!", "Click to force resource packs!", "/elitemobs forceresourcepack")); + Logger.sendMessage(player, "This setting is now no longer in use! Use my ResourcePackManager plugin to easily and automatically merge & host the EliteMobs resource pack, and much more!"); + return; +// +// if (ResourcePackDataConfig.isEliteMobsResourcePackEnabled()) { +// //Case for if it is downloaded +// ResourcePackDataConfig.toggleEliteMobsResourcePackStatus(false); +// } else { +// ResourcePackDataConfig.toggleEliteMobsResourcePackStatus(true); +// player.spigot().sendMessage(SpigotMessage.simpleMessage("&8[EliteMobs] &2The EliteMobs resource pack has been installed!")); +// player.spigot().sendMessage(SpigotMessage.commandHoverMessage("&eBefore you go! &fDo you want to force players to use the resource pack? This is necessary if you plan to use &cModelEngine for the custom boss models. &aClick here if you want to force resource packs. &eIgnore this message if you don't!", "Click to force resource packs!", "/elitemobs forceresourcepack")); +// } + } + +// public static void forceResourcePack(Player player) { +// ResourcePackDataConfig.toggleForceResourcePack(true); +// player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); +// } + + private static void dungeonButtonInteraction(Player player, SetupMenu setupMenu, InventoryClickEvent event) { + //for minidungeons + EMPackage emPackage = setupMenu.minidungeonHashMap.get(event.getSlot()); + if (emPackage != null) { + if (!emPackage.isDownloaded()) { + player.sendMessage("----------------------------------------------------"); + player.sendMessage(ChatColorConverter.convert("&4Download this at &9" + emPackage.getDungeonPackagerConfigFields().getDownloadLink() + " &4!")); + player.sendMessage("----------------------------------------------------"); + player.closeInventory(); + setupMenus.remove(event.getInventory()); + return; + } + if (!emPackage.isInstalled()) + emPackage.install(player); + else if (!emPackage.uninstall(player)) { + player.sendMessage("[EliteMobs] Failed to unload package because players were present in the worlds you were trying to unload! Remove the players from the dungeon before uninstalling it!"); + } + setupMenus.remove(event.getInventory()); + player.closeInventory(); } } @@ -74,8 +96,6 @@ private void redrawMenu(int page, Inventory inventory) { inventory.clear(); //reserve resource pack status customResourcePackStatus(); - //reserve adventurer's guild - adventurersGuildWorldStatus(); //iterate through dungeons dungeonStatuses(); //Set icons @@ -114,93 +134,6 @@ private void addNavigationElements() { inventory.setItem(nextIcon, nextButton); } - public static void forceResourcePack(Player player) { - ResourcePackDataConfig.toggleForceResourcePack(true); - player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); - } - - private static void dungeonButtonInteraction(Player player, SetupMenu setupMenu, InventoryClickEvent event) { - //for minidungeons - EMPackage emPackage = setupMenu.minidungeonHashMap.get(event.getSlot()); - if (emPackage != null) { - if (!emPackage.isDownloaded()) { - player.sendMessage("----------------------------------------------------"); - player.sendMessage(ChatColorConverter.convert("&4Download this at &9" + emPackage.getDungeonPackagerConfigFields().getDownloadLink() + " &4!")); - player.sendMessage("----------------------------------------------------"); - player.closeInventory(); - setupMenus.remove(event.getInventory()); - return; - } - if (!emPackage.isInstalled()) - if (emPackage instanceof SchematicPackage) - emPackage.install(player, true); - else emPackage.install(player); - else if (emPackage instanceof SchematicPackage) emPackage.uninstall(player); - else if (!emPackage.uninstall(player)) { - player.sendMessage("[EliteMobs] Failed to unload package because players were present in the worlds you were trying to unload! Remove the players from the dungeon before uninstalling it!"); - } - setupMenus.remove(event.getInventory()); - player.closeInventory(); - } - } - - private static void adventurersGuildButtonInteraction(Player player, SetupMenu setupMenu) { - //case where Adventurer's Guild Hub isn't downloaded - if (!setupMenu.adventurersGuildIsDownloaded) { - player.closeInventory(); - player.sendMessage("----------------------------------------------------"); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Adventurer's Guild Hub download link: https://magmaguy.itch.io/")); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aOnce downloaded, follow this setup guide: &9&nhttps://youtu.be/boRg2X4qhw4")); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Need help? " + DiscordLinks.mainLink)); - player.sendMessage("----------------------------------------------------"); - } else { - //case for install - if (!AdventurersGuildConfig.isGuildWorldIsEnabled()) { - try { - player.closeInventory(); - player.sendMessage("----------------------------------------------------"); - CustomWorldLoading.startupWorldInitialization(); - AdventurersGuildCommand.defineTeleportLocation(); - AdventurersGuildConfig.toggleGuildInstall(); - if (Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) { - WorldGuardCompatibility.protectWorldMinidugeonArea(AdventurersGuildCommand.defineTeleportLocation()); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2The Adventurer's Guild Hub has been protected against griefing and mob spawning (among others)!")); - } else - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4It is highly recommended you install WorldGuard to protect the Adventurer's Guild Hub World! Reinstall the hub through /em setup after installing WorldGuard in order to automatically protect the area!")); - PlayerTeleportEvent playerTeleportEvent = new PlayerTeleportEvent(player, AdventurersGuildConfig.getGuildWorldLocation()); - new EventCaller(playerTeleportEvent); - if (!playerTeleportEvent.isCancelled()) - player.teleport(AdventurersGuildConfig.getGuildWorldLocation()); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Successfully installed Adventurer's Guild Hub! Do &a/ag &2to go there and talk to the transporter or open the Teleports page in /em to go back!")); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Need help? &9&n" + DiscordLinks.mainLink)); - player.sendMessage("----------------------------------------------------"); - } catch (Exception e) { - player.closeInventory(); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to install Adventurer's Guild Hub! Report this to the dev!")); - player.sendMessage("----------------------------------------------------"); - e.printStackTrace(); - } - //case for uninstall - } else { - try { - player.closeInventory(); - Bukkit.unloadWorld(AdventurersGuildConfig.getGuildWorldLocation().getWorld(), true); - AdventurersGuildConfig.setGuildWorldLocation(null); - AdventurersGuildConfig.toggleGuildInstall(); - player.sendMessage("----------------------------------------------------"); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Successfully uninstalled Adventurer's Guild Hub!")); - player.sendMessage("----------------------------------------------------"); - } catch (Exception e) { - player.closeInventory(); - player.sendMessage("----------------------------------------------------"); - player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to uninstall Adventurer's Guild Hub! Report this to the dev!")); - player.sendMessage("----------------------------------------------------"); - e.printStackTrace(); - } - } - } - } - private void dungeonStatuses() { //Counter has to account for pages int dungeonCounter = 0; @@ -208,7 +141,7 @@ private void dungeonStatuses() { if (currentPage != 1) dungeonCounter = validSlots.size() * (currentPage - 1) - 2; else - inventoryLocationCounter = 2; + inventoryLocationCounter = 1; List rawEmPackages = EMPackage.getEmPackages().values().stream().toList(); List alphabeticalSort = new ArrayList<>(); rawEmPackages.forEach(iteratedPackage -> alphabeticalSort.add(ChatColor.stripColor(ChatColorConverter.convert(iteratedPackage.getDungeonPackagerConfigFields().getName())))); @@ -220,34 +153,19 @@ private void dungeonStatuses() { })); minidungeonHashMap.clear(); for (int i = dungeonCounter; i < emPackages.size(); i++) { - if (currentPage == 1 && minidungeonHashMap.size() > validSlots.size() - 3) break; + if (currentPage == 1 && minidungeonHashMap.size() > validSlots.size() - 2) break; if (inventoryLocationCounter >= validSlots.size()) break; EMPackage emPackage = emPackages.get(i); - if (!Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) - inventory.setItem(validSlots.get(dungeonCounter), ItemStackGenerator.generateItemStack(Material.RED_STAINED_GLASS_PANE, - ChatColorConverter.convert("&4You need WorldGuard to install Minidungeons correctly!"))); - else - switch (emPackage.getDungeonPackagerConfigFields().getDungeonLocationType()) { - case WORLD: - addWorldDungeon(emPackage, inventoryLocationCounter); - break; - case SCHEMATIC: - addSchematicDungeon(emPackage, inventoryLocationCounter); - break; - case INSTANCED: - break; - default: - new WarningMessage("Dungeon " + emPackage.getDungeonPackagerConfigFields().getFilename() + " does not have a valid location type and therefore can't be set up automatically!"); - break; - } + addDungeonPackagerContent(emPackage, inventoryLocationCounter); + minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; inventoryLocationCounter++; } } - private void addWorldDungeon(EMPackage emPackage, int counter) { + private void addDungeonPackagerContent(EMPackage emPackage, int counter) { String itemName = emPackage.getDungeonPackagerConfigFields().getName(); List lore = new ArrayList<>(); @@ -259,26 +177,9 @@ private void addWorldDungeon(EMPackage emPackage, int counter) { inventory.setItem(validSlots.get(counter), ItemStackGenerator.generateItemStack(getMaterial(emPackage), itemName, lore)); } - private void addSchematicDungeon(EMPackage emPackage, int counter) { - if (!Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) { - inventory.setItem(validSlots.get(counter), ItemStackGenerator.generateItemStack(Material.RED_STAINED_GLASS_PANE, ChatColorConverter.convert("&4You need WorldEdit to use this!"))); - return; - } - - String itemName = emPackage.getDungeonPackagerConfigFields().getName(); - - List lore = new ArrayList<>(); - if (emPackage.getDungeonPackagerConfigFields().getCustomInfo() != null) - lore.addAll(emPackage.getDungeonPackagerConfigFields().getCustomInfo()); - addSize(lore, emPackage); - addBossCount(lore, emPackage); - addInstallationString(lore, emPackage); - - lore = ChatColorConverter.convert(lore); - inventory.setItem(validSlots.get(counter), ItemStackGenerator.generateItemStack(getMaterial(emPackage), itemName, lore)); - } - private Material getMaterial(EMPackage emPackage) { + if (emPackage.isOutOfDate()) + return Material.ORANGE_STAINED_GLASS_PANE; if (emPackage.isInstalled()) return Material.GREEN_STAINED_GLASS_PANE; if (emPackage.isDownloaded()) @@ -290,17 +191,15 @@ private void addSize(List lore, EMPackage emPackage) { lore.add("&fSize: " + emPackage.getDungeonPackagerConfigFields().getDungeonSizeCategory().toString()); } - private void addBossCount(List lore, EMPackage emPackage) { - try { - lore.add("&fRegional boss count: " + emPackage.getCustomBossEntityList().size()); - } catch (Exception ex) { - //todo: fix this - //new WarningMessage("Failed to determine regional boss count! Are the relative dungeon locations correct?"); - } - } - private void addInstallationString(List lore, EMPackage emPackage) { String status = "&fStatus: "; + if (emPackage.isOutOfDate()) { + lore.add(status + "&4outdated!"); + lore.add("&4Download the update at"); + lore.add("&9" + emPackage.getDungeonPackagerConfigFields().getDownloadLink() + " &f!"); + lore.add("&cClick to uninstall!"); + return; + } if (emPackage.isInstalled()) { lore.add(status + "&2already installed!"); lore.add("&cClick to uninstall!"); @@ -321,10 +220,10 @@ private void customResourcePackStatus() { String state = "Custom resource pack is"; String lore; Material material; - boolean resourceState = ResourcePackDataConfig.isEliteMobsResourcePackEnabled(); + boolean resourceState = Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager"); if (!resourceState) { - material = Material.ORANGE_STAINED_GLASS_PANE; + material = Material.YELLOW_STAINED_GLASS_PANE; lore = ChatColor.RED + "Not enabled! Click to enable!"; } else { material = Material.GREEN_STAINED_GLASS_PANE; @@ -334,29 +233,6 @@ private void customResourcePackStatus() { inventory.setItem(validSlots.get(0), ItemStackGenerator.generateItemStack(material, state, new ArrayList<>(List.of(lore)))); } - private void adventurersGuildWorldStatus() { - if (currentPage != 1) return; - String state = "Adventurer's Guild world is"; - String lore; - Material material; - if (CustomWorldLoading.adventurersGuildWorldExists()) - adventurersGuildIsDownloaded = true; - - if (!adventurersGuildIsDownloaded) { - material = Material.RED_STAINED_GLASS_PANE; - lore = ChatColor.RED + "Not downloaded! Click to download!"; - } else { - if (!AdventurersGuildConfig.isGuildWorldIsEnabled()) { - material = Material.ORANGE_STAINED_GLASS_PANE; - lore = ChatColor.RED + "Not setup! Click to install!"; - } else { - material = Material.GREEN_STAINED_GLASS_PANE; - lore = ChatColor.GREEN + "Working correctly! Click to uninstall!"; - } - } - inventory.setItem(validSlots.get(1), ItemStackGenerator.generateItemStack(material, state, new ArrayList<>(List.of(lore)))); - } - public static class SetupMenuListeners implements Listener { @EventHandler(ignoreCancelled = true) public void onInventoryInteraction(InventoryClickEvent event) { @@ -370,11 +246,6 @@ public void onInventoryInteraction(InventoryClickEvent event) { return; } //for permissions mode - //for adventurer's guild world - if (event.getSlot() == 11 && setupMenu.getCurrentPage() == 1) { - adventurersGuildButtonInteraction(player, setupMenu); - return; - } if (event.getSlot() == infoIcon) { player.sendMessage( "EliteMobs installation process:", diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index e9aa7cc30..e29f97515 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,18 +1,14 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; -import lombok.Setter; -import org.bukkit.Location; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class AdventurersGuildConfig { +public class AdventurersGuildConfig extends ConfigurationFile { @Getter private static final String[][] rankNames = new String[11][21]; @Getter @@ -24,15 +20,6 @@ public class AdventurersGuildConfig { @Getter private static boolean addDodge; @Getter - private static boolean guildWorldIsEnabled; - @Getter - private static String guildWorldName; - @Getter - private static String guildLocationString; - @Getter - @Setter - private static Location guildWorldLocation; - @Getter private static boolean agTeleport; @Getter private static boolean guildLootLimiter; @@ -79,25 +66,96 @@ public class AdventurersGuildConfig { @Getter private static boolean disableCommonerRank; - private static File file; - private static FileConfiguration fileConfiguration; + public AdventurersGuildConfig() { + super("AdventurersGuild.yml"); + } - private AdventurersGuildConfig() { + public static String getRankName(int prestigeTier, int rankTier) { + return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]); } - public static void toggleGuildInstall() { - guildWorldIsEnabled = !guildWorldIsEnabled; - fileConfiguration.set("guildHubIsEnabledv2", guildWorldIsEnabled); - save(); + public static String getShortenedRankName(int prestigeTier, int rankTier) { + return ChatColorConverter.convert(shortRankNames[prestigeTier][rankTier]); } - public static void save() { - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); + private static String prestigeColors(int prestigeTier) { + switch (prestigeTier) { + case 1: + return "&e"; + case 2: + return "&2"; + case 3: + return "&a"; + case 4: + return "&3"; + case 5: + return "&b"; + case 6: + return "&4"; + case 7: + return "&c"; + case 8: + return "&9"; + case 9: + return "&d"; + case 10: + return "&5"; + default: + return "error"; + } } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("AdventurersGuild.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + private static String romanNumerals(int prestigeTier) { + switch (prestigeTier) { + case 1: + return "Ⅰ"; + case 2: + return "ⅠⅠ"; + case 3: + return "ⅠⅠⅠ"; + case 4: + return "ⅠⅤ"; + case 5: + return "Ⅴ"; + case 6: + return "ⅤⅠ"; + case 7: + return "ⅤⅠⅠ"; + case 8: + return "ⅤⅠⅠⅠ"; + case 9: + return "ⅠⅩ"; + case 10: + return "Ⅹ"; + case 11: + return "ⅩⅠ"; + case 12: + return "ⅩⅠⅠ"; + case 13: + return "ⅩⅠⅠⅠ"; + case 14: + return "ⅩⅠⅤ"; + case 15: + return "ⅩⅤ"; + case 16: + return "ⅩⅤⅠ"; + case 17: + return "ⅩⅤⅠⅠ"; + case 18: + return "ⅩⅤⅠⅠⅠ"; + case 19: + return "ⅩⅠⅩ"; + case 20: + return "ⅩⅩ"; + case 0: + return "0"; + default: + return "error"; + } + } + + @Override + public void initializeValues() { addMaxHealth = ConfigurationEngine.setBoolean( List.of("Sets if EliteMobs will add max health when unlocking guild ranks as a prestige reward"), fileConfiguration, "Add max health when unlocking higher guild ranks", true); @@ -107,18 +165,6 @@ public static void initializeConfig() { addDodge = ConfigurationEngine.setBoolean( List.of("Sets if EliteMobs will add dodge chance when unlocking guild ranks as a prestige reward"), fileConfiguration, "Add dodge chance when unlocking higher guild ranks", true); - guildWorldIsEnabled = ConfigurationEngine.setBoolean( - List.of("Sets if the adventurer's guild hub is enabled. Don't set this manually! It is meant to be installed through the '/em setup' command"), - fileConfiguration, "guildHubIsEnabledv2", false); - guildWorldName = ConfigurationEngine.setString( - List.of("Sets the adventurer's guild world name. Do NOT change this to the name of your main world.", - "Only change this if you have created your own custom dedicated guild hub world that is meant for nothing else than to be a guild hub.", - "Most normal interaction are disabled in the guild hub world!"), - file, fileConfiguration, "Adventurer's Guild world name v3", "em_adventurers_guild", false); - guildLocationString = ConfigurationEngine.setString( - List.of("Sets the spawn coordinates for the adventurer's guild world.") - , file, fileConfiguration, "Guild world coordinates", "208.5,88,236.5,-80,0", false); - guildWorldLocation = null; agTeleport = ConfigurationEngine.setBoolean( List.of("Sets if user commands get rerouted to the adventurer's guild hub. This is highly recommended for gameplay immersion and tutorial purposes."), fileConfiguration, "userCommandsTeleportToAdventurersGuild", true); @@ -429,11 +475,11 @@ public static void initializeConfig() { baseKillsForRankUp = ConfigurationEngine.setInt( List.of("Sets the estimated base amount of bosses that must be killed to be able to afford a rank up."), - fileConfiguration, "baseKillsForRankUp", 100); + fileConfiguration, "baseKillsForRankUpV2", 100); additionalKillsForRankUpPerTier = ConfigurationEngine.setInt( List.of("Sets the estimated additional amount of bosses that must be killed to be able to rank up, per level.", "The formula is this amount x the level the player is currently at."), - fileConfiguration, "additionalKillsForRankUpPerTier", 50); + fileConfiguration, "additionalKillsForRankUpPerTierV2", 50); prestigeUnlockMessageTitle = ConfigurationEngine.setString( List.of("Sets title sent to players when someone unlocks a prestige rank.", @@ -444,9 +490,6 @@ public static void initializeConfig() { "$tier is a placeholder that gets replaced with the player's prestige level."), file, fileConfiguration, "prestigeUnlockMessageSubtitle", "&2has unlocked $tier&2!", true); - //initializes the AG location - AdventurersGuildCommand.defineTeleportLocation(); - peacefulModeEliteChanceDecrease = ConfigurationEngine.setDouble( List.of("Sets the multiplier that will be applied to the spawn chance when players are using the peaceful (commoner) rank."), fileConfiguration, "peacefulModeEliteChanceDecrease", 0.2); @@ -458,92 +501,5 @@ public static void initializeConfig() { disableCommonerRank = ConfigurationEngine.setBoolean( List.of("Disables users' ability to switch to peaceful mode for EliteMobs. Peaceful mode lowers level and spawn rates of mobs around that player specifically"), fileConfiguration, "disableCommonerRank", false); - - save(); } - - public static String getRankName(int prestigeTier, int rankTier) { - return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]); - } - - public static String getShortenedRankName(int prestigeTier, int rankTier) { - return ChatColorConverter.convert(shortRankNames[prestigeTier][rankTier]); - } - - private static String prestigeColors(int prestigeTier) { - switch (prestigeTier) { - case 1: - return "&e"; - case 2: - return "&2"; - case 3: - return "&a"; - case 4: - return "&3"; - case 5: - return "&b"; - case 6: - return "&4"; - case 7: - return "&c"; - case 8: - return "&9"; - case 9: - return "&d"; - case 10: - return "&5"; - default: - return "error"; - } - } - - private static String romanNumerals(int prestigeTier) { - switch (prestigeTier) { - case 1: - return "Ⅰ"; - case 2: - return "ⅠⅠ"; - case 3: - return "ⅠⅠⅠ"; - case 4: - return "ⅠⅤ"; - case 5: - return "Ⅴ"; - case 6: - return "ⅤⅠ"; - case 7: - return "ⅤⅠⅠ"; - case 8: - return "ⅤⅠⅠⅠ"; - case 9: - return "ⅠⅩ"; - case 10: - return "Ⅹ"; - case 11: - return "ⅩⅠ"; - case 12: - return "ⅩⅠⅠ"; - case 13: - return "ⅩⅠⅠⅠ"; - case 14: - return "ⅩⅠⅤ"; - case 15: - return "ⅩⅤ"; - case 16: - return "ⅩⅤⅠ"; - case 17: - return "ⅩⅤⅠⅠ"; - case 18: - return "ⅩⅤⅠⅠⅠ"; - case 19: - return "ⅩⅠⅩ"; - case 20: - return "ⅩⅩ"; - case 0: - return "0"; - default: - return "error"; - } - } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java index e68549c59..62988c78e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class AntiExploitConfig { +public class AntiExploitConfig extends ConfigurationFile { + private static final String ANTI_EXPLOIT_LABEL = "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."; @Getter private static String antiExploitMessage; @Getter @@ -32,58 +32,48 @@ public class AntiExploitConfig { @Getter private static int antiExploitThreshold; - private AntiExploitConfig() { + public AntiExploitConfig() { + super("AntiExploit.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("AntiExploit.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - + @Override + public void initializeValues() { antiExploitMessage = ConfigurationEngine.setString( List.of("Sets the message that shows up when the antiexploit is triggered."), file, fileConfiguration, "AntiExploit message", "&c[EM AntiExploit] &7Nearby elite won't drop special loot.", true); darkroomAntiExploit1 = ConfigurationEngine.setBoolean( - List.of("Sets if the darkroom antiexploit 1 is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), + List.of("Sets if the darkroom antiexploit 1 is enabled.", ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable darkroom antiexploit 1", true); darkroomAntiExploit2 = ConfigurationEngine.setBoolean( - List.of("Sets if the darkroom antiexploit 2 is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), + List.of("Sets if the darkroom antiexploit 2 is enabled.", ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable darkroom antiexploit 2", true); darkroomAntiExploit3 = ConfigurationEngine.setBoolean( - List.of("Sets if the darkroom antiexploit 3 is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), + List.of("Sets if the darkroom antiexploit 3 is enabled.", ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable darkroom antiexploit 3", true); largeDarkroomAntiExploit1 = ConfigurationEngine.setBoolean( - List.of("Sets if the large darkroom antiexploit 1 is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), + List.of("Sets if the large darkroom antiexploit 1 is enabled.", ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable large darkroom antiexploit 1", true); endermanHeightAntiExploit = ConfigurationEngine.setBoolean( - List.of("Sets if the enderman height antiexploit is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), + List.of("Sets if the enderman height antiexploit is enabled.", ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable enderman height antiexploit", true); mountAntiExploit = ConfigurationEngine.setBoolean( - List.of("Sets if the mount antiexploit is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), + List.of("Sets if the mount antiexploit is enabled.", ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable mount antiexploit", true); noItemPickup = ConfigurationEngine.setBoolean( List.of("Sets if elite mobs can pick items up"), fileConfiguration, "preventItemPickupByMobs", true); ambientDamageExploit = ConfigurationEngine.setBoolean( List.of("Sets if the ambient damage antiexploit is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), fileConfiguration, "Enable ambient damage antiexploit", true); + ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable ambient damage antiexploit", true); honeyBlockExploit = ConfigurationEngine.setBoolean( List.of("Sets if the honey block antiexploit is enabled.", - "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available."), fileConfiguration, "Enable honey block antiexploit", true); + ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable honey block antiexploit", true); antiExploitThreshold = ConfigurationEngine.setInt( List.of("Sets the threshold for antiexploit activation. Higher values make it more tolerant. Modifying this is not recommended."), fileConfiguration, "antiExploitThreshold", 10); noPathExploit = ConfigurationEngine.setBoolean( List.of("Sets if the no path antiexploit is enabled"), fileConfiguration, "nPathExploit", true); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java index 11beba6a7..76a140724 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java @@ -1,12 +1,11 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class ArenasConfig { +public class ArenasConfig extends ConfigurationFile { @Getter private static String notEnoughPlayersMessage; @Getter @@ -50,13 +49,12 @@ public class ArenasConfig { @Getter private static String noArenaPermissionMessage; - private ArenasConfig() { + public ArenasConfig() { + super("Arenas.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("Arenas.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - + @Override + public void initializeValues() { notEnoughPlayersMessage = ConfigurationEngine.setString( List.of("Message that appears when not enough players are present to start an arena."), file, fileConfiguration, "notEnoughPlayersMessage", "&8[EliteMobs] &cYou need at least $amount to start the match!", true); @@ -120,6 +118,5 @@ public static void initializeConfig() { noArenaPermissionMessage = ConfigurationEngine.setString( List.of("Sets the message sent to players if they do not have permission to enter an arena."), file, fileConfiguration, "noArenaPermissionMessage", "[EliteMobs] You don't have the permission to enter this arena!", true); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java index c2f0ff89f..f5d60687b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java @@ -1,12 +1,11 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class CombatTagConfig { +public class CombatTagConfig extends ConfigurationFile { @Getter private static boolean enableCombatTag; @Getter @@ -18,13 +17,12 @@ public class CombatTagConfig { @Getter private static String teleportCancelled; - private CombatTagConfig() { + public CombatTagConfig() { + super("CombatTag.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("CombatTag.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - + @Override + public void initializeValues() { enableCombatTag = ConfigurationEngine.setBoolean( List.of("Sets if the combat tag is enabled.", "When enabled, flying players that engage in combat are set to stop flying."), fileConfiguration, "Enable combat tag", true); @@ -40,8 +38,5 @@ public static void initializeConfig() { teleportCancelled = ConfigurationEngine.setString( List.of("Sets the message sent when players move while waiting for teleportation."), file, fileConfiguration, "Teleport cancelled", "&7[EM] &cTeleport interrupted!", true); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 82b145e0d..c47c3692e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,99 +1,20 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -public class ConfigurationEngine { - - public static File fileCreator(String path, String fileName) { - File file = new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + "/" + path + "/", fileName); - return fileCreator(file); - } - - public static File fileCreator(String fileName) { - File file = new File(MetadataHandler.PLUGIN.getDataFolder().getPath(), fileName); - return fileCreator(file); - } - - public static File fileCreator(File file) { - - if (!file.exists()) - try { - file.getParentFile().mkdirs(); - file.createNewFile(); - } catch (IOException ex) { - Bukkit.getLogger().warning("[EliteMobs] Error generating the plugin file: " + file.getName()); - } - - return file; - - } - - public static FileConfiguration fileConfigurationCreator(File file) { - try { - return YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)); - } catch (Exception exception) { - new WarningMessage("Failed to read configuration from file " + file.getName()); - return null; - } - } - - public static void fileSaverCustomValues(FileConfiguration fileConfiguration, File file) { - fileConfiguration.options().copyDefaults(true); - - try { - fileConfiguration.save(file); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - public static void fileSaverOnlyDefaults(FileConfiguration fileConfiguration, File file) { - fileConfiguration.options().copyDefaults(true); - UnusedNodeHandler.clearNodes(fileConfiguration); - - try { - fileConfiguration.save(file); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - private static void setComments(FileConfiguration fileConfiguration, String key, List comments) { - if (VersionChecker.serverVersionOlderThan(18, 2)) return; - fileConfiguration.setComments(key, comments); - } - - public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - fileConfiguration.addDefault(key, defaultValue); - return fileConfiguration.getBoolean(key); - } - - public static Boolean setBoolean(List comments, FileConfiguration fileConfiguration, String key, boolean defaultValue) { - boolean value = setBoolean(fileConfiguration, key, defaultValue); - setComments(fileConfiguration, key, comments); - return value; - } +public class ConfigurationEngine extends com.magmaguy.magmacore.config.ConfigurationEngine { public static String setString(File file, FileConfiguration fileConfiguration, String key, String defaultValue, boolean translatable) { fileConfiguration.addDefault(key, defaultValue); @@ -109,29 +30,6 @@ public static String setString(List comments, File file, FileConfigurati return value; } - - public static int setInt(FileConfiguration fileConfiguration, String key, int defaultValue) { - fileConfiguration.addDefault(key, defaultValue); - return fileConfiguration.getInt(key); - } - - public static int setInt(List comments, FileConfiguration fileConfiguration, String key, int defaultValue) { - int value = setInt(fileConfiguration, key, defaultValue); - setComments(fileConfiguration, key, comments); - return value; - } - - public static double setDouble(FileConfiguration fileConfiguration, String key, double defaultValue) { - fileConfiguration.addDefault(key, defaultValue); - return fileConfiguration.getDouble(key); - } - - public static double setDouble(List comments, FileConfiguration fileConfiguration, String key, double defaultValue) { - double value = setDouble(fileConfiguration, key, defaultValue); - setComments(fileConfiguration, key, comments); - return value; - } - public static List setList(File file, FileConfiguration fileConfiguration, String key, List defaultValue, boolean translatable) { fileConfiguration.addDefault(key, defaultValue); if (translatable) @@ -146,39 +44,6 @@ public static List setList(List comment, File file, FileConfiguration fi return value; } - private static ItemStack setItemStack(FileConfiguration fileConfiguration, String key, ItemStack itemStack) { - fileConfiguration.addDefault(key + ".material", itemStack.getType().toString()); - if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) - fileConfiguration.addDefault(key + ".name", itemStack.getItemMeta().getDisplayName()); - if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasLore()) - fileConfiguration.addDefault(key + ".lore", itemStack.getItemMeta().getLore()); - if (itemStack.getType().equals(Material.PLAYER_HEAD)) - fileConfiguration.addDefault(key + ".owner", ((SkullMeta) itemStack.getItemMeta()).getOwner()); - Material material; - try { - material = Material.valueOf(fileConfiguration.getString(key + ".material")); - } catch (Exception ex) { - new WarningMessage("Material type " + fileConfiguration.getString(key + ".material") + " is not valid! Correct it to make a valid item."); - return null; - } - String name = ""; - try { - name = fileConfiguration.getString(key + ".name"); - } catch (Exception ex) { - new WarningMessage("Item name " + fileConfiguration.getString(key + ".name") + " is not valid! Correct it to make a valid item."); - } - List lore = new ArrayList<>(); - try { - lore = fileConfiguration.getStringList(key + ".lore"); - } catch (Exception ex) { - new WarningMessage("Item lore " + fileConfiguration.getString(key + ".lore") + " is not valid! Correct it to make a valid item."); - } - ItemStack fileItemStack = ItemStackGenerator.generateItemStack(material, name, lore); - if (material == Material.PLAYER_HEAD) - ((SkullMeta) itemStack.getItemMeta()).setOwningPlayer(Bukkit.getOfflinePlayer(fileConfiguration.getString(key + ".owner"))); - return fileItemStack; - } - public static ItemStack setItemStack(File file, FileConfiguration fileConfiguration, String key, ItemStack itemStack, boolean translatable) { fileConfiguration.addDefault(key + ".material", itemStack.getType().toString()); if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) @@ -191,20 +56,20 @@ public static ItemStack setItemStack(File file, FileConfiguration fileConfigurat try { material = Material.valueOf(fileConfiguration.getString(key + ".material")); } catch (Exception ex) { - new WarningMessage("Material type " + fileConfiguration.getString(key + ".material") + " is not valid! Correct it to make a valid item."); + Logger.warn("Material type " + fileConfiguration.getString(key + ".material") + " is not valid! Correct it to make a valid item."); return null; } String name = ""; try { - name = setString(file, fileConfiguration, key+".name", itemStack.getItemMeta().getDisplayName(), true); + name = setString(file, fileConfiguration, key + ".name", itemStack.getItemMeta().getDisplayName(), true); } catch (Exception ex) { - new WarningMessage("Item name " + fileConfiguration.getString(key + ".name") + " is not valid! Correct it to make a valid item."); + Logger.warn("Item name " + fileConfiguration.getString(key + ".name") + " is not valid! Correct it to make a valid item."); } List lore = new ArrayList<>(); try { - lore = setList(file, fileConfiguration, key+".lore", null, true); + lore = setList(file, fileConfiguration, key + ".lore", null, true); } catch (Exception ex) { - new WarningMessage("Item lore " + fileConfiguration.getString(key + ".lore") + " is not valid! Correct it to make a valid item."); + Logger.warn("Item lore " + fileConfiguration.getString(key + ".lore") + " is not valid! Correct it to make a valid item."); } ItemStack fileItemStack = ItemStackGenerator.generateItemStack(material, name, lore); if (material == Material.PLAYER_HEAD) @@ -212,19 +77,4 @@ public static ItemStack setItemStack(File file, FileConfiguration fileConfigurat return fileItemStack; } - public static boolean writeValue(Object value, File file, FileConfiguration fileConfiguration, String path) { - fileConfiguration.set(path, value); - try { - fileSaverCustomValues(fileConfiguration, file); - } catch (Exception exception) { - new WarningMessage("Failed to write value for " + path + " in file " + file.getName()); - return false; - } - return true; - } - - public static void removeValue(File file, FileConfiguration fileConfiguration, String path) { - writeValue(null, file, fileConfiguration, path); - } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java index 218dcd24b..d0fbb9990 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -1,131 +1,89 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.utils.ZipFile; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.scheduler.BukkitRunnable; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.Locale; public class ConfigurationExporter { private ConfigurationExporter() { } public static void initializeConfigs() { - Path configurationsPath = Paths.get(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath()); - if (!Files.isDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports"))) { - try { - Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports")); - } catch (Exception exception) { - new WarningMessage("Failed to create exports directory! Tell the dev!"); - exception.printStackTrace(); + new BukkitRunnable() { + @Override + public void run() { + Path configurationsPath = Paths.get(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath()); + if (!Files.isDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports"))) { + try { + Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports")); + } catch (Exception exception) { + Logger.warn("Failed to create exports directory! Tell the dev!"); + exception.printStackTrace(); + } + } + try { + File rspFile = Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack.zip").toFile(); + if (rspFile.exists()) rspFile.delete(); + downloadFile("https://magmaguy.com/downloads/elitemobs_resource_pack.zip", Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports").toAbsolutePath().toString()); + } catch (Exception e) { + Logger.warn("Failed to download official resource pack! Tell the dev!"); + e.printStackTrace(); + } } - return; - } - - try { - new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getCanonicalPath() + File.separatorChar + "exports").toString()); - } catch (Exception ex) { - new WarningMessage("Failed to get imports folder! Report this to the dev!"); - } - + }.runTaskAsynchronously(MetadataHandler.PLUGIN); } - public static void createResourcePack(CommandSender commandSender) { - if (!CustomModel.isUsingModels()) { - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&c Could not generate resource pack because ModelEngine is not installed! Install ModelEngine to use this feature.")); - return; - } - - if (CustomModel.getModelPlugin() == CustomModel.ModelPlugin.FREE_MINECRAFT_MODELS) { - copyResourcePack(commandSender, "FreeMinecraftModels", "output"); - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&f Copied all files from Free Minecraft Models to " + MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack")); - } else { - copyResourcePack(commandSender, "ModelEngine", "resource pack"); - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&f Copied all files from Model Engine to " + MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack")); - } - - if (ZipFile.zip(new File(MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack"), MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack.zip")) - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&f Packaged texture pack into " + MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack.zip") + " , ready to distribute!"); - else { - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&c Failed to package the resource pack into a zipped file! Report this to the dev!")); - return; - } - - if (commandSender instanceof Player) { - ((Player) commandSender).spigot().sendMessage(SpigotMessage.commandHoverMessage(ChatColorConverter.convert("Done! &2You can click here to update your server.properties with the new SHA1 value of this texture pack!"), "Click runs the /em updateresourcepack command!", "/em updateresourcepack")); - commandSender.sendMessage("If you want to do it manually, your SHA1 code is " + generateResourcePackSHA1(commandSender)); - } else { - commandSender.sendMessage("Done! You can run the command /em updateresourcepack in order to put the right SHA1 value into server.properties. Don't forget to upload the texture place to some place where players can get it!"); - commandSender.sendMessage("If you want to do it manually, your SHA1 code is " + generateResourcePackSHA1(commandSender)); - } + public static void downloadFile(String fileURL, String saveFilePath) throws IOException { + URL url = new URL(fileURL); + HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); + int responseCode = httpConn.getResponseCode(); + + // Check HTTP response code first + if (responseCode == HttpURLConnection.HTTP_OK) { + String fileName = ""; + String disposition = httpConn.getHeaderField("Content-Disposition"); + + if (disposition != null) { + // Extracts file name from header field + int index = disposition.indexOf("filename="); + if (index > 0) { + fileName = disposition.substring(index + 10, disposition.length() - 1); + } + } else { + // Extracts file name from URL + fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1); + } - } + // Opens input stream from the HTTP connection + InputStream inputStream = httpConn.getInputStream(); + String saveFilePathWithName = saveFilePath + File.separatorChar + fileName; - private static void copyResourcePack(CommandSender commandSender, String pluginDirectoryName, String resourcePackFolderName) { - File originalResourcePackFile = new File(MetadataHandler.PLUGIN.getDataFolder().getParentFile().toString() + File.separatorChar + pluginDirectoryName + File.separatorChar + resourcePackFolderName); - if (!originalResourcePackFile.exists()) { - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&c Could not generate resource pack because ModelEngine is not installed! Install ModelEngine to use this feature.")); - return; - } + // Opens an output stream to save into file + FileOutputStream outputStream = new FileOutputStream(saveFilePathWithName); + int bytesRead = -1; + byte[] buffer = new byte[4096]; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } - try { - if (!Paths.get(MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack").toFile().exists()) - Files.createDirectory(Paths.get(MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack")); - } catch (Exception ex) { - commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&c Failed to generate target directory plugins/EliteMobs/exports/elitemobs_resource_pack required for storing the resource pack! Report this to the dev!")); - return; - } + outputStream.close(); + inputStream.close(); - copyDirectory(originalResourcePackFile, Paths.get(MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack")); - } - - private static String generateResourcePackSHA1(CommandSender commandSender) { - File zippedResourcePack = Paths.get(MetadataHandler.PLUGIN.getDataFolder() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack.zip").toFile(); - if (!zippedResourcePack.exists()) { - commandSender.sendMessage("[EliteMobs] Failed to generate SHA-1 code, no zipped resource pack found!"); - return null; - } - String sha1 = null; - try { - sha1 = sha1CodeString(zippedResourcePack); - } catch (Exception ex) { - commandSender.sendMessage("[EliteMobs] Failed to generate SHA-1 code! Report this to the dev!"); - ex.printStackTrace(); - return null; - } - if (sha1 == null) { - commandSender.sendMessage("[EliteMobs] SHA-1 code is null! Report this to the dev!"); - return null; + } else { + Logger.warn("No file to download. Server replied HTTP code: " + responseCode); } - return sha1; - } - - public static String sha1CodeString(File file) throws IOException, NoSuchAlgorithmException { - FileInputStream fileInputStream = new FileInputStream(file); - MessageDigest digest = MessageDigest.getInstance("SHA-1"); - DigestInputStream digestInputStream = new DigestInputStream(fileInputStream, digest); - byte[] bytes = new byte[1024]; - // read all file content - while (digestInputStream.read(bytes) > 0) digest = digestInputStream.getMessageDigest(); - byte[] resultByteArry = digest.digest(); - return bytesToHexString(resultByteArry); + httpConn.disconnect(); } public static byte[] sha1CodeByteArray(File file) throws IOException, NoSuchAlgorithmException { @@ -137,49 +95,4 @@ public static byte[] sha1CodeByteArray(File file) throws IOException, NoSuchAlgo while (digestInputStream.read(bytes) > 0) digest = digestInputStream.getMessageDigest(); return digest.digest(); } - - public static String bytesToHexString(byte[] bytes) { - StringBuilder sb = new StringBuilder(); - for (byte b : bytes) { - int value = b & 0xFF; - if (value < 16) { - // if value less than 16, then it's hex String will be only - // one character, so we need to append a character of '0' - sb.append("0"); - } - sb.append(Integer.toHexString(value).toUpperCase(Locale.ROOT)); - } - return sb.toString(); - } - - private static void copyDirectory(File directoryToClone, Path targetPath) { - for (File file : directoryToClone.listFiles()) - try { - new InfoMessage("Adding " + file.getCanonicalPath()); - copyFile(file, targetPath); - } catch (Exception exception) { - new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - - private static void copyFile(File file, Path targetPath) { - try { - if (file.isDirectory()) { - if (!Paths.get(targetPath + "" + File.separatorChar + file.getName()).toFile().exists()) - Files.createDirectory(Paths.get(targetPath + "" + File.separatorChar + file.getName())); - for (File iteratedFile : file.listFiles()) - copyFile(iteratedFile, Paths.get(targetPath + "" + File.separatorChar + file.getName())); - } else { - if (!Paths.get(targetPath + "" + File.separatorChar + file.getName()).toFile().exists() || !targetPath.toString().contains("pack.png") && !targetPath.toString().contains("pack.mcmeta")) { - if (!targetPath.toFile().exists()) targetPath.toFile().mkdirs(); - Files.copy(file.toPath(), Paths.get(targetPath + "" + File.separatorChar + file.getName()), StandardCopyOption.REPLACE_EXISTING); - } else - new InfoMessage("File " + targetPath + "" + File.separatorChar + file.getName() + " already existed and should not be overwritten, skipping!"); - } - } catch (Exception exception) { - new WarningMessage("Failed to copy directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java deleted file mode 100644 index 0e9fa98c0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.magmaguy.elitemobs.config; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.utils.ZipFile; -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; - -public class ConfigurationImporter { - private ConfigurationImporter() { - } - - public static void initializeConfigs() { - Path configurationsPath = Paths.get(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath()); - if (!Files.isDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "imports"))) { - try { - Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "imports")); - } catch (Exception exception) { - new WarningMessage("Failed to create import directory! Tell the dev!"); - exception.printStackTrace(); - } - return; - } - - File importsFile = null; - try { - importsFile = new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getCanonicalPath() + File.separatorChar + "imports").toString()); - } catch (Exception ex) { - new WarningMessage("Failed to get imports folder! Report this to the dev!"); - return; - } - - if (importsFile.listFiles().length == 0) return; - boolean importedModels = false; - - for (File zippedFile : importsFile.listFiles()) { - File unzippedFile; - try { - if (zippedFile.getName().contains(".zip")) unzippedFile = ZipFile.unzip(zippedFile.getName()); - else unzippedFile = zippedFile; - } catch (Exception e) { - new WarningMessage("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); - e.printStackTrace(); - continue; - } - try { - for (File file : unzippedFile.listFiles()) { - switch (file.getName()) { - case "custombosses": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "custombosses"), false); - break; - case "customitems": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "customitems"), false); - break; - case "customtreasurechests": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "customtreasurechests"), false); - break; - case "dungeonpackages": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "dungeonpackages"), false); - break; - case "customevents": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "customevents"), false); - break; - case "customspawns": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "customspawns"), false); - break; - case "customquests": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "customquests"), false); - break; - case "customarenas": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "customarenas"), false); - break; - case "npcs": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "npcs"), false); - break; - case "wormholes": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "wormholes"), false); - break; - case "powers": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "powers"), false); - break; - case "worldcontainer": - moveWorlds(file); - break; - case "world_blueprints": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "world_blueprints"), false); - break; - case "ModelEngine", "models": - //todo: check if the "force" code is required, check if file is getting saved with modelengine doesn't have a configuration folder - if (CustomModel.getModelPlugin() == CustomModel.ModelPlugin.MODEL_ENGINE) - moveDirectory(file, Paths.get(file.getParentFile().getParentFile().getParentFile().getParentFile().toString() + File.separatorChar + "ModelEngine" + File.separatorChar + "blueprints"), true); - else - moveDirectory(file, Paths.get(file.getParentFile().getParentFile().getParentFile().getParentFile().toString() + File.separatorChar + "FreeMinecraftModels" + File.separatorChar + "imports"), true); - if (CustomModel.customModelsEnabled()) { - importedModels = true; - } else - new WarningMessage("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); - break; - case "schematics": - moveDirectory(file, Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "schematics"), false); - break; - default: - new WarningMessage("Directory " + file.getName() + " for zipped file " + zippedFile.getName() + " was not a recognized directory for the file import system! Was the zipped file packaged correctly?"); - } - deleteDirectory(file); - } - } catch (Exception e) { - new WarningMessage("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); - e.printStackTrace(); - continue; - } - try { - unzippedFile.delete(); - zippedFile.delete(); - } catch (Exception ex) { - new WarningMessage("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); - ex.printStackTrace(); - } - } - - if (importedModels) { - CustomModel.reloadModels(); - for (Player player : Bukkit.getOnlinePlayers()) - if (player.hasPermission("elitemobs.*")) - player.spigot().sendMessage(SpigotMessage.commandHoverMessage(ChatColorConverter.convert("&8[EliteMobs] &fEliteMobs just detected that recently imported files had Custom Models in them! " + "&2Click here to generate the EliteMobs resource pack for those models!"), "Clicking will run the command /em generateresourcepack", "/em generateresourcepack")); - } - - } - - private static void deleteDirectory(File file) { - if (file == null) return; - if (file.isDirectory()) for (File iteratedFile : file.listFiles()) - if (iteratedFile != null) deleteDirectory(iteratedFile); - new InfoMessage("Cleaning up " + file.getPath()); - file.delete(); - } - - private static void moveWorlds(File worldcontainerFile) { - for (File file : worldcontainerFile.listFiles()) - try { - File destinationFile = new File(Paths.get(Bukkit.getWorldContainer().getCanonicalPath() + File.separatorChar + file.getName()).normalize().toString()); - if (destinationFile.exists()) { - new InfoMessage("Overriding existing directory " + destinationFile.getPath()); - if (Bukkit.getWorld(file.getName()) != null) { - Bukkit.unloadWorld(file.getName(), false); - new WarningMessage("Unloaded world " + file.getName() + " for safe replacement!"); - } - deleteDirectory(destinationFile); - } - FileUtils.moveDirectory(file, destinationFile); - } catch (Exception exception) { - new WarningMessage("Failed to move worlds for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - - private static void moveDirectory(File unzippedDirectory, Path targetPath, boolean force) { - for (File file : unzippedDirectory.listFiles()) - try { - new InfoMessage("Adding " + file.getCanonicalPath()); - moveFile(file, targetPath, force); - } catch (Exception exception) { - new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - - private static void moveFile(File file, Path targetPath, boolean force) { - try { - if (file.isDirectory()) { - if (Paths.get(targetPath + "" + File.separatorChar + file.getName()).toFile().exists()) - for (File iteratedFile : file.listFiles()) - moveFile(iteratedFile, Paths.get(targetPath + "" + File.separatorChar + file.getName()), force); - else { - targetPath.toFile().mkdirs(); - Files.move(file.toPath(), Paths.get(targetPath + "" + File.separatorChar + file.getName()), StandardCopyOption.REPLACE_EXISTING); - } - } else if (targetPath.toFile().exists()) { - targetPath.toFile().mkdirs(); - Files.move(file.toPath(), Paths.get(targetPath + "" + File.separatorChar + file.getName()), StandardCopyOption.REPLACE_EXISTING); - } - } catch (Exception exception) { - new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java deleted file mode 100644 index 87f384a23..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.magmaguy.elitemobs.config; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; -import org.bukkit.Bukkit; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.reflections.Reflections; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.*; -import java.util.logging.Level; - -public class CustomConfig { - - //This stores configurations long term, ? is the specific extended custom config field - private final HashMap customConfigFieldsHashMap = new HashMap<>(); - //This is only used for loading configurations in to check if the machine has all of the default files - private final List customConfigFieldsArrayList = new ArrayList<>(); - private final String folderName; - private final Class customConfigFields; - - /** - * Initializes all configurations and stores them in a list for later access - */ - public CustomConfig(String folderName, String packageName, Class customConfigFields) { - this.folderName = folderName; - this.customConfigFields = customConfigFields; - - //Set defaults through reflections by getting everything that extends specific CustomConfigFields within specific package scopes - Reflections reflections = new Reflections(packageName); - - Set classSet = new HashSet<>(reflections.getSubTypesOf(customConfigFields)); - classSet.forEach(aClass -> { - try { - customConfigFieldsArrayList.add(aClass.newInstance()); - } catch (Exception ex) { - new WarningMessage("Failed to generate plugin default classes for " + folderName + " ! This is very bad, warn the developer!"); - ex.printStackTrace(); - } - }); - - //Check if the directory doesn't exist - try { - if (!Files.isDirectory(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + folderName))) { - generateFreshConfigurations(); - return; - } - } catch (Exception ex) { - new WarningMessage("Failed to generate plugin default files for " + folderName + " ! This is very bad, warn the developer!"); - ex.printStackTrace(); - return; - } - - //Runs if the directory exists - //Check if all the defaults exist - directoryCrawler(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + folderName); - - try { - //Generate missing default config files, might've been deleted or might have been added in newer version - if (!customConfigFieldsArrayList.isEmpty()) - generateFreshConfigurations(); - } catch (Exception ex) { - new WarningMessage("Failed to finish generating default plugin files for " + folderName + " ! This is very bad, warn the developer!"); - ex.printStackTrace(); - } - - } - - private void directoryCrawler(String path) { - for (File file : Objects.requireNonNull((new File(path)).listFiles())) { - if (file.isFile()) - fileInitializer(file); - else if (file.isDirectory()) - directoryCrawler(file.getPath()); - } - } - - private void fileInitializer(File file) { - - boolean isPremade = false; - for (Object object : customConfigFieldsArrayList) { - try { - Method getFilename = CustomConfigFields.class.getDeclaredMethod("getFilename"); - if (file.getName().equalsIgnoreCase((String) getFilename.invoke(object))) { - customConfigFieldsArrayList.remove(object); - initialize((CustomConfigFields) object); - isPremade = true; - break; - } - } catch (Exception ex) { - new WarningMessage("Failed to read plugin files for " + folderName + " ! This is very bad, warn the developer!"); - isPremade = true; - ex.printStackTrace(); - } - } - if (!isPremade) - initialize(file); - - } - - public HashMap getCustomConfigFieldsHashMap() { - return customConfigFieldsHashMap; - } - - /** - * Adds entry to custom config fields. This is done directly by the custom config fields as they are iterated through. - * - * @param filename Name of the file , using the format filename.yml - * @param customConfigFields Custom Config Fields, should be from an extended subclass - */ - public void addCustomConfigFields(String filename, CustomConfigFields customConfigFields) { - customConfigFieldsHashMap.put(filename, customConfigFields); - } - - /** - * Called when the appropriate configurations directory does not exist - */ - private void generateFreshConfigurations() { - for (Object customConfigFields : customConfigFieldsArrayList) - initialize((CustomConfigFields) customConfigFields); - } - - /** - * Initializes a single instance of a premade configuration using the default values. Writes defaults. - */ - private void initialize(CustomConfigFields customConfigFields) { - //Create configuration file from defaults if it does not exist - File file = ConfigurationEngine.fileCreator(folderName, customConfigFields.getFilename()); - //Get config file - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - - //Associate config - customConfigFields.setFile(file); - customConfigFields.setFileConfiguration(fileConfiguration); - - //Parse actual fields and load into RAM to be used - customConfigFields.processConfigFields(); - - //Save all configuration values as they exist - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); - - //if (customConfigFields.isEnabled) - //Store for use by the plugin - addCustomConfigFields(file.getName(), customConfigFields); - } - - /** - * Called when a user-made file is detected. - */ - private void initialize(File file) { - //Load file configuration from file - try { - //Make sure it's a yml configuration file - if (!file.getName().endsWith(".yml")) return; - YamlConfiguration fileConfiguration = new YamlConfiguration(); - try { - fileConfiguration.load(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)); - } catch (IOException ex) { - Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); - } catch (InvalidConfigurationException ex) { - new WarningMessage("Failed to load file " + file.getName() + " in " + file.getAbsolutePath() + " ! This file is not correctly formatted for a yaml file."); - new WarningMessage("You can check the file vality by through YAML linters, such as the one at https://www.yamllint.com/"); - ex.printStackTrace(); - return; - } - //Instantiate the correct CustomConfigFields instance - Constructor constructor = customConfigFields.getConstructor(String.class, boolean.class); - CustomConfigFields instancedCustomConfigFields = (CustomConfigFields) constructor.newInstance(file.getName(), true); - instancedCustomConfigFields.setFileConfiguration(fileConfiguration); - instancedCustomConfigFields.setFile(file); - //Parse actual fields and load into RAM to be used - instancedCustomConfigFields.processConfigFields(); - //if (instancedCustomConfigFields.isEnabled) - //Store for use by the plugin - addCustomConfigFields(file.getName(), instancedCustomConfigFields); - } catch (Exception ex) { - new WarningMessage("Bad constructor for file " + file.getName()); - ex.printStackTrace(); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java index a13973a8b..3e22bd9a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java @@ -1,28 +1,12 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; -import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.WarningMessage; -import org.bukkit.*; import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.util.Vector; -import java.io.File; -import java.util.*; +import java.util.List; +import java.util.Map; -public class CustomConfigFields implements CustomConfigFieldsInterface { - - protected String filename; - protected boolean isEnabled; - protected FileConfiguration fileConfiguration; - protected File file; +public class CustomConfigFields extends com.magmaguy.magmacore.config.CustomConfigFields { /** * Used by plugin-generated files (defaults) @@ -31,36 +15,7 @@ public class CustomConfigFields implements CustomConfigFieldsInterface { * @param isEnabled */ public CustomConfigFields(String filename, boolean isEnabled) { - this.filename = filename.contains(".yml") ? filename : filename + ".yml"; - this.isEnabled = isEnabled; - } - - public String getFilename() { - return filename; - } - - public boolean isEnabled() { - return isEnabled; - } - - public void setEnabled(boolean enabled) { - isEnabled = enabled; - } - - public FileConfiguration getFileConfiguration() { - return fileConfiguration; - } - - public void setFileConfiguration(FileConfiguration fileConfiguration) { - this.fileConfiguration = fileConfiguration; - } - - public File getFile() { - return file; - } - - public void setFile(File file) { - this.file = file; + super(filename, isEnabled); } @Override @@ -68,8 +23,9 @@ public void processConfigFields() { } - protected boolean configHas(String configKey) { - return fileConfiguration.contains(configKey); + @Override + public String getFilename() { + return super.getFilename(); } protected String translatable(String filename, String key, String value) { @@ -80,268 +36,6 @@ protected List translatable(String filename, String key, List va return TranslationsConfig.add(filename, key, value); } - protected String processString(String path, String value, String pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || !Objects.equals(value, pluginDefault)) - fileConfiguration.addDefault(path, value); - return value; - } - try { - return ChatColorConverter.convert(fileConfiguration.getString(path)); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - - public List processList(String path, List value, List pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) - fileConfiguration.addDefault(path, value); - return value; - } - try { - return new ArrayList<>(Objects.requireNonNull(fileConfiguration.getList(path))); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - public List processStringList(String path, List value, List pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) - fileConfiguration.addDefault(path, value); - return value; - } - try { - List list = new ArrayList<>(); - for (String string : fileConfiguration.getStringList(path)) - list.add(ChatColorConverter.convert(string)); - return list; - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - /** - * This not only gets a list of worlds, but gets a list of already loaded worlds. This might cause issues if the worlds - * aren't loaded when the code for getting worlds runs. - * - * @param path Configuration path - * @param pluginDefault Default value - should be null or empty - * @return Worlds from the list that are loaded at the time this runs, probably on startup - */ - protected List processWorldList(String path, List value, List pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (value != null && (forceWriteDefault || value != pluginDefault)) - processStringList(path, worldListToStringListConverter(value), worldListToStringListConverter(pluginDefault), forceWriteDefault); - return value; - } - try { - List validWorldStrings = processStringList(path, worldListToStringListConverter(pluginDefault), worldListToStringListConverter(value), forceWriteDefault); - List validWorlds = new ArrayList<>(); - if (!validWorldStrings.isEmpty()) - for (String string : validWorldStrings) { - World world = Bukkit.getWorld(string); - if (world != null) - validWorlds.add(world); - } - return validWorlds; - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - private List worldListToStringListConverter(List pluginDefault) { - if (pluginDefault == null) return null; - List newList = new ArrayList<>(); - pluginDefault.forEach(element -> newList.add(element.getName())); - return newList; - } - - - protected > List processEnumList(String path, List value, List pluginDefault, Class enumClass, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) - processStringList(path, enumListToStringListConverter(value), enumListToStringListConverter(pluginDefault), forceWriteDefault); - return value; - } - try { - List newList = new ArrayList<>(); - List stringList = processStringList(path, enumListToStringListConverter(value), enumListToStringListConverter(pluginDefault), forceWriteDefault); - stringList.forEach(string -> { - try { - newList.add(Enum.valueOf(enumClass, string.toUpperCase(Locale.ROOT))); - } catch (Exception ex) { - new WarningMessage(filename + " : " + "Value " + string + " is not a valid for " + path + " ! This may be due to your server version, or due to an invalid value!"); - } - }); - return newList; - } catch ( - Exception ex) { - ex.printStackTrace(); - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - private > List enumListToStringListConverter(List list) { - if (list == null) return Collections.emptyList(); - List newList = new ArrayList<>(); - list.forEach(element -> newList.add(element.toString())); - return newList; - } - - protected int processInt(String path, int value, int pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) fileConfiguration.addDefault(path, value); - return value; - } - try { - return fileConfiguration.getInt(path); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - protected long processLong(String path, long value, long pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) fileConfiguration.addDefault(path, value); - return value; - } - try { - return fileConfiguration.getLong(path); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - - protected double processDouble(String path, double value, double pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) fileConfiguration.addDefault(path, value); - return value; - } - try { - return fileConfiguration.getDouble(path); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - protected Double processDouble(String path, Double value, Double pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || !Objects.equals(value, pluginDefault)) fileConfiguration.addDefault(path, value); - return value; - } - try { - return fileConfiguration.getDouble(path); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - protected boolean processBoolean(String path, boolean value, boolean pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) fileConfiguration.addDefault(path, value); - return value; - } - try { - return fileConfiguration.getBoolean(path); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - public > T processEnum(String path, T value, T pluginDefault, Class enumClass, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) { - String valueString = null; - if (value != null) - valueString = value.toString().toUpperCase(Locale.ROOT); - String pluginDefaultString = null; - if (pluginDefault != null) - pluginDefaultString = pluginDefault.toString().toUpperCase(Locale.ROOT); - processString(path, valueString, pluginDefaultString, forceWriteDefault); - } - return value; - } - try { - return Enum.valueOf(enumClass, fileConfiguration.getString(path).toUpperCase(Locale.ROOT)); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + fileConfiguration.getString(path)); - value = null; - } - if (value == null) - return pluginDefault; - return value; - } - - public ItemStack processItemStack(String path, ItemStack value, ItemStack pluginDefault, boolean forceWriteDefault) { - if (!configHas(path)) { - if (forceWriteDefault || value != pluginDefault) - processString(path, itemStackDeserializer(value), itemStackDeserializer(pluginDefault), forceWriteDefault); - return value; - } - try { - String materialString = processString(path, itemStackDeserializer(value), itemStackDeserializer(pluginDefault), forceWriteDefault); - if (materialString == null) - return null; - if (materialString.matches("[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}")) { - ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD); - SkullMeta skullMeta = (SkullMeta) playerHead.getItemMeta(); - skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(materialString))); - playerHead.setItemMeta(skullMeta); - return playerHead; - } - if (materialString.contains(":")) { - ItemStack itemStack = ItemStackGenerator.generateItemStack(Material.getMaterial(materialString.split(":")[0])); - if (materialString.split(":")[0].contains("leather_") || materialString.split(":")[0].contains("LEATHER_")) { - LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta(); - leatherArmorMeta.setColor(Color.fromRGB(Integer.parseInt(materialString.split(":")[1], 16))); - itemStack.setItemMeta(leatherArmorMeta); - } else { - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setCustomModelData(Integer.parseInt(materialString.split(":")[1])); - itemStack.setItemMeta(itemMeta); - } - return itemStack; - } else - return ItemStackGenerator.generateItemStack(Material.getMaterial(materialString)); - } catch (Exception ex) { - new WarningMessage("File " + filename + " has an incorrect entry for " + path); - new WarningMessage("Entry: " + value); - } - return value; - } - - public Map processMap(String path, Map value) { - if (!configHas(path) && value != null) - fileConfiguration.addDefaults(value); - if (fileConfiguration.get(path) == null) return Collections.emptyMap(); - return fileConfiguration.getConfigurationSection(path).getValues(false); - } - public ConfigurationSection processConfigurationSection(String path, Map value) { if (!configHas(path) && value != null) fileConfiguration.addDefaults(value); @@ -353,50 +47,4 @@ public ConfigurationSection processConfigurationSection(String path, Map'"), @@ -123,7 +130,7 @@ public static void initializeConfig() { fileConfiguration, "enableHighCompatibilityMode", false); if (Bukkit.getPluginManager().isPluginEnabled("MythicMobs") || Bukkit.getPluginManager().isPluginEnabled("LevelledMobs")) { - new InfoMessage("Other boss mob plugins have been detected, high compatibility mode will be used!"); + Logger.info("Other boss mob plugins have been detected, high compatibility mode will be used!"); doStrictSpawningRules = true; } nightmareWorldSpawnBonus = ConfigurationEngine.setDouble( @@ -148,7 +155,7 @@ public static void initializeConfig() { file, fileConfiguration, "defaultSpawnLocation", ConfigurationLocation.deserialize(Bukkit.getWorlds().get(0).getSpawnLocation()), false)); } catch (Exception ex) { - new WarningMessage("There is an issue with your defaultSpawnLocation in the config.yml configuration file! Fix it!"); + Logger.warn("There is an issue with your defaultSpawnLocation in the config.yml configuration file! Fix it!"); } doExplosionRegen = ConfigurationEngine.setBoolean( @@ -193,20 +200,10 @@ public static void initializeConfig() { treasureChestNoDropMessage = ConfigurationEngine.setString( List.of("Sets the message that appears when a player opens a treasure chest but gets nothing"), file, fileConfiguration, "treasureChestNoDropMessage", "&8[EliteMobs] &cYou didn't get anything! Better luck next time!", true); - bossAlreadyGoneMessage= ConfigurationEngine.setString( + bossAlreadyGoneMessage = ConfigurationEngine.setString( List.of("Sets the message that appears when a player tries to track a boss that is no longer valid"), file, fileConfiguration, "bossAlreadyGoneMessage", "&c[EliteMobs] Sorry, this boss is already gone!", true); - - - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); + resetPlayerScaleOnLogin = ConfigurationEngine.setBoolean(List.of("Sets whether to reset player scale (literally, the player size on login).", "This is important because some elite powers can modify it and if the server crashes players will be stuck to whatever scale was set when the server crashed, unless this option is set to true."), fileConfiguration, "resetPlayerScale", true); + forceMenuUnicode = ConfigurationEngine.setBoolean(List.of("Sets whether the menu unicodes for the resource pack should be forced even if the pack is not being hosted through the recommended methods (which is using ResourcePackManager)"), fileConfiguration, "forceMenuUnicode", false); } - - public static void setLanguage(CommandSender commandSender, String filename) { - language = filename; - fileConfiguration.set("language", filename); - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); - ReloadCommand.reload(commandSender); - } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java index cd7b70a3c..8afc3545e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java @@ -1,20 +1,21 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class DiscordSRVConfig { +public class DiscordSRVConfig extends ConfigurationFile { @Getter private static String announcementRoomName; - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("DiscordSRV.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public DiscordSRVConfig() { + super("DiscordSRV.yml"); + } + @Override + public void initializeValues() { announcementRoomName = ConfigurationEngine.setString( List.of("Documentation can be found here: https://github.com/MagmaGuy/EliteMobs/wiki/DiscordSRV---Discord-broadcasts"), file, fileConfiguration, "announcementRoomName", @@ -22,7 +23,5 @@ public static void initializeConfig() { "_ANNOUNCEMENTS_TO_BE_BROADCASTED_IN_AS_YOU_HAVE_IN_YOUR_DISCORDSRV_" + "CONFIGURATION_FILE_CHECK_ELITEMOBS_WIKI_FOR_DETAILS", false); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index 6f7c979a6..12944c718 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -1,12 +1,11 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class DungeonsConfig { +public class DungeonsConfig extends ConfigurationFile { @Getter private static String instancedDungeonTitle; @@ -26,13 +25,21 @@ public class DungeonsConfig { private static String instancedDungeonCompleteMessage; @Getter private static String instancedDungeonClosingInstanceMessage; + @Getter + private static boolean friendlyFireInDungeons; + @Getter + private static double fireDamageMultiplier; + @Getter + private static double poisonDamageMultiplier; + @Getter + private static double witherDamageMultiplier; - private DungeonsConfig() { + public DungeonsConfig() { + super("dungeons.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("dungeons.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @Override + public void initializeValues() { dungeonRezInstructions = ConfigurationEngine.setString( List.of("Sets the text that appears over resurrection banners in dungeons"), @@ -71,8 +78,20 @@ public static void initializeConfig() { List.of("Sets the message that appears when an instanced dungeon closing"), file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); + friendlyFireInDungeons = ConfigurationEngine.setBoolean( + List.of("Sets if PvP will be allowed in dungeons"), + fileConfiguration, "friendlyFireInDungeons", false); + fireDamageMultiplier = ConfigurationEngine.setDouble( + List.of("Sets the damage multiplier for fire damage in dungeons", + "This is important for balance as by default the damage is a bit too high for the dungeons as we design them"), + fileConfiguration, "fireDamageMultiplier", 0.5); + witherDamageMultiplier = ConfigurationEngine.setDouble( + List.of("Sets the damage multiplier for wither damage in dungeons", + "This is important for balance as by default the damage is a bit too high for the dungeons as we design them"), + fileConfiguration, "witherDamageMultiplier", 0.5); + poisonDamageMultiplier = ConfigurationEngine.setDouble( + List.of("Sets the damage multiplier for fire damage in dungeons", + "This is important for balance as by default the damage is a bit too high for the dungeons as we design them"), + fileConfiguration, "poisonDamageMultiplier", 0.5); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index a5a29b2bb..20a73bea6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,18 +1,17 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; /** * Created by MagmaGuy on 17/06/2017. */ -public class EconomySettingsConfig { +public class EconomySettingsConfig extends ConfigurationFile { @Getter private static boolean enableEconomy; @Getter @@ -83,14 +82,26 @@ public class EconomySettingsConfig { private static String shopBatchSellMessage; - private EconomySettingsConfig() { + public EconomySettingsConfig() { + super("EconomySettings.yml"); } - public static void initializeConfig() { + private static void addMaterial(FileConfiguration fileConfiguration, Material material, double value) { + ConfigurationEngine.setDouble( + List.of("Sets the worth of this material for the elitemobs currency system."), + fileConfiguration, "materialWorth." + material.name(), value); + } - File file = ConfigurationEngine.fileCreator("EconomySettings.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public static double getMaterialWorth(Material material) { + try { + return thisConfiguration.getDouble("materialWorth." + material.name()); + } catch (Exception ex) { + return defaultMaterialWorth; + } + } + @Override + public void initializeValues() { double netheriteLevel = CombatSystem.NETHERITE_TIER_LEVEL + 10D; double tridentLevel = CombatSystem.DIAMOND_TIER_LEVEL + 10D; double diamondLevel = CombatSystem.DIAMOND_TIER_LEVEL + 10D; @@ -205,17 +216,15 @@ public static void initializeConfig() { addMaterial(fileConfiguration, Material.ELYTRA, diamondLevel); addMaterial(fileConfiguration, Material.TURTLE_HELMET, goldWoodLeatherLevel); - if (!VersionChecker.serverVersionOlderThan(16, 0)) { - addMaterial(fileConfiguration, Material.NETHERITE_AXE, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_PICKAXE, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_SHOVEL, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_HOE, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_SWORD, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_HELMET, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_CHESTPLATE, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_LEGGINGS, netheriteLevel); - addMaterial(fileConfiguration, Material.NETHERITE_BOOTS, netheriteLevel); - } + addMaterial(fileConfiguration, Material.NETHERITE_AXE, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_PICKAXE, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_SHOVEL, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_HOE, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_SWORD, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_HELMET, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_CHESTPLATE, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_LEGGINGS, netheriteLevel); + addMaterial(fileConfiguration, Material.NETHERITE_BOOTS, netheriteLevel); defaultMaterialWorth = ConfigurationEngine.setDouble( List.of("Sets the default material worth for items not specifically defined."), @@ -267,23 +276,5 @@ public static void initializeConfig() { List.of("Message sent upon selling a batch of elite items."), file, fileConfiguration, "shopBatchSellItem", "&aYou have sold your items &afor $currency_amount $currency_name!", true); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - thisConfiguration = fileConfiguration; - } - - private static void addMaterial(FileConfiguration fileConfiguration, Material material, double value) { - ConfigurationEngine.setDouble( - List.of("Sets the worth of this material for the elitemobs currency system."), - fileConfiguration, "materialWorth." + material.name(), value); - } - - public static double getMaterialWorth(Material material) { - try { - return thisConfiguration.getDouble("materialWorth." + material.name()); - } catch (Exception ex) { - return defaultMaterialWorth; - } - } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java index 8999ca60f..2d72be5c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java @@ -1,34 +1,37 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class EventsConfig { +public class EventsConfig extends ConfigurationFile { @Getter private static boolean announcementBroadcastWorldOnly; @Getter private static int actionEventMinimumCooldown; @Getter + private static int timedEventMinimumCooldown; + @Getter private static boolean actionEventsEnabled; @Getter private static boolean timedEventsEnabled; - private EventsConfig() { + public EventsConfig() { + super("events.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("events.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - + @Override + public void initializeValues() { announcementBroadcastWorldOnly = ConfigurationEngine.setBoolean( List.of("Sets if events will only broadcasted in the world the events happens in."), fileConfiguration, "Only broadcast event message in event worlds", false); actionEventMinimumCooldown = ConfigurationEngine.setInt( List.of("Sets the minimum cooldown, in minutes, between action events"), - fileConfiguration, "actionEventMinimumCooldownMinutes", 60 * 4); + fileConfiguration, "actionEventMinimumCooldownMinutes", 4); + timedEventMinimumCooldown = ConfigurationEngine.setInt( + List.of("Sets the minimum cooldown, in minutes, between timed events"), + fileConfiguration, "actionEventMinimumCooldownMinutes", 4); actionEventsEnabled = ConfigurationEngine.setBoolean( List.of("Sets if action events will happen.", "https://github.com/MagmaGuy/EliteMobs/wiki/Creating-Custom-Events#action-events"), @@ -38,7 +41,5 @@ public static void initializeConfig() { "https://github.com/MagmaGuy/EliteMobs/wiki/Creating-Custom-Events#timed-events"), fileConfiguration, "timedEventsEnabled", true); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java index 3a7d97f6b..1e3dc63ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java @@ -1,14 +1,13 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; -public class ItemSettingsConfig { +public class ItemSettingsConfig extends ConfigurationFile { @Getter private static String shopItemSource; @Getter @@ -98,9 +97,7 @@ public class ItemSettingsConfig { @Getter private static boolean preventEliteItemsFromBreaking; @Getter - private static String lowArmorDurabilityItemDropMessage; - @Getter - private static String lowWeaponDurabilityItemDropMessage; + private static String noItemDurabilityMessage; @Getter private static int minimumProcedurallyGeneratedDiamondLootLevelPlusSeven; @Getter @@ -122,12 +119,12 @@ public class ItemSettingsConfig { @Getter private static String levelRangeTooDifferent; - private ItemSettingsConfig() { + public ItemSettingsConfig() { + super("ItemSettings.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("ItemSettings.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @Override + public void initializeValues() { doEliteMobsLoot = ConfigurationEngine.setBoolean( List.of("Sets if any EliteMobs loot will drop.", @@ -159,7 +156,7 @@ public static void initializeConfig() { "$potionEffects - shows the potion effects on the item", "$loreResaleValue - shows the value of the item. Might show the purchase or sell price depending on where it is viewed", "Important: Several of the placeholders can be further customized by the configuration settings further below"), - file, fileConfiguration, "itemLoreStructureV2", Arrays.asList( + file, fileConfiguration, "itemLoreStructureV2", new ArrayList<>(List.of( ChatColorConverter.convert("&7&m&l---------&7<&lEquip Info&7>&m&l---------"), ChatColorConverter.convert("&7Item level: &f$itemLevel &7Prestige &6$prestigeLevel"), ChatColorConverter.convert("$weaponOrArmorStats"), @@ -176,7 +173,7 @@ public static void initializeConfig() { ChatColorConverter.convert("$potionEffect"), ChatColorConverter.convert("&7&l&m-----------------------------"), ChatColorConverter.convert("$loreResaleValue") - ), true); + )), true); shopItemSource = ConfigurationEngine.setString( List.of("Sets the shop source lore for store purchased"), file, fileConfiguration, "shopSourceItemLores", "&7Purchased from a store", true); @@ -310,12 +307,9 @@ public static void initializeConfig() { List.of("Sets if EliteMobs will prevent Elite Items from breaking when using the durability loss on death system.", "Players will not be able to use items with no durability left anyway, this is simply to prevent the accidental loss of high level but low durability items."), fileConfiguration, "preventEliteItemsFromBreaking", true); - lowArmorDurabilityItemDropMessage = ConfigurationEngine.setString( - List.of("Sets the message that will be sent to players if the durability left on an item is too low to be used in combat."), - file, fileConfiguration, "lowDurabilityItemDropMessage", "&8[EliteMobs] &cDropped armor due to low durability! &8Repair it at the NPC with scrap to use it!", true); - lowWeaponDurabilityItemDropMessage = ConfigurationEngine.setString( + noItemDurabilityMessage = ConfigurationEngine.setString( List.of("Sets the characters prefixed to vanilla enchantments in item lore."), - file, fileConfiguration, "lowWeaponItemDropMessage", "&8[EliteMobs] &cDropped weapon due to low durability! &8Repair it at the NPC with scrap to use it!", true); + file, fileConfiguration, "noItemDurabilityMessage", "&8[EliteMobs] $item &4is broken! It won't work until repaired!", true); minimumProcedurallyGeneratedDiamondLootLevelPlusSeven = ConfigurationEngine.setInt( List.of("Sets the minimum level, +7, of bosses that can procedurally generated drop diamond gear in EliteMobs.", "There is no procedurally generated netherite gear in EliteMobs, only custom loot."), @@ -348,6 +342,5 @@ public static void initializeConfig() { List.of("Sets the message sent when a played kills a boss but the gear level is too different from the boss level to get coins"), file, fileConfiguration, "levelRangeTooDifferent", "&8EM] &4Your gear is level $playerLevel and the boss is level $bossLevel, level difference is too high to get coins!", true); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java deleted file mode 100644 index 0aa4c0dad..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.magmaguy.elitemobs.config; - -import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; - -import java.io.File; - -public class ItemUpgradeSystemConfig { - - @Getter - private static double luckyTicketChance; - @Getter - private static double enchantedBookChance; - @Getter - private static double scrapChance; - private ItemUpgradeSystemConfig() { - } - - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("ItemUpgradeSystem.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - //luckyTicketChance = ConfigurationEngine.setDouble("luckyTicketChance", ) - //todo: odds for new special items go here - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java new file mode 100644 index 000000000..3a0b9fcdd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -0,0 +1,121 @@ +package com.magmaguy.elitemobs.config; + +import org.bukkit.Particle; + +import java.util.Locale; + +public class LegacyValueConverter { + private LegacyValueConverter() { + } + + public static String parseEnchantment(String materialName) { + switch (materialName.toUpperCase(Locale.ROOT)) { + case "ARROW_DAMAGE": + return "POWER"; + case "ARROW_FIRE": + return "FLAME"; + case "ARROW_INFINITE": + return "INFINITY"; + case "ARROW_KNOCKBACK": + return "PUNCH"; + case "DAMAGE_ARTHROPODS": + return "BANE_OF_ARTHROPODS"; + case "DAMAGE_UNDEAD": + return "SMITE"; + case "DIG_SPEED": + return "EFFICIENCY"; + case "DURABILITY": + return "UNBREAKING"; + case "LOOT_BONUS_BLOCKS": + return "FORTUNE"; + case "LOOT_BONUS_MOBS": + return "LOOTING"; + case "LUCK": + return "LUCK_OF_THE_SEA"; + case "RESPIRATION": + return "RESPIRATION"; + case "PROTECTION_ENVIRONMENTAL": + return "PROTECTION"; + case "BLAST_PROTECTION": + return "BLAST_PROTECTION"; + case "PROTECTION_FALL": + return "FEATHER_FALLING"; + case "PROTECTION_FIRE": + return "FIRE_PROTECTION"; + case "PROTECTION_PROJECTILE": + return "PROJECTILE_PROTECTION"; + case "WATER_WORKER": + return "AQUA_AFFINITY"; + default: + return materialName; + } + } + + public static String parsePotionEffect(String potionEffectName) { + switch (potionEffectName.toUpperCase(Locale.ROOT)) { + case "CONFUSION": + return "NAUSEA"; + case "DAMAGE_RESISTANCE": + return "RESISTANCE"; + case "FAST_DIGGING": + return "HASTE"; + case "HARM": + return "INSTANT_DAMAGE"; + case "HEAL": + return "INSTANT_HEALTH"; + case "INCREASE_DAMAGE": + return "STRENGTH"; + case "JUMP": + return "JUMP_BOOST"; + case "SLOW": + return "SLOWNESS"; + case "SLOW_DIGGING": + return "MINING_FATIGUE"; + default: + return potionEffectName; + } + } + + public static String parseParticle(String potionEffectName) { + switch (potionEffectName.toUpperCase(Locale.ROOT)) { + case "EXPLOSION_NORMAL", "EXPLOSION_LARGE": + return Particle.EXPLOSION.toString(); + case "SMOKE_NORMAL": + return Particle.SMOKE.toString(); + case "SMOKE_LARGE": + return Particle.LARGE_SMOKE.toString(); + case "REDSTONE": + return Particle.DUST.toString(); + case "SLIME": + return Particle.ITEM_SLIME.toString(); + case "DRIP_LAVA": + return Particle.DRIPPING_WATER.toString(); + case "EXPLOSION_HUGE": + return Particle.EXPLOSION.toString(); + case "SNOWBALL": + return Particle.SNOWFLAKE.toString(); + case "SPELL": + return Particle.WITCH.toString(); + case "DRIP_WATER": + return Particle.DRIPPING_WATER.toString(); + case "SPELL_MOB": + return Particle.WITCH.toString(); + case "VILLAGER_ANGRY": + return Particle.ANGRY_VILLAGER.toString(); + case "WATER_BUBBLE": + return Particle.UNDERWATER.toString(); + case "VILLAGER_HAPPY": + return Particle.HAPPY_VILLAGER.toString(); + case "WATER_SPLASH": + return Particle.SPLASH.toString(); + default: + return potionEffectName; + } + } + + public static String parseDeserializedBlocks(String originalDeserializedBlock) { + if (originalDeserializedBlock.endsWith("grass")) + return originalDeserializedBlock.replace("grass", "grass_block[snowy=false]"); + return originalDeserializedBlock; + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java index 02fa1cb05..070621c58 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java @@ -1,13 +1,12 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.Collections; import java.util.List; -public class MobCombatSettingsConfig { +public class MobCombatSettingsConfig extends ConfigurationFile { @Getter private static boolean doNaturalMobSpawning; @Getter @@ -89,15 +88,12 @@ public class MobCombatSettingsConfig { @Getter private static double blockingDamageReduction; - - private MobCombatSettingsConfig() { + public MobCombatSettingsConfig() { + super("MobCombatSettings.yml"); } - public static void initializeConfig() { - - File file = ConfigurationEngine.fileCreator("MobCombatSettings.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - + @Override + public void initializeValues() { doNaturalMobSpawning = ConfigurationEngine.setBoolean( List.of("Sets if naturally spawned elites will spawn. Note: event mobs like the zombie king are not naturally spawned elites! You will have to disable events if you want to disable event bosses."), fileConfiguration, "doNaturalEliteMobSpawning", true); @@ -222,7 +218,5 @@ public static void initializeConfig() { blockingDamageReduction = ConfigurationEngine.setDouble( List.of("Sets the multiplier applied to damage reduction when a player is holding up a shield for melee attacks (powers excluded)."), fileConfiguration, "blockingDamageReduction", 0.8); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java index dc58e0f94..0114dfdaf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -1,23 +1,20 @@ package com.magmaguy.elitemobs.config; -import org.bukkit.configuration.file.FileConfiguration; +import com.magmaguy.magmacore.config.ConfigurationFile; -import java.io.File; import java.util.List; -public class ModelsConfig { - private ModelsConfig(){} - +public class ModelsConfig extends ConfigurationFile { public static String treasureChest; - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("Models.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public ModelsConfig() { + super("Models.yml"); + } + @Override + public void initializeValues() { treasureChest = ConfigurationEngine.setString( List.of("Name of the custom model for the treasure chest"), file, fileConfiguration, "treasureChest", "elitemobs_treasure_chest", false); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java index dc140eb7e..c49ca5e92 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -1,21 +1,17 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.items.itemconstructor.MaterialGenerator; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; import org.bukkit.Material; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -public class ProceduralItemGenerationSettingsConfig { +public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile { @Getter private static final List validMaterials = new ArrayList<>(); @Getter - private static FileConfiguration fileConfiguration; - @Getter private static boolean doProceduralItemDrops; @Getter @@ -60,13 +56,28 @@ public class ProceduralItemGenerationSettingsConfig { private static List verbs; @Getter private static List verbers; + @Getter + private static ProceduralItemGenerationSettingsConfig instance; + + public ProceduralItemGenerationSettingsConfig() { + super("ProceduralItemGenerationSettings.yml"); + } + + private void addMaterial(Material material) { + ConfigurationEngine.setBoolean(fileConfiguration, "validMaterials." + material.name(), true); + } - private ProceduralItemGenerationSettingsConfig() { + public void cacheMaterials() { + validMaterials.clear(); + for (String material : fileConfiguration.getConfigurationSection("validMaterials").getKeys(false)) + if (fileConfiguration.getConfigurationSection("validMaterials").getBoolean(material)) + validMaterials.add(material); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("ProceduralItemGenerationSettings.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + + @Override + public void initializeValues() { + instance = this; doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); @@ -142,7 +153,7 @@ public static void initializeConfig() { tridentName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.trident", "Trident", true); crossbowName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.crossbow", "Crossbow", true); - nameFormat = ConfigurationEngine.setList(file, fileConfiguration, "nameFormats", Arrays.asList( + nameFormat = ConfigurationEngine.setList(file, fileConfiguration, "nameFormats", new ArrayList<>(List.of( "$verb $itemType of the $adjective $noun", "$itemType of the $adjective $noun", "$noun's $adjective $verb $itemType", @@ -150,9 +161,9 @@ public static void initializeConfig() { "$adjective $verb $itemType", "The $verb-er", "The $adjective $verb-er" - ), true); + )), true); - nouns = ConfigurationEngine.setList(file, fileConfiguration, "nouns", Arrays.asList( + nouns = ConfigurationEngine.setList(file, fileConfiguration, "nouns", new ArrayList<>(List.of( "MagmaGuy", "Dawn", "Sunset", @@ -443,9 +454,9 @@ public static void initializeConfig() { "Rakshasa", "Revenant", "Cultist" - ), true); + )), true); - adjectives = ConfigurationEngine.setList(file, fileConfiguration, "adjectives", Arrays.asList( + adjectives = ConfigurationEngine.setList(file, fileConfiguration, "adjectives", new ArrayList<>(List.of( "Adorable", "Beautiful", "Clean", @@ -972,9 +983,9 @@ public static void initializeConfig() { "Trusting", "Unassuming", "Threatening" - ), true); + )), true); - verbs = ConfigurationEngine.setList(file, fileConfiguration, "verbs", Arrays.asList( + verbs = ConfigurationEngine.setList(file, fileConfiguration, "verbs", new ArrayList<>(List.of( "Slashing", "Cutting", "Stabbing", @@ -1236,9 +1247,9 @@ public static void initializeConfig() { "Spying", "Avenging", "Storming" - ), true); + )), true); - verbers = ConfigurationEngine.setList(file, fileConfiguration, "verb-ers (noun)", Arrays.asList( + verbers = ConfigurationEngine.setList(file, fileConfiguration, "verb-ers (noun)", new ArrayList<>(List.of( "World Breaker", "World Shatterer", "Avenger", @@ -1447,23 +1458,8 @@ public static void initializeConfig() { "Snorer", "Thruster", "Slapper" - ), true); - - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); + )), true); MaterialGenerator.initializeValidProceduralMaterials(); } - - private static void addMaterial(Material material) { - ConfigurationEngine.setBoolean(fileConfiguration, "validMaterials." + material.name(), true); - } - - public static void cacheMaterials() { - validMaterials.clear(); - for (String material : fileConfiguration.getConfigurationSection("validMaterials").getKeys(false)) - if (fileConfiguration.getConfigurationSection("validMaterials").getBoolean(material)) - validMaterials.add(material); - } - - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java index 68e14d13e..863584853 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -4,8 +4,8 @@ import com.magmaguy.elitemobs.quests.objectives.DialogObjective; import com.magmaguy.elitemobs.quests.objectives.KillObjective; import com.magmaguy.elitemobs.quests.objectives.Objective; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -13,10 +13,9 @@ import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -public class QuestsConfig { +public class QuestsConfig extends ConfigurationFile { @Getter private static boolean requireQuestTurnIn; @@ -105,12 +104,93 @@ public class QuestsConfig { @Getter private static int itemEntryCharacterLimitBedrockMenu; - private QuestsConfig() { + public QuestsConfig() { + super("Quests.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("Quests.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + private static List setEntityTypes(FileConfiguration fileConfiguration, File file) { + List entityTypes = new ArrayList<>(new ArrayList<>(List.of( + EntityType.BLAZE.toString(), + EntityType.CAVE_SPIDER.toString(), + EntityType.DROWNED.toString(), + EntityType.ELDER_GUARDIAN.toString(), + EntityType.ENDERMAN.toString(), + EntityType.ENDERMITE.toString(), + EntityType.EVOKER.toString(), + EntityType.GHAST.toString(), + EntityType.GUARDIAN.toString(), + EntityType.HUSK.toString(), + EntityType.ILLUSIONER.toString(), + EntityType.IRON_GOLEM.toString(), + EntityType.PILLAGER.toString(), + EntityType.RAVAGER.toString(), + EntityType.SILVERFISH.toString(), + EntityType.SKELETON.toString(), + EntityType.SPIDER.toString(), + EntityType.STRAY.toString(), + EntityType.VINDICATOR.toString(), + EntityType.WITCH.toString(), + EntityType.WITHER_SKELETON.toString(), + EntityType.WOLF.toString(), + EntityType.ZOMBIE.toString() + ))); + + List laterEntities = new ArrayList<>(List.of( + EntityType.HOGLIN.toString(), + EntityType.ZOGLIN.toString(), + EntityType.PIGLIN_BRUTE.toString(), + EntityType.PIGLIN.toString(), + EntityType.ZOMBIFIED_PIGLIN.toString())); + entityTypes.addAll(laterEntities); + + ConfigurationEngine.setList(file, fileConfiguration, "questEntityTypes", entityTypes, false); + + List parsedTypes = new ArrayList<>(); + for (String string : entityTypes) + try { + parsedTypes.add(EntityType.valueOf(string)); + } catch (Exception ex) { + Logger.warn("Entity type " + string + " is not a valid entity type from the Spigot API!"); + } + return parsedTypes; + } + + public static String getQuestChatProgressionMessage(Objective objective) { + String newString = ""; + if (objective instanceof KillObjective) + newString = killQuestChatProgressionMessage; + else if (objective instanceof CustomFetchObjective) + newString = fetchQuestChatProgressionMessage; + else if (objective instanceof DialogObjective) + newString = dialogQuestChatProgressionMessage; + newString = newString.replace("$name", ChatColor.WHITE + ChatColor.stripColor(objective.getObjectiveName())); + newString = newString.replace("$current", objective.getCurrentAmount() + ""); + newString = newString.replace("$target", objective.getTargetAmount() + ""); + if (!objective.isObjectiveCompleted()) + return newString.replace("$color", ongoingColorCode); + else + return newString.replace("$color", completedColorCode); + } + + public static String getQuestScoreboardProgressionLine(Objective objective) { + String newString = ""; + if (objective instanceof KillObjective) + newString = killQuestScoreboardProgressionLine; + else if (objective instanceof CustomFetchObjective) + newString = fetchQuestScoreboardProgressionLine; + else if (objective instanceof DialogObjective) + newString = dialogQuestScoreboardProgressionLine; + newString = newString.replace("$name", ChatColor.WHITE + ChatColor.stripColor(objective.getObjectiveName())); + newString = newString.replace("$current", objective.getCurrentAmount() + ""); + newString = newString.replace("$target", objective.getTargetAmount() + ""); + if (!objective.isObjectiveCompleted()) + return newString.replace("$color", ongoingColorCode); + else + return newString.replace("$color", completedColorCode); + } + + @Override + public void initializeValues() { requireQuestTurnIn = ConfigurationEngine.setBoolean( List.of("Sets if quests have to be returned to quest givers to complete the quest."), @@ -252,89 +332,5 @@ public static void initializeConfig() { List.of("Sets the maximum amount of characters per item entry in inventory-based menus for quests before creating another item to continue the entry."), fileConfiguration, "itemEntryCharacterLimitBedrockMenu", 300); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - } - - private static List setEntityTypes(FileConfiguration fileConfiguration, File file) { - List entityTypes = new ArrayList<>(Arrays.asList( - EntityType.BLAZE.toString(), - EntityType.CAVE_SPIDER.toString(), - EntityType.DROWNED.toString(), - EntityType.ELDER_GUARDIAN.toString(), - EntityType.ENDERMAN.toString(), - EntityType.ENDERMITE.toString(), - EntityType.EVOKER.toString(), - EntityType.GHAST.toString(), - EntityType.GUARDIAN.toString(), - EntityType.HUSK.toString(), - EntityType.ILLUSIONER.toString(), - EntityType.IRON_GOLEM.toString(), - EntityType.PILLAGER.toString(), - EntityType.RAVAGER.toString(), - EntityType.SILVERFISH.toString(), - EntityType.SKELETON.toString(), - EntityType.SPIDER.toString(), - EntityType.STRAY.toString(), - EntityType.VINDICATOR.toString(), - EntityType.WITCH.toString(), - EntityType.WITHER_SKELETON.toString(), - EntityType.WOLF.toString(), - EntityType.ZOMBIE.toString() - )); - - if (!VersionChecker.serverVersionOlderThan(16, 0)) { - List laterEntities = Arrays.asList( - EntityType.HOGLIN.toString(), - EntityType.ZOGLIN.toString(), - EntityType.PIGLIN_BRUTE.toString(), - EntityType.PIGLIN.toString(), - EntityType.ZOMBIFIED_PIGLIN.toString()); - entityTypes.addAll(laterEntities); - } - - ConfigurationEngine.setList(file, fileConfiguration, "questEntityTypes", entityTypes, false); - - List parsedTypes = new ArrayList<>(); - for (String string : entityTypes) - try { - parsedTypes.add(EntityType.valueOf(string)); - } catch (Exception ex) { - new WarningMessage("Entity type " + string + " is not a valid entity type from the Spigot API!"); - } - return parsedTypes; - } - - public static String getQuestChatProgressionMessage(Objective objective) { - String newString = ""; - if (objective instanceof KillObjective) - newString = killQuestChatProgressionMessage; - else if (objective instanceof CustomFetchObjective) - newString = fetchQuestChatProgressionMessage; - else if (objective instanceof DialogObjective) - newString = dialogQuestChatProgressionMessage; - newString = newString.replace("$name", ChatColor.WHITE + ChatColor.stripColor(objective.getObjectiveName())); - newString = newString.replace("$current", objective.getCurrentAmount() + ""); - newString = newString.replace("$target", objective.getTargetAmount() + ""); - if (!objective.isObjectiveCompleted()) - return newString.replace("$color", ongoingColorCode); - else - return newString.replace("$color", completedColorCode); - } - - public static String getQuestScoreboardProgressionLine(Objective objective) { - String newString = ""; - if (objective instanceof KillObjective) - newString = killQuestScoreboardProgressionLine; - else if (objective instanceof CustomFetchObjective) - newString = fetchQuestScoreboardProgressionLine; - else if (objective instanceof DialogObjective) - newString = dialogQuestScoreboardProgressionLine; - newString = newString.replace("$name", ChatColor.WHITE + ChatColor.stripColor(objective.getObjectiveName())); - newString = newString.replace("$current", objective.getCurrentAmount() + ""); - newString = newString.replace("$target", objective.getTargetAmount() + ""); - if (!objective.isObjectiveCompleted()) - return newString.replace("$color", ongoingColorCode); - else - return newString.replace("$color", completedColorCode); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java deleted file mode 100644 index cdb862561..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.magmaguy.elitemobs.config; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; -import lombok.Getter; -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.scheduler.BukkitRunnable; - -import java.io.File; -import java.io.IOException; -import java.net.URL; - -public class ResourcePackDataConfig { - - @Getter - public static boolean eliteMobsResourcePackEnabled; - @Getter - public static boolean displayCustomMenuUnicodes; - @Getter - public static boolean forceResourcePack; - @Getter - public static String resourcePackPrompt; - @Getter - public static String resourcePackLink; - @Getter - public static byte[] SHA1 = null; - private static File file; - private static FileConfiguration fileConfiguration; - - private ResourcePackDataConfig() { - } - - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("resource_pack_config.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - eliteMobsResourcePackEnabled = ConfigurationEngine.setBoolean(fileConfiguration, "eliteMobsResourcePackEnabled", false); - forceResourcePack = ConfigurationEngine.setBoolean(fileConfiguration, "forceResourcePack", false); - resourcePackPrompt = ConfigurationEngine.setString(file, fileConfiguration, "resourcePackPrompt", "[EliteMobs] The use of the resource pack is highly recommended!", true); - displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; - resourcePackLink = ConfigurationEngine.setString(file, fileConfiguration, "resourcePackLink", "https://www.magmaguy.com/downloads/elitemobs_resource_pack.zip", false); - updateSHA1(); - if (DefaultConfig.isMenuUnicodeFormatting()) displayCustomMenuUnicodes = true; - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - } - - public static void updateSHA1() { - if (!eliteMobsResourcePackEnabled || resourcePackLink == null) return; - new BukkitRunnable() { - @Override - public void run() { - File tempFile = new File("elitemobs_resource_pack.zip"); - try { - FileUtils.copyURLToFile(new URL(resourcePackLink), tempFile); - } catch (IOException e) { - new WarningMessage("[EliteMobs] Failed to get resource pack from https://www.magmaguy.com/downloads/elitemobs_resource_pack.zip ! This might mean the server is down, in which case you will have to host the resource pack on your own! (2)"); - return; - } - try { - SHA1 = ConfigurationExporter.sha1CodeByteArray(tempFile); - } catch (Exception e) { - new WarningMessage("[EliteMobs] Failed to generate your SHA1 key! You will have to do this manually, though this might mean there is a serious problem with the resource pack."); - } - } - }.runTaskAsynchronously(MetadataHandler.PLUGIN); - } - - public static void toggleEliteMobsResourcePackStatus(boolean status) { - fileConfiguration.set("eliteMobsResourcePackEnabled", status); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - eliteMobsResourcePackEnabled = status; - displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; - if (status) { - updateSHA1(); - Bukkit.getOnlinePlayers().forEach(ResourcePackDataConfig::sendResourcePack); - } - } - - public static void toggleForceResourcePack(boolean status){ - fileConfiguration.set("forceResourcePack", status); - forceResourcePack = status; - } - - public static void sendResourcePack(Player player) { - player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); - } - - public static class ResourcePackDataConfigEvents implements Listener { - @EventHandler(priority = EventPriority.MONITOR) - public void onPlayerLogin(PlayerJoinEvent event) { - if (!eliteMobsResourcePackEnabled) return; - if (SHA1 == null) return; - sendResourcePack(event.getPlayer()); - } - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/SchematicsFolderConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SchematicsFolderConfig.java deleted file mode 100644 index 8c6c6fc5c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/SchematicsFolderConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.magmaguy.elitemobs.config; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -public class SchematicsFolderConfig { - private SchematicsFolderConfig() { - } - - public static void initializeConfigs() { - Path configurationsPath = Paths.get(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath()); - if (!Files.isDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "schematics"))) { - try { - Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "schematics")); - } catch (Exception exception) { - new WarningMessage("Failed to create schematics directory! Tell the dev!"); - exception.printStackTrace(); - } - } - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index eb0e8a45d..0e211c4fd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.config; -import org.bukkit.configuration.file.FileConfiguration; +import com.magmaguy.magmacore.config.ConfigurationFile; -import java.io.File; import java.util.List; -public class SoundsConfig { - private SoundsConfig() { - } - +public class SoundsConfig extends ConfigurationFile { public static String treasureChestOpenSound; public static String guildRankUpSound; public static String guildPrestigeSound; @@ -17,39 +13,38 @@ private SoundsConfig() { public static String questAbandonSound; public static String questAcceptSound; - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("Sounds.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public SoundsConfig() { + super("Sounds.yml"); + } + @Override + public void initializeValues() { treasureChestOpenSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a treasure chest opens"), - file, fileConfiguration, "treasureChestOpenSound", "elitemobs_treasure_chest_open", false); + file, fileConfiguration, "treasureChestOpenSound", "elitemobs:treasure_chest.open", false); guildRankUpSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a player ranks up at the guild"), - file, fileConfiguration, "guildRankUpSound", "elitemobs_guild_rankup", false); + file, fileConfiguration, "guildRankUpSound", "elitemobs:guild.rankup", false); guildPrestigeSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a player prestiges at the guild"), - file, fileConfiguration, "guildPrestigeSound", "elitemobs_guild_prestige", false); + file, fileConfiguration, "guildPrestigeSound", "elitemobs:guild.prestige", false); questProgressionSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a player progresses a quest"), - file, fileConfiguration, "questProgressionSound", "elitemobs_quest_progression", false); + file, fileConfiguration, "questProgressionSound", "elitemobs:quest.progression", false); questCompleteSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a player completes a quest"), - file, fileConfiguration, "questCompleteSound", "elitemobs_quest_completion", false); + file, fileConfiguration, "questCompleteSound", "elitemobs:quest.completion", false); questAbandonSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a player abandons a quest"), - file, fileConfiguration, "questAbandonSound", "elitemobs_quest_abandon", false); + file, fileConfiguration, "questAbandonSound", "elitemobs:quest.abandon", false); questAcceptSound = ConfigurationEngine.setString( List.of("Sets the sound that will play when a player accepts a quest"), - file, fileConfiguration, "questAcceptSound", "elitemobs_quest_accept", false); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); + file, fileConfiguration, "questAcceptSound", "elitemobs:quest.accept", false); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index cfdacdc37..536569ffa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -1,16 +1,15 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.HashMap; import java.util.List; -public class SpecialItemSystemsConfig { +public class SpecialItemSystemsConfig extends ConfigurationFile { @Getter private static final HashMap specialValues = new HashMap<>(); @@ -41,11 +40,24 @@ public class SpecialItemSystemsConfig { @Getter private static String challengeAnnouncement; - public static void initializeConfig() { - specialValues.clear(); + public SpecialItemSystemsConfig() { + super("SpecialItemSystems.yml"); + } - File file = ConfigurationEngine.fileCreator("SpecialItemSystems.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + private static void addDefaultEnchantmentBook(FileConfiguration fileConfiguration, String configFilename, double chance) { + String key = "enchantedBookWeightedDropChance." + configFilename; + fileConfiguration.addDefault(key, chance); + CustomItem customItem = CustomItem.getCustomItem(configFilename + ".yml"); + if (customItem == null) { + Logger.warn("Failed to get custom item " + configFilename + ".yml for the special loot list!"); + return; + } + specialValues.put(customItem, fileConfiguration.getDouble(key)); + } + + @Override + public void initializeValues() { + specialValues.clear(); dropSpecialLoot = ConfigurationEngine.setBoolean( List.of("Sets if special loot will drop."), @@ -108,11 +120,10 @@ public static void initializeConfig() { addDefaultEnchantmentBook(fileConfiguration, "elite_scrap_huge", 100); - if (!VersionChecker.serverVersionOlderThan(18, 2)) - fileConfiguration.setComments("enchantedBookWeightedDropChance", - List.of("Sets the chance of a special item dropping over another special item.", - "The higher the value, the higher the chance of that item getting picked over other items.", - "Keep in mind that if values get too high, things with low values will become almost impossible to obtain.")); + fileConfiguration.setComments("enchantedBookWeightedDropChance", + List.of("Sets the chance of a special item dropping over another special item.", + "The higher the value, the higher the chance of that item getting picked over other items.", + "Keep in mind that if values get too high, things with low values will become almost impossible to obtain.")); luckyTicketMultiplier = ConfigurationEngine.setDouble( List.of("Multiplier for the lucky ticket success chance in enchantments. 2.0 = 2x"), @@ -154,17 +165,5 @@ public static void initializeConfig() { List.of("Sets the message announced to all players when losing an item while trying to enchant it if the item has more than 10 enchantments"), file, fileConfiguration, "criticalFailureAnnouncement", "&8[EliteMobs] $player &clost $itemName &cwhile trying to enchant it!", true); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - } - - private static void addDefaultEnchantmentBook(FileConfiguration fileConfiguration, String configFilename, double chance) { - String key = "enchantedBookWeightedDropChance." + configFilename; - fileConfiguration.addDefault(key, chance); - CustomItem customItem = CustomItem.getCustomItem(configFilename + ".yml"); - if (customItem == null) { - new WarningMessage("Failed to get custom item " + configFilename + ".yml for the special loot list!"); - return; - } - specialValues.put(customItem, fileConfiguration.getDouble(key)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java b/src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java deleted file mode 100644 index 4f8778e1b..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.magmaguy.elitemobs.config; - -import org.bukkit.Bukkit; -import org.bukkit.configuration.Configuration; -import org.bukkit.configuration.file.FileConfiguration; - -public class UnusedNodeHandler { - - private UnusedNodeHandler() { - } - - public static Configuration clearNodes(FileConfiguration configuration) { - - for (String actual : configuration.getKeys(false)) { - boolean keyExists = false; - for (String defaults : configuration.getDefaults().getKeys(true)) - if (actual.equals(defaults)) { - keyExists = true; - break; - } - - if (!keyExists) { - configuration.set(actual, null); - Bukkit.getLogger().warning(actual); - Bukkit.getLogger().info("[EliteMobs] Deleting unused config values."); - } - } - return configuration; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java index 9d4cf42ca..fe1a8dc9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -1,32 +1,37 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.ArrayList; import java.util.List; -public class ValidWorldsConfig { +public class ValidWorldsConfig extends ConfigurationFile { @Getter private static final List validWorlds = new ArrayList<>(); @Getter - private static List zoneBasedWorlds = new ArrayList<>(); - @Getter - private static List nightmareWorlds = new ArrayList<>(); - @Getter - private static FileConfiguration fileConfiguration; - private static File file; + private static ValidWorldsConfig instance; + + public ValidWorldsConfig() { + super("ValidWorlds.yml"); + instance = this; + } + + public static void addWorld(String worldName) { + if (instance.fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return; - private ValidWorldsConfig() { + ConfigurationEngine.setBoolean( + List.of("Sets if elites will spawn in this world."), + instance.fileConfiguration, "Valid worlds." + worldName, true); + ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); + validWorlds.add(worldName); } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("ValidWorlds.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @Override + public void initializeValues() { for (World world : Bukkit.getWorlds()) ConfigurationEngine.setBoolean(fileConfiguration, "Valid worlds." + world.getName(), true); @@ -36,30 +41,5 @@ public static void initializeConfig() { for (String key : validWorldsSection.getKeys(false)) if (validWorldsSection.getBoolean(key)) validWorlds.add(key); - - zoneBasedWorlds = ConfigurationEngine.setList( - List.of("Sets the list of zone-based worlds.", - "THE ZONE-BASED GAME MODE IS OUTDATED AND WILL SOON BE REMOVED!"), - file, fileConfiguration, "zoneBasedWorlds", new ArrayList(), false); - nightmareWorlds = ConfigurationEngine.setList( - List.of("Sets the list of nightmare mode worlds.", - "Nightmare mode worlds are a game mode where days are shorter and players can not sleep.", - "Nightmare worlds also have higher amounts of elite spawns.", - "https://github.com/MagmaGuy/EliteMobs/wiki/%5BGame-Mode%5D-Nightmare-mode"), - file, fileConfiguration, "nightmareWorlds", new ArrayList(), false); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - - } - - public static void addWorld(String worldName) { - if (fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return; - - ConfigurationEngine.setBoolean( - List.of("Sets if elites will spawn in this world."), - fileConfiguration, "Valid worlds." + worldName, true); - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); - validWorlds.add(worldName); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java index b2d03f13b..3eb1a4150 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java @@ -1,12 +1,11 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.magmacore.config.ConfigurationFile; import lombok.Getter; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; -public class WormholesConfig { +public class WormholesConfig extends ConfigurationFile { @Getter private static String dungeonNotInstalledMessage; @Getter @@ -18,13 +17,12 @@ public class WormholesConfig { @Getter private static String insufficientCurrencyForWormholeMessage; - private WormholesConfig() { + public WormholesConfig() { + super("Wormholes.yml"); } - public static void initializeConfig() { - File file = ConfigurationEngine.fileCreator("Wormholes.yml"); - FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - + @Override + public void initializeValues() { dungeonNotInstalledMessage = ConfigurationEngine.setString( List.of("Sets the message that appears when a teleport is used for a dungeon that is not installed."), file, fileConfiguration, "dungeonNotInstalledMessage", "&8[EliteMobs] &cDungeon $dungeonID &cis not installed! This teleport will not work.", true); @@ -40,7 +38,5 @@ public static void initializeConfig() { insufficientCurrencyForWormholeMessage = ConfigurationEngine.setString( List.of("Sets the message that is sent when a player tries to use a wormhole but does not have enough currency to use it."), file, fileConfiguration, "insufficientCurrencyForWormholeMessage", "&8[EliteMobs] &cInsufficient currency! You need $amount to use this wormhole!", true); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java index df1ddd05d..ce53ee642 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java @@ -7,14 +7,14 @@ import java.io.File; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class CommandsConfig { - private static final ArrayList commandsConfigFields = new ArrayList<>(Arrays.asList( + private static final ArrayList commandsConfigFields = new ArrayList<>(new ArrayList<>(List.of( new CheckTierConfig(), new CheckTierOthersConfig() - )); + ))); private CommandsConfig() { diff --git a/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java index a2105cdf7..ec86cfb9c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config.customarenas; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.instanced.arena.ArenaInstance; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java index 0ea2b3740..2ae2f1f42 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.customarenas; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.items.customloottable.CustomLootTable; import lombok.Getter; import lombok.Setter; @@ -10,7 +9,7 @@ import java.util.ArrayList; import java.util.List; -public class CustomArenasConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class CustomArenasConfigFields extends CustomConfigFields { @Getter @Setter diff --git a/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java b/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java index 8d30db49d..e8a03f797 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfigFields; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class WoodLeagueArena extends CustomArenasConfigFields { public WoodLeagueArena() { @@ -14,7 +14,7 @@ public WoodLeagueArena() { super.setStartLocation("em_adventurers_guild,219.5,70,295.5,0,0"); super.setExitLocation("em_adventurers_guild,242.5,92,269.5,84,0"); super.setWaveCount(50); - super.setBossList(Arrays.asList( + super.setBossList(new ArrayList<>(List.of( "wave=1:spawnPoint=north:boss=wood_league_wave_1_melee.yml", "wave=1:spawnPoint=north:boss=wood_league_wave_1_melee.yml", "wave=1:spawnPoint=north:boss=wood_league_wave_1_ranged.yml", @@ -613,8 +613,8 @@ public WoodLeagueArena() { "wave=49:spawnPoint=southwest:boss=wood_league_wave_49_healer.yml", "wave=50:spawnPoint=center:boss=wood_league_wave_50_boss.yml" - )); - super.setSpawnPoints(Arrays.asList( + ))); + super.setSpawnPoints(new ArrayList<>(List.of( "name=north:location=em_adventurers_guild,219.5,71,273.5", "name=south:location=em_adventurers_guild,219.5,71,316.5", "name=west:location=em_adventurers_guild,197.5,71,295.5", @@ -623,10 +623,10 @@ public WoodLeagueArena() { "name=northeast:location=em_adventurers_guild,233.5,71,281.5", "name=southeast:location=em_adventurers_guild,233.5,71,309.5", "name=northwest:location=em_adventurers_guild,205.5,71,281.5", - "name=southwest:location=em_adventurers_guild,205.5,71,309.5")); + "name=southwest:location=em_adventurers_guild,205.5,71,309.5"))); super.setDelayBetweenWaves(5); - super.setRawArenaRewards(Arrays.asList( + super.setRawArenaRewards(new ArrayList<>(List.of( "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01", "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01", "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01", @@ -669,56 +669,56 @@ public WoodLeagueArena() { "filename=elite_scrap_large.yml:wave=45:chance=1:amount=5", "filename=elite_scrap_huge.yml:wave=50:chance=1:amount=5", - "currencyAmount=3:wave=1", - "currencyAmount=10:wave=2", - "currencyAmount=20:wave=3", - "currencyAmount=30:wave=4", - "currencyAmount=40:wave=5", - "currencyAmount=50:wave=6", - "currencyAmount=60:wave=7", - "currencyAmount=70:wave=8", - "currencyAmount=80:wave=9", - "currencyAmount=90:wave=10", - "currencyAmount=100:wave=11", - "currencyAmount=110:wave=12", - "currencyAmount=120:wave=13", - "currencyAmount=130:wave=14", - "currencyAmount=140:wave=15", - "currencyAmount=150:wave=16", - "currencyAmount=160:wave=17", - "currencyAmount=170:wave=18", - "currencyAmount=180:wave=19", - "currencyAmount=190:wave=20", - "currencyAmount=200:wave=21", - "currencyAmount=210:wave=22", - "currencyAmount=220:wave=23", - "currencyAmount=230:wave=24", - "currencyAmount=240:wave=25", - "currencyAmount=250:wave=26", - "currencyAmount=260:wave=27", - "currencyAmount=270:wave=28", - "currencyAmount=280:wave=29", - "currencyAmount=290:wave=30", - "currencyAmount=300:wave=31", - "currencyAmount=310:wave=32", - "currencyAmount=320:wave=33", - "currencyAmount=330:wave=34", - "currencyAmount=340:wave=35", - "currencyAmount=350:wave=36", - "currencyAmount=360:wave=37", - "currencyAmount=370:wave=38", - "currencyAmount=380:wave=39", - "currencyAmount=390:wave=40", - "currencyAmount=400:wave=41", - "currencyAmount=410:wave=42", - "currencyAmount=420:wave=43", - "currencyAmount=430:wave=44", - "currencyAmount=450:wave=45", - "currencyAmount=460:wave=46", - "currencyAmount=470:wave=47", - "currencyAmount=480:wave=48", - "currencyAmount=490:wave=49", - "currencyAmount=500:wave=50", + "currencyAmount=2:wave=1", + "currencyAmount=5:wave=2", + "currencyAmount=10:wave=3", + "currencyAmount=15:wave=4", + "currencyAmount=20:wave=5", + "currencyAmount=25:wave=6", + "currencyAmount=30:wave=7", + "currencyAmount=35:wave=8", + "currencyAmount=40:wave=9", + "currencyAmount=45:wave=10", + "currencyAmount=50:wave=11", + "currencyAmount=55:wave=12", + "currencyAmount=60:wave=13", + "currencyAmount=65:wave=14", + "currencyAmount=70:wave=15", + "currencyAmount=75:wave=16", + "currencyAmount=80:wave=17", + "currencyAmount=85:wave=18", + "currencyAmount=90:wave=19", + "currencyAmount=95:wave=20", + "currencyAmount=100:wave=21", + "currencyAmount=105:wave=22", + "currencyAmount=110:wave=23", + "currencyAmount=115:wave=24", + "currencyAmount=120:wave=25", + "currencyAmount=125:wave=26", + "currencyAmount=130:wave=27", + "currencyAmount=135:wave=28", + "currencyAmount=140:wave=29", + "currencyAmount=145:wave=30", + "currencyAmount=150:wave=31", + "currencyAmount=155:wave=32", + "currencyAmount=160:wave=33", + "currencyAmount=165:wave=34", + "currencyAmount=170:wave=35", + "currencyAmount=175:wave=36", + "currencyAmount=180:wave=37", + "currencyAmount=185:wave=38", + "currencyAmount=190:wave=39", + "currencyAmount=195:wave=40", + "currencyAmount=200:wave=41", + "currencyAmount=205:wave=42", + "currencyAmount=210:wave=43", + "currencyAmount=215:wave=44", + "currencyAmount=220:wave=45", + "currencyAmount=225:wave=46", + "currencyAmount=230:wave=47", + "currencyAmount=235:wave=48", + "currencyAmount=240:wave=49", + "currencyAmount=250:wave=50", "level=10:filename=summon_merchant_scroll.yml:wave=10", @@ -754,8 +754,8 @@ public WoodLeagueArena() { "filename=novices_leggings.yml:itemlevel=10:wave=10:chance=0.2", "filename=novices_boots.yml:itemlevel=10:wave=10:chance=0.2" - )); - super.setArenaMessages(new ArrayList<>(Arrays.asList( + ))); + super.setArenaMessages(new ArrayList<>(new ArrayList<>(List.of( "wave=1:message=&8[Gladius] &fToday's main event! A legendary fighter came all the way to the arena to test his might against the toughest monsters from all the land! But before that, here's a rookie fighting some zombies.", "wave=2:message=&8[Gladius] &fWould you look at that, they at least know how to wave their arms! That was just the warmup, let's start putting on some pressure!", "wave=3:message=&8[Gladius] &fSo you think you know how to fight? Well this wave will put the &cheat &fon! Ha ha ha ha ha!", @@ -807,7 +807,7 @@ public WoodLeagueArena() { "wave=49:message=&8[Gladius] &fAlright send all we have left, we have no other options! Move forth, &carchers&f!", "wave=50:message=&8[Gladius] &fI guess this is it for me... I have no option but to declare - wait, who is that in the distance? Is that &4Uther, the Champion of the Wood League Arena&f? Ladies and gentlemen, match set and over, our contestant has no chance of winning here! They shall be &csmitten &fby our champion!", "wave=51:message=&8[Gladius the Destitute] &fUnbelievable, Uther has been defeated! We have a new arena champion! I would be incredibly excited if I wasn't so terribly in debt now!" - ))); + )))); setMaximumPlayerCount(5); setCylindricalArena(true); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java index 2bf77e545..b48e83ecc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config.custombosses; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.ArrayList; import java.util.HashMap; @@ -28,7 +28,7 @@ public CustomBossesConfig() { //Initialize the regional bosses in the world List locations = customBossesConfigFields.processStringList("spawnLocations", new ArrayList<>(), new ArrayList<>(), false); // if (locations.isEmpty() && !customBossesConfigFields.isRemoveAfterDeath()) -// new InfoMessage(customBossesConfigFields.getFilename() + " does not have a set location yet! It will not spawn. Did you install its minidungeon?"); +// Logger.info(customBossesConfigFields.getFilename() + " does not have a set location yet! It will not spawn. Did you install its minidungeon?"); for (String string : locations) InstancedBossEntity.add(string, customBossesConfigFields); continue; @@ -40,7 +40,7 @@ public CustomBossesConfig() { //Initialize the regional bosses in the world List locations = customBossesConfigFields.processStringList("spawnLocations", new ArrayList<>(), new ArrayList<>(), false); // if (locations.isEmpty() && !customBossesConfigFields.isRemoveAfterDeath()) -// new InfoMessage(customBossesConfigFields.getFilename() + " does not have a set location yet! It will not spawn. Did you install its minidungeon?"); +// Logger.info(customBossesConfigFields.getFilename() + " does not have a set location yet! It will not spawn. Did you install its minidungeon?"); for (String string : locations) new RegionalBossEntity(customBossesConfigFields, string).initialize(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index 562146e9d..d8fe6319a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -1,15 +1,15 @@ package com.magmaguy.elitemobs.config.custombosses; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; import com.magmaguy.elitemobs.items.customloottable.CustomLootTable; +import com.magmaguy.elitemobs.mobconstructor.BossType; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; import com.magmaguy.elitemobs.powers.scripts.caching.EliteScriptBlueprint; import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -19,7 +19,7 @@ import java.util.*; -public class CustomBossesConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class CustomBossesConfigFields extends CustomConfigFields { @Getter private static final Map regionalElites = new HashMap<>(); @@ -214,6 +214,10 @@ public class CustomBossesConfigFields extends CustomConfigFields implements Cust private boolean neutral = false; @Getter private String onKillMessage; + @Getter + private BossType bossType = BossType.NORMAL; + @Getter + private double scale = 1D; /** * Creates a new default pre-made Custom Boss. The boss is further customized through a builder pattern. @@ -241,7 +245,7 @@ public String getName() { //This method unifies all level placeholders down to $level and applies a custom level for quest display purposes public String getCleanName(int level) { String cleanNameLevel; - if (level != 0) cleanNameLevel = level + ""; + if (level == 0) cleanNameLevel = level + ""; else cleanNameLevel = this.level; return ChatColorConverter.convert(getName().replace("$level", cleanNameLevel) .replace("$normalLevel", ChatColorConverter.convert("&2[&a" + cleanNameLevel + "&2]&f")) @@ -268,7 +272,7 @@ public int getLevel() { try { return Integer.valueOf(level); } catch (Exception ex) { - new WarningMessage("Regional Elite Mob level for " + getFilename() + " is neither numeric nor dynamic. Fix the configuration for it."); + Logger.warn("Regional Elite Mob level for " + getFilename() + " is neither numeric nor dynamic. Fix the configuration for it."); return 1; } } @@ -280,7 +284,7 @@ public void setOnSpawnBlockStates(List onSpawnBlockStates) { try { fileConfiguration.save(file); } catch (Exception ex) { - new WarningMessage("Failed to save on spawn block states!", true); + Logger.warn("Failed to save on spawn block states!", true); } } @@ -290,7 +294,7 @@ public void setOnRemoveBlockStates(List onRemoveBlockStates) { try { fileConfiguration.save(file); } catch (Exception ex) { - new WarningMessage("Failed to save on remove block states!", true); + Logger.warn("Failed to save on remove block states!", true); } } @@ -300,7 +304,7 @@ public void processConfigFields() { this.entityType = processEnum("entityType", entityType, EntityType.ZOMBIE, EntityType.class, true); if (entityType == null) entityType = EntityType.ZOMBIE; if (EliteMobProperties.getPluginData(entityType) == null) { - new WarningMessage("Failed to get plugin data for entity type " + entityType.toString() + " in file " + filename + " ! Defaulting to zombie."); + Logger.warn("Failed to get plugin data for entity type " + entityType.toString() + " in file " + filename + " ! Defaulting to zombie."); entityType = EntityType.ZOMBIE; } this.instanced = processBoolean("instanced", instanced, false, false); @@ -334,7 +338,7 @@ public void processConfigFields() { this.locationMessage = translatable(filename, "locationMessage", processString("locationMessage", locationMessage, null, false)); this.mountedEntity = processString("mountedEntity", mountedEntity, null, false); if (mountedEntity != null && mountedEntity.equals(filename)) { - new WarningMessage("Custom Boss " + filename + " has itself for a mount. This makes an infinite loop of the boss mounting itself. The boss mount will not be used for safety reasons."); + Logger.warn("Custom Boss " + filename + " has itself for a mount. This makes an infinite loop of the boss mounting itself. The boss mount will not be used for safety reasons."); this.mountedEntity = null; } this.customModelMountPointID = processString("customModelMountPointID", customModelMountPointID, null, false); @@ -382,6 +386,15 @@ public void processConfigFields() { this.onKillMessage = ConfigurationEngine.setString( List.of("Sets the message that is shown when a boss is killed", "Placeholders:", "$player - username of the player the boss killed"), file, fileConfiguration, "onKillMessage", null, true); + + String bossTypeString = ConfigurationEngine.setString(file, fileConfiguration, "bossType", "NORMAL", false); + try { + this.bossType = BossType.valueOf(bossTypeString.toUpperCase(Locale.ROOT)); + } catch (Exception e) { + Logger.warn("Boss type for boss " + filename + " is not a valid boss type!"); + } + + this.scale = processDouble("scale", scale, 1, false); } public boolean isCustomModelExists() { @@ -406,16 +419,16 @@ private HashMap processDamageModifiers(String path, HashMap deserializeDamageModifiers(HashMap damage } protected List majorBossDeathString(String slainLine) { - return Arrays.asList( + return new ArrayList<>(List.of( "&e&l---------------------------------------------", "&4" + slainLine, "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------"); + "&e&l---------------------------------------------")); } public void saveFile() { try { fileConfiguration.save(file); } catch (Exception ex) { - new WarningMessage("Failed to save boss file " + filename + "!"); + Logger.warn("Failed to save boss file " + filename + "!"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP1Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP1Boss.java index 3d1d8db70..3f6402ddc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP1Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP1Boss.java @@ -4,7 +4,7 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -20,28 +20,28 @@ public AlphaWerewolfP1Boss() { setHealthMultiplier(4); setDamageMultiplier(2); setPhases(List.of("alpha_werewolf_p2.yml:0.99")); - setPowers(Arrays.asList("spirit_walk.yml", + setPowers(new ArrayList<>(new ArrayList<>(List.of("spirit_walk.yml", "summonable:summonType=GLOBAL:filename=gamma_werewolf.yml:amount=1:customSpawn=normal_surface_spawn.yml", - "summonable:summonType=GLOBAL:filename=omega_wolf.yml:amount=2:customSpawn=normal_surface_spawn.yml")); + "summonable:summonType=GLOBAL:filename=omega_wolf.yml:amount=2:customSpawn=normal_surface_spawn.yml")))); setSpawnMessage("&cThe howls of an Alpha Werewolf are heard!"); setDeathMessage("&aThe Alpha Werewolf has been stopped by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&4The Alpha Wolf has been put down!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4Dawn breaks, the Alpha Wolf vanishes without a trace!"); setLocationMessage("&7Enraged Vindicator: $distance blocks away!"); - setUniqueLootList(Arrays.asList( + setUniqueLootList(new ArrayList<>(List.of( "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", - "wolfsbane.yml:0.2")); + "wolfsbane.yml:0.2"))); setTrails(Collections.singletonList(Material.BONE.toString())); setAnnouncementPriority(2); HashMap damageModifiers = new HashMap<>(); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP2Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP2Boss.java index 52ea6ac2e..ad9bda686 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP2Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/AlphaWerewolfP2Boss.java @@ -4,9 +4,10 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.List; public class AlphaWerewolfP2Boss extends CustomBossesConfigFields { public AlphaWerewolfP2Boss() { @@ -18,30 +19,30 @@ public AlphaWerewolfP2Boss() { setPersistent(true); setHealthMultiplier(4); setDamageMultiplier(2); - setPowers(Arrays.asList("attack_blinding.yml", "ground_pound.yml", "moonwalk.yml", "spirit_walk.yml", + setPowers(new ArrayList<>(List.of("attack_blinding.yml", "ground_pound.yml", "moonwalk.yml", "spirit_walk.yml", "summonable:summonType=ON_HIT:filename=beta_wolf.yml:amount=5:chance=0.1:inheritAggro=true:spawnNearby=true", "summonable:summonType=ON_HIT:filename=gamma_werewolf.yml:amount=1:chance=0.1:inheritAggro=true:spawnNearby=true", "summonable:summonType=GLOBAL:filename=gamma_werewolf.yml:amount=1:customSpawn=normal_surface_spawn.yml", - "summonable:summonType=GLOBAL:filename=omega_wolf.yml:amount=2:customSpawn=normal_surface_spawn.yml")); + "summonable:summonType=GLOBAL:filename=omega_wolf.yml:amount=2:customSpawn=normal_surface_spawn.yml"))); setSpawnMessage("&cThe howls of an Alpha Werewolf are heard!"); setDeathMessage("&aThe Alpha Werewolf has been stopped by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&4The Alpha Wolf has been put down!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4Dawn breaks, the Alpha Wolf vanishes without a trace!"); setLocationMessage("&7Alpha Wolf: $distance blocks away!"); - setUniqueLootList(Arrays.asList( + setUniqueLootList(new ArrayList<>(List.of( "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", "werewolf_bone.yml:0.2", - "wolfsbane.yml:0.2")); + "wolfsbane.yml:0.2"))); setTrails(Collections.singletonList(Material.BONE.toString())); setDisguise("custom:alpha_werewolf_p2"); setCustomDisguiseData("player alpha_werewolf_p2 setskin {\"id\":\"50f47a40-9557-4ef8-9986-9c97215116e4\",\"name\":\"Unknown\",\"properties\":[{\"name\":\"textures\",\"value\":\"ewogICJ0aW1lc3RhbXAiIDogMTU5NjY5NjY4Njg4OCwKICAicHJvZmlsZUlkIiA6ICIwNmE4NjAyZDAwODk0YWQxOTcyMGQ3NGE1OGU1MDZjZiIsCiAgInByb2ZpbGVOYW1lIiA6ICJfMW5kcmFfIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzU1ZWFhMDlkNDVlMzFhNmM0YzFjYTc3MWNkZWE4ZDlmM2Y2MWJjMTI1MGI5ZTg5NGY3ZmQ1YzIxM2YxOGE0YjUiCiAgICB9CiAgfQp9\",\"signature\":\"psopRAKIS71E2Chl8hKBKXJG6yvtDxP+e0yUY6iDRlPC8M/0Vs+lL1dnArQSKO68PZ6KlaiYRdMhEWHVTdbz3wXniNK8KNi+Aitl3MYXGD7BRfxENJE4GOjyvAYyWgxyU3s2D8gZbBMkrNYBcNI7SvhLUT67libXG0WOUCBLGE29mtRRS74eHEC0P55CoVXJtxksxBr3wM4p55hQepQoDV+zrGmokwNZjgxlNaMP0v6R6LWyBxfwnCTVNRa8PS+YmMtxXkqa9Dl9aDAzit41J455F9Ei/Md4wahZ89pauLzBnWrjlJLriv5yg/pCWBOlUqreLaiN3y+gFmMa1TjI52FMyPn56/GW5U+Eud90nL9I4NignfJzdGgDqjP2e7xcgRvmEb344+97/fTPy721vgsMXMAlEPwQg7HadTCUOpRGn918gGRTbLdZGPRvcZxRKVV6unM1bB25XaRNC5GZtOHRDO61YmX5c5URIy6ectjmhPrw3u6Yx8q/5N5+OIsoADANTUh9decoaCT4Z5T12s6YtsBy7qay3fTt4oVj4pWO3zWvLJ+8NmGKlyX+SHz7xcxXhFOUgXoX7V+5ICN87zn4IsQ7j4Ihn8uSrEbX05tnfBELbQFz7MGULvqwnR2GiEYyVULOB4y1fISoRNNx1TtbtAOMEB3dnKlHgdzkdhM=\"}],\"legacy\":false}"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ArmorGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ArmorGoblinBoss.java index 312eb51f6..edfd3ff93 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ArmorGoblinBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ArmorGoblinBoss.java @@ -5,8 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class ArmorGoblinBoss extends CustomBossesConfigFields { public ArmorGoblinBoss() { @@ -24,28 +25,28 @@ public ArmorGoblinBoss() { setMainHand(new ItemStack(Material.SHIELD)); setOffHand(new ItemStack(Material.SHIELD)); setBaby(true); - setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml")); + setPowers(new ArrayList<>(List.of("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml"))); setSpawnMessage("&cAn Armor Goblin has been sighted!"); setDeathMessage("&aAn Armor Goblin has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Armor Goblin has been pillaged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4An Armor Goblin has escaped!"); setLocationMessage("&cArmor Goblin: $distance blocks away!"); setTrails(Collections.singletonList(Material.GOLD_NUGGET.toString())); setAnnouncementPriority(2); setPersistent(true); - setUniqueLootList(Arrays.asList( + setUniqueLootList(new ArrayList<>(List.of( "goblin_helmet.yml:0.2", "goblin_chestplate.yml:0.2", "goblin_leggings.yml:0.2", "goblin_boots.yml:0.2" - )); + ))); setFollowDistance(100); setCustomModel("em_goblin_armor"); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BalrogConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BalrogConfig.java index d65df6d93..6acb2c3a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BalrogConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BalrogConfig.java @@ -4,8 +4,9 @@ import org.bukkit.Particle; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class BalrogConfig extends CustomBossesConfigFields { public BalrogConfig() { @@ -14,13 +15,13 @@ public BalrogConfig() { true, "$eventBossLevel &4Balrog", "dynamic"); - setPowers(Collections.singletonList("summonable:summonType=ON_HIT:chance=0.5:filename=raug.yml")); + setPowers(new ArrayList<>(List.of("summonable:summonType=ON_HIT:chance=0.5:filename=raug.yml"))); setUniqueLootList(Collections.singletonList("dwarven_greed.yml:1")); - setTrails(Arrays.asList(Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), + setTrails(new ArrayList<>(List.of(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), Particle.FLAME.toString(), - Particle.FLAME.toString())); + Particle.FLAME.toString()))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BeastMasterBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BeastMasterBoss.java index a1851e0b4..c540d426a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BeastMasterBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BeastMasterBoss.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class BeastMasterBoss extends CustomBossesConfigFields { @@ -17,20 +17,20 @@ public BeastMasterBoss() { setDamageMultiplier(2); setSpawnMessage("&cThe Beast Master has been sighted!"); setDeathMessage("&aThe Best Master has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Beast Master has been savaged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4The Beast Master has returned to the wilds!"); setLocationMessage("&cBeast Master: $distance blocks away!"); setAnnouncementPriority(2); setPersistent(true); - setPowers(Arrays.asList("attack_poison.yml", "ground_pound.yml", "bonus_loot.yml", - "summonable:summonType=ON_HIT:filename=wild_wolf.yml:spawnNearby=true:inheritAggro=true:inheritLevel=true:chance=0.2")); + setPowers(new ArrayList<>(List.of("attack_poison.yml", "ground_pound.yml", "bonus_loot.yml", + "summonable:summonType=ON_HIT:filename=wild_wolf.yml:spawnNearby=true:inheritAggro=true:inheritLevel=true:chance=0.2"))); setUniqueLootList(List.of("summon_wolf_scroll.yml:1")); setFollowDistance(100); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BetaWolfBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BetaWolfBoss.java index 571772bc9..b14794688 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BetaWolfBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BetaWolfBoss.java @@ -4,6 +4,7 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -18,7 +19,7 @@ public BetaWolfBoss() { setDropsVanillaLoot(false); setHealthMultiplier(0.5); setDamageMultiplier(0.5); - setPowers(List.of("attack_poison.yml")); + setPowers(new ArrayList<>(List.of("attack_poison.yml"))); HashMap damageModifiers = new HashMap<>(); damageModifiers.put(Material.IRON_SWORD, 2D); damageModifiers.put(Material.IRON_AXE, 2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BlayyzeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BlayyzeConfig.java index 9df51d807..ad8e7c33a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BlayyzeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BlayyzeConfig.java @@ -4,7 +4,7 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -19,17 +19,17 @@ public BlayyzeConfig() { setPersistent(true); setHealthMultiplier(4); setDamageMultiplier(2); - setPowers(Arrays.asList("meteor_shower.yml", "summon_embers.yml", "bullet_hell.yml", "spirit_walk.yml")); + setPowers(new ArrayList<>(List.of("meteor_shower.yml", "summon_embers.yml", "bullet_hell.yml", "spirit_walk.yml"))); setSpawnMessage("&cSomething came out of the meteorite's crater..."); setDeathMessage("&6$players completed first contact."); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&6The Blayyze has been repelled!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&6The ayyliens have been taken to area 51!"); setLocationMessage("&6????: $distance blocks away"); setUniqueLootList(List.of("meteor_shower_scroll.yml:1")); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CharmsGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CharmsGoblinBoss.java index 0c036c8d3..f55390d06 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CharmsGoblinBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CharmsGoblinBoss.java @@ -5,8 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class CharmsGoblinBoss extends CustomBossesConfigFields { public CharmsGoblinBoss() { @@ -22,23 +23,23 @@ public CharmsGoblinBoss() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setBaby(true); - setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml")); + setPowers(new ArrayList<>(List.of("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml"))); setSpawnMessage("&cA Charms Goblin has been sighted!"); setDeathMessage("&aA Charms Goblin has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Charms Goblin has been pillaged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4A Charms Goblin has escaped!"); setLocationMessage("&cCharms Goblin: $distance blocks away!"); setTrails(Collections.singletonList(Material.GOLD_NUGGET.toString())); setAnnouncementPriority(2); setPersistent(true); - setUniqueLootList(Arrays.asList( + setUniqueLootList(new ArrayList<>(List.of( "berserker_charm.yml:0.2", "chameleon_charm.yml:0.2", "cheetah_charm.yml:0.2", @@ -52,7 +53,7 @@ public CharmsGoblinBoss() { "scorpion_charm.yml:0.2", "shulker_charm.yml:0.2", "slowpoke_charm.yml:0.2", - "vampiric_charm.yml:0.2")); + "vampiric_charm.yml:0.2"))); setFollowDistance(100); setCustomModel("em_goblin_charms"); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CoinsGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CoinsGoblinBoss.java index b09930d34..0f6e84b3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CoinsGoblinBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/CoinsGoblinBoss.java @@ -5,8 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class CoinsGoblinBoss extends CustomBossesConfigFields { public CoinsGoblinBoss() { @@ -22,17 +23,17 @@ public CoinsGoblinBoss() { setLeggings(new ItemStack(Material.GOLDEN_LEGGINGS)); setBoots(new ItemStack(Material.GOLDEN_BOOTS)); setBaby(true); - setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml", "bonus_coins.yml:20")); + setPowers(new ArrayList<>(List.of("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml", "bonus_coins.yml:20"))); setSpawnMessage("&cA Coins Goblin has been sighted!"); setDeathMessage("&aA Coins Goblin has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Coins Goblin has been pillaged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4A Coins Goblin has escaped!"); setLocationMessage("&cCoins Goblin: $distance blocks away!"); setTrails(Collections.singletonList(Material.GOLD_NUGGET.toString())); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/EmberConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/EmberConfig.java index 0da41f50c..5be146775 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/EmberConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/EmberConfig.java @@ -16,6 +16,6 @@ public EmberConfig() { setHealthMultiplier(0.3); setDamageMultiplier(0.3); setDropsEliteMobsLoot(false); - setTrails(Collections.singletonList(Particle.SPELL_WITCH.toString())); + setTrails(Collections.singletonList(Particle.WITCH.toString())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/FireFaeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/FireFaeConfig.java index 417e3f396..78af5a281 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/FireFaeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/FireFaeConfig.java @@ -4,7 +4,9 @@ import org.bukkit.Particle; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class FireFaeConfig extends CustomBossesConfigFields { public FireFaeConfig() { @@ -15,7 +17,7 @@ public FireFaeConfig() { "dynamic"); setHealthMultiplier(0.3); setDamageMultiplier(0.3); - setPowers(Collections.singletonList("attack_fire.yml")); + setPowers(new ArrayList<>(List.of("attack_fire.yml"))); setUniqueLootList(Collections.singletonList("the_feller.yml:0.3")); setTrails(Collections.singletonList(Particle.FLAME.toString())); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/GamaWerewolfBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/GamaWerewolfBoss.java index f6b5b6568..a6e53ef41 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/GamaWerewolfBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/GamaWerewolfBoss.java @@ -4,8 +4,9 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; public class GamaWerewolfBoss extends CustomBossesConfigFields { public GamaWerewolfBoss() { @@ -16,8 +17,8 @@ public GamaWerewolfBoss() { "dynamic"); setHealthMultiplier(1.5); setDamageMultiplier(1.5); - setPowers(Arrays.asList("ground_pound.yml", - "summonable:summonType=ON_COMBAT_ENTER:filename=omega_wolf.yml:amount=2:inheritAggro=true:spawnNearby=true")); + setPowers(new ArrayList<>(List.of("ground_pound.yml", + "summonable:summonType=ON_COMBAT_ENTER:filename=omega_wolf.yml:amount=2:inheritAggro=true:spawnNearby=true"))); setDisguise("custom:gamma_werewolf"); setCustomDisguiseData("player gamma_werewolf setskin {\"id\":\"5f5fff79-687e-46ad-8020-e618a6ec8871\",\"name\":\"Unknown\",\"properties\":[{\"name\":\"textures\",\"value\":\"ewogICJ0aW1lc3RhbXAiIDogMTYyNzE4OTcxMTA4MCwKICAicHJvZmlsZUlkIiA6ICJkMGFkNThjOTNiMzY0ZjgyOWRjZWEzMTAzMzE5MTgyMSIsCiAgInByb2ZpbGVOYW1lIiA6ICJfU2FwcGhpcmVfTHVuYV8iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjgxZjRmMGRiNWUzZDQzYmU2ZWMwNzE3Njc0MDMxN2Y4ZTQxZWJiNjU0YzYwZTU4MzVhZGYyMzE5MzUzMTE3IgogICAgfQogIH0KfQ==\",\"signature\":\"d9XXwZOzBUfoV04rV2XOoSRI1GYolEe2ABeNXL8Yft56L+ci/tzM+DWya9yzTjP1cS4wQ1B23rAX2CQfcSC9HF/LPTtwzE+gmGt0EVGH+S3jvcXPl/Vb2igfK6LmINqhjpqEIhvF8NePF3oZ01S6Bwc46v1SMRQ3LpWC9cPPrIeVc48RrpsxknQVzszuKHeiDv3H1x4pdhpR3EdLlAPMyapijio1yjYCRgxd9TWN/4EcbtKTWy2AeEwU/eATYiNFYcFPdOQ3FGjiveUkeq8dGGe8huZvFCNcSizuws70HaIQrJceosRfnwiuJUBUVkYS9cPCVmV+dDOBOCYt7falct2wuHQWFXcD6e9Umqts26lzLbccDY0VQnb9k32Ip/6m95v8sg7AP1OcEN9PNrD5MV+p+CSkzfqfoS2nDcBg69hhi6DYqPBzlqVmDAdRJs2MX5kQoYwM5Zqi6LJDWqVNkNixc/MBnzkS92PcG93cd6eMPjE6p4gWRLoU9hbuUo+6xxh4vItBJj+65UgRvVk48fJJSEKn61be8Jhp6nuhmJ4AUYfGcBun9Q0Wn7py+YsBAZs6Abt3+Nr56V7dOxhiR2hINmhklZVOsiv5UDTzlWhpUe0yBjp92ELfzt7mbLzv5he6SUaxK1OytYchA8nJbTEZnsLpOiXaJs+wKgz1u9s=\"}],\"legacy\":false}"); HashMap damageModifiers = new HashMap<>(); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/IceFaeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/IceFaeConfig.java index 2b767ac61..28d5e26b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/IceFaeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/IceFaeConfig.java @@ -4,7 +4,9 @@ import org.bukkit.Particle; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class IceFaeConfig extends CustomBossesConfigFields { public IceFaeConfig() { @@ -15,8 +17,8 @@ public IceFaeConfig() { "dynamic"); setHealthMultiplier(0.3); setDamageMultiplier(0.3); - setPowers(Collections.singletonList("attack_freeze.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml"))); setUniqueLootList(Collections.singletonList("the_feller.yml:0.3")); - setTrails(Collections.singletonList(Particle.WATER_DROP.toString())); + setTrails(Collections.singletonList(Particle.DRIPPING_WATER.toString())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ImperialBeeGuardConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ImperialBeeGuardConfig.java index 516d01f5f..72d2eb3ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ImperialBeeGuardConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ImperialBeeGuardConfig.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Particle; import org.bukkit.entity.EntityType; @@ -10,16 +9,14 @@ public class ImperialBeeGuardConfig extends CustomBossesConfigFields { public ImperialBeeGuardConfig() { super("imperial_bee_guard", - EntityType.ZOMBIE, + EntityType.BEE, true, "$reinforcementLevel &eImperial Bee Soldier", "dynamic"); - if (!VersionChecker.serverVersionOlderThan(15, 0)) - setEntityType(EntityType.BEE); setDropsEliteMobsLoot(false); setDropsVanillaLoot(false); setHealthMultiplier(0.1); setDamageMultiplier(0.1); - setTrails(Collections.singletonList(Particle.SMOKE_LARGE.toString())); + setTrails(Collections.singletonList(Particle.LARGE_SMOKE.toString())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KillerRabbitOfCaerbannogConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KillerRabbitOfCaerbannogConfig.java index 087ddf7cb..5b426195e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KillerRabbitOfCaerbannogConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KillerRabbitOfCaerbannogConfig.java @@ -4,8 +4,9 @@ import org.bukkit.Particle; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class KillerRabbitOfCaerbannogConfig extends CustomBossesConfigFields { public KillerRabbitOfCaerbannogConfig() { @@ -15,11 +16,11 @@ public KillerRabbitOfCaerbannogConfig() { "$eventBossLevel &cKiller Rabbit of Caerbannog", "dynamic"); setUniqueLootList(Collections.singletonList("rabbit_charm.yml:1")); - setTrails(Arrays.asList(Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), + setTrails(new ArrayList<>(List.of(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), Particle.FLAME.toString(), - Particle.FLAME.toString())); + Particle.FLAME.toString()))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KrakenConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KrakenConfig.java index 8da023946..1ff299231 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KrakenConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/KrakenConfig.java @@ -4,8 +4,9 @@ import org.bukkit.Particle; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class KrakenConfig extends CustomBossesConfigFields { public KrakenConfig() { @@ -15,11 +16,11 @@ public KrakenConfig() { "$eventBossLevel &3Kraken", "dynamic"); setUniqueLootList(Collections.singletonList("rod_of_the_depths.yml:1")); - setTrails(Arrays.asList(Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), + setTrails(new ArrayList<>(List.of(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), Particle.FLAME.toString(), - Particle.FLAME.toString())); + Particle.FLAME.toString()))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/LightningFaeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/LightningFaeConfig.java index aef9045bd..ae13646cc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/LightningFaeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/LightningFaeConfig.java @@ -4,7 +4,9 @@ import org.bukkit.Particle; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class LightningFaeConfig extends CustomBossesConfigFields { public LightningFaeConfig() { @@ -15,8 +17,8 @@ public LightningFaeConfig() { "dynamic"); setHealthMultiplier(0.3); setDamageMultiplier(0.3); - setPowers(Collections.singletonList("attack_lightning.yml")); + setPowers(new ArrayList<>(List.of("attack_lightning.yml"))); setUniqueLootList(Collections.singletonList("the_feller.yml:0.3")); - setTrails(Collections.singletonList(Particle.SPELL.toString())); + setTrails(Collections.singletonList(Particle.WITCH.toString())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/OmegaWolfBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/OmegaWolfBoss.java index 325dce764..9ff9e1291 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/OmegaWolfBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/OmegaWolfBoss.java @@ -4,8 +4,9 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; public class OmegaWolfBoss extends CustomBossesConfigFields { public OmegaWolfBoss() { @@ -14,7 +15,7 @@ public OmegaWolfBoss() { true, "$reinforcementLevel &7Omega Wolf", "dynamic"); - setPowers(Arrays.asList("attack_poison.yml", "moonwalk.yml")); + setPowers(new ArrayList<>(List.of("attack_poison.yml", "moonwalk.yml"))); HashMap damageModifiers = new HashMap<>(); damageModifiers.put(Material.IRON_SWORD, 2D); damageModifiers.put(Material.IRON_AXE, 2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanBeastBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanBeastBoss.java index 17cf4ba3e..a96597f33 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanBeastBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanBeastBoss.java @@ -3,6 +3,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.List; public class PillagerCaravanBeastBoss extends CustomBossesConfigFields { @@ -15,6 +16,6 @@ public PillagerCaravanBeastBoss() { setDropsEliteMobsLoot(false); setDropsVanillaLoot(false); setFollowDistance(100); - setPowers(List.of("attack_confusing.yml")); + setPowers(new ArrayList<>(List.of("attack_confusing.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanGuardBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanGuardBoss.java index 1f2661d4b..4253cd683 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanGuardBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanGuardBoss.java @@ -3,6 +3,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.List; public class PillagerCaravanGuardBoss extends CustomBossesConfigFields { @@ -16,6 +17,6 @@ public PillagerCaravanGuardBoss() { setDropsVanillaLoot(false); setMountedEntity("pillager_caravan_beast.yml"); setFollowDistance(100); - setPowers(List.of("attack_poison.yml")); + setPowers(new ArrayList<>(List.of("attack_poison.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanLeaderBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanLeaderBoss.java index 0545a68e8..2cebc1792 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanLeaderBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/PillagerCaravanLeaderBoss.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class PillagerCaravanLeaderBoss extends CustomBossesConfigFields { public PillagerCaravanLeaderBoss() { @@ -13,18 +14,18 @@ public PillagerCaravanLeaderBoss() { "$eventBossLevel &cPillager Caravan Leader", "dynamic"); setPersistent(true); - setPowers(Arrays.asList("bonus_loot.yml", "arrow_fireworks.yml", "arrow_rain.yml", + setPowers(new ArrayList<>(List.of("bonus_loot.yml", "arrow_fireworks.yml", "arrow_rain.yml", "summonable:summonType=ON_COMBAT_ENTER:filename=pillager_caravan_guard.yml:spawnNearby=true:inheritLevel=true", - "summonable:summonType=ON_COMBAT_ENTER:filename=pillager_caravan_guard.yml:spawnNearby=true:inheritLevel=true")); + "summonable:summonType=ON_COMBAT_ENTER:filename=pillager_caravan_guard.yml:spawnNearby=true:inheritLevel=true"))); setMountedEntity("pillager_caravan_beast.yml"); setFollowDistance(100); setDamageMultiplier(2); setHealthMultiplier(2); - setUniqueLootList(Arrays.asList("summon_merchant_scroll.yml:0.5", + setUniqueLootList(new ArrayList<>(List.of("summon_merchant_scroll.yml:0.5", "summon_merchant_scroll.yml:0.5", "summon_merchant_scroll.yml:0.5", "summon_merchant_scroll.yml:0.5", - "summon_merchant_scroll.yml:0.5")); + "summon_merchant_scroll.yml:0.5"))); setSpawnMessage("&cA pillager caravan has been sighted!"); majorBossDeathString("The pillager caravan has been vanquished!"); setLocationMessage("&cPillager Caravan: $distance blocks away!"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/QueenBeeBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/QueenBeeBoss.java index 488589cba..8155fa69e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/QueenBeeBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/QueenBeeBoss.java @@ -1,29 +1,27 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Particle; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class QueenBeeBoss extends CustomBossesConfigFields { public QueenBeeBoss() { super("queen_bee", - EntityType.ZOMBIE, + EntityType.BEE, true, "$eventBossLevel &6Queen Bee", "dynamic"); - if (!VersionChecker.serverVersionOlderThan(15, 0)) - setEntityType(EntityType.BEE); - setPowers(Collections.singletonList("summonable:summonType=ON_HIT:chance=0.5:filename=imperial_bee_guard.yml")); + setPowers(new ArrayList<>(List.of("summonable:summonType=ON_HIT:chance=0.5:filename=imperial_bee_guard.yml"))); setUniqueLootList(Collections.singletonList("the_stinger.yml:1")); - setTrails(Arrays.asList(Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), - Particle.SMOKE_LARGE.toString(), + setTrails(new ArrayList<>(List.of(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), Particle.FLAME.toString(), - Particle.FLAME.toString())); + Particle.FLAME.toString()))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/RaugConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/RaugConfig.java index 157ae3c93..02850bb2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/RaugConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/RaugConfig.java @@ -15,6 +15,6 @@ public RaugConfig() { "dynamic"); setHealthMultiplier(0.1); setDamageMultiplier(0.1); - setTrails(Collections.singletonList(Particle.SMOKE_LARGE.toString())); + setTrails(Collections.singletonList(Particle.LARGE_SMOKE.toString())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/SnoopyConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/SnoopyConfig.java index 0298c6212..8dd2fb819 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/SnoopyConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/SnoopyConfig.java @@ -4,7 +4,9 @@ import org.bukkit.Material; import org.bukkit.entity.EntityType; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; /** * In the loving memory of Snoopy, the best boy @@ -21,7 +23,7 @@ public SnoopyConfig() { setTimeout(3); setHealthMultiplier(10); setDamageMultiplier(2); - setPowers(Collections.singletonList("invulnerability_fire.yml")); + setPowers(new ArrayList<>(List.of("invulnerability_fire.yml"))); setDropsVanillaLoot(false); setDropsEliteMobsLoot(false); setTrails(Collections.singletonList(Material.BONE.toString())); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TestCustomBossesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TestCustomBossesConfig.java index 8c2547e81..4ec3d37c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TestCustomBossesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TestCustomBossesConfig.java @@ -1,14 +1,14 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class TestCustomBossesConfig extends CustomBossesConfigFields { public TestCustomBossesConfig() { @@ -26,25 +26,24 @@ public TestCustomBossesConfig() { setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); setMainHand(new ItemStack(Material.GOLDEN_AXE)); setOffHand(new ItemStack(Material.SHIELD)); - setPowers(Collections.singletonList("invulnerability_knockback.yml")); + setPowers(new ArrayList<>(List.of("invulnerability_knockback.yml"))); setSpawnMessage("A test boss has been spawned!"); setDeathMessage("A test boss has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Test Boss has been debugged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("A test boss entity has escaped!"); setLocationMessage("Test entity: $distance"); setUniqueLootList(Collections.singletonList("magmaguys_toothpick.yml:1")); - if (!VersionChecker.serverVersionOlderThan(18, 0)) - setTrails(Collections.singletonList(Particle.BLOCK_MARKER.toString())); + setTrails(Collections.singletonList(Particle.BLOCK_MARKER.toString())); setOnDamageMessages(Collections.singletonList("I've hit you!")); setOnDamagedMessages(Collections.singletonList("I've been hit!")); - setOnDeathCommands(Collections.singletonList("broadcast $players has killed $name! That was level $level!")); + setOnDeathCommands(Collections.singletonList("say $players has killed $name! That was level $level!")); setAnnouncementPriority(3); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TheLivingDeadConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TheLivingDeadConfig.java index f494ae5d2..d1ba9ca78 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TheLivingDeadConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TheLivingDeadConfig.java @@ -1,11 +1,12 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TheLivingDeadConfig extends CustomBossesConfigFields { public TheLivingDeadConfig() { @@ -18,7 +19,7 @@ public TheLivingDeadConfig() { setChestplate(ItemStackGenerator.generateItemStack(Material.CHAINMAIL_CHESTPLATE)); setLeggings(ItemStackGenerator.generateItemStack(Material.CHAINMAIL_LEGGINGS)); setBoots(ItemStackGenerator.generateItemStack(Material.CHAINMAIL_BOOTS)); - setPowers(Arrays.asList("attack_fire.yml", "corpse.yml", "ground_pound.yml")); + setPowers(new ArrayList<>(List.of("attack_fire.yml", "corpse.yml", "ground_pound.yml"))); setFollowDistance(100); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie1Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie1Boss.java index ea777cb8e..756347a8b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie1Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie1Boss.java @@ -1,28 +1,26 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TotemZombie1Boss extends CustomBossesConfigFields { public TotemZombie1Boss() { super("totem_zombie_1", EntityType.ZOMBIE, true, "$eventBossLevel Head Zombie", "dynamic"); setPersistent(true); setMountedEntity("totem_zombie_2.yml"); - setPowers(Arrays.asList("skeleton_tracking_arrow.yml", "attack_fireball.yml", "hyper_loot.yml")); + setPowers(new ArrayList<>(List.of("skeleton_tracking_arrow.yml", "attack_fireball.yml", "hyper_loot.yml"))); setCullReinforcements(false); setFollowDistance(100); - if (!VersionChecker.serverVersionOlderThan(16, 0)) { - setHelmet(new ItemStack(Material.NETHERITE_HELMET)); - setChestplate(new ItemStack(Material.NETHERITE_CHESTPLATE)); - setLeggings(new ItemStack(Material.NETHERITE_LEGGINGS)); - setBoots(new ItemStack(Material.NETHERITE_BOOTS)); - setMainHand(new ItemStack(Material.NETHERITE_SWORD)); - } + setHelmet(new ItemStack(Material.NETHERITE_HELMET)); + setChestplate(new ItemStack(Material.NETHERITE_CHESTPLATE)); + setLeggings(new ItemStack(Material.NETHERITE_LEGGINGS)); + setBoots(new ItemStack(Material.NETHERITE_BOOTS)); + setMainHand(new ItemStack(Material.NETHERITE_SWORD)); setDamageMultiplier(2); setHealthMultiplier(2); setSpawnMessage("&cA Dr. Craftenmine abomination has been sighted!"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie2Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie2Boss.java index b488fe0db..26e003c86 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie2Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie2Boss.java @@ -5,13 +5,14 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TotemZombie2Boss extends CustomBossesConfigFields { public TotemZombie2Boss() { super("totem_zombie_2", EntityType.ZOMBIE, true, "$eventBossLevel Totem Zombie", "dynamic"); setMountedEntity("totem_zombie_3.yml"); - setPowers(Arrays.asList("arrow_rain.yml", "attack_arrow.yml", "bonus_loot.yml")); + setPowers(new ArrayList<>(List.of("arrow_rain.yml", "attack_arrow.yml", "bonus_loot.yml"))); setCullReinforcements(false); setFollowDistance(100); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie3Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie3Boss.java index 5d88cd999..ac4d193e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie3Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie3Boss.java @@ -5,13 +5,14 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TotemZombie3Boss extends CustomBossesConfigFields { public TotemZombie3Boss() { super("totem_zombie_3", EntityType.ZOMBIE, true, "$eventBossLevel Totem Zombie", "dynamic"); setMountedEntity("totem_zombie_4.yml"); - setPowers(Arrays.asList("attack_lightning.yml", "attack_web.yml", "bonus_loot.yml")); + setPowers(new ArrayList<>(List.of("attack_lightning.yml", "attack_web.yml", "bonus_loot.yml"))); setCullReinforcements(false); setFollowDistance(100); setHelmet(new ItemStack(Material.IRON_HELMET)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie4Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie4Boss.java index 3a89d3c59..9f8feb388 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie4Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie4Boss.java @@ -5,13 +5,14 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TotemZombie4Boss extends CustomBossesConfigFields { public TotemZombie4Boss() { super("totem_zombie_4", EntityType.ZOMBIE, true, "$eventBossLevel Totem Zombie", "dynamic"); setMountedEntity("totem_zombie_5.yml"); - setPowers(Arrays.asList("attack_push.yml", "attack_poison.yml", "bonus_loot.yml")); + setPowers(new ArrayList<>(List.of("attack_push.yml", "attack_poison.yml", "bonus_loot.yml"))); setCullReinforcements(false); setFollowDistance(100); setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie5Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie5Boss.java index e23732afe..02e6d1d91 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie5Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie5Boss.java @@ -5,13 +5,14 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TotemZombie5Boss extends CustomBossesConfigFields { public TotemZombie5Boss() { super("totem_zombie_5", EntityType.ZOMBIE, true, "$eventBossLevel Totem Zombie", "dynamic"); setMountedEntity("totem_zombie_6.yml"); - setPowers(Arrays.asList("attack_gravity.yml", "attack_blinding.yml", "bonus_loot.yml")); + setPowers(new ArrayList<>(List.of("attack_gravity.yml", "attack_blinding.yml", "bonus_loot.yml"))); setCullReinforcements(false); setFollowDistance(100); setHelmet(new ItemStack(Material.LEATHER_HELMET)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie6Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie6Boss.java index db144bf24..016300fb4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie6Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie6Boss.java @@ -5,14 +5,15 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TotemZombie6Boss extends CustomBossesConfigFields { public TotemZombie6Boss() { super("totem_zombie_6", EntityType.ZOMBIE, true, "$eventBossLevel Totem Zombie", "dynamic"); setBaby(true); setHelmet(new ItemStack(Material.LEATHER_HELMET)); - setPowers(Arrays.asList("attack_wither.yml", "bonus_loot.yml")); + setPowers(new ArrayList<>(List.of(("attack_wither.yml"), "bonus_loot.yml"))); setCullReinforcements(false); setFollowDistance(100); setDamageMultiplier(1.5); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TreasureGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TreasureGoblinBoss.java index 0f6dc1bfa..1824bf945 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TreasureGoblinBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TreasureGoblinBoss.java @@ -5,8 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class TreasureGoblinBoss extends CustomBossesConfigFields { public TreasureGoblinBoss() { @@ -22,17 +23,17 @@ public TreasureGoblinBoss() { setLeggings(new ItemStack(Material.GOLDEN_LEGGINGS)); setBoots(new ItemStack(Material.GOLDEN_BOOTS)); setBaby(true); - setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml", "hyper_loot.yml", "spirit_walk.yml")); + setPowers(new ArrayList<>(List.of("gold_explosion.yml", "gold_shotgun.yml", "hyper_loot.yml", "spirit_walk.yml"))); setSpawnMessage("&cA Treasure Goblin has been sighted!"); setDeathMessage("&aA Treasure Goblin has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Treasure Goblin has been pillaged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4A Treasure Goblin has escaped!"); setLocationMessage("&cTreasure Goblin: $distance blocks away!"); setTrails(Collections.singletonList(Material.GOLD_NUGGET.toString())); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WeaponsGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WeaponsGoblinBoss.java index e8e873678..e6154206b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WeaponsGoblinBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WeaponsGoblinBoss.java @@ -1,13 +1,13 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class WeaponsGoblinBoss extends CustomBossesConfigFields { public WeaponsGoblinBoss() { @@ -18,37 +18,35 @@ public WeaponsGoblinBoss() { "dynamic"); setHealthMultiplier(4); setDamageMultiplier(2); - if (!VersionChecker.serverVersionOlderThan(16, 0)) { - setHelmet(new ItemStack(Material.NETHERITE_HELMET)); - setChestplate(new ItemStack(Material.NETHERITE_CHESTPLATE)); - setLeggings(new ItemStack(Material.NETHERITE_LEGGINGS)); - setBoots(new ItemStack(Material.NETHERITE_BOOTS)); - setMainHand(new ItemStack(Material.NETHERITE_SWORD)); - setOffHand(new ItemStack(Material.NETHERITE_AXE)); - } + setHelmet(new ItemStack(Material.NETHERITE_HELMET)); + setChestplate(new ItemStack(Material.NETHERITE_CHESTPLATE)); + setLeggings(new ItemStack(Material.NETHERITE_LEGGINGS)); + setBoots(new ItemStack(Material.NETHERITE_BOOTS)); + setMainHand(new ItemStack(Material.NETHERITE_SWORD)); + setOffHand(new ItemStack(Material.NETHERITE_AXE)); setBaby(true); - setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml")); + setPowers(new ArrayList<>(List.of("gold_explosion.yml", "gold_shotgun.yml", "spirit_walk.yml"))); setSpawnMessage("&cA Weapons Goblin has been sighted!"); setDeathMessage("&aA Weapons Goblin has been slain by $players!"); - setDeathMessages(Arrays.asList( + setDeathMessages(new ArrayList<>(List.of( "&e&l---------------------------------------------", "&eThe Weapons Goblin has been pillaged!", "&c&l 1st Damager: $damager1name &cwith $damager1damage damage!", "&6&l 2nd Damager: $damager2name &6with $damager2damage damage!", "&e&l 3rd Damager: $damager3name &ewith $damager3damage damage!", "&aSlayers: $players", - "&e&l---------------------------------------------")); + "&e&l---------------------------------------------"))); setEscapeMessage("&4A Weapons Goblin has escaped!"); setLocationMessage("&cWeapons Goblin: $distance blocks away!"); setTrails(Collections.singletonList(Material.GOLD_NUGGET.toString())); setAnnouncementPriority(2); setPersistent(true); - setUniqueLootList(Arrays.asList( + setUniqueLootList(new ArrayList<>(List.of( "goblin_slasher.yml:0.2", "goblin_cleaver.yml:0.2", "goblin_poker.yml:0.2", "goblin_shooter.yml:0.2", - "goblin_ballista.yml:0.2")); + "goblin_ballista.yml:0.2"))); setFollowDistance(100); setCustomModel("em_goblin_weapon"); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Boss.java index f5072d0f8..d4192e19f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Boss.java @@ -1,11 +1,10 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave10Boss extends CustomBossesConfigFields { public WoodLeagueWave10Boss() { @@ -15,9 +14,9 @@ public WoodLeagueWave10Boss() { "$bossLevel &4Bad Doggo", "10"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); - setPowers(Arrays.asList("ground_pound.yml", - "summonable:summonType=ON_HIT:filename=wood_league_wave_10_reinforcement.yml:amount=2:chance=0.1:inheritAggro=true:spawnNearby=true")); + + setPowers(new ArrayList<>(List.of("ground_pound.yml", + "summonable:summonType=ON_HIT:filename=wood_league_wave_10_reinforcement.yml:amount=2:chance=0.1:inheritAggro=true:spawnNearby=true"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(5D); setDamageMultiplier(2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Reinforcement.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Reinforcement.java index fe27274cf..cf76b3d74 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Reinforcement.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave10Reinforcement.java @@ -1,9 +1,7 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; public class WoodLeagueWave10Reinforcement extends CustomBossesConfigFields { public WoodLeagueWave10Reinforcement() { @@ -13,7 +11,7 @@ public WoodLeagueWave10Reinforcement() { "$reinforcementLevel &cBad Pupper", "10"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMovementSpeedAttribute(0.6D); setHealthMultiplier(0.25D); setDamageMultiplier(0.8D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Melee.java index 202cfd53f..6bc097692 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave11Melee extends CustomBossesConfigFields { @@ -15,7 +14,7 @@ public WoodLeagueWave11Melee() { "$normalLevel &4Arena Zombie", "11"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml"))); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Ranged.java index 5e9cde46c..20d6a4fe4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave11Ranged extends CustomBossesConfigFields { @@ -15,8 +16,8 @@ public WoodLeagueWave11Ranged() { "$normalLevel Arena Crossbowman", "11"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("attack_vacuum.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Melee.java index 328c38745..6a8588b06 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave12Melee extends CustomBossesConfigFields { @@ -15,7 +14,7 @@ public WoodLeagueWave12Melee() { "$normalLevel &4Arena Zombie", "12"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml"))); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Ranged.java index 844b9a5c5..3a2ccbf59 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave12Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave12Ranged extends CustomBossesConfigFields { @@ -15,8 +16,8 @@ public WoodLeagueWave12Ranged() { "$normalLevel Arena Crossbowman", "12"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("attack_vacuum.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Melee.java index 65f03c419..713d8c092 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Melee.java @@ -1,11 +1,10 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave13Melee extends CustomBossesConfigFields { public WoodLeagueWave13Melee() { @@ -15,7 +14,7 @@ public WoodLeagueWave13Melee() { "$normalLevel &4Arena Zombie", "13"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_poison.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_poison.yml"))); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Ranged.java index 742d2b1c6..06760236f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave13Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave13Ranged extends CustomBossesConfigFields { public WoodLeagueWave13Ranged() { @@ -15,8 +16,8 @@ public WoodLeagueWave13Ranged() { "$normalLevel Arena Crossbowman", "13"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "attack_poison.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "attack_poison.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Melee.java index 34bbd1853..196ea187f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave14Melee extends CustomBossesConfigFields { @@ -15,7 +14,7 @@ public WoodLeagueWave14Melee() { "$normalLevel &4Arena Zombie", "14"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml"))); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Ranged.java index 5e622e3e3..b91bd881e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave14Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave14Ranged extends CustomBossesConfigFields { @@ -15,8 +16,8 @@ public WoodLeagueWave14Ranged() { "$normalLevel Arena Crossbowman", "14"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("attack_vacuum.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave15Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave15Miniboss.java index 2d6f67b7e..ba0dbc68e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave15Miniboss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave15Miniboss.java @@ -1,26 +1,21 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave15Miniboss extends CustomBossesConfigFields { public WoodLeagueWave15Miniboss() { super("wood_league_wave_15_miniboss", - EntityType.ZOMBIE, + EntityType.ZOGLIN, true, "$bossLevel &4Mr. Oinkers", "15"); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setEntityType(EntityType.ZOGLIN); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); - setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml")); + + setPowers(new ArrayList<>(List.of("gold_explosion.yml", "gold_shotgun.yml"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(3D); setDamageMultiplier(2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Melee.java index 0e6a1fa50..a1e0be91d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave16Melee extends CustomBossesConfigFields { @@ -15,8 +14,7 @@ public WoodLeagueWave16Melee() { "$normalLevel Mr. Oinkers Fan", "16"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml"))); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Ranged.java index 990a028c7..c6948b752 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave16Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave16Ranged extends CustomBossesConfigFields { @@ -15,9 +16,9 @@ public WoodLeagueWave16Ranged() { "$normalLevel Mr. Oinkers Fan", "16"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("attack_vacuum.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml"))); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Melee.java index 08352ce6a..ed925b7ab 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Melee.java @@ -1,11 +1,10 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave17Melee extends CustomBossesConfigFields { public WoodLeagueWave17Melee() { @@ -15,7 +14,7 @@ public WoodLeagueWave17Melee() { "$normalLevel &4Arena Zombie", "17"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml"))); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Ranged.java index 22b37404e..38050f2d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave17Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave17Ranged extends CustomBossesConfigFields { public WoodLeagueWave17Ranged() { @@ -15,8 +16,8 @@ public WoodLeagueWave17Ranged() { "$normalLevel Arena Crossbowman", "17"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave18Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave18Melee.java index 29390cd18..a44a7fbc4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave18Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave18Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave18Melee extends CustomBossesConfigFields { public WoodLeagueWave18Melee() { @@ -15,8 +16,7 @@ public WoodLeagueWave18Melee() { "$normalLevel &4Fencing Club Enthusiast", "18"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml"))); setMainHand(new ItemStack(Material.DIAMOND_SWORD)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave19Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave19Ranged.java index e44152402..5fe608210 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave19Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave19Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave19Ranged extends CustomBossesConfigFields { public WoodLeagueWave19Ranged() { @@ -15,8 +16,8 @@ public WoodLeagueWave19Ranged() { "$normalLevel Archery Club Enthusiast", "19"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Melee.java index 3f7d94bc3..b20f52daa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Melee.java @@ -1,9 +1,7 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; public class WoodLeagueWave1Melee extends CustomBossesConfigFields { public WoodLeagueWave1Melee() { @@ -13,6 +11,6 @@ public WoodLeagueWave1Melee() { "$normalLevel Arena Zombie", "1"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Ranged.java index e36f37e66..7b6a9a6ea 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave1Ranged.java @@ -14,6 +14,6 @@ public WoodLeagueWave1Ranged() { "1"); setMainHand(new ItemStack(Material.CROSSBOW)); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave20Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave20Boss.java index c906365db..e4a9bf1cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave20Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave20Boss.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave20Boss extends CustomBossesConfigFields { public WoodLeagueWave20Boss() { @@ -21,7 +23,7 @@ public WoodLeagueWave20Boss() { setBoots(new ItemStack(Material.GOLDEN_BOOTS)); setMainHand(new ItemStack(Material.GOLDEN_AXE)); setOffHand(new ItemStack(Material.BOW)); - setPowers(Arrays.asList("skeleton_tracking_arrow.yml", "zombie_bloat.yml", "shield_wall.yml", "bullet_hell.yml")); + setPowers(new ArrayList<>(List.of("skeleton_tracking_arrow.yml", "zombie_bloat.yml", "shield_wall.yml", "bullet_hell.yml"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(5D); setDamageMultiplier(2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Melee.java index df8c3585e..93a88dd9a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave21Melee extends CustomBossesConfigFields { public WoodLeagueWave21Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave21Melee() { "$normalLevel &4Arena Zombie", "21"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Ranged.java index 8d7a4f590..75573f0a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave21Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave21Ranged extends CustomBossesConfigFields { public WoodLeagueWave21Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave21Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Melee.java index 29dd427f8..f15daf5bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave22Melee extends CustomBossesConfigFields { public WoodLeagueWave22Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave22Melee() { "$normalLevel &4Arena Zombie", "22"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Ranged.java index 59b57b117..a16a0fbba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave22Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave22Ranged extends CustomBossesConfigFields { public WoodLeagueWave22Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave22Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Melee.java index 5e284ebd0..2bdc87613 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave23Melee extends CustomBossesConfigFields { public WoodLeagueWave23Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave23Melee() { "$normalLevel &4Arena Zombie", "23"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "attack_wither.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "attack_wither.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Ranged.java index df1e388d7..0b4fcc092 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave23Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave23Ranged extends CustomBossesConfigFields { public WoodLeagueWave23Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave23Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml", "attack_wither.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml", "attack_wither.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Melee.java index 1dc924493..e5fbde528 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave24Melee extends CustomBossesConfigFields { public WoodLeagueWave24Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave24Melee() { "$normalLevel &4Arena Zombie", "24"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Ranged.java index 427f0c5ba..96c97685b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave24Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave24Ranged extends CustomBossesConfigFields { public WoodLeagueWave24Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave24Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave25Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave25Miniboss.java index e654ae8b5..8316510bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave25Miniboss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave25Miniboss.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave25Miniboss extends CustomBossesConfigFields { public WoodLeagueWave25Miniboss() { @@ -14,7 +16,7 @@ public WoodLeagueWave25Miniboss() { true, "$minibossLevel &bAgdluak", "25"); - setPowers(Arrays.asList("frost_cone.yml", "attack_freeze.yml", "arrow_rain.yml")); + setPowers(new ArrayList<>(List.of("frost_cone.yml", "attack_freeze.yml", "arrow_rain.yml"))); setHealthMultiplier(3D); setDamageMultiplier(2D); setFollowDistance(60); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Melee.java index 316d31740..bd07d5414 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave26Melee extends CustomBossesConfigFields { public WoodLeagueWave26Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave26Melee() { "$normalLevel &4Arena Zombie", "26"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Ranged.java index f3612188b..58745f173 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave26Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave26Ranged extends CustomBossesConfigFields { public WoodLeagueWave26Ranged() { @@ -20,7 +22,7 @@ public WoodLeagueWave26Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_vacuum.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml", "skeleton_tracking_arrow.yml"))); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Melee.java index f3973aa1f..e3782544a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave27Melee extends CustomBossesConfigFields { public WoodLeagueWave27Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave27Melee() { "$normalLevel &4Arena Zombie", "27"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Ranged.java index 619d327af..da7c31f94 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave27Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave27Ranged extends CustomBossesConfigFields { public WoodLeagueWave27Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave27Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave28Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave28Melee.java index 3e8db708d..79dd3a530 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave28Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave28Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave28Melee extends CustomBossesConfigFields { public WoodLeagueWave28Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave28Melee() { "$normalLevel &4Arena Zombie", "28"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.LEATHER_HELMET)); setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave29Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave29Ranged.java index 9f36aef1f..96427706f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave29Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave29Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave29Ranged extends CustomBossesConfigFields { public WoodLeagueWave29Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave29Ranged() { setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Melee.java index db1e9aae7..47e54f286 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Melee.java @@ -1,9 +1,7 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; public class WoodLeagueWave2Melee extends CustomBossesConfigFields { public WoodLeagueWave2Melee() { @@ -13,6 +11,6 @@ public WoodLeagueWave2Melee() { "$normalLevel Arena Zombie", "2"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Ranged.java index 7a6de403e..a24e15ea6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave2Ranged.java @@ -14,6 +14,6 @@ public WoodLeagueWave2Ranged() { "2"); setMainHand(new ItemStack(Material.CROSSBOW)); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave30Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave30Boss.java index c1279015a..5de90d62d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave30Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave30Boss.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave30Boss extends CustomBossesConfigFields { public WoodLeagueWave30Boss() { @@ -21,7 +23,7 @@ public WoodLeagueWave30Boss() { setBoots(new ItemStack(Material.LEATHER_BOOTS)); setMainHand(new ItemStack(Material.BOW)); setOffHand(new ItemStack(Material.TOTEM_OF_UNDYING)); - setPowers(Arrays.asList("attack_fire.yml", "attack_poison.yml", "shield_wall.yml", "attack_wither.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_fire.yml", "attack_poison.yml", "shield_wall.yml", "attack_wither.yml", "skeleton_tracking_arrow.yml"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(5D); setDamageMultiplier(2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Melee.java index 25722a095..7053513f6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave31Melee extends CustomBossesConfigFields { public WoodLeagueWave31Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave31Melee() { "$normalLevel &4Arena Zombie", "31"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Ranged.java index a67b5f71d..be6a3d8de 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave31Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave31Ranged extends CustomBossesConfigFields { public WoodLeagueWave31Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave31Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Melee.java index 7f4085386..ac4e141ca 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave32Melee extends CustomBossesConfigFields { public WoodLeagueWave32Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave32Melee() { "$normalLevel &4Arena Zombie", "32"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Ranged.java index efb5554f3..0ecaf5b19 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave32Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave32Ranged extends CustomBossesConfigFields { public WoodLeagueWave32Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave32Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Melee.java index f5d89f12d..42893d29c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave33Melee extends CustomBossesConfigFields { public WoodLeagueWave33Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave33Melee() { "$normalLevel &4Arena Zombie", "33"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml", "attack_poison.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml", "attack_poison.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Ranged.java index bda46cacd..233883e29 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave33Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave33Ranged extends CustomBossesConfigFields { public WoodLeagueWave33Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave33Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "attack_blinding.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "attack_blinding.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Melee.java index d4466a26b..66d985adf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave34Melee extends CustomBossesConfigFields { public WoodLeagueWave34Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave34Melee() { "$normalLevel &4Arena Zombie", "34"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Ranged.java index 3fbab85c6..5240114cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave34Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave34Ranged extends CustomBossesConfigFields { public WoodLeagueWave34Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave34Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave35Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave35Miniboss.java index 973776512..2fabd52ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave35Miniboss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave35Miniboss.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave35Miniboss extends CustomBossesConfigFields { public WoodLeagueWave35Miniboss() { @@ -14,7 +16,7 @@ public WoodLeagueWave35Miniboss() { true, "$minibossLevel &6The Jester", "35"); - setPowers(Arrays.asList("attack_confusing.yml", "attack_push.yml", "attack_gravity.yml", "fireworks_barrage.yml", "arrow_fireworks.yml")); + setPowers(new ArrayList<>(List.of("attack_confusing.yml", "attack_push.yml", "attack_gravity.yml", "fireworks_barrage.yml", "arrow_fireworks.yml"))); setHealthMultiplier(3D); setDamageMultiplier(2D); setFollowDistance(60); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Melee.java index 4ecb8944f..ab69d8b08 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave36Melee extends CustomBossesConfigFields { public WoodLeagueWave36Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave36Melee() { "$normalLevel &4Arena Zombie", "36"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Ranged.java index 6ed8e1879..c4f042f25 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave36Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave36Ranged extends CustomBossesConfigFields { public WoodLeagueWave36Ranged() { @@ -20,7 +22,7 @@ public WoodLeagueWave36Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml"))); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Melee.java index e0ef7b6da..0355da1bb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave37Melee extends CustomBossesConfigFields { public WoodLeagueWave37Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave37Melee() { "$normalLevel &4Arena Zombie", "37"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Ranged.java index 580356f65..1c0266826 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave37Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave37Ranged extends CustomBossesConfigFields { public WoodLeagueWave37Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave37Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave38Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave38Melee.java index 6191e2a7e..94ba133e3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave38Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave38Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave38Melee extends CustomBossesConfigFields { public WoodLeagueWave38Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave38Melee() { "$normalLevel &4Arena Swordsman", "38"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.IRON_HELMET)); setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); setLeggings(new ItemStack(Material.IRON_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave39Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave39Ranged.java index f2bfe755b..25ab6c108 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave39Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave39Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave39Ranged extends CustomBossesConfigFields { public WoodLeagueWave39Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave39Ranged() { setLeggings(new ItemStack(Material.IRON_LEGGINGS)); setBoots(new ItemStack(Material.IRON_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Melee.java index 0eba16db7..f803211a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave3Melee extends CustomBossesConfigFields { @@ -14,8 +13,8 @@ public WoodLeagueWave3Melee() { true, "$normalLevel Arena Zombie", "3"); - setPowers(List.of("attack_fire.yml")); + setPowers(new ArrayList<>(List.of("attack_fire.yml"))); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Ranged.java index acd53368d..f64c5357a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave3Ranged extends CustomBossesConfigFields { @@ -16,6 +17,6 @@ public WoodLeagueWave3Ranged() { "3"); setMainHand(new ItemStack(Material.CROSSBOW)); setFollowDistance(60); - setPowers(List.of("attack_fire.yml")); + setPowers(new ArrayList<>(List.of("attack_fire.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave40Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave40Boss.java index 35570973c..51b85f17f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave40Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave40Boss.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave40Boss extends CustomBossesConfigFields { public WoodLeagueWave40Boss() { @@ -21,7 +23,7 @@ public WoodLeagueWave40Boss() { setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.DIAMOND_SWORD)); setOffHand(new ItemStack(Material.SHIELD)); - setPowers(Arrays.asList("attack_wither.yml", "attack_poison.yml", "shield_wall.yml", "bullet_hell.yml", "skeleton_tracking_arrow.yml", "flame_pyre.yml")); + setPowers(new ArrayList<>(List.of("attack_wither.yml", "attack_poison.yml", "shield_wall.yml", "bullet_hell.yml", "skeleton_tracking_arrow.yml", "flame_pyre.yml"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(5D); setDamageMultiplier(2D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Melee.java index 08e6ee121..eef118f96 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Melee.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave41Melee extends CustomBossesConfigFields { public WoodLeagueWave41Melee() { @@ -15,7 +17,7 @@ public WoodLeagueWave41Melee() { "$normalLevel &4Arena Zombie", "41"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Ranged.java index 31abe94cb..13b1ffbee 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave41Ranged.java @@ -5,7 +5,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class WoodLeagueWave41Ranged extends CustomBossesConfigFields { public WoodLeagueWave41Ranged() { @@ -20,6 +22,6 @@ public WoodLeagueWave41Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Healer.java index 6d787a4d5..78cc5a456 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave42Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave42Healer() { "42"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setHealthMultiplier(.5D); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Melee.java index 5197d5306..ac410b316 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave42Melee extends CustomBossesConfigFields { public WoodLeagueWave42Melee() { @@ -15,7 +16,7 @@ public WoodLeagueWave42Melee() { "$normalLevel &4Arena Zombie", "42"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Ranged.java index 2847f787b..56385d9d1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave42Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave42Ranged extends CustomBossesConfigFields { public WoodLeagueWave42Ranged() { @@ -20,6 +21,6 @@ public WoodLeagueWave42Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Healer.java index a8050e356..81507655c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave43Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave43Healer() { "43"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setHealthMultiplier(.5D); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Melee.java index 6e3db17b7..55498f3ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave43Melee extends CustomBossesConfigFields { public WoodLeagueWave43Melee() { @@ -15,7 +16,7 @@ public WoodLeagueWave43Melee() { "$normalLevel &4Arena Zombie", "43"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml", "attack_poison.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml", "attack_poison.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Ranged.java index 4a735200b..2edca9c83 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave43Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave43Ranged extends CustomBossesConfigFields { public WoodLeagueWave43Ranged() { @@ -20,6 +21,6 @@ public WoodLeagueWave43Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml", "attack_wither.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml", "attack_wither.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Healer.java index c4b527986..8355fa282 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave44Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave44Healer() { "44"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setHealthMultiplier(.5D); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Melee.java index 9c3d21aae..f710abe90 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave44Melee extends CustomBossesConfigFields { public WoodLeagueWave44Melee() { @@ -15,7 +16,7 @@ public WoodLeagueWave44Melee() { "$normalLevel &4Arena Zombie", "44"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Ranged.java index 08db31686..9aca81908 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave44Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave44Ranged extends CustomBossesConfigFields { public WoodLeagueWave44Ranged() { @@ -20,6 +21,6 @@ public WoodLeagueWave44Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave45Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave45Miniboss.java index 7eab794b1..cc62aebe8 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave45Miniboss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave45Miniboss.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave45Miniboss extends CustomBossesConfigFields { public WoodLeagueWave45Miniboss() { @@ -14,7 +15,7 @@ public WoodLeagueWave45Miniboss() { true, "$minibossLevel &6Thousand Blades", "45"); - setPowers(Arrays.asList("attack_arrow.yml", "arrow_rain.yml", "arrow_fireworks.yml", "attack_fireball.yml", "bullet_hell.yml", "meteor_shower.yml")); + setPowers(new ArrayList<>(List.of("attack_arrow.yml", "arrow_rain.yml", "arrow_fireworks.yml", "attack_fireball.yml", "bullet_hell.yml", "meteor_shower.yml"))); setHealthMultiplier(3D); setDamageMultiplier(2D); setFollowDistance(60); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Healer.java index 6dd2f5b86..25ced2418 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave46Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave46Healer() { "46"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); setHealthMultiplier(.5D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Melee.java index 3f049cf96..a804e01ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave46Melee extends CustomBossesConfigFields { public WoodLeagueWave46Melee() { @@ -15,7 +16,7 @@ public WoodLeagueWave46Melee() { "$normalLevel &4Arena Zombie", "46"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Ranged.java index cb681cba0..9325c74dc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave46Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave46Ranged extends CustomBossesConfigFields { public WoodLeagueWave46Ranged() { @@ -20,7 +21,7 @@ public WoodLeagueWave46Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Healer.java index 8c06e9803..0935104c8 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave47Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave47Healer() { "47"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setHealthMultiplier(.5D); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Melee.java index f857e3690..10a902c1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave47Melee extends CustomBossesConfigFields { public WoodLeagueWave47Melee() { @@ -15,7 +16,7 @@ public WoodLeagueWave47Melee() { "$normalLevel &4Arena Zombie", "47"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Ranged.java index 703a2c7ec..bcfcc5e15 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave47Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave47Ranged extends CustomBossesConfigFields { public WoodLeagueWave47Ranged() { @@ -20,6 +21,6 @@ public WoodLeagueWave47Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Healer.java index 74a6c2c30..a9c8c7175 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave48Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave48Healer() { "48"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setHealthMultiplier(.5D); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Melee.java index e9d587d32..4a82ca2d7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave48Melee.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave48Melee extends CustomBossesConfigFields { public WoodLeagueWave48Melee() { @@ -15,7 +16,7 @@ public WoodLeagueWave48Melee() { "$normalLevel &4Arena Zombie", "48"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml")); + setPowers(new ArrayList<>(List.of("corpse.yml", "attack_fire.yml", "invulnerability_arrow.yml"))); setHelmet(new ItemStack(Material.DIAMOND_HELMET)); setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Healer.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Healer.java index 48c83dc55..82047ad8d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Healer.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Healer.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave49Healer extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave49Healer() { "49"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setHealthMultiplier(.5D); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Ranged.java index eb615d45d..45d6dd3f1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave49Ranged.java @@ -5,7 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave49Ranged extends CustomBossesConfigFields { public WoodLeagueWave49Ranged() { @@ -20,6 +21,6 @@ public WoodLeagueWave49Ranged() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(Arrays.asList("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml")); + setPowers(new ArrayList<>(List.of("attack_freeze.yml", "skeleton_tracking_arrow.yml", "shield_wall.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Melee.java index 9a2b86e83..4cfbc05f1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Melee.java @@ -1,9 +1,7 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; public class WoodLeagueWave4Melee extends CustomBossesConfigFields { public WoodLeagueWave4Melee() { @@ -13,6 +11,6 @@ public WoodLeagueWave4Melee() { "$normalLevel Arena Zombie", "4"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Ranged.java index b4f41d01f..35009171b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave4Ranged.java @@ -14,6 +14,6 @@ public WoodLeagueWave4Ranged() { "4"); setMainHand(new ItemStack(Material.CROSSBOW)); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Boss.java index da8e52355..746e236e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Boss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Boss.java @@ -1,13 +1,12 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class WoodLeagueWave50Boss extends CustomBossesConfigFields { public WoodLeagueWave50Boss() { @@ -17,20 +16,19 @@ public WoodLeagueWave50Boss() { "$bossLevel &6Uther the Champion", "50"); setFollowDistance(60); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMainHand(new ItemStack(Material.NETHERITE_AXE)); + setMainHand(new ItemStack(Material.NETHERITE_AXE)); setOffHand(new ItemStack(Material.SHIELD)); - setPowers(Arrays.asList("ground_pound.yml", + setPowers(new ArrayList<>(List.of("ground_pound.yml", "shield_wall.yml", "bullet_hell.yml", "arrow_fireworks.yml", "fireworks_barrage.yml", - "summonable:summonType=ON_COMBAT_ENTER:filename=wood_league_wave_50_reinforcement.yml:amount=2")); + "summonable:summonType=ON_COMBAT_ENTER:filename=wood_league_wave_50_reinforcement.yml:amount=2"))); setMovementSpeedAttribute(0.4D); setHealthMultiplier(10D); setDamageMultiplier(1D); - setPhases(new ArrayList<>(Arrays.asList( + setPhases(new ArrayList<>(new ArrayList<>(List.of( "wood_league_wave_50_boss_p2.yml:0.66", - "wood_league_wave_50_boss_p3.yml:0.33"))); + "wood_league_wave_50_boss_p3.yml:0.33")))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP2.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP2.java index 2d100a413..f06687790 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP2.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP2.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave50BossP2 extends CustomBossesConfigFields { public WoodLeagueWave50BossP2() { @@ -16,15 +16,14 @@ public WoodLeagueWave50BossP2() { "$bossLevel &6Uther the Champion", "50"); setFollowDistance(60); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMainHand(new ItemStack(Material.NETHERITE_AXE)); + setMainHand(new ItemStack(Material.NETHERITE_AXE)); setOffHand(new ItemStack(Material.SHIELD)); - setPowers(Arrays.asList("firestorm.yml", + setPowers(new ArrayList<>(List.of("firestorm.yml", "flame_pyre.yml", "flamethrower.yml", "death_slice.yml", "firestorm.yml", - "summonable:summonType=ON_COMBAT_ENTER:filename=wood_league_wave_50_reinforcement.yml:amount=2")); + "summonable:summonType=ON_COMBAT_ENTER:filename=wood_league_wave_50_reinforcement.yml:amount=2"))); setMovementSpeedAttribute(0.5D); setHealthMultiplier(10D); setDamageMultiplier(1D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP3.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP3.java index 509637fa4..c895ecebf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP3.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50BossP3.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WoodLeagueWave50BossP3 extends CustomBossesConfigFields { public WoodLeagueWave50BossP3() { @@ -16,15 +16,14 @@ public WoodLeagueWave50BossP3() { "$bossLevel &6Uther the Champion", "50"); setFollowDistance(60); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMainHand(new ItemStack(Material.NETHERITE_AXE)); + setMainHand(new ItemStack(Material.NETHERITE_AXE)); setOffHand(new ItemStack(Material.SHIELD)); - setPowers(Arrays.asList("attack_lightning.yml", + setPowers(new ArrayList<>(List.of("attack_lightning.yml", "lightning_bolts.yml", "gold_explosion.yml", "photon_ray.yml", "thunderstorm.yml", - "summonable:summonType=ON_COMBAT_ENTER:filename=wood_league_wave_50_reinforcement.yml:amount=2")); + "summonable:summonType=ON_COMBAT_ENTER:filename=wood_league_wave_50_reinforcement.yml:amount=2"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(10D); setDamageMultiplier(1D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Reinforcement.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Reinforcement.java index fc9788911..147a71fa2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Reinforcement.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Reinforcement.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave50Reinforcement extends CustomBossesConfigFields { @@ -16,7 +17,7 @@ public WoodLeagueWave50Reinforcement() { "50"); setFollowDistance(60); setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("channel_healing.yml")); + setPowers(new ArrayList<>(List.of("channel_healing.yml"))); setMovementSpeedAttribute(0.6D); setHealthMultiplier(0.25D); setDamageMultiplier(0.8D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave5Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave5Miniboss.java index 8cb3d863e..ab27a49aa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave5Miniboss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave5Miniboss.java @@ -1,11 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave5Miniboss extends CustomBossesConfigFields { @@ -15,12 +13,12 @@ public WoodLeagueWave5Miniboss() { true, "$minibossLevel &cWeird Cow", "5"); - setPowers(Arrays.asList("attack_push.yml", "attack_gravity.yml")); + setPowers(new ArrayList<>(List.of("attack_push.yml", "attack_gravity.yml"))); setOnDamagedMessages(List.of("Woof!")); setHealthMultiplier(3D); setDamageMultiplier(2D); setFollowDistance(60); setMovementSpeedAttribute(0.6D); - setHelmet(new ItemStack(Material.STICK)); + } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Melee.java index 84a7c18f1..a0fd5cd6a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Melee.java @@ -1,9 +1,7 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; public class WoodLeagueWave6Melee extends CustomBossesConfigFields { public WoodLeagueWave6Melee() { @@ -13,7 +11,7 @@ public WoodLeagueWave6Melee() { "$normalLevel Arena Zombie", "6"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Ranged.java index a4521366d..a4d562b6a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave6Ranged.java @@ -13,7 +13,7 @@ public WoodLeagueWave6Ranged() { "$normalLevel Arena Crossbowman", "6"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setDamageMultiplier(0.5D); setHealthMultiplier(0.75D); diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Melee.java index c8f83e6b9..3df50aa28 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave7Melee extends CustomBossesConfigFields { @@ -15,7 +14,6 @@ public WoodLeagueWave7Melee() { "$normalLevel Arena Zombie", "7"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Ranged.java index a818134b0..70e402b58 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave7Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave7Ranged extends CustomBossesConfigFields { @@ -15,8 +16,8 @@ public WoodLeagueWave7Ranged() { "$normalLevel Arena Crossbowman", "7"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("attack_vacuum.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave8Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave8Melee.java index 7c4920ad2..14f9540a2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave8Melee.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave8Melee.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.config.custombosses.premade; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import org.bukkit.Material; import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave8Melee extends CustomBossesConfigFields { @@ -15,7 +14,7 @@ public WoodLeagueWave8Melee() { "$normalLevel Arena Zombie", "8"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + setPowers(new ArrayList<>(List.of("corpse.yml"))); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave9Ranged.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave9Ranged.java index 6881f9ab9..7e1fd96e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave9Ranged.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave9Ranged.java @@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.ArrayList; import java.util.List; public class WoodLeagueWave9Ranged extends CustomBossesConfigFields { @@ -15,8 +16,8 @@ public WoodLeagueWave9Ranged() { "$normalLevel Arena Crossbowman", "9"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); - setPowers(List.of("attack_vacuum.yml")); + setPowers(new ArrayList<>(List.of("attack_vacuum.yml"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ZombieKingBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ZombieKingBoss.java index 9cc6e5231..0c5b98ef8 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ZombieKingBoss.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/ZombieKingBoss.java @@ -6,8 +6,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class ZombieKingBoss extends CustomBossesConfigFields { public ZombieKingBoss() { @@ -24,8 +25,8 @@ public ZombieKingBoss() { setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); setBoots(new ItemStack(Material.DIAMOND_BOOTS)); setMainHand(new ItemStack(Material.GOLDEN_AXE)); - setPowers(Arrays.asList("flame_pyre.yml", "flamethrower.yml", "summon_the_returned.yml", "spirit_walk.yml", - "summonable:summonType=GLOBAL:filename=the_living_dead.yml:amount=5:customSpawn=normal_surface_spawn.yml")); + setPowers(new ArrayList<>(List.of("flame_pyre.yml", "flamethrower.yml", "summon_the_returned.yml", "spirit_walk.yml", + "summonable:summonType=GLOBAL:filename=the_living_dead.yml:amount=5:customSpawn=normal_surface_spawn.yml"))); setSpawnMessage("&cThe Zombie King has been sighted!"); setDeathMessage("&aThe Zombie King has been slain by $players!"); majorBossDeathString("The Zombie King has been slain!"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfig.java index b839953b2..721728f5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfig.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.config.customevents; -import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfigFields.java index 7494a2bff..40bd8614d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customevents/CustomEventsConfigFields.java @@ -1,9 +1,8 @@ package com.magmaguy.elitemobs.config.customevents; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.events.CustomEvent; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -11,7 +10,7 @@ import java.util.ArrayList; import java.util.List; -public class CustomEventsConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class CustomEventsConfigFields extends CustomConfigFields { @Getter @Setter @@ -74,7 +73,7 @@ public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, true, true); this.eventType = processEnum("eventType", eventType, CustomEvent.EventType.DEFAULT, CustomEvent.EventType.class, true); if (eventType == CustomEvent.EventType.DEFAULT) { - new WarningMessage("Failed to determine a valid event type for " + filename + " ! This event will not be registered."); + Logger.warn("Failed to determine a valid event type for " + filename + " ! This event will not be registered."); return; } this.bossFilenames = processStringList("bossFilenames", bossFilenames, new ArrayList<>(), true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/BalrogEvent.java b/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/BalrogEvent.java index 761b5b9d3..072da3e09 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/BalrogEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/BalrogEvent.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.events.CustomEvent; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class BalrogEvent extends CustomEventsConfigFields { @@ -14,8 +14,8 @@ public BalrogEvent() { setEventType(CustomEvent.EventType.BREAK_BLOCK); setBossFilenames(List.of("balrog.yml")); setChance(0.001); - setBreakableMaterials(Arrays.asList(Material.COAL_ORE, Material.IRON_ORE, Material.GOLD_ORE, Material.LAPIS_ORE, - Material.DIAMOND_ORE, Material.EMERALD_ORE, Material.REDSTONE_ORE)); + setBreakableMaterials(new ArrayList<>(List.of(Material.COAL_ORE, Material.IRON_ORE, Material.GOLD_ORE, Material.LAPIS_ORE, + Material.DIAMOND_ORE, Material.EMERALD_ORE, Material.REDSTONE_ORE))); setEventDuration(20); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/FaeEvent.java b/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/FaeEvent.java index ad659e0dc..8fdceff5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/FaeEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/FaeEvent.java @@ -4,17 +4,18 @@ import com.magmaguy.elitemobs.events.CustomEvent; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class FaeEvent extends CustomEventsConfigFields { public FaeEvent() { super("fae", true); setEventType(CustomEvent.EventType.BREAK_BLOCK); - setBossFilenames(Arrays.asList("fire_fae.yml", "ice_fae.yml", "lightning_fae.yml")); + setBossFilenames(new ArrayList<>(List.of("fire_fae.yml", "ice_fae.yml", "lightning_fae.yml"))); setChance(0.001); - setBreakableMaterials(Arrays.asList(Material.BIRCH_LOG, Material.ACACIA_LOG, Material.DARK_OAK_LOG, - Material.OAK_LOG, Material.SPRUCE_LOG, Material.JUNGLE_LOG)); + setBreakableMaterials(new ArrayList<>(List.of(Material.BIRCH_LOG, Material.ACACIA_LOG, Material.DARK_OAK_LOG, + Material.OAK_LOG, Material.SPRUCE_LOG, Material.JUNGLE_LOG))); setEventDuration(20); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/QueenBeeEvent.java b/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/QueenBeeEvent.java index b791ee9e5..1b8fd7da4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/QueenBeeEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customevents/premade/QueenBeeEvent.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.config.customevents.CustomEventsConfigFields; import com.magmaguy.elitemobs.events.CustomEvent; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import java.util.List; @@ -14,8 +13,7 @@ public QueenBeeEvent() { setEventType(CustomEvent.EventType.BREAK_BLOCK); setBossFilenames(List.of("queen_bee.yml")); setChance(0.001); - if (!VersionChecker.serverVersionOlderThan(15, 0)) - setBreakableMaterials(List.of(Material.BEE_NEST)); + setBreakableMaterials(List.of(Material.BEE_NEST)); setEventDuration(20); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfig.java index 15ce5ec19..6b29e0db5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfig.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.config.customitems; -import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java index aac25d720..33054229a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java @@ -1,8 +1,9 @@ package com.magmaguy.elitemobs.config.customitems; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.items.customitems.CustomItem; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -10,7 +11,7 @@ import java.util.ArrayList; import java.util.List; -public class CustomItemsConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class CustomItemsConfigFields extends CustomConfigFields { @Getter @Setter @@ -83,5 +84,49 @@ public void processConfigFields() { this.permission = processString("permission", permission, "", false); this.level = processInt("level", level, 0, false); this.soulbound = processBoolean("soulbound", soulbound, true, false); + updatePostProcessor(); + } + + private void updatePostProcessor() { + List newEnchantments = new ArrayList<>(); + for (String enchantment : enchantments) { + if (!enchantment.contains(",")) { + Logger.warn("Invalid format for enchantment in file " + filename + " for enchantment " + enchantment + " : missing ',' for valid level after the enchantment name"); + continue; + } + String[] split = enchantment.split(","); + String result = LegacyValueConverter.parseEnchantment(split[0]); + if (result.equals(split[0])) newEnchantments.add(enchantment); + else newEnchantments.add(result + "," + split[1]); + } + enchantments = newEnchantments; + + List newPotionEffects = new ArrayList<>(); + for (String potionEffect : potionEffects) { + if (!potionEffect.contains(",")) { + Logger.warn("Invalid format for potion effect in file " + filename + " for potion effect " + potionEffect + " : missing ',' for valid level after the potion effect name"); + continue; + } + String[] split = potionEffect.split(","); + String result = LegacyValueConverter.parsePotionEffect(split[0]); + if (result.equals(split[0])) newPotionEffects.add(potionEffect); + else { + StringBuilder newString = new StringBuilder(); + newString.append(result + ","); + + for (int i = 1; i < split.length; i++) { + newString.append(split[i]); + if (i != split.length - 1) + newString.append(","); + } + newPotionEffects.add(newString.toString()); + } + } + potionEffects = newPotionEffects; + + potionEffects.forEach(potionEffect -> { + if (potionEffect.contains("INSTANT_DAMAGE")) + Logger.warn("Item " + filename + " contains HARM/INSTANT_DAMAGE potion effect, which heals undead mobs (Minecraft vanilla mechanic) and often times confuses players and admins. It is recommended you switch this potion effect with something else, like STRENGTH if you want more damage."); + }); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/BerserkerCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/BerserkerCharmConfig.java index 6d81ec21f..73df1ae55 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/BerserkerCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/BerserkerCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class BerserkerCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public BerserkerCharmConfig() { true, Material.TOTEM_OF_UNDYING, "&bBerserker Charm", - Arrays.asList("&aLose yourself in the face of", "&aoverwhelming adversity in more", "&aways than one...")); + new ArrayList<>(List.of("&aLose yourself in the face of", "&aoverwhelming adversity in more", "&aways than one..."))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("BLINDNESS,0,self,onHit", "FAST_DIGGING,0,self,onHit")); + setPotionEffects(new ArrayList<>(List.of("BLINDNESS,0,self,onHit", "FAST_DIGGING,0,self,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java index 124121082..8f6bea653 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ChallengersBootsConfig extends CustomItemsConfigFields { public ChallengersBootsConfig() { - super("challengers_boots", true, Material.DIAMOND_BOOTS, "&cChallenger's Boots", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("challengers_boots", true, Material.DIAMOND_BOOTS, "&cChallenger's Boots", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(40); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersChestplateConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersChestplateConfig.java index 94c4971f0..3ffe99d49 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersChestplateConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersChestplateConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ChallengersChestplateConfig extends CustomItemsConfigFields { public ChallengersChestplateConfig() { - super("challengers_chestplate", true, Material.DIAMOND_CHESTPLATE, "&cChallenger's Chestplate", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("challengers_chestplate", true, Material.DIAMOND_CHESTPLATE, "&cChallenger's Chestplate", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(40); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersHelmetConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersHelmetConfig.java index c319dd416..9bd405be2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersHelmetConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersHelmetConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ChallengersHelmetConfig extends CustomItemsConfigFields { public ChallengersHelmetConfig() { - super("challengers_helmet", true, Material.DIAMOND_HELMET, "&cChallenger's Helmet", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("challengers_helmet", true, Material.DIAMOND_HELMET, "&cChallenger's Helmet", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(40); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersLeggingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersLeggingsConfig.java index be0800b39..199891924 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersLeggingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersLeggingsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ChallengersLeggingsConfig extends CustomItemsConfigFields { public ChallengersLeggingsConfig() { - super("challengers_leggings", true, Material.DIAMOND_LEGGINGS, "&cChallenger's Leggings", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("challengers_leggings", true, Material.DIAMOND_LEGGINGS, "&cChallenger's Leggings", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(40); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersSwordConfig.java index 9b383b791..06a5326c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersSwordConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersSwordConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ChallengersSwordConfig extends CustomItemsConfigFields { public ChallengersSwordConfig() { - super("challengers_sword", true, Material.DIAMOND_SWORD, "&cChallenger's Sword", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "DURABILITY,5")); + super("challengers_sword", true, Material.DIAMOND_SWORD, "&cChallenger's Sword", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(40); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChameleonCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChameleonCharmConfig.java index f605cc65d..907fc9d81 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChameleonCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChameleonCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ChameleonCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public ChameleonCharmConfig() { true, Material.LEATHER, "&bChameleon Charm", - Arrays.asList("&aThe colorful Chameleon can", "&ablend in just about anywhere,", "&aslowly creeping around...")); + new ArrayList<>(List.of("&aThe colorful Chameleon can", "&ablend in just about anywhere,", "&aslowly creeping around..."))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("INVISIBILITY,0,self,onHit", "SLOW,0,self,onHit", "BLINDNESS,0,self,onHit")); + setPotionEffects(new ArrayList<>(List.of("INVISIBILITY,0,self,onHit", "SLOW,0,self,onHit", "BLINDNESS,0,self,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/CheetahCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/CheetahCharmConfig.java index fd6cf9df5..cd9ba2d2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/CheetahCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/CheetahCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class CheetahCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public CheetahCharmConfig() { true, Material.GOLDEN_BOOTS, "&bCheetah Charm", - Arrays.asList("&aCheetahs can reach speeds of", "&a120 km/h... for about 60", "&aseconds. Make them count!")); + new ArrayList<>(List.of("&aCheetahs can reach speeds of", "&a120 km/h... for about 60", "&aseconds. Make them count!"))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("SPEED,2,self,continuous", "HUNGER,0,self,continuous")); + setPotionEffects(new ArrayList<>(List.of("SPEED,2,self,continuous", "HUNGER,0,self,continuous"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index 3dff27bdb..e60d80fb2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class DepthsSeekerConfig extends CustomItemsConfigFields { public DepthsSeekerConfig() { @@ -12,9 +13,9 @@ public DepthsSeekerConfig() { true, Material.FISHING_ROD, "&2Depths seeker", - Arrays.asList("&9Come from depths immeasurable", "&9and looted from monster most vile,", "&9there is no telling what horrors", "&9this fishing rod has seen.")); - setEnchantments(Arrays.asList("LURE,3", "LUCK,3", "DURABILITY,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK,0,self,continuous")); + new ArrayList<>(List.of("&9Come from depths immeasurable", "&9and looted from monster most vile,", "&9there is no telling what horrors", "&9this fishing rod has seen."))); + setEnchantments(new ArrayList<>(List.of("LURE,3", "LUCK_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1"))); + setPotionEffects(new ArrayList<>(List.of("WATER_BREATHING,0,self,continuous", "LUCK,0,self,continuous"))); setItemType(CustomItem.ItemType.UNIQUE); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java index 98b618338..239a8deb3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class DwarvenGreedConfig extends CustomItemsConfigFields { public DwarvenGreedConfig() { @@ -12,9 +13,9 @@ public DwarvenGreedConfig() { true, Material.WOODEN_PICKAXE, "&4Dwarven Greed", - Arrays.asList("&cThose who delve too greedily", "&cand too deep may wake ancient", "&chorrors of shadow and flame", "&cbest left undisturbed.")); - setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "DURABILITY,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("FAST_DIGGING,1,self,continuous", "NIGHT_VISION,0,self,continuous")); + new ArrayList<>(List.of("&cThose who delve too greedily", "&cand too deep may wake ancient", "&chorrors of shadow and flame", "&cbest left undisturbed."))); + setEnchantments(new ArrayList<>(List.of("FORTUNE,4", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1"))); + setPotionEffects(new ArrayList<>(List.of("FAST_DIGGING,1,self,continuous", "NIGHT_VISION,0,self,continuous"))); setItemType(CustomItem.ItemType.UNIQUE); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ElephantCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ElephantCharmConfig.java index 49d0116f8..c4904416e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ElephantCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ElephantCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ElephantCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public ElephantCharmConfig() { true, Material.ANVIL, "&bElephant Charm", - Arrays.asList("&aGain the power of an elephant", "&astampede, for the cost of the", "&aspeed of an elephant stampede!")); + new ArrayList<>(List.of("&aGain the power of an elephant", "&astampede, for the cost of the", "&aspeed of an elephant stampede!"))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("INCREASE_DAMAGE,1,self,onHit", "SLOW,3,self,onHit")); + setPotionEffects(new ArrayList<>(List.of("INCREASE_DAMAGE,1,self,onHit", "SLOW,3,self,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowDamageConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowDamageConfig.java index d2d6f4a7e..4b576c0b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowDamageConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowDamageConfig.java @@ -8,15 +8,15 @@ import java.util.List; public class EnchantedBookArrowDamageConfig extends CustomItemsConfigFields { - public EnchantedBookArrowDamageConfig(){ - super("enchanted_book_arrow_damage", - true, - Material.BOOK, - "&5Elite Power Enchanted Book", - new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("ARROW_DAMAGE,1", "ENCHANTED_SOURCE,1"))); - setItemType(CustomItem.ItemType.UNIQUE); - setScalability(CustomItem.Scalability.FIXED); - setSoulbound(false); + public EnchantedBookArrowDamageConfig() { + super("enchanted_book_arrow_damage", + true, + Material.BOOK, + "&5Elite Power Enchanted Book", + new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); + setEnchantments(new ArrayList<>(List.of("POWER,1", "ENCHANTED_SOURCE,1"))); + setItemType(CustomItem.ItemType.UNIQUE); + setScalability(CustomItem.Scalability.FIXED); + setSoulbound(false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowInfiniteConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowInfiniteConfig.java index e4db33f3b..6dfd1cabb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowInfiniteConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowInfiniteConfig.java @@ -14,7 +14,7 @@ public EnchantedBookArrowInfiniteConfig() { Material.BOOK, "&5Elite Infinity Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("ARROW_INFINITE,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("INFINITY,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowKnockbackConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowKnockbackConfig.java index 9d8089859..7cbdcac56 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowKnockbackConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowKnockbackConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookArrowKnockbackConfig extends CustomItemsConfigFields { - public EnchantedBookArrowKnockbackConfig(){ + public EnchantedBookArrowKnockbackConfig() { super("enchanted_book_arrow_knockback", true, Material.BOOK, "&5Elite Punch Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("ARROW_KNOCKBACK,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("PUNCH,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookChannelingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookChannelingConfig.java index 939b478ed..27d629d05 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookChannelingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookChannelingConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookChannelingConfig extends CustomItemsConfigFields { - public EnchantedBookChannelingConfig(){ + public EnchantedBookChannelingConfig() { super("enchanted_book_channeling", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageAllConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageAllConfig.java index 5bfea51d2..c6dae5de3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageAllConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageAllConfig.java @@ -14,7 +14,7 @@ public EnchantedBookDamageAllConfig() { Material.BOOK, "&5Elite Sharpness Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("DAMAGE_ALL,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageArthropodsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageArthropodsConfig.java index 967b31c55..7b86c9ab7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageArthropodsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageArthropodsConfig.java @@ -14,7 +14,7 @@ public EnchantedBookDamageArthropodsConfig() { Material.BOOK, "&5Elite Bane of Arthropods Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("DAMAGE_ARTHROPODS,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("BANE_OF_ARTHROPODS,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageUndeadConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageUndeadConfig.java index 7786fa581..64ba5fd13 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageUndeadConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDamageUndeadConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookDamageUndeadConfig extends CustomItemsConfigFields { - public EnchantedBookDamageUndeadConfig(){ + public EnchantedBookDamageUndeadConfig() { super("enchanted_book_damage_undead", true, Material.BOOK, "&5Elite Smite Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("DAMAGE_UNDEAD,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("SMITE,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDepthStriderConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDepthStriderConfig.java index c2969f52a..88e7d32dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDepthStriderConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDepthStriderConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookDepthStriderConfig extends CustomItemsConfigFields { - public EnchantedBookDepthStriderConfig(){ + public EnchantedBookDepthStriderConfig() { super("enchanted_book_depth_strider", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDigSpeedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDigSpeedConfig.java index 2fc1ec656..77f4f0253 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDigSpeedConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDigSpeedConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookDigSpeedConfig extends CustomItemsConfigFields { - public EnchantedBookDigSpeedConfig(){ + public EnchantedBookDigSpeedConfig() { super("enchanted_book_dig_speed", true, Material.BOOK, "&5Elite Efficiency Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("DIG_SPEED,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("EFFICIENCY,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDurabilityConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDurabilityConfig.java index 9fa012bb1..799b07078 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDurabilityConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDurabilityConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookDurabilityConfig extends CustomItemsConfigFields { - public EnchantedBookDurabilityConfig(){ + public EnchantedBookDurabilityConfig() { super("enchanted_book_durability", true, Material.BOOK, "&5Elite Unbreaking Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("DURABILITY,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("UNBREAKING,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookEarthquakeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookEarthquakeConfig.java index f5956cd6e..10b15a0ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookEarthquakeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookEarthquakeConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookEarthquakeConfig extends CustomItemsConfigFields { - public EnchantedBookEarthquakeConfig(){ + public EnchantedBookEarthquakeConfig() { super("enchanted_book_earthquake", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlameConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlameConfig.java index a3d8c9ed1..99025718b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlameConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlameConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookFlameConfig extends CustomItemsConfigFields { - public EnchantedBookFlameConfig(){ + public EnchantedBookFlameConfig() { super("enchanted_book_arrow_fire", true, Material.BOOK, "&5Elite Flame Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("ARROW_FIRE,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("FLAME,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlamethrowerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlamethrowerConfig.java index 31cd99560..dc818ebc3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlamethrowerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlamethrowerConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookFlamethrowerConfig extends CustomItemsConfigFields { - public EnchantedBookFlamethrowerConfig(){ + public EnchantedBookFlamethrowerConfig() { super("enchanted_book_flamethrower", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFrostWalkerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFrostWalkerConfig.java index c9af73d67..6dd0551ae 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFrostWalkerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFrostWalkerConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookFrostWalkerConfig extends CustomItemsConfigFields { - public EnchantedBookFrostWalkerConfig(){ + public EnchantedBookFrostWalkerConfig() { super("enchanted_book_frost_walker", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookHunterConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookHunterConfig.java index 23f00e19f..cd937d8e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookHunterConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookHunterConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookHunterConfig extends CustomItemsConfigFields { - public EnchantedBookHunterConfig(){ + public EnchantedBookHunterConfig() { super("enchanted_book_hunter", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookIceBreakerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookIceBreakerConfig.java index ec8ba02f5..404ecdf2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookIceBreakerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookIceBreakerConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookIceBreakerConfig extends CustomItemsConfigFields { - public EnchantedBookIceBreakerConfig(){ + public EnchantedBookIceBreakerConfig() { super("enchanted_book_ice_breaker", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookImpalingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookImpalingConfig.java index c7a57507a..b63dc469d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookImpalingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookImpalingConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookImpalingConfig extends CustomItemsConfigFields { - public EnchantedBookImpalingConfig(){ + public EnchantedBookImpalingConfig() { super("enchanted_book_impaling", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookKnockbackConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookKnockbackConfig.java index 9b456fbcf..8628be905 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookKnockbackConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookKnockbackConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookKnockbackConfig extends CustomItemsConfigFields { - public EnchantedBookKnockbackConfig(){ + public EnchantedBookKnockbackConfig() { super("enchanted_book_knockback", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLightningConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLightningConfig.java index d3e2ff312..c5f411043 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLightningConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLightningConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookLightningConfig extends CustomItemsConfigFields { - public EnchantedBookLightningConfig(){ + public EnchantedBookLightningConfig() { super("enchanted_book_lightning", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusBlocksConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusBlocksConfig.java index e94252ca4..2ac7cc1c3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusBlocksConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusBlocksConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookLootBonusBlocksConfig extends CustomItemsConfigFields { - public EnchantedBookLootBonusBlocksConfig(){ + public EnchantedBookLootBonusBlocksConfig() { super("enchanted_book_loot_bonus_blocks", true, Material.BOOK, "&5Elite Fortune Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("LOOT_BONUS_BLOCKS,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("FORTUNE,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusMobsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusMobsConfig.java index e9066326d..a599a99de 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusMobsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLootBonusMobsConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookLootBonusMobsConfig extends CustomItemsConfigFields { - public EnchantedBookLootBonusMobsConfig(){ + public EnchantedBookLootBonusMobsConfig() { super("enchanted_book_loot_bonus_mobs", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoudStrikesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoudStrikesConfig.java index c0fb1fe31..5de5c27dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoudStrikesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoudStrikesConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookLoudStrikesConfig extends CustomItemsConfigFields { - public EnchantedBookLoudStrikesConfig(){ + public EnchantedBookLoudStrikesConfig() { super("enchanted_book_loud_strikes", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoyaltyConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoyaltyConfig.java index e01f89309..20b0a705f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoyaltyConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLoyaltyConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookLoyaltyConfig extends CustomItemsConfigFields { - public EnchantedBookLoyaltyConfig(){ + public EnchantedBookLoyaltyConfig() { super("enchanted_book_loyalty", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLuckConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLuckConfig.java index ac2117fa0..7d6110913 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLuckConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLuckConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookLuckConfig extends CustomItemsConfigFields { - public EnchantedBookLuckConfig(){ + public EnchantedBookLuckConfig() { super("enchanted_book_luck", true, Material.BOOK, "&5Elite Luck of the Sea Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("LUCK,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("LUCK_OF_THE_SEA,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLureConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLureConfig.java index c47f6b8e0..1557b3bd8 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLureConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLureConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookLureConfig extends CustomItemsConfigFields { - public EnchantedBookLureConfig(){ + public EnchantedBookLureConfig() { super("enchanted_book_lure", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMendingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMendingConfig.java index 012e41d2d..0aaf06b6e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMendingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMendingConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookMendingConfig extends CustomItemsConfigFields { - public EnchantedBookMendingConfig(){ + public EnchantedBookMendingConfig() { super("enchanted_book_mending", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMeteorShowerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMeteorShowerConfig.java index 63bfeb327..9f20eb536 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMeteorShowerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMeteorShowerConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookMeteorShowerConfig extends CustomItemsConfigFields { - public EnchantedBookMeteorShowerConfig(){ + public EnchantedBookMeteorShowerConfig() { super("enchanted_book_meteor_shower", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMultishotConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMultishotConfig.java index 52e84aaa2..042c8562b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMultishotConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookMultishotConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookMultishotConfig extends CustomItemsConfigFields { - public EnchantedBookMultishotConfig(){ + public EnchantedBookMultishotConfig() { super("enchanted_book_multishot", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookOxygenConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookOxygenConfig.java index d9bce4083..898cb733d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookOxygenConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookOxygenConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookOxygenConfig extends CustomItemsConfigFields { - public EnchantedBookOxygenConfig(){ + public EnchantedBookOxygenConfig() { super("enchanted_book_oxygen", true, Material.BOOK, "&5Elite Respiration Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("OXYGEN,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("RESPIRATION,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPiercingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPiercingConfig.java index b3ba940ee..3211a1e44 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPiercingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPiercingConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookPiercingConfig extends CustomItemsConfigFields { - public EnchantedBookPiercingConfig(){ + public EnchantedBookPiercingConfig() { super("enchanted_book_piercing", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPlasmaBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPlasmaBootsConfig.java index 9737ecc76..e3741e9e4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPlasmaBootsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookPlasmaBootsConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookPlasmaBootsConfig extends CustomItemsConfigFields { - public EnchantedBookPlasmaBootsConfig(){ + public EnchantedBookPlasmaBootsConfig() { super("enchanted_book_plasma_boots", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionEnvironmentalConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionEnvironmentalConfig.java index e41651efc..495de4535 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionEnvironmentalConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionEnvironmentalConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookProtectionEnvironmentalConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionEnvironmentalConfig(){ + public EnchantedBookProtectionEnvironmentalConfig() { super("enchanted_book_protection_environmental", true, Material.BOOK, "&5Elite Protection Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("PROTECTION_ENVIRONMENTAL,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionExplosionsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionExplosionsConfig.java index 769be3302..56413bb5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionExplosionsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionExplosionsConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookProtectionExplosionsConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionExplosionsConfig(){ + public EnchantedBookProtectionExplosionsConfig() { super("enchanted_book_protection_explosions", true, Material.BOOK, "&5Elite Blast Protection Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("PROTECTION_EXPLOSIONS,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("BLAST_PROTECTION,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFallConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFallConfig.java index 37c2c0088..71a77ce5a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFallConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFallConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookProtectionFallConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionFallConfig(){ + public EnchantedBookProtectionFallConfig() { super("enchanted_book_protection_fall", true, Material.BOOK, "&5Elite Feather Falling Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("PROTECTION_FALL,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("FEATHER_FALLING,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFireConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFireConfig.java index f49607d3b..1a6511654 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFireConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionFireConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookProtectionFireConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionFireConfig(){ + public EnchantedBookProtectionFireConfig() { super("enchanted_book_protection_fire", true, Material.BOOK, "&5Elite Fire Protection Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("PROTECTION_FIRE,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("FIRE_PROTECTION,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionProjectileConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionProjectileConfig.java index 005c1797c..b8baa90f6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionProjectileConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionProjectileConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookProtectionProjectileConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionProjectileConfig(){ + public EnchantedBookProtectionProjectileConfig() { super("enchanted_book_protection_projectile", true, Material.BOOK, "&5Elite Projectile Protection Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("PROTECTION_PROJECTILE,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("PROJECTILE_PROTECTION,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookQuickChargeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookQuickChargeConfig.java index 51dfe8f5c..88afe28fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookQuickChargeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookQuickChargeConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookQuickChargeConfig extends CustomItemsConfigFields { - public EnchantedBookQuickChargeConfig(){ + public EnchantedBookQuickChargeConfig() { super("enchanted_book_quick_charge", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookRiptideConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookRiptideConfig.java index 72deb0aec..2fac218de 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookRiptideConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookRiptideConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookRiptideConfig extends CustomItemsConfigFields { - public EnchantedBookRiptideConfig(){ + public EnchantedBookRiptideConfig() { super("enchanted_book_riptide", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSilkTouchConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSilkTouchConfig.java index de818e36a..3d2b36c89 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSilkTouchConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSilkTouchConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookSilkTouchConfig extends CustomItemsConfigFields { - public EnchantedBookSilkTouchConfig(){ + public EnchantedBookSilkTouchConfig() { super("enchanted_book_silk_touch", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSoulSpeedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSoulSpeedConfig.java index 314598b92..e3d8be3e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSoulSpeedConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSoulSpeedConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookSoulSpeedConfig extends CustomItemsConfigFields { - public EnchantedBookSoulSpeedConfig(){ + public EnchantedBookSoulSpeedConfig() { super("enchanted_book_soul_speed", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSweepingEdgeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSweepingEdgeConfig.java index 8c3092202..336642441 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSweepingEdgeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookSweepingEdgeConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookSweepingEdgeConfig extends CustomItemsConfigFields { - public EnchantedBookSweepingEdgeConfig(){ + public EnchantedBookSweepingEdgeConfig() { super("enchanted_book_sweeping_edge", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookThornsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookThornsConfig.java index d69c580b8..68bba7af2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookThornsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookThornsConfig.java @@ -8,7 +8,7 @@ import java.util.List; public class EnchantedBookThornsConfig extends CustomItemsConfigFields { - public EnchantedBookThornsConfig(){ + public EnchantedBookThornsConfig() { super("enchanted_book_thorns", true, Material.BOOK, diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookWaterWorkerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookWaterWorkerConfig.java index 3622228e3..60c93fbb1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookWaterWorkerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookWaterWorkerConfig.java @@ -8,13 +8,13 @@ import java.util.List; public class EnchantedBookWaterWorkerConfig extends CustomItemsConfigFields { - public EnchantedBookWaterWorkerConfig(){ + public EnchantedBookWaterWorkerConfig() { super("enchanted_book_water_worker", true, Material.BOOK, "&5Elite Aqua Affinity Enchanted Book", new ArrayList<>(List.of("&2Used to enchant items at the enchanter!"))); - setEnchantments(new ArrayList<>(List.of("WATER_WORKER,1", "ENCHANTED_SOURCE,1"))); + setEnchantments(new ArrayList<>(List.of("AQUA_AFFINITY,1", "ENCHANTED_SOURCE,1"))); setItemType(CustomItem.ItemType.UNIQUE); setScalability(CustomItem.Scalability.FIXED); setSoulbound(false); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FireflyCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FireflyCharmConfig.java index 813e312ff..d7d9a1f0c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FireflyCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FireflyCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class FireflyCharmConfig extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public FireflyCharmConfig() { "&bFirefly Charm", List.of("&aLight up the night!")); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("NIGHT_VISION,0,self,continuous", "GLOWING,0,target,onHit")); + setPotionEffects(new ArrayList<>(List.of("NIGHT_VISION,0,self,continuous", "GLOWING,0,target,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FishyCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FishyCharmConfig.java index a91a02f03..1ac2a51a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FishyCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/FishyCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class FishyCharmConfig extends CustomItemsConfigFields { @@ -12,7 +12,7 @@ public FishyCharmConfig() { true, Material.COD, "&bFishy Charm", - Arrays.asList("&aThere's just something not", "&aquite right with this one...")); + new ArrayList<>(List.of("&aThere's just something not", "&aquite right with this one..."))); setEnchantments(List.of("VANISHING_CURSE,1")); setPotionEffects(List.of("WATER_BREATHING,0,self,continuous")); setDropWeight("1"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 1733e17d1..a336cf971 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinBallistaItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinBallistaItem() { Material.CROSSBOW, "&8Goblin Ballista", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "DURABILITY,1", "QUICK_CHARGE,3", "MULTISHOT,1")); + setEnchantments(new ArrayList<>(List.of("POWER,1", "UNBREAKING,1", "QUICK_CHARGE,3", "MULTISHOT,1"))); setPotionEffects(List.of("HEAL,0,self,onHit")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBootsItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBootsItem.java index db9e2a960..8f7f28642 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBootsItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBootsItem.java @@ -2,10 +2,9 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinBootsItem extends CustomItemsConfigFields { @@ -15,9 +14,8 @@ public GoblinBootsItem() { Material.GOLDEN_BOOTS, "&8Goblin Boots", List.of("&8A treasure among goblins!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_BOOTS); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "DURABILITY,1")); + setMaterial(Material.NETHERITE_BOOTS); + setEnchantments(new ArrayList<>(List.of("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1"))); setPotionEffects(List.of("SPEED,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinChestplateItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinChestplateItem.java index ec0d0fcac..ae27fd0b0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinChestplateItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinChestplateItem.java @@ -2,22 +2,19 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinChestplateItem extends CustomItemsConfigFields { public GoblinChestplateItem() { super("goblin_chestplate", true, - Material.GOLDEN_CHESTPLATE, + Material.NETHERITE_CHESTPLATE, "&8Goblin Chestplate", List.of("&8A treasure among goblins!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_CHESTPLATE); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "DURABILITY,1")); + setEnchantments(new ArrayList<>(List.of("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1"))); setPotionEffects(List.of("SATURATION,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinCleaverItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinCleaverItem.java index 4bddf4e31..fe17ac508 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinCleaverItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinCleaverItem.java @@ -2,22 +2,19 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinCleaverItem extends CustomItemsConfigFields { public GoblinCleaverItem() { super("goblin_cleaver", true, - Material.GOLDEN_AXE, + Material.NETHERITE_AXE, "&8Goblin Cleaver", List.of("&8A treasure among goblins!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_AXE); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "DURABILITY,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,5"))); setPotionEffects(List.of("POISON,0,target,onHit")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinHelmetItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinHelmetItem.java index 3379d2191..d1c40b2cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinHelmetItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinHelmetItem.java @@ -2,22 +2,19 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinHelmetItem extends CustomItemsConfigFields { public GoblinHelmetItem() { super("goblin_helmet", true, - Material.GOLDEN_HELMET, + Material.NETHERITE_HELMET, "&8Goblin Helmet", List.of("&8A treasure among goblins!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_HELMET); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "DURABILITY,1")); + setEnchantments(new ArrayList<>(List.of("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1"))); setPotionEffects(List.of("NIGHT_VISION,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinLeggingsItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinLeggingsItem.java index 561900d6c..e514f7691 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinLeggingsItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinLeggingsItem.java @@ -2,22 +2,19 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinLeggingsItem extends CustomItemsConfigFields { public GoblinLeggingsItem() { super("goblin_leggings", true, - Material.GOLDEN_LEGGINGS, + Material.NETHERITE_LEGGINGS, "&8Goblin Leggings", List.of("&8A treasure among goblins!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_LEGGINGS); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "DURABILITY,1")); + setEnchantments(new ArrayList<>(List.of("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1"))); setPotionEffects(List.of("JUMP,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java index c75072389..048b5db00 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinPokerItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinPokerItem() { Material.TRIDENT, "&8Goblin Poker", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "DURABILITY,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,5"))); setPotionEffects(List.of("WITHER,0,target,onHit")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinShooterItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinShooterItem.java index c0c51191f..5b44505ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinShooterItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinShooterItem.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinShooterItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "DURABILITY,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(new ArrayList<>(List.of("POWER,1", "UNBREAKING,1", "INFINITY,1", "FLAME,1"))); setPotionEffects(List.of("SPEED,2,self,onHit")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinSlasherItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinSlasherItem.java index c6207d559..72e4ac05a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinSlasherItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinSlasherItem.java @@ -2,22 +2,19 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class GoblinSlasherItem extends CustomItemsConfigFields { public GoblinSlasherItem() { super("goblin_slasher", true, - Material.GOLDEN_SWORD, + Material.NETHERITE_SWORD, "&8Goblin Slasher", List.of("&8A treasure among goblins!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_SWORD); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "DURABILITY,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,5"))); setPotionEffects(List.of("FAST_DIGGING,0,self,onHit")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsBootsConfig.java index 029b983bd..033e73b4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsBootsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsBootsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GruntsBootsConfig extends CustomItemsConfigFields { public GruntsBootsConfig() { - super("grunts_boots", true, Material.IRON_BOOTS, "&fGrunt's Boots", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,5", "DURABILITY,5")); + super("grunts_boots", true, Material.IRON_BOOTS, "&fGrunt's Boots", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,5", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(20); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsChestplateConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsChestplateConfig.java index a59c48533..773dd8d8a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsChestplateConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsChestplateConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GruntsChestplateConfig extends CustomItemsConfigFields { public GruntsChestplateConfig() { - super("grunts_chestplate", true, Material.IRON_CHESTPLATE, "&fGrunt's Chestplate", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "DURABILITY,5")); + super("grunts_chestplate", true, Material.IRON_CHESTPLATE, "&fGrunt's Chestplate", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(20); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsHelmetConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsHelmetConfig.java index f5aa3e4d5..f2fe58bb5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsHelmetConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsHelmetConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GruntsHelmetConfig extends CustomItemsConfigFields { public GruntsHelmetConfig() { - super("grunts_helmet", true, Material.IRON_HELMET, "&fGrunt's Helmet", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "DURABILITY,5")); + super("grunts_helmet", true, Material.IRON_HELMET, "&fGrunt's Helmet", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(20); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsLeggingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsLeggingsConfig.java index 19e2b0e68..00bc38fc4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsLeggingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsLeggingsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GruntsLeggingsConfig extends CustomItemsConfigFields { public GruntsLeggingsConfig() { - super("grunts_leggings", true, Material.IRON_LEGGINGS, "&fGrunt's Leggings", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "DURABILITY,5")); + super("grunts_leggings", true, Material.IRON_LEGGINGS, "&fGrunt's Leggings", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(20); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsSwordConfig.java index 00c954f6b..69f7206dc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsSwordConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GruntsSwordConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GruntsSwordConfig extends CustomItemsConfigFields { public GruntsSwordConfig() { - super("grunts_sword", true, Material.IRON_SWORD, "&fGrunt's Sword", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,5", "KNOCKBACK,2", "SWEEPING_EDGE,1", "DURABILITY,5")); + super("grunts_sword", true, Material.IRON_SWORD, "&fGrunt's Sword", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,5", "KNOCKBACK,2", "SWEEPING_EDGE,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(20); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusBootsConfig.java index c0608da27..3cdde5432 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusBootsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusBootsConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusBootsConfig extends CustomItemsConfigFields { public InvictusBootsConfig() { - super("invictus_boots", true, Material.DIAMOND_BOOTS, "&4Invictus Boots", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_BOOTS); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("invictus_boots", true, Material.NETHERITE_BOOTS, "&4Invictus Boots", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setPotionEffects(List.of("SPEED,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(50); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusChestplateConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusChestplateConfig.java index c3258964c..bf8e9199e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusChestplateConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusChestplateConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusChestplateConfig extends CustomItemsConfigFields { public InvictusChestplateConfig() { - super("invictus_chestplate", true, Material.DIAMOND_CHESTPLATE, "&4Invictus Chestplate", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_CHESTPLATE); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("invictus_chestplate", true, Material.NETHERITE_CHESTPLATE, "&4Invictus Chestplate", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setPotionEffects(List.of("HEAL,0,self,onHit")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(50); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusHelmetConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusHelmetConfig.java index 22a7a38c8..b5f0678fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusHelmetConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusHelmetConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusHelmetConfig extends CustomItemsConfigFields { public InvictusHelmetConfig() { - super("invictus_helmet", true, Material.DIAMOND_HELMET, "&4Invictus Helmet", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_HELMET); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("invictus_helmet", true, Material.NETHERITE_HELMET, "&4Invictus Helmet", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setPotionEffects(List.of("NIGHT_VISION,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(50); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusLeggingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusLeggingsConfig.java index 9d3fe2ce6..f13f57c40 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusLeggingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusLeggingsConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusLeggingsConfig extends CustomItemsConfigFields { public InvictusLeggingsConfig() { - super("invictus_leggings", true, Material.DIAMOND_LEGGINGS, "&4Invictus Leggings", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_LEGGINGS); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("invictus_leggings", true, Material.NETHERITE_LEGGINGS, "&4Invictus Leggings", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setPotionEffects(List.of("JUMP,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(50); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusPickaxeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusPickaxeConfig.java index 03845db93..57c11afca 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusPickaxeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusPickaxeConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusPickaxeConfig extends CustomItemsConfigFields { public InvictusPickaxeConfig() { - super("invictus_pickaxe", true, Material.DIAMOND_PICKAXE, "&4Invictus Pickaxe", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_PICKAXE); - setEnchantments(Arrays.asList("DIG_SPEED,6", "DRILLING,3", "DURABILITY,5")); + super("invictus_pickaxe", true, Material.NETHERITE_PICKAXE, "&4Invictus Pickaxe", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("EFFICIENCY,6", "DRILLING,3", "UNBREAKING,5"))); setPotionEffects(List.of("FAST_DIGGING,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusShovelConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusShovelConfig.java index 73c841329..71e6dc3f7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusShovelConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusShovelConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusShovelConfig extends CustomItemsConfigFields { public InvictusShovelConfig() { - super("invictus_shovel", true, Material.DIAMOND_SHOVEL, "&4Invictus Shovel", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_SHOVEL); - setEnchantments(Arrays.asList("DIG_SPEED,6", "DRILLING,3", "DURABILITY,5")); + super("invictus_shovel", true, Material.NETHERITE_SHOVEL, "&4Invictus Shovel", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("EFFICIENCY,6", "DRILLING,3", "UNBREAKING,5"))); setPotionEffects(List.of("FAST_DIGGING,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusSwordConfig.java index a49422250..f19ce8a63 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusSwordConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/InvictusSwordConfig.java @@ -2,18 +2,15 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class InvictusSwordConfig extends CustomItemsConfigFields { public InvictusSwordConfig() { - super("invictus_sword", true, Material.DIAMOND_SWORD, "&4Invictus Sword", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - setMaterial(Material.NETHERITE_SWORD); - setEnchantments(Arrays.asList("DAMAGE_ALL,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "DURABILITY,5")); + super("invictus_sword", true, Material.NETHERITE_SWORD, "&4Invictus Sword", new ArrayList<>(List.of("&2Awarded to the champions of the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "UNBREAKING,5"))); setPotionEffects(List.of("WITHER,0,target,onHit")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(50); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 3cbcfa73c..9b678407c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class LuckyCharmsConfig extends CustomItemsConfigFields { @@ -12,7 +12,7 @@ public LuckyCharmsConfig() { true, Material.COOKIE, "&bLucky Charms", - Arrays.asList("&aPart of a complete breakfast!", "&cNote: Absolutely not a part of", "&ca complete breakfast.")); + new ArrayList<>(List.of("&aPart of a complete breakfast!", "&cNote: Absolutely not a part of", "&ca complete breakfast."))); setEnchantments(List.of("VANISHING_CURSE,1")); setPotionEffects(List.of("LUCK,0,self,continuous")); setDropWeight("1"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/MeteorShowerScrollConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/MeteorShowerScrollConfig.java index 8985c783b..de12cf2b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/MeteorShowerScrollConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/MeteorShowerScrollConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class MeteorShowerScrollConfig extends CustomItemsConfigFields { @@ -13,7 +13,7 @@ public MeteorShowerScrollConfig() { true, Material.PAPER, "&7Meteor Shower Scroll", - Arrays.asList("&4Call forth destruction.", "&4Single-use.")); + new ArrayList<>(List.of("&4Call forth destruction.", "&4Single-use."))); setEnchantments(List.of("METEOR_SHOWER,1")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesBootsConfig.java index 98df7fabe..e4efd4ca1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesBootsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesBootsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class NovicesBootsConfig extends CustomItemsConfigFields { public NovicesBootsConfig() { - super("novices_boots", true, Material.LEATHER_BOOTS, "&8Novice's Boots", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "DURABILITY,5")); + super("novices_boots", true, Material.LEATHER_BOOTS, "&8Novice's Boots", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesChestplateConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesChestplateConfig.java index 8783f3166..c33eb0dc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesChestplateConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesChestplateConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class NovicesChestplateConfig extends CustomItemsConfigFields { public NovicesChestplateConfig() { - super("novices_chestplate", true, Material.LEATHER_CHESTPLATE, "&8Novice's Chestplate", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "DURABILITY,5")); + super("novices_chestplate", true, Material.LEATHER_CHESTPLATE, "&8Novice's Chestplate", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesHelmetConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesHelmetConfig.java index 1930fce45..e2da64dd7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesHelmetConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesHelmetConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class NovicesHelmetConfig extends CustomItemsConfigFields { public NovicesHelmetConfig() { - super("novices_helmet", true, Material.LEATHER_HELMET, "&8Novice's Helmet", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "DURABILITY,5")); + super("novices_helmet", true, Material.LEATHER_HELMET, "&8Novice's Helmet", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesLeggingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesLeggingsConfig.java index e8b4ef234..6002aa790 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesLeggingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesLeggingsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class NovicesLeggingsConfig extends CustomItemsConfigFields { public NovicesLeggingsConfig() { - super("novices_leggings", true, Material.LEATHER_LEGGINGS, "&8Novice's Leggings", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "DURABILITY,5")); + super("novices_leggings", true, Material.LEATHER_LEGGINGS, "&8Novice's Leggings", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java index bd0af60f7..00dc7ef28 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class NovicesSwordConfig extends CustomItemsConfigFields { public NovicesSwordConfig() { - super("novices_sword", true, Material.STONE_SWORD, "&8Novice's Sword", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,5", "SWEEPING_EDGE,1", "DURABILITY,5")); + super("novices_sword", true, Material.STONE_SWORD, "&8Novice's Sword", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,5", "SWEEPING_EDGE,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/OwlCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/OwlCharmConfig.java index f6e5203e6..9e975b915 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/OwlCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/OwlCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class OwlCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public OwlCharmConfig() { true, Material.ELYTRA, "&bOwl Charm", - Arrays.asList("&aBecome the ultimate nocturnal", "&apredator!")); + new ArrayList<>(List.of("&aBecome the ultimate nocturnal", "&apredator!"))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("GLOWING,0,target,onHit", "JUMP,2,self,continuous", "NIGHT_VISION,0,self,continuous", "WEAKNESS,0,self,continuous")); + setPotionEffects(new ArrayList<>(List.of("GLOWING,0,target,onHit", "JUMP,2,self,continuous", "NIGHT_VISION,0,self,continuous", "WEAKNESS,0,self,continuous"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RabbitCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RabbitCharmConfig.java index 3cab56608..717c7a738 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RabbitCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RabbitCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class RabbitCharmConfig extends CustomItemsConfigFields { @@ -12,7 +12,7 @@ public RabbitCharmConfig() { true, Material.RABBIT_FOOT, "&bRabbit Charm", - Arrays.asList("&aWith this charm, just about", "&aany destination is only a hop,", "&askip and a jump away!")); + new ArrayList<>(List.of("&aWith this charm, just about", "&aany destination is only a hop,", "&askip and a jump away!"))); setEnchantments(List.of("VANISHING_CURSE,1")); setPotionEffects(List.of("JUMP,2,self,continuous")); setDropWeight("1"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RodOfTheDepthsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RodOfTheDepthsConfig.java index 7b3aef81a..b0bd1e2a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RodOfTheDepthsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/RodOfTheDepthsConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class RodOfTheDepthsConfig extends CustomItemsConfigFields { public RodOfTheDepthsConfig() { @@ -12,9 +13,9 @@ public RodOfTheDepthsConfig() { true, Material.FISHING_ROD, "&3Rod of the Depths", - Arrays.asList("&3You want to hear about where", "&3I got this from? Sit down lad,", "&3I've got a tale for ye...")); - setEnchantments(Arrays.asList("LURE,3", "LUCK,1", "DURABILITY,6", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("INVISIBILITY,0,self,onHit", "SLOW,0,self,onHit", "BLINDNESS,0,self,onHit")); + new ArrayList<>(List.of("&3You want to hear about where", "&3I got this from? Sit down lad,", "&3I've got a tale for ye..."))); + setEnchantments(new ArrayList<>(List.of("LURE,3", "LUCK_OF_THE_SEA,1", "UNBREAKING,6", "VANISHING_CURSE,1"))); + setPotionEffects(new ArrayList<>(List.of("INVISIBILITY,0,self,onHit", "SLOW,0,self,onHit", "BLINDNESS,0,self,onHit"))); setItemType(CustomItem.ItemType.UNIQUE); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SalamanderCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SalamanderCharmConfig.java index d9f43f62f..fe82635e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SalamanderCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SalamanderCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class SalamanderCharmConfig extends CustomItemsConfigFields { @@ -12,7 +12,7 @@ public SalamanderCharmConfig() { true, Material.LEATHER, "&bSalamander Charm", - Arrays.asList("&aAlmost as hot as MagmaGuy's", "&anew mixtape!")); + new ArrayList<>(List.of("&aAlmost as hot as MagmaGuy's", "&anew mixtape!"))); setEnchantments(List.of("VANISHING_CURSE,1")); setPotionEffects(List.of("FIRE_RESISTANCE,0,self,continuous")); setDropWeight("1"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScorpionCharm.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScorpionCharm.java index 7bd6be114..87af5ad73 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScorpionCharm.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScorpionCharm.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ScorpionCharm extends CustomItemsConfigFields { @@ -12,7 +12,7 @@ public ScorpionCharm() { true, Material.POISONOUS_POTATO, "&bScorpion Charm", - Arrays.asList("&aFloat like a butterfly,", "&asting like a bee,", "&apoison like a potato!")); + new ArrayList<>(List.of("&aFloat like a butterfly,", "&asting like a bee,", "&apoison like a potato!"))); setEnchantments(List.of("VANISHING_CURSE,1")); setPotionEffects(List.of("POISON,0,target,onHit")); setDropWeight("1"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteHugeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteHugeConfig.java index 60dfeda4a..a2956f0fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteHugeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteHugeConfig.java @@ -5,7 +5,6 @@ import org.bukkit.Material; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class ScrapEliteHugeConfig extends CustomItemsConfigFields { @@ -14,7 +13,7 @@ public ScrapEliteHugeConfig() { true, Material.PURPLE_DYE, "&5Huge Elite Scrap", - Arrays.asList("&fUsed to repair Elite items!", "&fFully repairs an item!")); + new ArrayList<>(List.of("&fUsed to repair Elite items!", "&fFully repairs an item!"))); setItemType(CustomItem.ItemType.UNIQUE); setEnchantments(new ArrayList<>(List.of("repair,5"))); setScalability(CustomItem.Scalability.FIXED); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteLargeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteLargeConfig.java index 99fc1c8ad..d905dd681 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteLargeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteLargeConfig.java @@ -5,7 +5,6 @@ import org.bukkit.Material; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class ScrapEliteLargeConfig extends CustomItemsConfigFields { @@ -14,7 +13,7 @@ public ScrapEliteLargeConfig() { true, Material.RED_DYE, "&9Large Elite Scrap", - Arrays.asList("&fUsed to repair Elite items!", "&fRepairs a huge amount!")); + new ArrayList<>(List.of("&fUsed to repair Elite items!", "&fRepairs a huge amount!"))); setItemType(CustomItem.ItemType.UNIQUE); setEnchantments(new ArrayList<>(List.of("repair,4"))); setScalability(CustomItem.Scalability.FIXED); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteMediumConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteMediumConfig.java index 531c0bef3..43f9c7fc2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteMediumConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteMediumConfig.java @@ -5,7 +5,6 @@ import org.bukkit.Material; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class ScrapEliteMediumConfig extends CustomItemsConfigFields { @@ -14,7 +13,7 @@ public ScrapEliteMediumConfig() { true, Material.ORANGE_DYE, "&9Medium Elite Scrap", - Arrays.asList("&fUsed to repair Elite items!", "&fRepairs a large amount!")); + new ArrayList<>(List.of("&fUsed to repair Elite items!", "&fRepairs a large amount!"))); setItemType(CustomItem.ItemType.UNIQUE); setEnchantments(new ArrayList<>(List.of("repair,3"))); setScalability(CustomItem.Scalability.FIXED); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteSmallConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteSmallConfig.java index 0c5787ae6..ef552e874 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteSmallConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteSmallConfig.java @@ -5,7 +5,6 @@ import org.bukkit.Material; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class ScrapEliteSmallConfig extends CustomItemsConfigFields { @@ -14,7 +13,7 @@ public ScrapEliteSmallConfig() { true, Material.GREEN_DYE, "&9Small Elite Scrap", - Arrays.asList("&fUsed to repair Elite items!", "&fRepairs a medium amount!")); + new ArrayList<>(List.of("&fUsed to repair Elite items!", "&fRepairs a medium amount!"))); setItemType(CustomItem.ItemType.UNIQUE); setEnchantments(new ArrayList<>(List.of("repair,2"))); setScalability(CustomItem.Scalability.FIXED); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteTinyConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteTinyConfig.java index c2932e699..3377f930f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteTinyConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ScrapEliteTinyConfig.java @@ -5,7 +5,6 @@ import org.bukkit.Material; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class ScrapEliteTinyConfig extends CustomItemsConfigFields { @@ -14,7 +13,7 @@ public ScrapEliteTinyConfig() { true, Material.WHITE_DYE, "&fTiny Elite Scrap", - Arrays.asList("&fUsed to repair Elite items!", "&fRepairs a small amount!")); + new ArrayList<>(List.of("&fUsed to repair Elite items!", "&fRepairs a small amount!"))); setItemType(CustomItem.ItemType.UNIQUE); setEnchantments(new ArrayList<>(List.of("repair,1"))); setScalability(CustomItem.Scalability.FIXED); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ShulkerCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ShulkerCharmConfig.java index e23a7074e..57248b0ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ShulkerCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ShulkerCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ShulkerCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public ShulkerCharmConfig() { true, Material.FEATHER, "&bShulker Charm", - Arrays.asList("&aI believe I can fly", "&aI believe I can touch the sky", "&aAnd you're coming with me!")); + new ArrayList<>(List.of("&aI believe I can fly", "&aI believe I can touch the sky", "&aAnd you're coming with me!"))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("LEVITATION,0,self,onHit", "LEVITATION,1,target,onHit")); + setPotionEffects(new ArrayList<>(List.of("LEVITATION,0,self,onHit", "LEVITATION,1,target,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SlowpokeCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SlowpokeCharmConfig.java index 6f0a9074a..a3877d2da 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SlowpokeCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SlowpokeCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class SlowpokeCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public SlowpokeCharmConfig() { true, Material.CARROT_ON_A_STICK, "&bSlowpoke Charm", - Arrays.asList("&aLet's just hope it doesn't hit", "&aitself in its confusion...")); + new ArrayList<>(List.of("&aLet's just hope it doesn't hit", "&aitself in its confusion..."))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("SLOW,0,self,onHit", "CONFUSION,0,target,onHit")); + setPotionEffects(new ArrayList<>(List.of("SLOW,0,self,onHit", "CONFUSION,0,target,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonMerchantScrollConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonMerchantScrollConfig.java index ca71b5f1e..4ef99ed02 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonMerchantScrollConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonMerchantScrollConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class SummonMerchantScrollConfig extends CustomItemsConfigFields { @@ -12,7 +12,7 @@ public SummonMerchantScrollConfig() { true, Material.PAPER, "&6Summon Merchant Scroll", - Arrays.asList("&aNeed to sell an item?", "&aRight-click to activate", "&aor yell &9Jeeves!")); + new ArrayList<>(List.of("&aNeed to sell an item?", "&aRight-click to activate", "&aor yell &9Jeeves!"))); setEnchantments(List.of("SUMMON_MERCHANT,1")); setDropWeight("5"); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonWolfScrollConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonWolfScrollConfig.java index 35d2f3027..a69fce0ea 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonWolfScrollConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/SummonWolfScrollConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class SummonWolfScrollConfig extends CustomItemsConfigFields { @@ -13,7 +13,7 @@ public SummonWolfScrollConfig() { true, Material.PAPER, "&6Summon Wolf Scroll", - Arrays.asList("&aSummons a good boy", "&ato help you bite Elites!", "&aMake sure you pet it!")); + new ArrayList<>(List.of("&aSummons a good boy", "&ato help you bite Elites!", "&aMake sure you pet it!"))); setEnchantments(List.of("SUMMON_WOLF,1")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 14fbb4d6c..394e71def 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TheFellerConfig extends CustomItemsConfigFields { public TheFellerConfig() { @@ -12,9 +13,9 @@ public TheFellerConfig() { true, Material.DIAMOND_AXE, "&2The Feller", - Arrays.asList("&aEven in your sleep,", "&ayou can feel this axe''s", "&asaplust")); - setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "SILK_TOUCH,1", "DURABILITY,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("FAST_DIGGING,1,self,continuous", "NIGHT_VISION,0,self,continuous")); + new ArrayList<>(List.of("&aEven in your sleep,", "&ayou can feel this axe''s", "&asaplust"))); + setEnchantments(new ArrayList<>(List.of("FORTUNE,4", "SILK_TOUCH,1", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1"))); + setPotionEffects(new ArrayList<>(List.of("FAST_DIGGING,1,self,continuous", "NIGHT_VISION,0,self,continuous"))); setItemType(CustomItem.ItemType.UNIQUE); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheStingerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheStingerConfig.java index 8582afaf4..2b55e434b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheStingerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheStingerConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class TheStingerConfig extends CustomItemsConfigFields { @@ -13,8 +13,8 @@ public TheStingerConfig() { true, Material.GOLDEN_SWORD, "&eThe Stinger", - Arrays.asList("&aFloat like a butterfly,", "&asting like a bee!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DURABILITY,1", "VANISHING_CURSE,1")); + new ArrayList<>(List.of("&aFloat like a butterfly,", "&asting like a bee!"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "UNBREAKING,1", "VANISHING_CURSE,1"))); setPotionEffects(List.of("POISON,0,target,onHit")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/UnbindScrollConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/UnbindScrollConfig.java index 334ed40f8..40e45c591 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/UnbindScrollConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/UnbindScrollConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class UnbindScrollConfig extends CustomItemsConfigFields { @@ -13,9 +13,9 @@ public UnbindScrollConfig() { true, Material.PAPER, "&5Unbind Scroll", - Arrays.asList("&5Allows users to unbind one", + new ArrayList<>(List.of("&5Allows users to unbind one", "&5soulbound item at an anvil!", - "&5Use wisely!")); + "&5Use wisely!"))); setEnchantments(List.of("UNBIND,1")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VampiricCharmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VampiricCharmConfig.java index 596fd1d2c..c6583876f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VampiricCharmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VampiricCharmConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfigFields; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class VampiricCharmConfig extends CustomItemsConfigFields { @@ -12,9 +12,9 @@ public VampiricCharmConfig() { true, Material.STICK, "&bVampiric Charm", - Arrays.asList("&aNo one can remember where this", "&acame from, and no one can,", "&aforget how dangerous it is...")); + new ArrayList<>(List.of("&aNo one can remember where this", "&acame from, and no one can,", "&aforget how dangerous it is..."))); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("HEAL,0,self,onHit", "BLINDNESS,0,self,onHit", "SLOW,0,self,onHit")); + setPotionEffects(new ArrayList<>(List.of("HEAL,0,self,onHit", "BLINDNESS,0,self,onHit", "SLOW,0,self,onHit"))); setDropWeight("1"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index 63b850031..dca970c39 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class VeteransBootsConfig extends CustomItemsConfigFields { public VeteransBootsConfig() { - super("veterans_boots", true, Material.GOLDEN_BOOTS, "&6Veteran's Boots", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("veterans_boots", true, Material.GOLDEN_BOOTS, "&6Veteran's Boots", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(30); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransChestplateConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransChestplateConfig.java index 48fb98c91..4879bcb65 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransChestplateConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransChestplateConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class VeteransChestplateConfig extends CustomItemsConfigFields { public VeteransChestplateConfig() { - super("veterans_chestplate", true, Material.GOLDEN_CHESTPLATE, "&6Veteran's Chestplate", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("veterans_chestplate", true, Material.GOLDEN_CHESTPLATE, "&6Veteran's Chestplate", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(30); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransHelmetConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransHelmetConfig.java index 42aa52da0..069e12586 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransHelmetConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransHelmetConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class VeteransHelmetConfig extends CustomItemsConfigFields { public VeteransHelmetConfig() { - super("veterans_helmet", true, Material.GOLDEN_HELMET, "&6Veteran's Helmet", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("veterans_helmet", true, Material.GOLDEN_HELMET, "&6Veteran's Helmet", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(30); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransLeggingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransLeggingsConfig.java index fba2b58d1..610288772 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransLeggingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransLeggingsConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class VeteransLeggingsConfig extends CustomItemsConfigFields { public VeteransLeggingsConfig() { - super("veterans_leggings", true, Material.GOLDEN_LEGGINGS, "&6Veteran's Leggings", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION_ENVIRONMENTAL,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "DURABILITY,5")); + super("veterans_leggings", true, Material.GOLDEN_LEGGINGS, "&6Veteran's Leggings", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("PROTECTION,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(30); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransSwordConfig.java index cd96a33bc..ac13304ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransSwordConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransSwordConfig.java @@ -4,12 +4,13 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class VeteransSwordConfig extends CustomItemsConfigFields { public VeteransSwordConfig() { - super("veterans_sword", true, Material.GOLDEN_SWORD, "&6Veteran's Sword", Arrays.asList("&2Awarded to those who challenge the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,5", "KNOCKBACK,2", "MENDING,1", "SWEEPING_EDGE,1", "DURABILITY,5")); + super("veterans_sword", true, Material.GOLDEN_SWORD, "&6Veteran's Sword", new ArrayList<>(List.of("&2Awarded to those who challenge the", "&2Wood League Arena!"))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "SWEEPING_EDGE,1", "UNBREAKING,5"))); setItemType(CustomItem.ItemType.UNIQUE); setLevel(30); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WerewolfBoneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WerewolfBoneItem.java index 9a9a9a178..2cfc5a067 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WerewolfBoneItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WerewolfBoneItem.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class WerewolfBoneItem extends CustomItemsConfigFields { @@ -13,7 +13,7 @@ public WerewolfBoneItem() { true, Material.BONE, "&6Werewolf Bone", - Arrays.asList("&aHaving killed the alpha,", "&athis temporarily makes you!", "&athe wolves' new leader")); + new ArrayList<>(List.of("&aHaving killed the alpha,", "&athis temporarily makes you!", "&athe wolves' new leader"))); setEnchantments(List.of("SUMMON_WOLF,1")); setItemType(CustomItem.ItemType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 93e85d278..3a526cf78 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class WolfsbaneItem extends CustomItemsConfigFields { public WolfsbaneItem() { @@ -12,9 +13,9 @@ public WolfsbaneItem() { true, Material.IRON_SWORD, "&7Wolfsbane", - Arrays.asList("&aMade from the remains of", "&aan alpha werewolf, all", "&awolves cower at the sight of it.")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "FIRE_ASPECT,4", "DURABILITY,5", "LOOT_BONUS_MOBS,5")); - setPotionEffects(Arrays.asList("FAST_DIGGING,2,self,onHit", "NIGHT_VISION,0,self,continuous")); + new ArrayList<>(List.of("&aMade from the remains of", "&aan alpha werewolf, all", "&awolves cower at the sight of it."))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOTING,5"))); + setPotionEffects(new ArrayList<>(List.of("FAST_DIGGING,2,self,onHit", "NIGHT_VISION,0,self,continuous"))); setItemType(CustomItem.ItemType.UNIQUE); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ZombieKingsAxeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ZombieKingsAxeConfig.java index de901fbe6..e87707d02 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ZombieKingsAxeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ZombieKingsAxeConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ZombieKingsAxeConfig extends CustomItemsConfigFields { public ZombieKingsAxeConfig() { @@ -12,10 +13,10 @@ public ZombieKingsAxeConfig() { true, Material.GOLDEN_AXE, "&4Zombie King's Axe", - Arrays.asList("The axe of the one Zombies", "call their king.", "The bloodlust is palpable.")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,5", "DIG_SPEED,5", "DURABILITY,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "WATER_WORKER,5", "FLAMETHROWER,1")); - setPotionEffects(Arrays.asList("FAST_DIGGING,0,self,onHit", "NIGHT_VISION,0,self,continuous", "WITHER,0,target,onHit")); + new ArrayList<>(List.of("The axe of the one Zombies", "call their king.", "The bloodlust is palpable."))); + setEnchantments(new ArrayList<>(List.of("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", + "FIRE_ASPECT,4", "LOOTING,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1"))); + setPotionEffects(new ArrayList<>(List.of("FAST_DIGGING,0,self,onHit", "NIGHT_VISION,0,self,continuous", "WITHER,0,target,onHit"))); setItemType(CustomItem.ItemType.UNIQUE); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfig.java index 81494039b..126943f4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfig.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.config.customquests; -import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java index c9992d92f..e6e6a1223 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java @@ -1,17 +1,18 @@ package com.magmaguy.elitemobs.config.customquests; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.configuration.ConfigurationSection; import java.util.*; -public class CustomQuestsConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class CustomQuestsConfigFields extends CustomConfigFields { + @Getter + @Setter + protected Map> customObjectives = new HashMap(); @Getter @Setter List temporaryPermissions = new ArrayList<>(); @@ -21,12 +22,6 @@ public class CustomQuestsConfigFields extends CustomConfigFields implements Cust @Getter @Setter private int questLevel = 0; - //@Getter - //@Setter - //private List customObjectivesList = new ArrayList<>(); - @Getter - @Setter - protected Map> customObjectives = new HashMap(); @Getter @Setter private List customRewardsList = new ArrayList<>(); @@ -103,8 +98,6 @@ public void setQuestLockoutPermission() { @Override public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, true, true); - //this.customObjectivesList = translatable(filename, "customObjectives", processStringList("customObjectives", customObjectivesList, new ArrayList<>(), true)); - //todo update format if (fileConfiguration.contains("customObjectives") && fileConfiguration.get("customObjectives") instanceof List) updateOldStringFormat(fileConfiguration.getStringList("customObjectives")); this.customObjectives = processQuestObjectives(); @@ -122,7 +115,6 @@ public void processConfigFields() { this.turnInNPC = processString("turnInNPC", turnInNPC, "", false); this.trackable = processBoolean("trackable", trackable, true, false); this.questLevel = processInt("questLevel", questLevel, 0, false); -// this.questMenuOpenSound = processString("questMenuOpenSound", questMenuOpenSound, "", false); this.questAcceptSound = processString("questAcceptSound", questAcceptSound, "", false); this.questCompleteSound = processString("questCompleteSound", questCompleteSound, "", false); } @@ -147,13 +139,13 @@ private void updateOldStringFormat(List oldList) { key = "objectiveType"; } default -> - new WarningMessage("Failed to correctly parse key " + key + " in " + filename + " while updating the old quest configuration format!"); + Logger.warn("Failed to correctly parse key " + key + " in " + filename + " while updating the old quest configuration format!"); } if (key.equalsIgnoreCase("dialog")) { value = Arrays.stream(((String) value).split("\\n")).toList(); } parsedEntry.put(key, value); - new InfoMessage("Converted quest old entry to " + key + ": " + value); + Logger.info("Converted quest old entry to " + key + ": " + value); } parsedObjectives.put("Objective" + counter, parsedEntry); } @@ -162,7 +154,7 @@ private void updateOldStringFormat(List oldList) { try { fileConfiguration.save(file); } catch (Exception ex) { - new WarningMessage("Failed to save new custom objective format!"); + Logger.warn("Failed to save new custom objective format!"); } } @@ -190,7 +182,7 @@ private Map> processQuestObjectives() { rawMap = fileConfiguration.getConfigurationSection("customObjectives").getValues(false); if (rawMap == null) { - new WarningMessage("Failed to parse custom objectives for " + filename); + Logger.warn("Failed to parse custom objectives for " + filename); return new HashMap<>(); } //Parse for the specific translatable elements diff --git a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/TestQuestConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/TestQuestConfig.java index b544f7753..eee94ee11 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/TestQuestConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/TestQuestConfig.java @@ -9,7 +9,7 @@ public class TestQuestConfig extends CustomQuestsConfigFields { public TestQuestConfig() { super("test_quest", true, - Map.of("Objective1",Map.of("objectiveType", "KILL_CUSTOM", + Map.of("Objective1", Map.of("objectiveType", "KILL_CUSTOM", "filename", "test_boss.yml", "amount", 1)), List.of("filename=magmaguys_toothpick.yml:amount=1:chance=1"), diff --git a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest0Config.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest0Config.java index ad2c94a80..e482af240 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest0Config.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest0Config.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfigFields; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -25,7 +25,7 @@ public WelcomeQuest0Config() { ); setQuestLockoutPermission(); setTurnInNPC("guide_1.yml"); - setQuestAcceptDialog(Arrays.asList("&8[Odigos]&f Alright, make sure you use &2/ag &f or &2/adventurersguild&f to head off to the Adventurer's Guild Hub!", - "Make sure you talk to Casus when you're there!")); + setQuestAcceptDialog(new ArrayList<>(List.of("&8[Odigos]&f Alright, make sure you use &2/ag &f or &2/adventurersguild&f to head off to the Adventurer's Guild Hub!", + "Make sure you talk to Casus when you're there!"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest1Config.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest1Config.java index fa3cd619e..43283845c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest1Config.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/WelcomeQuest1Config.java @@ -9,10 +9,10 @@ public WelcomeQuest1Config() { super("ag_welcome_quest_1.yml", true, new HashMap<>(), - Arrays.asList( + new ArrayList<>(List.of( "filename=magmaguys_toothpick.yml:amount=1:chance=1", "currencyAmount=750:amount=1:chance=1" - ), + )), 1, "&2Welcome to the AG!", Collections.singletonList("&aMeet the Adventurer's Guild NPCs!") diff --git a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/XmasQuest0Config.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/XmasQuest0Config.java index b0fb4797f..b3b7f8723 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/XmasQuest0Config.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/XmasQuest0Config.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfigFields; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -10,8 +10,8 @@ public class XmasQuest0Config extends CustomQuestsConfigFields { public XmasQuest0Config() { super("xmas_quest_0", true, - Map.of("Objective1",Map.of("objectiveType", "FETCH_ITEM", "filename", "xmas_lost_present.yml", "amount", 10, "itemName", "Lost Present")), - Arrays.asList( + Map.of("Objective1", Map.of("objectiveType", "FETCH_ITEM", "filename", "xmas_lost_present.yml", "amount", 10, "itemName", "Lost Present")), + new ArrayList<>(List.of( "filename=xmas_treat.yml:amount=10:chance=.3", "filename=xmas_treat_v2.yml:amount=1:chance=.3", "filename=xmas_and_gold.yml:amount=1:chance=.2", @@ -24,11 +24,11 @@ public XmasQuest0Config() { "currencyAmount=300:amount=1:chance=.3", "currencyAmount=300:amount=1:chance=.3", "currencyAmount=300:amount=1:chance=.3" - ), + )), 10, "&2Find the lost gifts!", - Arrays.asList("I seem to have lost some Christmas gifts along the way, would you help a poor old man find them again?", - "I will let you open one of them in return!")); + new ArrayList<>(List.of("I seem to have lost some Christmas gifts along the way, would you help a poor old man find them again?", + "I will let you open one of them in return!"))); super.setQuestAcceptDialog(List.of("&8[&cSaint Nick&8]&f Thank you! I will be waiting here for you!")); super.setQuestCompleteDialog(List.of("&8[&cSaint Nick&8]&f Thank you for your help! " + "There are still some lost gifts out there, talk to me again if you want to help out more!")); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfig.java index 75312b5b5..342f4e1c6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfig.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.config.customspawns; -import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfigFields.java index ac263aacd..2b23edfcc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/CustomSpawnConfigFields.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.customspawns; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.events.MoonPhaseDetector; import lombok.Getter; import lombok.Setter; @@ -11,7 +10,7 @@ import java.util.ArrayList; import java.util.List; -public class CustomSpawnConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class CustomSpawnConfigFields extends CustomConfigFields { @Getter @Setter diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/DeadMoonSpawn.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/DeadMoonSpawn.java index 041bcc57a..eef335c93 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/DeadMoonSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/DeadMoonSpawn.java @@ -5,7 +5,6 @@ import org.bukkit.World; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class DeadMoonSpawn extends CustomSpawnConfigFields { @@ -13,7 +12,7 @@ public DeadMoonSpawn() { super("dead_moon_spawn", true); setSurfaceSpawn(true); try { - setValidWorldEnvironments(new ArrayList<>(Arrays.asList(World.Environment.NORMAL, World.Environment.CUSTOM))); + setValidWorldEnvironments(new ArrayList<>(new ArrayList<>(List.of(World.Environment.NORMAL, World.Environment.CUSTOM)))); } catch (NoSuchFieldError err) { //So this happens when CUSTOM doesn't exist, which it should but in some bugged releases it doesn't. setValidWorldEnvironments(new ArrayList<>(List.of(World.Environment.NORMAL))); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/FullMoonSpawn.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/FullMoonSpawn.java index 564a6d4af..5841626df 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/FullMoonSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/FullMoonSpawn.java @@ -5,7 +5,6 @@ import org.bukkit.World; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class FullMoonSpawn extends CustomSpawnConfigFields { @@ -13,7 +12,7 @@ public FullMoonSpawn() { super("full_moon_spawn", true); setSurfaceSpawn(true); try { - setValidWorldEnvironments(new ArrayList<>(Arrays.asList(World.Environment.NORMAL, World.Environment.CUSTOM))); + setValidWorldEnvironments(new ArrayList<>(new ArrayList<>(List.of(World.Environment.NORMAL, World.Environment.CUSTOM)))); } catch (NoSuchFieldError ex) { //So this happens when CUSTOM doesn't exist, which it should but in some bugged releases it doesn't. setValidWorldEnvironments(new ArrayList<>(List.of(World.Environment.NORMAL))); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NighttimeSurfaceSpawn.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NighttimeSurfaceSpawn.java index 83d3eae86..a8d9eda63 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NighttimeSurfaceSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NighttimeSurfaceSpawn.java @@ -4,7 +4,6 @@ import org.bukkit.World; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class NighttimeSurfaceSpawn extends CustomSpawnConfigFields { @@ -13,7 +12,7 @@ public NighttimeSurfaceSpawn() { true); setSurfaceSpawn(true); try { - setValidWorldEnvironments(new ArrayList<>(Arrays.asList(World.Environment.NORMAL, World.Environment.CUSTOM))); + setValidWorldEnvironments(new ArrayList<>(new ArrayList<>(List.of(World.Environment.NORMAL, World.Environment.CUSTOM)))); } catch (NoSuchFieldError ex) { //So this happens when CUSTOM doesn't exist, which it should but in some bugged releases it doesn't. setValidWorldEnvironments(new ArrayList<>(List.of(World.Environment.NORMAL))); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalSurfaceSpawn.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalSurfaceSpawn.java index 3cb6135a7..d0be9051e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalSurfaceSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalSurfaceSpawn.java @@ -4,7 +4,6 @@ import org.bukkit.World; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class NormalSurfaceSpawn extends CustomSpawnConfigFields { @@ -14,7 +13,7 @@ public NormalSurfaceSpawn() { setSurfaceSpawn(true); setCanSpawnInLight(true); try { - setValidWorldEnvironments(new ArrayList<>(Arrays.asList(World.Environment.NORMAL, World.Environment.CUSTOM))); + setValidWorldEnvironments(new ArrayList<>(new ArrayList<>(List.of(World.Environment.NORMAL, World.Environment.CUSTOM)))); } catch (NoSuchFieldError ex) { //So this happens when CUSTOM doesn't exist, which it should but in some bugged releases it doesn't. setValidWorldEnvironments(new ArrayList<>(List.of(World.Environment.NORMAL))); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalUndergroundSpawn.java b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalUndergroundSpawn.java index 657c145cc..b6e2ab729 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalUndergroundSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customspawns/premade/NormalUndergroundSpawn.java @@ -4,7 +4,6 @@ import org.bukkit.World; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class NormalUndergroundSpawn extends CustomSpawnConfigFields { @@ -14,7 +13,7 @@ public NormalUndergroundSpawn() { setSurfaceSpawn(false); setCanSpawnInLight(false); try { - setValidWorldEnvironments(new ArrayList<>(Arrays.asList(World.Environment.NORMAL, World.Environment.CUSTOM))); + setValidWorldEnvironments(new ArrayList<>(new ArrayList<>(List.of(World.Environment.NORMAL, World.Environment.CUSTOM)))); } catch (NoSuchFieldError ex) { //So this happens when CUSTOM doesn't exist, which it should but in some bugged releases it doesn't. setValidWorldEnvironments(new ArrayList<>(List.of(World.Environment.NORMAL))); diff --git a/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index f74bf05c3..8f81d59aa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java @@ -5,9 +5,9 @@ import com.magmaguy.elitemobs.items.customloottable.CustomLootTable; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; -import org.bukkit.Bukkit; +import lombok.Setter; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -49,6 +49,9 @@ public class CustomTreasureChestConfigFields extends CustomConfigFields { private List locationsString = new ArrayList<>(); @Getter private CustomLootTable customLootTable = null; + @Getter + @Setter + private boolean instanced = false; public CustomTreasureChestConfigFields(String filename, boolean isEnabled) { @@ -108,6 +111,7 @@ public void processConfigFields() { this.effects = processStringList("effects", effects, new ArrayList<>(), false); this.locationsString = processStringList("locations", locationsString, new ArrayList<>(), false); this.locationString = processString("location", locationString, null, false); + this.instanced = processBoolean("instanced", instanced, false, false); if (locationString != null) new TreasureChest(this, locationString, restockTime); else if (locationsString != null) @@ -118,12 +122,12 @@ else if (locationsString != null) try { timestamp = Long.parseLong(strings[1]); } catch (Exception exception) { - new WarningMessage("Bad unix timestamp in locations for " + filename + " . Entry: " + strings[0]); + Logger.warn("Bad unix timestamp in locations for " + filename + " . Entry: " + strings[0]); } } new TreasureChest(this, strings[0], timestamp); } - else new WarningMessage("No locations found for chest " + filename); + else Logger.warn("No locations found for chest " + filename); } /** @@ -157,6 +161,7 @@ public TreasureChest addTreasureChest(Location chestInstanceLocation, long unixT } public void setRestockTime(Location location, long newRestockTime) { + if (isInstanced()) return; if (!locationsString.isEmpty()) { addTreasureChest(location, newRestockTime); return; @@ -167,7 +172,7 @@ public void setRestockTime(Location location, long newRestockTime) { try { fileConfiguration.save(file); } catch (Exception ex) { - Bukkit.getLogger().warning("[EliteMobs] Attempted to update restock time for a custom treasure chest and failed, did you delete it during runtime?"); + Logger.warn("Attempted to update restock time for a custom treasure chest and failed, did you delete it during runtime?"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestsConfig.java index b43a9177b..ef7c32954 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestsConfig.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config.customtreasurechests; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.CustomConfig; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -34,7 +34,7 @@ public static void addTreasureChestEntry(Player player, String customChestFileNa public static TreasureChest addTreasureChestEntry(Location location, String customChestFileName) { CustomTreasureChestConfigFields customTreasureChestConfigFields = getCustomTreasureChestConfigFields().get(customChestFileName); if (location == null) { - new WarningMessage("Failed to commit a location for a treasure chest!"); + Logger.warn("Failed to commit a location for a treasure chest!"); return null; } return customTreasureChestConfigFields.addTreasureChest(location, 0); @@ -43,7 +43,7 @@ public static TreasureChest addTreasureChestEntry(Location location, String cust public static void removeTreasureChestEntry(Location location, String customChestFileName) { CustomTreasureChestConfigFields customTreasureChestConfigFields = getCustomTreasureChestConfigFields().get(customChestFileName); if (location == null || customTreasureChestConfigFields == null) { - new WarningMessage("Failed to remove a location for a treasure chest!"); + Logger.warn("Failed to remove a location for a treasure chest!"); return; } customTreasureChestConfigFields.purgeLocations(); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfig.java index 748dae982..6fd299f13 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfig.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config.dungeonpackager; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.magmacore.config.CustomConfig; import lombok.Getter; import java.io.File; diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index a97398b7e..e48e6b2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -2,17 +2,14 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.util.Vector; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -21,8 +18,6 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter private String name; @Getter - private DungeonLocationType dungeonLocationType = DungeonLocationType.WORLD; - @Getter private ContentType contentType = null; @Getter private List customInfo = null; @@ -49,7 +44,6 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { private Location anchorPoint; @Getter private String defaultSchematicRotationString = null; - private SchematicPackage.SchematicRotation defaultSchematicRotation = null; @Getter @Setter private Integer calculatedRotation = 0; @@ -102,6 +96,18 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter @Setter private boolean enchantmentChallenge = false; + @Getter + @Setter + private boolean allowExplosions; + @Getter + @Setter + private boolean listedInTeleports = true; + @Getter + @Setter + private String song = null; + @Getter + @Setter + private boolean allowLiquidFlow = true; public DungeonPackagerConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); @@ -139,7 +145,8 @@ public DungeonPackagerConfigFields(String filename, String playerInfo, String regionEnterMessage, String regionLeaveMessage, - String dungeonConfigFolderName) { + String dungeonConfigFolderName, + boolean allowExplosions) { super(filename, isEnabled); this.contentType = ContentType.OPEN_DUNGEON; this.name = name; @@ -155,6 +162,7 @@ public DungeonPackagerConfigFields(String filename, this.regionEnterMessage = regionEnterMessage; this.regionLeaveMessage = regionLeaveMessage; this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; defaultDungeon = true; } @@ -176,7 +184,8 @@ public DungeonPackagerConfigFields(String filename, String regionLeaveMessage, List rawDungeonObjectives, String dungeonConfigFolderName, - int contentLevel) { + int contentLevel, + boolean allowExplosions) { super(filename, isEnabled); this.contentType = ContentType.INSTANCED_DUNGEON; this.name = name; @@ -195,138 +204,55 @@ public DungeonPackagerConfigFields(String filename, this.rawDungeonObjectives = rawDungeonObjectives; this.dungeonConfigFolderName = dungeonConfigFolderName; this.contentLevel = contentLevel; + this.allowExplosions = allowExplosions; defaultDungeon = true; } - /** - * Used by schematic-based dungeons - * - * @param filename Filename of the dungeon - * @param isEnabled If the dungeon is enabled - * @param name Human name of the dungeon - * @param customInfo Info displayed to players in menus - * @param relativeBossLocations List of relative locations for the bosses - * @param relativeTreasureChestLocations List of relative locations for the treasure chests - * @param downloadLink Download link for the dungeon - * @param dungeonSizeCategory Size of the dungeon - * @param schematicName Name of the schematic file of the dungeon - * @param protect If the dungeon should be protected with WorldGuard - * @param corner1 Corner of the dungeon for creating a region - * @param corner2 Other corner of the dungeon for creating a region - * @param teleportLocationOffsetString Point to teleport to offset from the anchor point of the schematic - * @param dungeonVersion Version of the dungeon - * @param playerInfo Additional custom info for players - * @param regionEnterMessage Message upon entering the region - * @param regionLeaveMessage Message upon leaving the region - */ + //For the adventurer's guild hub public DungeonPackagerConfigFields(String filename, boolean isEnabled, String name, List customInfo, - List relativeBossLocations, - List relativeTreasureChestLocations, - String downloadLink, - DungeonSizeCategory dungeonSizeCategory, - String schematicName, - Boolean protect, - Vector corner1, - Vector corner2, - String teleportLocationOffsetString, - int dungeonVersion, - String playerInfo, - String regionEnterMessage, - String regionLeaveMessage, - String defaultSchematicRotation, - String dungeonConfigFolderName) { - super(filename, isEnabled); - this.contentType = ContentType.SCHEMATIC_DUNGEON; - this.name = name; - this.customInfo = customInfo; - this.relativeBossLocations = relativeBossLocations; - this.relativeTreasureChestLocations = relativeTreasureChestLocations; - this.downloadLink = downloadLink; - this.dungeonSizeCategory = dungeonSizeCategory; - this.schematicName = schematicName; - this.protect = protect; - this.corner1 = corner1; - this.corner2 = corner2; - this.teleportLocationOffsetString = teleportLocationOffsetString; - this.dungeonVersion = dungeonVersion; - this.playerInfo = playerInfo; - this.regionEnterMessage = regionEnterMessage; - this.regionLeaveMessage = regionLeaveMessage; - this.defaultSchematicRotationString = defaultSchematicRotation; - this.dungeonConfigFolderName = dungeonConfigFolderName; - defaultDungeon = true; - } - - public DungeonPackagerConfigFields(String fileName, - boolean isEnabled, - String name, - DungeonLocationType dungeonLocationType, - List customInfo, - List relativeBossLocations, - List relativeTreasureChestLocations, String downloadLink, - DungeonSizeCategory dungeonSizeCategory, String worldName, - String schematicName, World.Environment environment, Boolean protect, - Vector corner1, - Vector corner2, String teleportLocationString, - String wormholeLocationString, int dungeonVersion, String playerInfo, String regionEnterMessage, String regionLeaveMessage, - String dungeonConfigFolderName) { - super(fileName, isEnabled); + String dungeonConfigFolderName, + boolean allowExplosions) { + super(filename, isEnabled); + this.contentType = ContentType.HUB; this.name = name; - this.dungeonLocationType = dungeonLocationType; this.customInfo = customInfo; - this.relativeBossLocations = new ArrayList<>(relativeBossLocations); - this.relativeTreasureChestLocations = new ArrayList<>(relativeTreasureChestLocations); this.downloadLink = downloadLink; - this.dungeonSizeCategory = dungeonSizeCategory; this.worldName = worldName; - this.schematicName = schematicName; this.environment = environment; this.protect = protect; - this.corner1 = corner1; - this.corner2 = corner2; this.teleportLocationString = teleportLocationString; this.dungeonVersion = dungeonVersion; this.playerInfo = playerInfo; this.regionEnterMessage = regionEnterMessage; this.regionLeaveMessage = regionLeaveMessage; this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; defaultDungeon = true; } - public SchematicPackage.SchematicRotation getDefaultSchematicRotation() { - if (defaultSchematicRotation == null) return SchematicPackage.SchematicRotation.SOUTH; - return defaultSchematicRotation; - } - @Override public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, false, true); this.name = translatable(filename, "name", processString("name", name, null, true)); - this.dungeonLocationType = processEnum("dungeonLocationType", dungeonLocationType, null, DungeonLocationType.class, true); - if (dungeonLocationType == null) { - new WarningMessage("File " + filename + " does not have a valid dungeonLocationType!"); - this.fileConfiguration = null; - return; - } this.customInfo = translatable(filename, "customInfo", processStringList("customInfo", customInfo, null, true)); this.relativeBossLocations = processStringList("relativeBossLocations", relativeBossLocations, null, false); this.relativeTreasureChestLocations = processStringList("relativeTreasureChestLocations", relativeTreasureChestLocations, null, false); this.downloadLink = processString("downloadLink", downloadLink, null, false); this.dungeonSizeCategory = processEnum("dungeonSizeCategory", dungeonSizeCategory, null, DungeonSizeCategory.class, false); if (dungeonSizeCategory == null) { - new WarningMessage("File " + filename + " does not have a valid dungeonSizeCategory!"); + Logger.warn("File " + filename + " does not have a valid dungeonSizeCategory!"); this.fileConfiguration = null; return; } @@ -337,14 +263,6 @@ public void processConfigFields() { this.protect = processBoolean("protect", protect, true, true); this.anchorPoint = processLocation("anchorPoint", anchorPoint, null, false); this.defaultSchematicRotationString = processString("defaultSchematicRotation", defaultSchematicRotationString, null, false); - if (defaultSchematicRotationString != null) - try { - if (defaultSchematicRotationString == null || defaultSchematicRotationString.isEmpty()) - defaultSchematicRotationString = "0"; - this.defaultSchematicRotation = SchematicPackage.SchematicRotation.valueOf(defaultSchematicRotationString); - } catch (Exception ex) { - new WarningMessage("Bad default schematic rotation for dungeon " + filename); - } this.calculatedRotation = processInt("calculatedRotation", calculatedRotation, 0, false); this.corner1 = processVector("corner1", corner1, null, false); this.corner2 = processVector("corner2", corner2, null, false); @@ -369,6 +287,10 @@ public void processConfigFields() { this.difficulties = (List>) fileConfiguration.getList("difficulties"); else fileConfiguration.addDefault("difficulties", difficulties); enchantmentChallenge = processBoolean("enchantmentChallenge", enchantmentChallenge, false, false); + this.allowExplosions = processBoolean("allowExplosionBlockDamage", allowExplosions, false, false); + this.listedInTeleports = processBoolean("listedInTeleports", listedInTeleports, true, false); + this.song = processString("song", song, null, false); + this.allowLiquidFlow = processBoolean("allowLiquidFlow", allowLiquidFlow, allowLiquidFlow, false); processAdditionalFields(); } @@ -390,29 +312,10 @@ public void installWorld() { ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); } - public void installSchematic(Location location, int calculatedRotation, SchematicPackage schematicPackage) { - this.isEnabled = true; - ConfigurationEngine.writeValue(true, file, fileConfiguration, "isEnabled"); - this.anchorPoint = location; - ConfigurationEngine.writeValue(ConfigurationLocation.deserialize(location), file, fileConfiguration, "anchorPoint"); - if (teleportLocationOffset == null) teleportLocationOffset = new Location(null, 0, 0, 0, 0, 0); - this.teleportLocation = schematicPackage.toRealPosition(teleportLocationOffset.toVector()); - this.teleportLocation.setYaw(location.getYaw() + teleportLocationOffset.getYaw()); - this.teleportLocation.setPitch(location.getPitch() + teleportLocationOffset.getPitch()); - ConfigurationEngine.writeValue(ConfigurationLocation.deserialize(teleportLocation), file, fileConfiguration, "teleportLocation"); - this.calculatedRotation = calculatedRotation; - ConfigurationEngine.writeValue(calculatedRotation, file, fileConfiguration, "calculatedRotation"); - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); - } - public void initializeWorld() { this.teleportLocation = processLocation("teleportLocation", teleportLocation, null, false); } - public void initializeSchematic() { - this.teleportLocation = ConfigurationLocation.serialize(teleportLocationString); - } - public void simpleUninstall() { this.isEnabled = false; ConfigurationEngine.writeValue(false, file, fileConfiguration, "isEnabled"); @@ -425,38 +328,6 @@ public void uninstallWorld() { ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); } - public void uninstallSchematic() { - this.isEnabled = false; - ConfigurationEngine.writeValue(false, file, fileConfiguration, "isEnabled"); - this.teleportLocation = null; - ConfigurationEngine.writeValue(null, file, fileConfiguration, "teleportLocation"); - this.calculatedRotation = 0; - ConfigurationEngine.writeValue(null, file, fileConfiguration, "calculatedRotation"); - this.anchorPoint = null; - ConfigurationEngine.writeValue(null, file, fileConfiguration, "anchorPoint"); - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); - } - - - public boolean addRelativeBossLocation(CustomBossesConfigFields customBossesConfigFields, Vector relativeLocation) { - String configurationLocation = customBossesConfigFields.getFilename() + ":" + relativeLocation.getX() + "," + relativeLocation.getY() + "," + relativeLocation.getZ(); - relativeBossLocations.add(configurationLocation); - return ConfigurationEngine.writeValue(relativeBossLocations, file, fileConfiguration, "relativeBossLocations"); - } - - public void removeRelativeBossLocation(CustomBossesConfigFields customBossesConfigFields, Vector relativeLocation) { - String configurationLocation = customBossesConfigFields.getFilename() + ":" + relativeLocation.getX() + "," + relativeLocation.getY() + "," + relativeLocation.getZ(); - relativeBossLocations.remove(configurationLocation); - ConfigurationEngine.writeValue(relativeBossLocations, file, fileConfiguration, "relativeBossLocations"); - } - - public boolean addRelativeTreasureChests(String treasureChestFilename, Vector relativeLocation) { - String configurationLocation = treasureChestFilename + ":" + relativeLocation.getX() + "," + relativeLocation.getY() + "," + relativeLocation.getZ(); - relativeTreasureChestLocations.add(configurationLocation); - return ConfigurationEngine.writeValue(relativeTreasureChestLocations, file, fileConfiguration, "relativeTreasureChestLocations"); - } - - public enum DungeonLocationType { WORLD, SCHEMATIC, diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AdventurersGuildHub.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AdventurersGuildHub.java new file mode 100644 index 000000000..350b9324f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AdventurersGuildHub.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.config.dungeonpackager.premade; + +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import com.magmaguy.elitemobs.utils.DiscordLinks; +import org.bukkit.World; + +import java.util.List; + +public class AdventurersGuildHub extends DungeonPackagerConfigFields { + public AdventurersGuildHub() { + super("adventurers_guild_hub", + true, + "&2[000] Adventurers Guild Hub!", + List.of("&aThe EliteMobs hub with shops and teleports!"), + DiscordLinks.freeMinidungeons, + "em_adventurers_guild", + World.Environment.NORMAL, + true, + "em_adventurers_guild,208.5,88,236.5,-80,0", + 0, + "Difficulty: &cHard\n" + + "$bossCount level $lowestTier Big Boss!\n" + + "&6Face fierce beasts at their home turf!", + "&8[EM] &aYou have entered the Beast Sanctuary! Beware of what prowls here!", + "&8[EM] &aYou've left the Beast Sanctuary! Did you take trophies?", + "em_adventurers_guild", + false); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java deleted file mode 100644 index 62ee849a6..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.magmaguy.elitemobs.config.dungeonpackager.premade; - -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; -import com.magmaguy.elitemobs.utils.DiscordLinks; -import org.bukkit.util.Vector; - -import java.util.ArrayList; -import java.util.Arrays; - -public class AirShipMinidungeon extends DungeonPackagerConfigFields { - public AirShipMinidungeon() { - super( - "airship_minidungeon", - false, - "&2[lvl 045-055] &6The Airship", - Arrays.asList("&fAn awesome airship full of undead pirates!", - "&6Credits: MagmaGuy, 69OzCanOfBepis", - "&6and Realm of Lotheridon"), - Arrays.asList( - "airship_tier_75_boss.yml:0.0,31.5,112.0", - "airship_tier_65_silverfish.yml:-8.0,21.5,102.0", - "airship_tier_65_silverfish.yml:-10.0,21.5,97.0", - "airship_tier_65_silverfish.yml:-13.0,21.5,93.0", - "airship_tier_65_silverfish.yml:-14.0,7.5,98.0", - "airship_tier_65_silverfish.yml:-13.0,9.5,86.0", - "airship_tier_65_silverfish.yml:-12.0,9.5,76.0", - "airship_tier_65_silverfish.yml:-11.0,9.5,62.0", - "airship_tier_65_silverfish.yml:-9.0,9.5,53.0", - "airship_tier_65_silverfish.yml:0.0,2.5,31.0", - "airship_tier_65_silverfish.yml:0.0,2.5,46.0", - "airship_tier_65_silverfish.yml:0.0,1.5,61.0", - "airship_tier_65_silverfish.yml:0.0,1.5,78.0", - "airship_tier_65_silverfish.yml:0.0,1.5,91.0", - "airship_tier_65_silverfish.yml:0.0,2.5,105.0", - "airship_tier_70_miniboss.yml:0.0,6.5,102.0", - "airship_tier_70_miniboss_2.yml:0.0,6.5,38.0", - "airship_tier_65_silverfish.yml:15.0,7.5,96.0", - "airship_tier_65_silverfish.yml:13.0,10.5,83.0", - "airship_tier_65_silverfish.yml:12.0,10.5,74.0", - "airship_tier_65_silverfish.yml:11.0,9.5,62.0", - "airship_tier_65_silverfish.yml:9.0,10.5,52.0", - "airship_tier_65_silverfish.yml:8.0,10.5,40.0", - "airship_tier_65_silverfish.yml:13.0,21.5,93.0", - "airship_tier_65_silverfish.yml:10.0,21.5,97.0", - "airship_tier_65_silverfish.yml:8.0,21.5,104.0", - "airship_tier_45_knockback.yml:7.0,16.5,42.0", - "airship_tier_45_knockback.yml:-8.0,16.5,42.0", - "airship_tier_45_witherblind.yml:-3.0,16.5,42.0", - "airship_tier_45_witherblind.yml:3.0,16.5,42.0", - "airship_tier_45_witherblind.yml:-6.0,14.5,59.0", - "airship_tier_45_knockback.yml:-6.0,14.5,53.0", - "airship_tier_45_knockback.yml:7.0,14.5,59.0", - "airship_tier_45_knockback.yml:2.0,14.5,75.0", - "airship_tier_45_witherblind.yml:-3.0,14.5,74.0", - "airship_tier_50_scourge.yml:2.0,14.5,89.0", - "airship_tier_50_scourge.yml:-2.0,14.5,89.0", - "airship_tier_60_mess_hall_mate.yml:8.0,14.5,89.0", - "airship_tier_60_mess_hall_mate.yml:10.0,14.5,90.0", - "airship_tier_60_mess_hall_mate.yml:8.0,14.5,97.0", - "airship_tier_60_mess_hall_mate.yml:-8.0,14.5,84.0", - "airship_tier_60_mess_hall_mate.yml:-9.0,14.5,87.0", - "airship_tier_60_mess_hall_mate.yml:-9.0,14.5,101.0", - "airship_tier_50_scourge.yml:0.0,14.5,98.0", - "airship_tier_65_bodyguard.yml:3.0,14.5,109.0", - "airship_tier_50_powder_monkeys.yml:10.0,5.5,88.0", - "airship_tier_50_powder_monkeys.yml:4.0,5.5,85.0", - "airship_tier_50_powder_monkeys.yml:6.0,5.5,77.0", - "airship_tier_50_powder_monkeys.yml:3.0,5.5,72.0", - "airship_tier_65_boatswain_boss.yml:3.0,5.5,74.0", - "airship_tier_65_boatswain_boss.yml:3.0,5.5,54.0", - "airship_tier_50_powder_monkeys.yml:0.0,5.5,59.0", - "airship_tier_50_powder_monkeys.yml:-4.0,5.5,53.0", - "airship_tier_50_powder_monkeys.yml:-4.0,5.5,67.0", - "airship_tier_50_powder_monkeys.yml:-6.0,5.5,73.0", - "airship_tier_50_powder_monkeys.yml:-5.0,5.5,85.0", - "airship_tier_50_powder_monkeys.yml:-9.0,5.5,86.0", - "airship_tier_65_boatswain_boss.yml:-7.0,5.5,80.0", - "airship_tier_70_miniboss_wayfinder.yml:-2.0,21.5,115.0", - "airship_tier_65_bodyguard.yml:-3.0,21.5,109.0", - "airship_tier_65_bodyguard.yml:3.0,21.5,109.0", - "airship_tier_45_witherblind.yml:8.0,21.5,82.0", - "airship_tier_45_witherblind.yml:-5.0,21.5,84.0", - "airship_tier_45_knockback.yml:11.0,26.5,96.0", - "airship_tier_45_knockback.yml:-11.0,26.5,96.0", - "airship_tier_45_knockback.yml:1.0,21.5,98.0", - "airship_tier_65_bodyguard.yml:-3.0,14.5,109.0"), - new ArrayList<>(), - DiscordLinks.premiumMinidungeons, - DungeonSizeCategory.MINIDUNGEON, - "em_airship.schem", - true, - new Vector(38, -2, 0), - new Vector(-40, 70, 146), - "12,14,56,0,0", - 0, - "Difficulty: &6Medium\n" + - "$bossCount bosses, from level $lowestTier to $highestTier\n" + - "&6An awesome airship full of undead pirates\n" + - "&6for experienced players!", - "&8[EM] &cEntering hostile air zone!", - "&8[EM] &cLeaving hostile air zone!", - SchematicPackage.SchematicRotation.SOUTH.toString(), - "the_airship"); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirshipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirshipMinidungeon.java new file mode 100644 index 000000000..c6f5dc37d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirshipMinidungeon.java @@ -0,0 +1,34 @@ +package com.magmaguy.elitemobs.config.dungeonpackager.premade; + +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import com.magmaguy.elitemobs.utils.DiscordLinks; +import org.bukkit.World; + +import java.util.ArrayList; +import java.util.List; + +public class AirshipMinidungeon extends DungeonPackagerConfigFields { + public AirshipMinidungeon() { + super("airship_minidungeon", + true, + "&2[lvl 045-055] &6The Airship", + new ArrayList<>(List.of("&fAn awesome airship full of undead pirates!", + "&6Credits: MagmaGuy, 69OzCanOfBepis", + "&6and Realm of Lotheridon")), + DiscordLinks.premiumMinidungeons, + DungeonSizeCategory.MINIDUNGEON, + "em_the_airship", + World.Environment.NORMAL, + true, + "em_the_airship,-95.5,188.0,43.5,-144,0", + 0, + "Difficulty: &6Medium\n" + + "$bossCount bosses, from level $lowestTier to $highestTier\n" + + "&6An awesome airship full of undead pirates\n" + + "&6for experienced players!", + "&8[EM] &cEntering hostile air zone!", + "&8[EM] &cLeaving hostile air zone!", + "the_airship", + false); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BeastsSanctuaryLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BeastsSanctuaryLair.java index 9e3ddf8f3..ea917e477 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BeastsSanctuaryLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BeastsSanctuaryLair.java @@ -4,26 +4,27 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.List; public class BeastsSanctuaryLair extends DungeonPackagerConfigFields { public BeastsSanctuaryLair() { super("beasts_sanctuary_lair", - false, + true, "&2[lvl 130] &6The Beasts Sanctuary", - Arrays.asList("&6Confront the beasts!"), + List.of("&6Confront the beasts!"), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.LAIR, "em_beasts_sanctuary", World.Environment.NORMAL, true, - "em_beasts_sanctuary,32.5,86.5,40.5,0,0", + "em_beasts_sanctuary,32.5,88.2,36.5,0,0", 0, "Difficulty: &cHard\n" + "$bossCount level $lowestTier Big Boss!\n" + "&6Face fierce beasts at their home turf!", "&8[EM] &aYou have entered the Beast Sanctuary! Beware of what prowls here!", "&8[EM] &aYou've left the Beast Sanctuary! Did you take trophies?", - "the_beasts_sanctuary"); + "the_beasts_sanctuary", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BinderOfWorldsSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BinderOfWorldsSanctum.java index c46db80c9..a130b6748 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BinderOfWorldsSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BinderOfWorldsSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class BinderOfWorldsSanctum extends DungeonPackagerConfigFields { public BinderOfWorldsSanctum() { super("binder_of_worlds_sanctum", - false, + true, "&2[lvl 200] &5The Binder Of Worlds", - Arrays.asList("&5The ultimate challenge. Be prepared!", - "&6Credits: MagmaGuy, 69OzCanOfBepis & Frostcone"), + new ArrayList<>(List.of("&5The ultimate challenge. Be prepared!", + "&6Credits: MagmaGuy, 69OzCanOfBepis & Frostcone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_binder_of_worlds", @@ -30,7 +30,8 @@ public BinderOfWorldsSanctum() { "&8[EM] &5You have left the unravelling. Did you find what you sought? Was it worth it?", List.of("filename=em_id_binder_of_worlds_phase_1.yml"), "the_binder_of_worlds", - 50); + 50, + true); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 205, "id", 0), Map.of("name", "hard", "levelSync", 200, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BoneMonasteryDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BoneMonasteryDungeon.java index a04884bda..6d46ddd22 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BoneMonasteryDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/BoneMonasteryDungeon.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class BoneMonasteryDungeon extends DungeonPackagerConfigFields { public BoneMonasteryDungeon() { super("bone_monastery_dungeon", - false, + true, "&2[lvl 085]&cThe Bone Monastery", - Arrays.asList("&fSpooky skeletons await.", - "&6Credits: MagmaGuy, Matevagyok, Frostcone, 69OzCanOfBepis"), + new ArrayList<>(List.of("&fSpooky skeletons await.", + "&6Credits: MagmaGuy, Matevagyok, Frostcone, 69OzCanOfBepis")), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_bone_monastery", @@ -28,7 +28,8 @@ public BoneMonasteryDungeon() { "&bYou have left the bone monastery!", List.of("filename=bone_monastery_bone_saint_himiko_p1.yml"), "the_bone_monastery", - 85); + 85, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 90, "id", 0), Map.of("name", "hard", "levelSync", 85, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off similarity index 90% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off index e1eae617c..9e7decd1f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.dungeonpackager.premade; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.util.Vector; @@ -11,11 +10,11 @@ public class CatacombsLair extends DungeonPackagerConfigFields { public CatacombsLair() { super("catacombs_lair", - false, + true, "&2[lvl 010] &8The Catacombs", - Arrays.asList("&fThe best starter lair for players!", + new ArrayList<>(List.of("&fThe best starter lair for players!", "&6Credits: Realm of Lotheridon"), - Arrays.asList( + new ArrayList<>(List.of( "catacombs_tier_5_evoker_guard_2.yml:2.5,0.5,13.5", "catacombs_tier_5_illusioner_guard_1.yml:-2.5,2.5,16.5", "catacombs_tier_15_boss.yml:0.5,-7.5,45.5", diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off similarity index 90% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off index 0831e96d1..b9bbff526 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.dungeonpackager.premade; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.util.Vector; @@ -11,13 +10,13 @@ public class ColosseumLair extends DungeonPackagerConfigFields { public ColosseumLair() { super("colosseum_lair", - false, + true, "&2[lvl 070] &6The Colosseum", - Arrays.asList("&fFeaturing the first true World boss, first", + new ArrayList<>(List.of("&fFeaturing the first true World boss, first", "&fmulti-phased battle, first mounted boss,", "&ffirst disguised boss... a truly epic fight!", "&6Credits: MagmaGuy & Maldini"), - Arrays.asList("colosseum_tier_70_boss_p1.yml:-0.5,-1.5,47.5", + new ArrayList<>(List.of("colosseum_tier_70_boss_p1.yml:-0.5,-1.5,47.5", "colosseum_tier_70_gladiator.yml:5.5,-7.5,22.5", "colosseum_tier_70_gladiator.yml:1.5,-7.5,22.5", "colosseum_tier_70_gladiator.yml:0.5,-7.5,30.5", diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CraftenminesLabSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CraftenminesLabSanctum.java index 543b507e1..39aad36c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CraftenminesLabSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CraftenminesLabSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class CraftenminesLabSanctum extends DungeonPackagerConfigFields { public CraftenminesLabSanctum() { super("craftenmines_lab_sanctum", - false, + true, "&2[lvl 030] &aCraftenmines Sanctum", - Arrays.asList("&aFace the creator of the devious creations!", - "&6Credits: MagmaGuy, 69OzCanOfBepis"), + new ArrayList<>(List.of("&aFace the creator of the devious creations!", + "&6Credits: MagmaGuy, 69OzCanOfBepis")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_craftenmines_lab", @@ -29,7 +29,8 @@ public CraftenminesLabSanctum() { "&8[EM] &5You have left Dr. Craftenmine's laboratory!", List.of("filename=dr_craftenmine_p1.yml"), "em_id_craftenmines_lab", - 30); + 30, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 25, "id", 0), Map.of("name", "hard", "levelSync", 30, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java index 6ac37644d..df8211fd7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java @@ -1,39 +1,35 @@ package com.magmaguy.elitemobs.config.dungeonpackager.premade; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; -import org.bukkit.util.Vector; +import org.bukkit.World; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class DarkCathedralLair extends DungeonPackagerConfigFields { public DarkCathedralLair() { super("dark_cathedral_lair", - false, + true, "&2[lvl 040] &8The Dark Cathedral", - Arrays.asList("&fThe first ever EliteMobs Lair!", + new ArrayList<>(List.of("&fThe first ever EliteMobs Lair!", "&fA classic that all servers need!", - "&6Credits: MagmaGuy & 69OzCanOfBepis"), - List.of("dark_cathedral_tier_75_boss.yml:0.5,0.5,24.5"), - new ArrayList<>(), + "&6Credits: MagmaGuy, 69OzCanOfBepis, Frost, Dali")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, - "em_dark_cathedral.schem", + "em_the_dark_cathedral", + World.Environment.NETHER, true, - new Vector(17, -27, 0), - new Vector(-19, 54, 32), - "0,0,0,0,0", + "em_the_dark_cathedral,47.5,85.2,199.5,163,0", 0, "Difficulty: &cHard\n" + "$bossCount level $highestTier Big Boss!\n" + "&cThe original minidungeon, a challenge for\n" + "&ca group of players or for veterans!", - "&8[EM] &8Welcome to the Dark Cathedral. &4Death awaits inside...", - "&8[EM] &8Now leaving the Dark Cathedral. &4It awaits your return...", - SchematicPackage.SchematicRotation.SOUTH.toString(), - "the_dark_cathedral"); + "&8[EM] &1An invasion is in progress. &9Stop the insurrection!", + "&8[EM] &1You managed to hold them back. &9For now...", + "the_dark_cathedral", + false); + setSong("name=elitemobs:dark_cathedral.ambient length=93830"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkSpireMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkSpireMinidungeon.java index f88ecbaa0..13f366e5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkSpireMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkSpireMinidungeon.java @@ -4,28 +4,30 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class DarkSpireMinidungeon extends DungeonPackagerConfigFields { public DarkSpireMinidungeon() { super("dark_spire_minidungeon", - false, + true, "&2[lvl 100-120] &8The Dark Spire", - Arrays.asList("&fThe first ever high level content!", + new ArrayList<>(List.of("&fThe first ever high level content!", "&fMade for those who want a real challenge!", - "&6Credits: 69OzCanOfBepis"), + "&6Credits: 69OzCanOfBepis")), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.MINIDUNGEON, "em_dark_spire", World.Environment.NETHER, true, - "em_dark_spire,61,96,96,153,0", + "em_dark_spire,60,97.5,97,110,0", 0, "Difficulty: &6Medium\n" + "$bossCount bosses, from level $lowestTier to $highestTier\n" + "&cA vast challenge for advanced players!", "&8[EM] &1An invasion is in progress. &9Stop the insurrection!", "&8[EM] &1You managed to hold them back. &9For now...", - "the_dark_spire"); + "the_dark_spire", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DiamondLeagueArena.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DiamondLeagueArena.java index 76938b220..cca59824c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DiamondLeagueArena.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DiamondLeagueArena.java @@ -4,14 +4,14 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.List; public class DiamondLeagueArena extends DungeonPackagerConfigFields { - public DiamondLeagueArena(){ + public DiamondLeagueArena() { super("diamond_league_arena", - false, + true, "&5[lvl 100-150] &fThe Diamond League Arena", - Arrays.asList("&fFace the Diamond League Arena!"), + List.of("&fFace the Diamond League Arena!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.ARENA, "em_diamond_arena", @@ -24,6 +24,7 @@ public DiamondLeagueArena(){ "level 100 to level 150!", "&fAre you prepared to face the arena?", "&fNow leaving the diamond league arena!", - "diamond_league_arena"); + "diamond_league_arena", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge1.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge1.java index be8080a6c..7f5db81cf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge1.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge1.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge1 extends DungeonPackagerConfigFields { public EnchantmentChallenge1() { super("enchantment_challenge_1_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 01", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_1", @@ -27,7 +26,8 @@ public EnchantmentChallenge1() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_dark_flame.yml"), "em_id_enchantment_challenge_1", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge10.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge10.java index 946060a29..abe1495af 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge10.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge10.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge10 extends DungeonPackagerConfigFields { - public EnchantmentChallenge10(){ + public EnchantmentChallenge10() { super("enchantment_challenge_10_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 10", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_10", @@ -27,7 +26,8 @@ public EnchantmentChallenge10(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_tricky_bones.yml"), "em_id_enchantment_challenge_10", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge11.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge11.java index 573fa9daa..113146b5f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge11.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge11.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge11 extends DungeonPackagerConfigFields { public EnchantmentChallenge11() { super("enchantment_challenge_11_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 11", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_11", @@ -27,7 +26,8 @@ public EnchantmentChallenge11() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_void_haze.yml"), "em_id_enchantment_challenge_11", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge12.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge12.java index e324e5051..763b12217 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge12.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge12.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge12 extends DungeonPackagerConfigFields { public EnchantmentChallenge12() { super("enchantment_challenge_12_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 12", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_12", @@ -27,7 +26,8 @@ public EnchantmentChallenge12() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_mad_arcanist.yml"), "em_id_enchantment_challenge_12", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge13.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge13.java index aade88eb0..c6a3b67f7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge13.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge13.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge13 extends DungeonPackagerConfigFields { public EnchantmentChallenge13() { super("enchantment_challenge_13_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 13", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_13", @@ -27,7 +26,8 @@ public EnchantmentChallenge13() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_abyss_wanderer_p1.yml"), "em_id_enchantment_challenge_13", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge14.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge14.java index 66154c75e..9d99c11f6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge14.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge14.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge14 extends DungeonPackagerConfigFields { public EnchantmentChallenge14() { super("enchantment_challenge_14_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 14", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_14", @@ -27,7 +26,8 @@ public EnchantmentChallenge14() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_hollow_soul.yml"), "em_id_enchantment_challenge_14", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge15.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge15.java index 343814603..c075b7c38 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge15.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge15.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge15 extends DungeonPackagerConfigFields { public EnchantmentChallenge15() { super("enchantment_challenge_15_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 15", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_15", @@ -27,7 +26,8 @@ public EnchantmentChallenge15() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_hopper_cultist.yml"), "em_id_enchantment_challenge_15", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge16.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge16.java index c5c597bc7..29bb4c651 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge16.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge16.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge16 extends DungeonPackagerConfigFields { public EnchantmentChallenge16() { super("enchantment_challenge_16_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 16", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_16", @@ -27,7 +26,8 @@ public EnchantmentChallenge16() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_shadow_heart.yml"), "em_id_enchantment_challenge_16", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge17.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge17.java index b76fee703..fcab49d66 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge17.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge17.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge17 extends DungeonPackagerConfigFields { public EnchantmentChallenge17() { super("enchantment_challenge_17_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 17", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_17", @@ -27,7 +26,8 @@ public EnchantmentChallenge17() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_void_fly.yml"), "em_id_enchantment_challenge_17", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge18.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge18.java index b57596495..a9849c978 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge18.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge18.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge18 extends DungeonPackagerConfigFields { public EnchantmentChallenge18() { super("enchantment_challenge_18_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 18", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_18", @@ -27,7 +26,8 @@ public EnchantmentChallenge18() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_grisly_grim.yml"), "em_id_enchantment_challenge_18", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge19.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge19.java index 4f33f18e1..38bfbb808 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge19.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge19.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge19 extends DungeonPackagerConfigFields { public EnchantmentChallenge19() { super("enchantment_challenge_19_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 19", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_19", @@ -27,7 +26,8 @@ public EnchantmentChallenge19() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_phantasm.yml"), "em_id_enchantment_challenge_19", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge2.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge2.java index 49bb57c4e..31ce2d9a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge2.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge2.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge2 extends DungeonPackagerConfigFields { - public EnchantmentChallenge2(){ + public EnchantmentChallenge2() { super("enchantment_challenge_2_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 02", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_2", @@ -27,7 +26,8 @@ public EnchantmentChallenge2(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_energized_bunny.yml"), "em_id_enchantment_challenge_2", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge20.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge20.java index 637842b07..9c2fa2773 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge20.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge20.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge20 extends DungeonPackagerConfigFields { public EnchantmentChallenge20() { super("enchantment_challenge_20_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 20", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_20", @@ -27,7 +26,8 @@ public EnchantmentChallenge20() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_soul_trampler.yml"), "em_id_enchantment_challenge_20", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge3.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge3.java index e1bfa03f7..44563aafa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge3.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge3.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge3 extends DungeonPackagerConfigFields { - public EnchantmentChallenge3(){ + public EnchantmentChallenge3() { super("enchantment_challenge_3_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 03", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_3", @@ -27,7 +26,8 @@ public EnchantmentChallenge3(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_jealous_block.yml"), "em_id_enchantment_challenge_3", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge4.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge4.java index a07cd9ec4..877e360ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge4.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge4.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge4 extends DungeonPackagerConfigFields { - public EnchantmentChallenge4(){ + public EnchantmentChallenge4() { super("enchantment_challenge_4_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 04", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_4", @@ -27,9 +26,10 @@ public EnchantmentChallenge4(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_leet_summoner.yml"), "em_id_enchantment_challenge_4", - 1); + 1, + false); setDifficulties(List.of( - Map.of("name", "normal", "id", 0))); + Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); setMaxPlayerCount(1); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge5.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge5.java index f29012eb3..98dd8f1f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge5.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge5.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge5 extends DungeonPackagerConfigFields { - public EnchantmentChallenge5(){ + public EnchantmentChallenge5() { super("enchantment_challenge_5_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 05", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_5", @@ -27,7 +26,8 @@ public EnchantmentChallenge5(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_loveable_impaler.yml"), "em_id_enchantment_challenge_5", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge6.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge6.java index c073aa50c..6b3840884 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge6.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge6.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge6 extends DungeonPackagerConfigFields { - public EnchantmentChallenge6(){ + public EnchantmentChallenge6() { super("enchantment_challenge_6_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 06", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_6", @@ -27,7 +26,8 @@ public EnchantmentChallenge6(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_ravegarer.yml"), "em_id_enchantment_challenge_6", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge7.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge7.java index fb203f4a0..fa6bfd7e9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge7.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge7.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge7 extends DungeonPackagerConfigFields { - public EnchantmentChallenge7(){ + public EnchantmentChallenge7() { super("enchantment_challenge_7_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 07", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_7", @@ -27,7 +26,8 @@ public EnchantmentChallenge7(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_rock_solid_cold.yml"), "em_id_enchantment_challenge_7", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge8.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge8.java index 5f52baab2..8aba4a9bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge8.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge8.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge8 extends DungeonPackagerConfigFields { public EnchantmentChallenge8() { super("enchantment_challenge_8_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 08", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_8", @@ -27,7 +26,8 @@ public EnchantmentChallenge8() { "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_the_firebunger.yml"), "em_id_enchantment_challenge_8", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge9.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge9.java index 17d685230..824adb7c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge9.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/EnchantmentChallenge9.java @@ -4,16 +4,15 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; public class EnchantmentChallenge9 extends DungeonPackagerConfigFields { - public EnchantmentChallenge9(){ + public EnchantmentChallenge9() { super("enchantment_challenge_9_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 09", - Arrays.asList("&fAn enchantment challenge dungeon!"), + List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_enchantment_challenge_9", @@ -27,7 +26,8 @@ public EnchantmentChallenge9(){ "&bYou have left the enchantment challenge!", List.of("filename=enchantment_boss_the_glass_master.yml"), "em_id_enchantment_challenge_9", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); setEnchantmentChallenge(true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FireworksLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FireworksLair.java index 1f84d4f8e..34cff84b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FireworksLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FireworksLair.java @@ -4,27 +4,29 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class FireworksLair extends DungeonPackagerConfigFields { public FireworksLair() { super("fireworks_lair", - false, + true, "&2[lvl 020] &aThe Fireworks", - Arrays.asList("&fThe 2021 4th of July map!", - "&6Credits: MagmaGuy"), + new ArrayList<>(List.of("&fThe 2021 4th of July map!", + "&6Credits: MagmaGuy")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_fireworks", World.Environment.NORMAL, true, - "em_fireworks,3,62,-20,17,-5", + "em_fireworks,29.5,66.2,-32.5,45,0", 0, "Difficulty: &cHard\n" + "$bossCount level $lowestTier Big Boss!\n" + "&6An encounter full of explosions!", "&8[EM] &eWelcome to the fireworks show!", "&8[EM] &eYou've left the party!", - "the_fireworks"); + "the_fireworks", + true); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FrostPalaceSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FrostPalaceSanctum.java index 56ff41e35..79d38c6f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FrostPalaceSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/FrostPalaceSanctum.java @@ -4,18 +4,18 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class FrostPalaceSanctum extends DungeonPackagerConfigFields { public FrostPalaceSanctum() { super("frost_palace_sanctum", - false, + true, "&2[lvl 050] &3The Frost Palace", - Arrays.asList("&fA 7 phase fight against", + new ArrayList<>(List.of("&fA 7 phase fight against", "the queen of ice!", - "&6Credits: MagmaGuy, Delio"), + "&6Credits: MagmaGuy, Delio")), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_frost_palace", @@ -29,7 +29,8 @@ public FrostPalaceSanctum() { "&bYou have left the Frost Palace!", List.of("filename=frost_palace_frost_queen_p0.yml"), "frost_palace", - 50); + 50, + true); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 55, "id", 0), Map.of("name", "hard", "levelSync", 50, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/HallosseumLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/HallosseumLair.java index 2d6778c06..62952b489 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/HallosseumLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/HallosseumLair.java @@ -4,27 +4,29 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class HallosseumLair extends DungeonPackagerConfigFields { public HallosseumLair() { super("hallosseum_lair", - false, + true, "&2[lvl 030] &cThe Hallosseum", - Arrays.asList("&fThe 2020 spooky halloween encounter!", - "&6Credits: MagmaGuy & 69OzCanOfBepis"), + new ArrayList<>(List.of("&fThe 2020 spooky halloween encounter!", + "&6Credits: MagmaGuy & 69OzCanOfBepis")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_hallosseum", World.Environment.NETHER, true, - "em_hallosseum,65,21,80,20,0", + "em_hallosseum,66.5,22.2,77.5,20,0", 0, "Difficulty: &chard\n" + "$bossCount level $lowestTier Big Boss!\n" + "&6A fun Halloween challenge!", "&8[EM] &4Trick or treat! &8Your soul is mine!", "&8[EM] &4You've escaped with your soul intact.", - "the_hallosseum"); + "the_hallosseum", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/InvasionMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/InvasionMinidungeon.java index 6d7fd0b73..ebaa354c3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/InvasionMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/InvasionMinidungeon.java @@ -4,27 +4,29 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class InvasionMinidungeon extends DungeonPackagerConfigFields { public InvasionMinidungeon() { super("invasion_minidungeon", - false, + true, "&2[lvl 035-045] &2The Invasion", - Arrays.asList("&fThe Halloween Minidungeon!", - "&6Credits: MagmaGuy & 69OzCanOfBepis"), + new ArrayList<>(List.of("&fThe Halloween Minidungeon!", + "&6Credits: MagmaGuy & 69OzCanOfBepis")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, "em_invasion", World.Environment.NORMAL, true, - "em_invasion,-10,12,20,80,0", + "em_invasion,-8.5,13.2,19.5,80,0", 0, "Difficulty: &6Medium\n" + "$bossCount aliens, from level $lowestTier to $highestTier\n" + "&6Don't get abducted!", "&8[EM] &7Alien invasion in progress! Defeat the Mothership!", "&8[EM] &7You have escaped the alien abductions! No one will ever believe you.", - "invasion"); + "invasion", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/IronLeagueArena.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/IronLeagueArena.java index f6818acda..3f60f38bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/IronLeagueArena.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/IronLeagueArena.java @@ -4,14 +4,14 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.List; public class IronLeagueArena extends DungeonPackagerConfigFields { public IronLeagueArena() { super("iron_league_arena", - false, + true, "&2[lvl 050-100] &fThe Iron League Arena", - Arrays.asList("&fFace the Iron League Arena!"), + List.of("&fFace the Iron League Arena!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.ARENA, "em_iron_league_arena", @@ -24,6 +24,7 @@ public IronLeagueArena() { "level 50 to level 100!", "&fAre you prepared to face the arena?", "&fNow leaving the iron league arena!", - "iron_league_arena"); + "iron_league_arena", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/KnightCastleLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/KnightCastleLair.java index 1a0b7757c..074241236 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/KnightCastleLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/KnightCastleLair.java @@ -4,27 +4,27 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.List; public class KnightCastleLair extends DungeonPackagerConfigFields { public KnightCastleLair() { super("knights_castle_lair", - false, + true, "&2[lvl 095] &fThe Knight's Castle", - Arrays.asList("&fChallenge the knights of the castle!"), + List.of("&fChallenge the knights of the castle!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_knight_castle", World.Environment.NORMAL, true, - "em_knight_castle,-24.5,5.0,54.5,-117,0", + "em_knight_castle,-20.5,6.2,55.5,-120,0", 0, "Difficulty: &chard\n" + "$bossCount level $lowestTier Big Boss!\n" + "&6Face an honorable duel!", "&fAssault the castle!", "&fNow leaving the castle!", - "the_knight_castle" - ); + "the_knight_castle", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/NorthPoleMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/NorthPoleMinidungeon.java index 499cfbd95..601dc404e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/NorthPoleMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/NorthPoleMinidungeon.java @@ -4,27 +4,29 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class NorthPoleMinidungeon extends DungeonPackagerConfigFields { public NorthPoleMinidungeon() { super("north_pole_minidungeon", - false, + true, "&2[lvl 055-060] &9The North Pole", - Arrays.asList("&fThe Christmas minidungeon!", - "&6Credits: MagmaGuy & 69OzCanOfBepis"), + new ArrayList<>(List.of("&fThe Christmas minidungeon!", + "&6Credits: MagmaGuy & 69OzCanOfBepis")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, "em_north_pole", World.Environment.NORMAL, true, - "em_north_pole,-265,42,-504,44,0", + "em_north_pole,-264.5,43.2,-503.5,47,0", 0, "Difficulty: &6Medium\n" + "$bossCount bosses, from level $lowestTier to $highestTier\n" + "&6Christmas in a snow globe!", "&8[EM] &7You have reached the North Pole! &fHave you been naughty this year?", "&8[EM] &7Come back and visit. &fThere are plenty of sweets and treats for next time!", - "the_north_pole"); + "the_north_pole", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisAdventure.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisAdventure.java index e74eb8612..d8d5a5d30 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisAdventure.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisAdventure.java @@ -4,28 +4,30 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class OasisAdventure extends DungeonPackagerConfigFields { public OasisAdventure() { super("oasis_adventure", - false, + true, "&2[lvl 020-055] &6The Oasis", - Arrays.asList("&fA massive adventure for beginners!", - "&6Credits: 69OzCanOfBepis"), + new ArrayList<>(List.of("&fA massive adventure for beginners!", + "&6Credits: 69OzCanOfBepis")), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.ADVENTURE, "em_oasis", World.Environment.NORMAL, true, - "em_oasis,261,20,284,-65,0", + "em_oasis,260.5,22,280.5,0,0", 2, "Difficulty: &2Solo-able\n" + "$bossCount bosses, from level $lowestTier to $highestTier\n" + "&6A big adventure for people who know the ropes!", "&8[EM] &6You have arrived at the Oasis!", "&8[EM] &6You have left the Oasis!", - "oasis"); + "oasis", + false); setWormholeWorldName("em_oasis_wormhole"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisPyramidSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisPyramidSanctum.java index 2d6c2d01e..8f8cbdb3d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisPyramidSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/OasisPyramidSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class OasisPyramidSanctum extends DungeonPackagerConfigFields { public OasisPyramidSanctum() { super("oasis_pyramid_sanctum", - false, + true, "&2[lvl 055] &6The Oasis Pyramid", - Arrays.asList("&fThe final dungeon of the Oasis adventure!", - "&6Credits: 69OzCanOfBepis, Frostcone, MagmaGuy"), + new ArrayList<>(List.of("&fThe final dungeon of the Oasis adventure!", + "&6Credits: 69OzCanOfBepis, Frostcone, MagmaGuy")), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_oasis_pyramid", @@ -28,8 +28,10 @@ public OasisPyramidSanctum() { "&bYou have left the Pyramid!", List.of("filename=oasis_pharaoh_p1.yml"), "em_id_oasis_pyramid", - 55); + 55, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); + setListedInTeleports(false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java index 431fbd020..7f607f7fd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java @@ -1,59 +1,27 @@ package com.magmaguy.elitemobs.config.dungeonpackager.premade; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; -import org.bukkit.util.Vector; +import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class PirateShipMinidungeon extends DungeonPackagerConfigFields { public PirateShipMinidungeon() { super("pirate_ship_minidungeon", - false, + true, "&2[lvl 010-020] &6The Pirate Ship", - Arrays.asList("&fA fun, challenging minidungeon full of", + new ArrayList<>(List.of("&fA fun, challenging minidungeon full of", "&fbosses made for players starting to get good,", "&fat EliteMobs!", - "&6Credits: MagmaGuy & Realm of Lotheridon"), - Arrays.asList( - "pirate_ship_tier_10.yml:-2.5,3.5,46.5", - "pirate_ship_tier_10.yml:2.5,3.5,46.5", - "pirate_ship_tier_15.yml:0.5,8.5,22.5", - "pirate_ship_tier_15.yml:-0.5,8.5,22.5", - "pirate_ship_tier_15.yml:0.5,8.5,22.5", - "pirate_ship_tier_20_melee_1.yml:0.5,3.5,67.5", - "pirate_ship_tier_20_melee_1.yml:-0.5,3.5,67.5", - "pirate_ship_tier_20_melee_2.yml:9.5,5.5,76.5", - "pirate_ship_tier_20_melee_2.yml:9.5,5.5,77.5", - "pirate_ship_tier_20_melee_2.yml:8.5,3.5,77.5", - "pirate_ship_tier_20_miniboss.yml:-9.5,3.5,76.5", - "pirate_ship_tier_20_ranged.yml:-1.5,8.5,67.5", - "pirate_ship_tier_20_ranged.yml:-1.5,8.5,67.5", - "pirate_ship_tier_25_miniboss_1.yml:-0.5,3.5,25.5", - "pirate_ship_tier_30_melee.yml:-0.5,-2.5,40.5", - "pirate_ship_tier_30_melee.yml:0.5,-2.5,43.5", - "pirate_ship_tier_30_melee.yml:0.5,-2.5,46.5", - "pirate_ship_tier_30_ranged.yml:-0.5,-2.5,45.5", - "pirate_ship_tier_30_ranged.yml:0.5,-2.5,47.5", - "pirate_ship_tier_30_ranged.yml:0.5,-2.5,50.5", - "pirate_ship_tier_30_miniboss_1.yml:-0.5,-2.5,31.5", - "pirate_ship_tier_35.yml:-0.5,13.5,84.5", - "pirate_ship_tier_35.yml:0.5,13.5,84.5", - "pirate_ship_tier_35.yml:-0.5,13.5,84.5", - "pirate_ship_tier_35_miniboss_1.yml:-1.5,8.5,84.5", - "pirate_ship_tier_35_miniboss_2.yml:-1.5,8.5,84.5", - "pirate_ship_tier_40_miniboss_1.yml:11.5,10.5,78.5", - "pirate_ship_tier_45_boss.yml:-13.5,10.5,79.5"), - List.of(), - DiscordLinks.premiumMinidungeons, + "&6Credits: MagmaGuy & Realm of Lotheridon")), + DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, - "em_pirate_ship.schem", + "em_the_pirate_ship", + World.Environment.NORMAL, true, - new Vector(16, -6, -1), - new Vector(-20, 58, 90), - "-17,1,49,0,0", + "em_the_pirate_ship,-85.5,64.0,236.5,180,0", 0, "Difficulty: &6Medium\n" + "$bossCount bosses, from level $lowestTier to $highestTier\n" + @@ -61,7 +29,7 @@ public PirateShipMinidungeon() { "&6aspiring adventurers!", "&8[EM] &3Now boarding the Pirate Ship! &bPillage and plunder to yer' hearts content!", "&8[EM] &3Player overboard! &bReturn when you've earned your sea-legs ye' landlubber!", - SchematicPackage.SchematicRotation.SOUTH.toString(), - "the_pirate_ship"); + "the_pirate_ship", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisAdventure.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisAdventure.java index 0ac9b21fa..f6d774aa7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisAdventure.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisAdventure.java @@ -4,28 +4,30 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class PrimisAdventure extends DungeonPackagerConfigFields { public PrimisAdventure() { super("primis_adventure", - false, + true, "&2[lvl 000-020] &7Primis", - Arrays.asList("&fA tutorial adventure for new players!", - "&6Credits: 69OzCanOfBepis, MagmaGuy"), + new ArrayList<>(List.of("&fA tutorial adventure for new players!", + "&6Credits: 69OzCanOfBepis, MagmaGuy")), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.ADVENTURE, "em_primis", World.Environment.NORMAL, true, - "em_primis,1406,20,362,33,0", + "em_primis,1406.5,21.5,357.5,33,0", 0, "Difficulty: &2Easy\n" + "$bossCount bosses, from level $lowestTier to $highestTier\n" + "&6A tutorial adventure for new players!", "&8[EM] &6Primis awaits, strike the earth!", "&8[EM] &6You have left Primis!", - "primis"); + "primis", + false); setWormholeWorldName("em_primis_wormhole"); setHasCustomModels(true); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisBloodTempleSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisBloodTempleSanctum.java index c2292f134..ee90dc388 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisBloodTempleSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisBloodTempleSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class PrimisBloodTempleSanctum extends DungeonPackagerConfigFields { public PrimisBloodTempleSanctum() { super("primis_blood_temple_sanctum", - false, + true, "&2[lvl 020] &aPrimis - Blood Temple'", - Arrays.asList("&fThe Fire Elemental awaits!", - "&6Credits: Dali_, Frostcone, MagmaGuy"), + new ArrayList<>(List.of("&fThe Fire Elemental awaits!", + "&6Credits: Dali_, Frostcone, MagmaGuy")), DiscordLinks.premiumMinidungeons, DungeonPackagerConfigFields.DungeonSizeCategory.SANCTUM, "em_id_bloodtemple", @@ -28,8 +28,10 @@ public PrimisBloodTempleSanctum() { "&bYou have left the Blood Temple!", List.of("filename=primis_final_elemental_p1.yml"), "em_id_bloodtemple", - 20); + 20, + true); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); + setListedInTeleports(false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisGladiusInvasionDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisGladiusInvasionDungeon.java index 62aa94f89..0c72e39bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisGladiusInvasionDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PrimisGladiusInvasionDungeon.java @@ -4,16 +4,16 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class PrimisGladiusInvasionDungeon extends DungeonPackagerConfigFields { public PrimisGladiusInvasionDungeon() { super("primis_gladius_invasion_dungeon", - false, + true, "&2[lvl 000-020] &aPrimis - Gladius Invasion", - Arrays.asList("&fIt is time to take Gladius back!", "&6Credits: 69OzCanOfBepis, Frostcone, MagmaGuy"), + new ArrayList<>(List.of("&fIt is time to take Gladius back!", "&6Credits: 69OzCanOfBepis, Frostcone, MagmaGuy")), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_primis_gladius", @@ -27,12 +27,14 @@ public PrimisGladiusInvasionDungeon() { "2&bYou have left the Gladius Invasion!", List.of("filename=primis_gladius_bell_id.yml"), "em_id_primis_gladius", - 1); + 1, + false); setDifficulties(List.of( Map.of("name", "normal", "id", 0, "levelSync", 18), Map.of("name", "hard", "id", 1, "levelSync", 15), Map.of("name", "mythic", "id", 2, "levelSync", 12) )); setMaxPlayerCount(5); + setListedInTeleports(false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off similarity index 90% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off index 003bdb5aa..77e9f1202 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.dungeonpackager.premade; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.util.Vector; @@ -11,9 +10,9 @@ public class RuinsLair extends DungeonPackagerConfigFields { public RuinsLair() { super("the_ruins", - false, + true, "&2[lvl 150] &6The Ruins", - Arrays.asList("&fA fight against a myth from", + new ArrayList<>(List.of("&fA fight against a myth from", "&fNorse mythology, be prepared for a smiting!", "&6Credits: 69OzCanOfBepis, MagmaGuy"), List.of( diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SewersMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SewersMinidungeon.java index f4ded3839..69a2b3603 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SewersMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SewersMinidungeon.java @@ -4,21 +4,22 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class SewersMinidungeon extends DungeonPackagerConfigFields { public SewersMinidungeon() { super("sewers_minidungeon", - false, + true, "&2[lvl 020-035] &8The Sewers", - Arrays.asList("&fThe biggest minidungeon ever made!", - "&6Credits: MagmaGuy & 69OzCanOfBepis"), + new ArrayList<>(List.of("&fThe biggest minidungeon ever made!", + "&6Credits: MagmaGuy & 69OzCanOfBepis")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, "em_sewer_maze", World.Environment.NORMAL, true, - "em_sewer_maze,-24,167,-173,90,0", + "em_sewer_maze,-21,168.2,-174,90,0", 0, "Difficulty: &6Medium\n" + "$bossCount bosses, from level $lowestTier to $highestTier\n" + @@ -26,6 +27,7 @@ public SewersMinidungeon() { "&8[EM] &5This place looks abandoned... &dYet something lurks in these sewers!", "&8[EM] &5You managed to stay above water. &dMaybe next time you'll drown.", - "the_sewers"); + "the_sewers", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ShadowOfTheBinderOfWorldsLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ShadowOfTheBinderOfWorldsLair.java index 14a782ec0..49db8c1d1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ShadowOfTheBinderOfWorldsLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ShadowOfTheBinderOfWorldsLair.java @@ -4,27 +4,29 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ShadowOfTheBinderOfWorldsLair extends DungeonPackagerConfigFields { public ShadowOfTheBinderOfWorldsLair() { super("shadow_of_the_binder_of_worlds_lair", - false, + true, "&2[lvl 200] &5Shadow of the Binder Of Worlds", - Arrays.asList("&5The penultimate challenge. Be prepared!", - "&6Credits: MagmaGuy, 69OzCanOfBepis & Frostcone"), + new ArrayList<>(List.of("&5The penultimate challenge. Be prepared!", + "&6Credits: MagmaGuy, 69OzCanOfBepis & Frostcone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_shadow_of_the_binder_of_worlds", World.Environment.THE_END, true, - "em_shadow_of_the_binder_of_worlds,-40,62,24,-130,-11", + "em_shadow_of_the_binder_of_worlds,-42.5,63.2,-19.5,-65,0", 0, "Difficulty: &6Nightmare\n" + "$bossCount level $highestTier final boss!\n" + "&5This is the hardest fight in EliteMobs!", "&8[EM] &5Reality unravels around you. You face the final challenge. &4You are not prepared!", "&8[EM] &5You have left the unravelling. Did you find what you sought? Was it worth it?", - "the_binder_of_worlds"); + "the_binder_of_worlds", + true); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SteamworksLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SteamworksLair.java index 1008a0a1b..35a5057e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SteamworksLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/SteamworksLair.java @@ -4,26 +4,27 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.List; public class SteamworksLair extends DungeonPackagerConfigFields { public SteamworksLair() { super("steamworks_lair", - false, + true, "&2[lvl 140] &6The Steamworks", - Arrays.asList("&fA steampunk inspired lair!"), + List.of("&fA steampunk inspired lair!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_steamworks_lair", World.Environment.NORMAL, true, - "em_steamworks_lair,-48,-49,-108,0,0", + "em_steamworks_lair,-48.5,-47.8,-102.5,40,0", 0, "Difficulty: &chard\n" + "$bossCount level $lowestTier Big Boss!\n" + "&6Get ready for a robot rumble!", "&6Reach the top and mind your step!", "&6Now leaving the clockwork dominion!", - "the_steamworks"); + "the_steamworks", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheBridgeSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheBridgeSanctum.java index cd39c6f62..e1695895c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheBridgeSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheBridgeSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheBridgeSanctum extends DungeonPackagerConfigFields { - public TheBridgeSanctum(){ + public TheBridgeSanctum() { super("the_bridge_sanctum", - false, + true, "&2[lvl 025] &3The Bridge Sanctum", - Arrays.asList("&fThe perfect intermediate instanced sanctum!", - "&6Credits: Dali_, MagmaGuy, Frostcone"), + new ArrayList<>(List.of("&fThe perfect intermediate instanced sanctum!", + "&6Credits: Dali_, MagmaGuy, Frostcone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_the_bridge", @@ -28,7 +28,8 @@ public TheBridgeSanctum(){ "&bYou have left The Bridge!", List.of("filename=the_bridge_ancient_guardian_p1.yml"), "em_id_the_bridge", - 25); + 25, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 30, "id", 0), Map.of("name", "hard", "levelSync", 25, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCaveSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCaveSanctum.java index 80e80579a..8d3e1c70a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCaveSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCaveSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheCaveSanctum extends DungeonPackagerConfigFields { public TheCaveSanctum() { super("the_cave_sanctum", - false, + true, "&2[lvl 010] &3The Cave Sanctum", - Arrays.asList("&fThe perfect starter instanced sanctum!", - "&6Credits: MagmaGuy, Frostcone, 69OzCanOfBepis, Realm of Lotheridon"), + new ArrayList<>(List.of("&fThe perfect starter instanced sanctum!", + "&6Credits: MagmaGuy, Frostcone, 69OzCanOfBepis, Realm of Lotheridon")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_the_cave", @@ -28,7 +28,8 @@ public TheCaveSanctum() { "&bYou have left The Cave!", List.of("filename=the_cave_boiler_p1.yml"), "em_id_the_cave", - 15); + 15, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 20, "id", 0), Map.of("name", "hard", "levelSync", 15, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCityDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCityDungeon.java index ed8a47619..131cc67a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCityDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheCityDungeon.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheCityDungeon extends DungeonPackagerConfigFields { - public TheCityDungeon(){ + public TheCityDungeon() { super("the_city_dungeon", - false, + true, "&2[lvl 030] &3The City Dungeon", - Arrays.asList("&fThe perfect intermediate instanced sanctum!", - "&6Credits: Dali_, MagmaGuy, Frostcone"), + new ArrayList<>(List.of("&fThe perfect intermediate instanced sanctum!", + "&6Credits: Dali_, MagmaGuy, Frostcone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_the_city", @@ -31,7 +31,8 @@ public TheCityDungeon(){ "filename=em_id_the_city_mini_boss_three.yml", "filename=em_id_the_city_royal_guard_p1.yml"), "em_id_the_city", - 30); + 30, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 35, "id", 0), Map.of("name", "hard", "levelSync", 30, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheClimbDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheClimbDungeon.java index 2784bf8f6..b6a6c1c4e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheClimbDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheClimbDungeon.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheClimbDungeon extends DungeonPackagerConfigFields { public TheClimbDungeon() { super("the_climb_dungeon", - false, + true, "&2[lvl 010] &3The Climb Dungeon", - Arrays.asList("&fThe perfect starter instanced dungeon!", - "&6Credits: MagmaGuy, Frostcone, 69OzCanOfBepis, Realm of Lotheridon"), + new ArrayList<>(List.of("&fThe perfect starter instanced dungeon!", + "&6Credits: MagmaGuy, Frostcone, 69OzCanOfBepis, Realm of Lotheridon")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_the_climb", @@ -31,7 +31,8 @@ public TheClimbDungeon() { "filename=the_climb_bone_champion.yml", "filename=the_climb_undead_guardian.yml"), "em_id_the_climb", - 10); + 10, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 15, "id", 0), Map.of("name", "hard", "levelSync", 10, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheDeepMinesDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheDeepMinesDungeon.java index 6c1aef9f6..100391f36 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheDeepMinesDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheDeepMinesDungeon.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheDeepMinesDungeon extends DungeonPackagerConfigFields { public TheDeepMinesDungeon() { super("the_deep_mines_dungeon", - false, + true, "&2[lvl 045] &3The Deep Mines Dungeon", - Arrays.asList("&fBelow lies the deepest mine ever dug.", - "&6Credits: Dali, MagmaGuy, FrostCone"), + new ArrayList<>(List.of("&fBelow lies the deepest mine ever dug.", + "&6Credits: Dali, MagmaGuy, FrostCone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_the_deep_mines", @@ -29,7 +29,8 @@ public TheDeepMinesDungeon() { List.of("filename=em_id_the_deep_mines_tnt_box.yml", "filename=em_id_the_deep_mines_boss_the_pursuer_p1.yml"), "em_id_the_deep_mines", - 45); + 45, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 47, "id", 0), Map.of("name", "hard", "levelSync", 45, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheMinesDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheMinesDungeon.java index 27314d01d..d2ffda0cd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheMinesDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheMinesDungeon.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheMinesDungeon extends DungeonPackagerConfigFields { - public TheMinesDungeon(){ + public TheMinesDungeon() { super("the_mines_dungeon", - false, + true, "&2[lvl 020] &3The Mines Dungeon", - Arrays.asList("&fReady to step up your dungeon game?", - "&6Credits: MagmaGuy, Frostcone, 69OzCanOfBepis, Realm of Lotheridon, Dali_"), + new ArrayList<>(List.of("&fReady to step up your dungeon game?", + "&6Credits: MagmaGuy, Frostcone, 69OzCanOfBepis, Realm of Lotheridon, Dali_")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_the_mines", @@ -32,7 +32,8 @@ public TheMinesDungeon(){ "filename=the_mines_mini_boss_forger.yml", "filename=the_mines_mini_boss_tusk.yml"), "em_id_the_mines", - 20); + 20, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 25, "id", 0), Map.of("name", "hard", "levelSync", 20, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java new file mode 100644 index 000000000..1f6238f42 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java @@ -0,0 +1,38 @@ +package com.magmaguy.elitemobs.config.dungeonpackager.premade; + +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import com.magmaguy.elitemobs.utils.DiscordLinks; +import org.bukkit.World; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class TheNetherBellSanctum extends DungeonPackagerConfigFields { + public TheNetherBellSanctum() { + super("the_nether_bell_sanctum", + true, + "&2[lvl 055] &3The Nether Bell Sanctum", + new ArrayList<>(List.of("&fVenture into the deepest part of the Nether!", + "&6Credits: Dali_, MagmaGuy, Frostcone")), + DiscordLinks.freeMinidungeons, + DungeonSizeCategory.SANCTUM, + "em_id_the_nether_bell", + World.Environment.NORMAL, + true, + "em_id_the_nether_bell,231.5,87,-219.5,44,0", + "em_id_the_nether_bell,184.5,69,-192.5,43,0", + 0, + "Difficulty: &45-man hard content!", + "&bNo being should be this deep in the Nether...", + "&bYou have left The Nether Bell!", + List.of("filename=em_id_the_nether_bell_boss_void_bell_p1.yml"), + "em_id_the_nether_bell", + 55, + false); + setDifficulties(List.of( + Map.of("name", "normal", "levelSync", 57, "id", 0), + Map.of("name", "hard", "levelSync", 55, "id", 1), + Map.of("name", "mythic", "levelSync", 53, "id", 2))); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherWastes.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherWastes.java index ded9a9ef8..77a6a4a04 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherWastes.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherWastes.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheNetherWastes extends DungeonPackagerConfigFields { - public TheNetherWastes(){ + public TheNetherWastes() { super("the_nether_wastes_dungeon", - false, + true, "&2[lvl 050] &3The Nether Wastes Dungeon", - Arrays.asList("&fAn unexplored part of the Nether.", - "&6Credits: MagmaGuy, Frostcone, Dali_"), + new ArrayList<>(List.of("&fAn unexplored part of the Nether.", + "&6Credits: MagmaGuy, Frostcone, Dali_")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_the_nether_wastes", @@ -28,7 +28,8 @@ public TheNetherWastes(){ "&bYou have left The Nether Wastes!", List.of("filename=em_id_the_nether_wastes_miniboss_5_shroud_p1.yml"), "em_id_the_nether_wastes", - 50); + 50, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 52, "id", 0), Map.of("name", "hard", "levelSync", 50, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ThePalaceSanctum.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ThePalaceSanctum.java index dc6909abf..5e5957a54 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ThePalaceSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ThePalaceSanctum.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class ThePalaceSanctum extends DungeonPackagerConfigFields { - public ThePalaceSanctum(){ + public ThePalaceSanctum() { super("the_palace_sanctum", - false, + true, "&2[lvl 030] &3The Palace Sanctum", - Arrays.asList("&fThe perfect intermediate instanced sanctum!", - "&6Credits: Dali_, MagmaGuy, Frostcone"), + new ArrayList<>(List.of("&fThe perfect intermediate instanced sanctum!", + "&6Credits: Dali_, MagmaGuy, Frostcone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.SANCTUM, "em_id_the_palace", @@ -28,7 +28,8 @@ public ThePalaceSanctum(){ "&bYou have left The Palace!", List.of("the_palace_old_stone_king_p1.yml"), "em_id_the_palace", - 35); + 35, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 40, "id", 0), Map.of("name", "hard", "levelSync", 35, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheQuarryDungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheQuarryDungeon.java index 37a8577fe..42a5f6e8b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheQuarryDungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheQuarryDungeon.java @@ -4,17 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; import java.util.Map; public class TheQuarryDungeon extends DungeonPackagerConfigFields { public TheQuarryDungeon() { super("the_quarry_dungeon", - false, + true, "&2[lvl 040] &3The Quarry Dungeon", - Arrays.asList("&fAn ancient dwarven quarry deep underground.", - "&6Credits: Dali_, MagmaGuy, Frostcone"), + new ArrayList<>(List.of("&fAn ancient dwarven quarry deep underground.", + "&6Credits: Dali_, MagmaGuy, Frostcone")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.DUNGEON, "em_id_the_quarry", @@ -30,7 +30,8 @@ public TheQuarryDungeon() { "filename=em_id_the_quarry_royal_wizard_three.yml", "filename=LiftStateFinishDungeon.yml"), "em_id_the_quarry", - 40); + 40, + false); setDifficulties(List.of( Map.of("name", "normal", "levelSync", 42, "id", 0), Map.of("name", "hard", "levelSync", 40, "id", 1), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/UnderGroveLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/UnderGroveLair.java index 48367ff56..c926a47de 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/UnderGroveLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/UnderGroveLair.java @@ -4,26 +4,27 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.List; public class UnderGroveLair extends DungeonPackagerConfigFields { public UnderGroveLair() { super("under_grove_lair", - false, + true, "&2[lvl 170] &6The Under Grove", - Arrays.asList("&6Stop the dryad's ritual!"), + List.of("&6Stop the dryad's ritual!"), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.LAIR, "em_under_grove", World.Environment.NORMAL, true, - "em_under_grove,-2.5,-40.5,35,90,0", + "em_under_grove,-2.5,-38.8,35.5,90,0", 0, "Difficulty: &cHard\n" + "$bossCount level $lowestTier Big Boss!\n" + "&6The dryads are up to no good, stop them!", "&8[EM] &aYou are now trespassing the sacred grove!", "&8[EM] &aYou have left the sacred grove!", - "the_under_grove"); + "the_under_grove", + false); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off similarity index 97% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off index 3847ac505..26eb8377e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config.dungeonpackager.premade; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.util.Vector; @@ -10,11 +9,11 @@ public class VampireManorMinidungeon extends DungeonPackagerConfigFields { public VampireManorMinidungeon() { super("vampire_manor", - false, + true, "&2[lvl 170] &cThe Vampire Manor", - Arrays.asList("&fPrepare to spill blood!", + new ArrayList<>(List.of("&fPrepare to spill blood!", "&6Credits: MagmaGuy, 69OzCanOfBepis"), - Arrays.asList( + new ArrayList<>(List.of( "vampire_grunt.yml:5.0,0.0,20.0", "vampire_grunt.yml:-5.0,0.0,20.0", "vampire_brute.yml:17.0,0.0,29.0", @@ -126,7 +125,7 @@ public VampireManorMinidungeon() { "vampire_brute.yml:17.0,26.0,87.0", "vampire_brute.yml:39.0,26.0,65.0", "vampire_brute.yml:39.0,26.0,31.0"), - Arrays.asList( + new ArrayList<>(List.of( "vampire_manor_south.yml:16.5,11.5,13.5", "vampire_manor_west.yml:-17.5,11.5,20.5", "vampire_manor_east.yml:-28.5,-0.5,44.5", diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java index 29cb05639..737597ab8 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java @@ -1,6 +1,8 @@ package com.magmaguy.elitemobs.config.enchantments; -import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.config.LegacyValueConverter; +import com.magmaguy.magmacore.config.CustomConfig; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -20,10 +22,17 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { - return enchantments.get(string); + String newString = LegacyValueConverter.parseEnchantment(string.replace(".yml", "")) + ".yml"; + newString = newString.toLowerCase(Locale.ROOT); + EnchantmentsConfigFields test = enchantments.get(newString); + if (test == null) { + Logger.warn("Failed to find enchant file " + newString); + new Exception().printStackTrace(); + } + return enchantments.get(newString); } public static EnchantmentsConfigFields getEnchantment(Enchantment enchantment) { - return getEnchantment(enchantment.getName().toLowerCase(Locale.ROOT) + ".yml"); + return getEnchantment(enchantment.getKey().getKey().toLowerCase(Locale.ROOT) + ".yml"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfigFields.java index cd8f8121e..206f08ddc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfigFields.java @@ -26,7 +26,7 @@ public EnchantmentsConfigFields(String filename, int maxLevel, double value, boolean isEnabledForProcedurallyGeneratedItems, - int maxEnchantmentLevel){ + int maxEnchantmentLevel) { super(filename, isEnabled); this.isEnabled = isEnabled; this.name = name; diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WaterWorkerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/AquaAffinityConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WaterWorkerConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/AquaAffinityConfig.java index 4775ca18e..74376999f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WaterWorkerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/AquaAffinityConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class WaterWorkerConfig extends EnchantmentsConfigFields { - public WaterWorkerConfig() { - super("water_worker", +public class AquaAffinityConfig extends EnchantmentsConfigFields { + public AquaAffinityConfig() { + super("aqua_affinity", true, "Aqua Affinity", 1, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageArthropodsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BaneOfArthropodsConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageArthropodsConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BaneOfArthropodsConfig.java index 679e11648..38ca2926e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageArthropodsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BaneOfArthropodsConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class DamageArthropodsConfig extends EnchantmentsConfigFields { - public DamageArthropodsConfig() { - super("damage_arthropods", +public class BaneOfArthropodsConfig extends EnchantmentsConfigFields { + public BaneOfArthropodsConfig() { + super("bane_of_arthropods", true, "Bane of Arthropods", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionExplosionsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BlastProtectionConfig.java similarity index 64% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionExplosionsConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BlastProtectionConfig.java index e7e6442c3..14c9161fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionExplosionsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BlastProtectionConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ProtectionExplosionsConfig extends EnchantmentsConfigFields { - public ProtectionExplosionsConfig() { - super("protection_explosions", +public class BlastProtectionConfig extends EnchantmentsConfigFields { + public BlastProtectionConfig() { + super("blast_protection", true, "Blast Protection", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BreachConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BreachConfig.java new file mode 100644 index 000000000..19f16c105 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BreachConfig.java @@ -0,0 +1,16 @@ +package com.magmaguy.elitemobs.config.enchantments.premade; + +import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; +import org.bukkit.enchantments.Enchantment; + +public class BreachConfig extends EnchantmentsConfigFields { + public BreachConfig() { + super("breach", + true, + "Breach", + 4, + 6, + true, + Enchantment.BREACH.getMaxLevel()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DensityConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DensityConfig.java new file mode 100644 index 000000000..8b29b8e5c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DensityConfig.java @@ -0,0 +1,16 @@ +package com.magmaguy.elitemobs.config.enchantments.premade; + +import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; +import org.bukkit.enchantments.Enchantment; + +public class DensityConfig extends EnchantmentsConfigFields { + public DensityConfig() { + super("density", + true, + "Density", + 4, + 6, + true, + Enchantment.DENSITY.getMaxLevel()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DigSpeedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/EfficiencyConfig.java similarity index 69% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DigSpeedConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/EfficiencyConfig.java index 22048d41c..b6d19f9ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DigSpeedConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/EfficiencyConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class DigSpeedConfig extends EnchantmentsConfigFields { - public DigSpeedConfig() { - super("dig_speed", +public class EfficiencyConfig extends EnchantmentsConfigFields { + public EfficiencyConfig() { + super("efficiency", true, "Efficiency", 5, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionFallConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FeatherFallingConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionFallConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FeatherFallingConfig.java index 082cd8a4b..bd1902ae7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionFallConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FeatherFallingConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ProtectionFallConfig extends EnchantmentsConfigFields { - public ProtectionFallConfig() { - super("protection_fall", +public class FeatherFallingConfig extends EnchantmentsConfigFields { + public FeatherFallingConfig() { + super("feather_falling", true, "Feather Falling", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionFireConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FireProtectionConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionFireConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FireProtectionConfig.java index e2473a44e..059643cea 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionFireConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FireProtectionConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ProtectionFireConfig extends EnchantmentsConfigFields { - public ProtectionFireConfig() { - super("protection_fire", +public class FireProtectionConfig extends EnchantmentsConfigFields { + public FireProtectionConfig() { + super("fire_protection", true, "Fire Protection", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowFireConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FlameConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowFireConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FlameConfig.java index b90e2ff9d..22134720f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowFireConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FlameConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ArrowFireConfig extends EnchantmentsConfigFields { - public ArrowFireConfig() { - super("arrow_fire", +public class FlameConfig extends EnchantmentsConfigFields { + public FlameConfig() { + super("flame", true, "Flame", 1, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootBonusBlocksConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FortuneConfig.java similarity index 66% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootBonusBlocksConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FortuneConfig.java index f2dfcb7a6..f221c41ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootBonusBlocksConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/FortuneConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class LootBonusBlocksConfig extends EnchantmentsConfigFields { - public LootBonusBlocksConfig() { - super("loot_bonus_blocks", +public class FortuneConfig extends EnchantmentsConfigFields { + public FortuneConfig() { + super("fortune", true, "Fortune", 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowInfiniteConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/InfinityConfig.java similarity index 67% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowInfiniteConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/InfinityConfig.java index 39828ed38..6672c71b7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowInfiniteConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/InfinityConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ArrowInfiniteConfig extends EnchantmentsConfigFields { - public ArrowInfiniteConfig() { - super("arrow_infinite", +public class InfinityConfig extends EnchantmentsConfigFields { + public InfinityConfig() { + super("infinity", true, "Infinity", 1, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootBonusMobsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootingConfig.java similarity index 66% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootBonusMobsConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootingConfig.java index b600fed48..742fb8ede 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootBonusMobsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LootingConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class LootBonusMobsConfig extends EnchantmentsConfigFields { - public LootBonusMobsConfig() { - super("loot_bonus_mobs", +public class LootingConfig extends EnchantmentsConfigFields { + public LootingConfig() { + super("looting", true, "Looting", 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LuckConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LuckOfTheSeaConfig.java similarity index 67% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LuckConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LuckOfTheSeaConfig.java index 23b4e9ca8..e5b925fc7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LuckConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/LuckOfTheSeaConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class LuckConfig extends EnchantmentsConfigFields { - public LuckConfig() { - super("luck", +public class LuckOfTheSeaConfig extends EnchantmentsConfigFields { + public LuckOfTheSeaConfig() { + super("luck_of_the_sea", true, "Luck of the Sea", 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowDamageConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/PowerConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowDamageConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/PowerConfig.java index cf62d605e..8af3d4a8d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowDamageConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/PowerConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ArrowDamageConfig extends EnchantmentsConfigFields { - public ArrowDamageConfig() { - super("arrow_damage", +public class PowerConfig extends EnchantmentsConfigFields { + public PowerConfig() { + super("power", true, "Power", 5, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionProjectileConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProjectileProtectionConfig.java similarity index 67% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionProjectileConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProjectileProtectionConfig.java index d6f25bc40..eb6d4fb9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionProjectileConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProjectileProtectionConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ProtectionProjectileConfig extends EnchantmentsConfigFields { - public ProtectionProjectileConfig() { - super("protection_projectile", +public class ProjectileProtectionConfig extends EnchantmentsConfigFields { + public ProjectileProtectionConfig() { + super("projectile_protection", true, "Projectile Protection", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionEnvironmentalConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionConfig.java similarity index 63% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionEnvironmentalConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionConfig.java index ac51b103c..85d3ea55a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionEnvironmentalConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ProtectionConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ProtectionEnvironmentalConfig extends EnchantmentsConfigFields { - public ProtectionEnvironmentalConfig() { - super("protection_environmental", +public class ProtectionConfig extends EnchantmentsConfigFields { + public ProtectionConfig() { + super("protection", true, "Protection", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowKnockbackConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/PunchConfig.java similarity index 66% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowKnockbackConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/PunchConfig.java index afd4fd8af..d81de603d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/ArrowKnockbackConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/PunchConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class ArrowKnockbackConfig extends EnchantmentsConfigFields { - public ArrowKnockbackConfig() { - super("arrow_knockback", +public class PunchConfig extends EnchantmentsConfigFields { + public PunchConfig() { + super("punch", true, "Punch", 2, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RepairConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RepairConfig.java index 56134b204..ba40be12b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RepairConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RepairConfig.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; public class RepairConfig extends EnchantmentsConfigFields { - public RepairConfig(){ + public RepairConfig() { super("repair", true, "Repair", diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/OxygenConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RespirationConfig.java similarity index 68% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/OxygenConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RespirationConfig.java index dc0084b4c..6f4b8edd7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/OxygenConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/RespirationConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class OxygenConfig extends EnchantmentsConfigFields { - public OxygenConfig() { - super("oxygen", +public class RespirationConfig extends EnchantmentsConfigFields { + public RespirationConfig() { + super("respiration", true, "Respiration", 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageAllConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/SharpnessConfig.java similarity index 69% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageAllConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/SharpnessConfig.java index 56a3a932c..79a08a039 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageAllConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/SharpnessConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class DamageAllConfig extends EnchantmentsConfigFields { - public DamageAllConfig() { - super("damage_all", +public class SharpnessConfig extends EnchantmentsConfigFields { + public SharpnessConfig() { + super("sharpness", true, "Sharpness", 5, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageUndeadConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/SmiteConfig.java similarity index 67% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageUndeadConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/SmiteConfig.java index 02d56a4e1..b627ba294 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DamageUndeadConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/SmiteConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class DamageUndeadConfig extends EnchantmentsConfigFields { - public DamageUndeadConfig() { - super("damage_undead", +public class SmiteConfig extends EnchantmentsConfigFields { + public SmiteConfig() { + super("smite", true, "Smite", 4, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DurabilityConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/UnbreakingConfig.java similarity index 69% rename from src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DurabilityConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/UnbreakingConfig.java index 600991ac7..8cbc168fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DurabilityConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/UnbreakingConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; -public class DurabilityConfig extends EnchantmentsConfigFields { - public DurabilityConfig() { - super("durability", +public class UnbreakingConfig extends EnchantmentsConfigFields { + public UnbreakingConfig() { + super("unbreaking", true, "Unbreaking", 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WindBurstConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WindBurstConfig.java new file mode 100644 index 000000000..193933fbb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WindBurstConfig.java @@ -0,0 +1,16 @@ +package com.magmaguy.elitemobs.config.enchantments.premade; + +import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfigFields; +import org.bukkit.enchantments.Enchantment; + +public class WindBurstConfig extends EnchantmentsConfigFields { + public WindBurstConfig() { + super("wind_burst", + true, + "Wind Burst", + 4, + 6, + true, + Enchantment.WIND_BURST.getMaxLevel()); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfig.java index 1e87eb5f5..d6938973d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfig.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.config.menus; -import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfigFields.java index b39e8586d..20b0a5631 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/MenusConfigFields.java @@ -1,9 +1,8 @@ package com.magmaguy.elitemobs.config.menus; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; -public class MenusConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class MenusConfigFields extends CustomConfigFields { public MenusConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ArenaMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ArenaMenuConfig.java index 47dce9098..05f5f9dd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ArenaMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ArenaMenuConfig.java @@ -3,8 +3,7 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -33,12 +32,8 @@ public void processAdditionalFields() { playerItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "playerItem", ItemStackGenerator.generateItemStack(Material.DIAMOND_SWORD, "&4Challenge the arena!", List.of("&2Fight in the arena!")), true); playerItemSlot = ConfigurationEngine.setInt(fileConfiguration, "playerItemSlot", 6); - if (!VersionChecker.serverVersionOlderThan(17, 0)) - spectatorItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "spectatorItem", - ItemStackGenerator.generateItemStack(Material.SPYGLASS, "&aSpectate!", List.of("&2Spectate players in the arena!"), MetadataHandler.signatureID), true); - else - spectatorItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "spectatorItem", - ItemStackGenerator.generateItemStack(Material.NOTE_BLOCK, "&aSpectate!", List.of("&2Spectate players in the arena!"), MetadataHandler.signatureID), true); + spectatorItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "spectatorItem", + ItemStackGenerator.generateItemStack(Material.SPYGLASS, "&aSpectate!", List.of("&2Spectate players in the arena!"), MetadataHandler.signatureID), true); spectatorItemSlot = ConfigurationEngine.setInt(fileConfiguration, "spectatorItemSlot", 2); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/BuyOrSellMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/BuyOrSellMenuConfig.java index 71c4d81a1..2979c22b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/BuyOrSellMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/BuyOrSellMenuConfig.java @@ -3,13 +3,13 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class BuyOrSellMenuConfig extends MenusConfigFields { public static String SHOP_NAME; @@ -32,9 +32,9 @@ public void processAdditionalFields() { "Information button", ItemStackGenerator.generateSkullItemStack("magmaguy", "&4&lEliteMobs &r&cby &4&lMagmaGuy", - Arrays.asList("&8Support the plugins you enjoy!", + new ArrayList<>(List.of("&8Support the plugins you enjoy!", "&aClick on the emerald to buy items!", - "&cClick on the redstone to sell items!"), MetadataHandler.signatureID), + "&cClick on the redstone to sell items!")), MetadataHandler.signatureID), fileConfiguration); INFORMATION_ITEM = ItemStackSerializer.deserialize("Information button", fileConfiguration); INFORMATION_SLOT = ConfigurationEngine.setInt(fileConfiguration, "Information button slot", 4); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java index 0e418cfe3..a8dad1fcc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.config.menus.premade; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; import com.magmaguy.elitemobs.items.customloottable.*; import com.magmaguy.elitemobs.quests.objectives.*; import com.magmaguy.elitemobs.quests.rewards.QuestReward; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -166,7 +166,7 @@ public void processAdditionalFields() { killQuestDefaultSummaryLine = ConfigurationEngine.setString(file, fileConfiguration, "killQuestDefaultSummaryLine", "&c➤Kill $name:$color$current&0/$color$target", true); fetchQuestDefaultSummaryLine = ConfigurationEngine.setString(file, fileConfiguration, "fetchQuestDefaultSummaryLine", "&c➤Get $name:$color&$current&0/$color$target", true); dialogQuestDefaultSummaryLine = ConfigurationEngine.setString(file, fileConfiguration, "dialogQuestDefaultSummaryLine", "&c➤Go talk to $name $location", true); - arenaQuestDefaultSummaryLine = ConfigurationEngine.setString(file, fileConfiguration, "arenaQuestDefaultSummaryLine", "&c➤Complete $arenaName", true); + arenaQuestDefaultSummaryLine = ConfigurationEngine.setString(file, fileConfiguration, "arenaQuestDefaultSummaryLine", "&c➤Complete $arenaName", true); rewardsLine = ConfigurationEngine.setString(file, fileConfiguration, "rewardsLine", "&2&lRewards:", true); rewardsDefaultSummaryLine = ConfigurationEngine.setString(file, fileConfiguration, "rewardsDefaultSummaryLine", "&2➤$amountx $rewardName &8($chance%)", true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomShopMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomShopMenuConfig.java index 48b54cd34..5fa896bc9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomShopMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomShopMenuConfig.java @@ -3,11 +3,11 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; @@ -33,9 +33,9 @@ public void processAdditionalFields() { fileConfiguration); rerollItem = ItemStackSerializer.deserialize("Reroll button", fileConfiguration); rerollSlot = ConfigurationEngine.setInt(fileConfiguration, "Reroll button slot", 4); - storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "Store item slots", Arrays.asList(9, 10, 11, 12, 13, 14, 15, 16, + storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "Store item slots", new ArrayList<>(List.of(9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53), false); + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53)), false); messageFullInventory = ConfigurationEngine.setString(file, fileConfiguration, "Full inventory message", "[EliteMobs] &4Your inventory is full! You can't buy items until you get some free space.", true); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/DynamicQuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/DynamicQuestMenuConfig.java index 0f6eb56fb..c6d8b81fd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/DynamicQuestMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/DynamicQuestMenuConfig.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.config.menus.premade; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; import com.magmaguy.elitemobs.items.customloottable.*; import com.magmaguy.elitemobs.quests.objectives.Objective; import com.magmaguy.elitemobs.quests.rewards.QuestReward; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -115,7 +115,7 @@ public void processAdditionalFields() { questName = ConfigurationEngine.setString(file, fileConfiguration, "questName", "Slay $amount $name", true); headerTextLines = ConfigurationEngine.setString(file, fileConfiguration, "headerTextLines2", - ChatColorConverter.convert("&c&lGuild request!\n&0&m⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯"), true); + ChatColorConverter.convert("&c&lGuild request!\n"), true); defaultLoreTextLines = ConfigurationEngine.setString(file, fileConfiguration, "defaultLoreTextLines", "&8Slay $amount $name!", true); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GetLootMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GetLootMenuConfig.java index f384872af..8cbe889da 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GetLootMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GetLootMenuConfig.java @@ -3,8 +3,8 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GuildRankMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GuildRankMenuConfig.java index 0ccc3b533..d0713eac0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GuildRankMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GuildRankMenuConfig.java @@ -3,13 +3,14 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GuildRankMenuConfig extends MenusConfigFields { @Getter @@ -70,7 +71,7 @@ public void processAdditionalFields() { "unlockedButtons", ItemStackGenerator.generateItemStack(Material.GRAY_STAINED_GLASS_PANE, "$rankName", - Arrays.asList("&f&m-------------------------------", + new ArrayList<>(List.of("&f&m-------------------------------", "&aThis rank is unlocked!", "&fYou can select it.", "&f&m-------------------------------", @@ -78,14 +79,14 @@ public void processAdditionalFields() { "$currencyBonusMessage", "$maxHealthIncrease", "$chanceToCrit", - "$chanceToDodge"), MetadataHandler.signatureID), fileConfiguration); + "$chanceToDodge")), MetadataHandler.signatureID), fileConfiguration); unlockedButton = ItemStackSerializer.deserialize("unlockedButtons", fileConfiguration); ItemStackSerializer.serialize( "lockedButtons", ItemStackGenerator.generateItemStack(Material.RED_STAINED_GLASS_PANE, "$rankName", - Arrays.asList("&f&m-------------------------------", + new ArrayList<>(List.of("&f&m-------------------------------", "&aThis rank is locked!", "&cYou need the $previousRank rank first!", "&f&m-------------------------------", @@ -93,28 +94,28 @@ public void processAdditionalFields() { "$currencyBonusMessage", "$maxHealthIncrease", "$chanceToCrit", - "$chanceToDodge"), MetadataHandler.signatureID), fileConfiguration); + "$chanceToDodge")), MetadataHandler.signatureID), fileConfiguration); lockedButton = ItemStackSerializer.deserialize("lockedButtons", fileConfiguration); ItemStackSerializer.serialize( "currentButtons", ItemStackGenerator.generateItemStack(Material.GREEN_STAINED_GLASS_PANE, "$rankName", - Arrays.asList("&f&m-------------------------------", + new ArrayList<>(List.of("&f&m-------------------------------", "&aThis is your current rank!", "&f&m-------------------------------", "$lootTier", "$currencyBonusMessage", "$maxHealthIncrease", "$chanceToCrit", - "$chanceToDodge"), MetadataHandler.signatureID), fileConfiguration); + "$chanceToDodge")), MetadataHandler.signatureID), fileConfiguration); currentButton = ItemStackSerializer.deserialize("currentButtons", fileConfiguration); ItemStackSerializer.serialize( "nextButtons", ItemStackGenerator.generateItemStack(Material.YELLOW_STAINED_GLASS_PANE, "Prestige $prestigeNumber", - Arrays.asList( + new ArrayList<>(List.of( "&6This is the next rank you can unlock", "&aSelect it when you're ready!", "&6Costs $price &6$currencyName", @@ -124,23 +125,23 @@ public void processAdditionalFields() { "$currencyBonusMessage", "$maxHealthIncrease", "$chanceToCrit", - "$chanceToDodge"), MetadataHandler.signatureID), fileConfiguration); + "$chanceToDodge")), MetadataHandler.signatureID), fileConfiguration); nextButton = ItemStackSerializer.deserialize("nextButtons", fileConfiguration); ItemStackSerializer.serialize( "prestigeLockedButtons", ItemStackGenerator.generateItemStack(Material.RED_STAINED_GLASS, "Prestige $rank", - Arrays.asList("&f&m-------------------------------", + new ArrayList<>(List.of("&f&m-------------------------------", "&4You must unlock all guild ranks first!", - "&f&m-------------------------------"), MetadataHandler.signatureID), fileConfiguration); + "&f&m-------------------------------")), MetadataHandler.signatureID), fileConfiguration); prestigeLockedButton = ItemStackSerializer.deserialize("prestigeLockedButtons", fileConfiguration); ItemStackSerializer.serialize( "prestigeNextUnlockButtons", ItemStackGenerator.generateItemStack(Material.GOLD_BLOCK, "Prestige $rank", - Arrays.asList("&f&m-------------------------------", + new ArrayList<>(List.of("&f&m-------------------------------", "&2Prestige unlock is ready!", "&6Costs $price &6$currencyName", "&cBuying prestige will reset guild ranks", @@ -153,7 +154,7 @@ public void processAdditionalFields() { "&a- Base chance to dodge", "&4Warning: this resets you current", "&4EliteMobs ITEMS AND CURRENCY!", - "&f&m-------------------------------"), MetadataHandler.signatureID), fileConfiguration); + "&f&m-------------------------------")), MetadataHandler.signatureID), fileConfiguration); prestigeNextUnlockButton = ItemStackSerializer.deserialize("prestigeNextUnlockButtons", fileConfiguration); notEnoughCurrencyMessage = ConfigurationEngine.setString(file, fileConfiguration, "notEnoughCurrencyMessages", diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ItemEnchantmentMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ItemEnchantmentMenuConfig.java index ea60acfac..966bac1c9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ItemEnchantmentMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ItemEnchantmentMenuConfig.java @@ -3,13 +3,13 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ItemEnchantmentMenuConfig extends MenusConfigFields { @@ -66,7 +66,7 @@ public void processAdditionalFields() { "infoButton", ItemStackGenerator.generateSkullItemStack("magmaguy", "&2Enchantment info:", - Arrays.asList( + new ArrayList<>(List.of( "&2This menu can add enchants to your elite items!", "&aIn order to enchant your elite item, add your", "&aelite item and your elite enchanted books!", @@ -74,7 +74,7 @@ public void processAdditionalFields() { "&6(high quality items) have a high chance of failing!", "&8Normal failure makes you fail to enchant the item.", "&8Challenge makes you fight a boss for the enchant.", - "&8Critical failures make you lose the item!"), MetadataHandler.signatureID), + "&8Critical failures make you lose the item!")), MetadataHandler.signatureID), fileConfiguration); infoButton = ItemStackSerializer.deserialize("infoButton", fileConfiguration); cancelSlot = ConfigurationEngine.setInt( diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/PlayerStatusMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/PlayerStatusMenuConfig.java index 4a4aaaafe..7755cfa13 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/PlayerStatusMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/PlayerStatusMenuConfig.java @@ -4,15 +4,14 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; import java.io.File; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class PlayerStatusMenuConfig extends MenusConfigFields { @@ -348,10 +347,10 @@ public void processAdditionalFields() { indexHeaderItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "indexHeaderItem", ItemStackGenerator.generateItemStack(Material.PAPER, "&5&l/ag &7- &6EliteMobs Hub", - Arrays.asList("CLICK TO USE", + new ArrayList<>(List.of("CLICK TO USE", "The place where you can find", "NPCs that give quests, buy and", - "sell items, give advice and more!")), true); + "sell items, give advice and more!"))), true); indexHeaderSlot = ConfigurationEngine.setInt(fileConfiguration, "indexHeaderSlot", 4); indexStatsItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "indexStatsItem", @@ -382,19 +381,14 @@ public void processAdditionalFields() { indexQuestTrackingItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "indexQuestTrackingItem", ItemStackGenerator.generateItemStack(Material.WRITABLE_BOOK, "&6Quest Tracking", - List.of("Click to go!")) ,true); + List.of("Click to go!")), true); indexQuestTrackingSlot = ConfigurationEngine.setInt(fileConfiguration, "indexQuestTrackingSlot", 20); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - indexBossTrackingItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "indexBossTrackingItem", - ItemStackGenerator.generateItemStack(Material.TARGET, - "&6Boss Tracking", - List.of("Click to go!")), true); - else - indexBossTrackingItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "indexBossTrackingItem", - ItemStackGenerator.generateItemStack(Material.DIAMOND, - "&6Boss Tracking", - List.of("Click to go!")), true); + indexBossTrackingItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "indexBossTrackingItem", + ItemStackGenerator.generateItemStack(Material.TARGET, + "&6Boss Tracking", + List.of("Click to go!")), true); + indexBossTrackingSlot = ConfigurationEngine.setInt(fileConfiguration, "indexBossTrackingSlot", 24); @@ -405,31 +399,22 @@ public void processAdditionalFields() { gearDamageItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "gearDamageItem", ItemStackGenerator.generateItemStack(Material.DIAMOND_SWORD, "&4Damage: $damage", - Arrays.asList("&fBase damage dealt to Elites.", - "&fBased on the level of your weapon!")),true); + new ArrayList<>(List.of("&fBase damage dealt to Elites.", + "&fBased on the level of your weapon!"))), true); gearDamageSlot = ConfigurationEngine.setInt(fileConfiguration, "gearDamageSlot", 23); gearArmorItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "gearArmorItem", ItemStackGenerator.generateItemStack(Material.SHIELD, "&2Defense: $defense", - Arrays.asList("&fBase damage reduction from Elites.", - "&fBased on the average level of your armor!")),true); + new ArrayList<>(List.of("&fBase damage reduction from Elites.", + "&fBased on the average level of your armor!"))), true); gearArmorSlot = ConfigurationEngine.setInt(fileConfiguration, "gearArmorSlot", 24); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - gearThreatItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "gearThreatItem", - ItemStackGenerator.generateItemStack(Material.TARGET, - "&cThreat Level: $threat", - Arrays.asList("&fThis determines the level of the", - "&fElite Mobs that spawns near you", - "&fTakes armor, weapon in hand, guild", - "&ftier into account.")), true); - else - gearThreatItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "gearThreatItem", - ItemStackGenerator.generateItemStack(Material.DIAMOND, - "&cThreat Level: $threat", - Arrays.asList("&fThis determines the level of the", - "&fElite Mobs that spawns near you", - "&fTakes armor, weapon in hand, guild", - "&ftier into account.")), true); + gearThreatItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "gearThreatItem", + ItemStackGenerator.generateItemStack(Material.TARGET, + "&cThreat Level: $threat", + new ArrayList<>(List.of("&fThis determines the level of the", + "&fElite Mobs that spawns near you", + "&fTakes armor, weapon in hand, guild", + "&ftier into account."))), true); gearThreatSlot = ConfigurationEngine.setInt(fileConfiguration, "gearThreatSlot", 25); statsChestMenuName = ConfigurationEngine.setString(file, fileConfiguration, "statsChestMenuName", "&2EliteMobs Stats", true); @@ -437,48 +422,36 @@ public void processAdditionalFields() { statsMoneyItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsMoneyItem", ItemStackGenerator.generateItemStack(Material.GOLD_INGOT, "&2Elite Coins: $money", - Arrays.asList("&fKill Elite Mobs to loot currency,", + new ArrayList<>(List.of("&fKill Elite Mobs to loot currency,", "&fsell their drops in /em shop or", - "&fcomplete quests!")), true); + "&fcomplete quests!"))), true); statsMoneySlot = ConfigurationEngine.setInt(fileConfiguration, "statsMoneySlot", 10); - if (!VersionChecker.serverVersionOlderThan(16, 0)) - statsGuildTierItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsGuildTierItem", - ItemStackGenerator.generateItemStack(Material.TARGET, - "&6Guild Tier: $tier", - Arrays.asList("&fGuild Rank determines how good your loot can ", - "&fbe, sets your bonus from the Prestige Tier, among ", - "&fother things. The Prestige Tier unlocks extremely ", - "&fpowerful rewards, like increased max health, chance ", - "&fto dodge/crit, increased currency rewards and more! ", - "&fYou can unlock Guild Ranks and Prestige Tiers at /ag!", - "&f⚜ = prestige rank, ✧ = guild rank!")), true); - else - statsGuildTierItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsGuildTierItem", - ItemStackGenerator.generateItemStack(Material.DIAMOND, - "&6Guild Tier: $tier", - Arrays.asList("&fGuild Rank determines how good your loot can ", - "&fbe, sets your bonus from the Prestige Tier, among ", - "&fother things. The Prestige Tier unlocks extremely ", - "&fpowerful rewards, like increased max health, chance ", - "&fto dodge/crit, increased currency rewards and more! ", - "&fYou can unlock Guild Ranks and Prestige Tiers at /ag!", - "&f⚜ = prestige rank, ✧ = guild rank!")), true); + statsGuildTierItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsGuildTierItem", + ItemStackGenerator.generateItemStack(Material.TARGET, + "&6Guild Tier: $tier", + new ArrayList<>(List.of("&fGuild Rank determines how good your loot can ", + "&fbe, sets your bonus from the Prestige Tier, among ", + "&fother things. The Prestige Tier unlocks extremely ", + "&fpowerful rewards, like increased max health, chance ", + "&fto dodge/crit, increased currency rewards and more! ", + "&fYou can unlock Guild Ranks and Prestige Tiers at /ag!", + "&f⚜ = prestige rank, ✧ = guild rank!"))), true); statsGuildTierSlot = ConfigurationEngine.setInt(fileConfiguration, "statsGuildTierSlot", 11); statsEliteKillsItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsEliteKillsItem", ItemStackGenerator.generateItemStack(Material.DIAMOND_SWORD, - "&4Elite Kils: &c$kills", - List.of("&fAmount of EliteMobs killed.")),true); + "&4Elite Kills: &c$kills", + List.of("&fAmount of EliteMobs killed.")), true); statsEliteKillsSlot = ConfigurationEngine.setInt(fileConfiguration, "statsEliteKillsSlot", 12); statsMaxEliteLevelKilledItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsMaxEliteLevelKilledItem", ItemStackGenerator.generateItemStack(Material.GOLDEN_SWORD, "&4Max Lvl Killed: &c$maxKill", - Arrays.asList("&fElite Mob levels are based on the tier", + new ArrayList<>(List.of("&fElite Mob levels are based on the tier", "&fof your gear! Higher tiers, higher", "&fElite Mob levels!\n", - "&eNote: only non-exploity kills get counted!")),true); + "&eNote: only non-exploity kills get counted!"))), true); statsMaxEliteLevelKilledSlot = ConfigurationEngine.setInt(fileConfiguration, "statsMaxEliteLevelKilledSlot", 13); statsEliteDeathsItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsEliteDeathsItem", @@ -490,37 +463,37 @@ public void processAdditionalFields() { statsQuestsCompletedItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsQuestsCompletedItem", ItemStackGenerator.generateItemStack(Material.LECTERN, "&5Quests Completed: &d$questsCompleted", - Arrays.asList("&fAmount of EliteMobs quests completed.", - "&fYou can accept quests by talking to NPCs!")), true); + new ArrayList<>(List.of("&fAmount of EliteMobs quests completed.", + "&fYou can accept quests by talking to NPCs!"))), true); statsQuestsCompletedSlot = ConfigurationEngine.setInt(fileConfiguration, "statsQuestsCompletedSlot", 15); statsScoreItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsScoreItem", ItemStackGenerator.generateItemStack(Material.ITEM_FRAME, "&3Score: &b$score", - Arrays.asList("&fYour EliteMobs score. It goes up", + new ArrayList<>(List.of("&fYour EliteMobs score. It goes up", "&fwhen you kill and elite mob,", "&fand it goes down when you die", "&fto an elite. Higher level", - "&felites give more score.")), true); + "&felites give more score."))), true); statsScoreSlot = ConfigurationEngine.setInt(fileConfiguration, "statsScoreSlot", 16); commandsChestMenuName = ConfigurationEngine.setString(file, fileConfiguration, "commandsChestMenuName", "&2EliteMobs Commands", true); - commandsAGItem = ConfigurationEngine.setItemStack(file ,fileConfiguration, "commandsAGItem", + commandsAGItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "commandsAGItem", ItemStackGenerator.generateItemStack(Material.END_PORTAL_FRAME, "&5/ag", - Arrays.asList("&fClick to use!", + new ArrayList<>(List.of("&fClick to use!", "&fThe place where you can find", "&fNPCs that give quests, buy and", - "&fsell items, give advice and more!")), true); + "&fsell items, give advice and more!"))), true); commandsAGSlot = ConfigurationEngine.setInt(fileConfiguration, "commandsAGSlot", 11); commandsShareItemItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "commandsShareItemItem", ItemStackGenerator.generateItemStack(Material.PAPER, "&5/shareitem", - Arrays.asList("&fClick to use!", + new ArrayList<>(List.of("&fClick to use!", "&fShares the Elite Item you're holding", - "&fon chat!")), true); + "&fon chat!"))), true); commandsShareItemSlot = ConfigurationEngine.setInt(fileConfiguration, "commandsShareItemSlot", 15); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ProceduralShopMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ProceduralShopMenuConfig.java index 19dd5f97e..989e2ad1a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ProceduralShopMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ProceduralShopMenuConfig.java @@ -3,11 +3,11 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ProceduralShopMenuConfig extends MenusConfigFields { @@ -33,9 +33,9 @@ public void processAdditionalFields() { fileConfiguration); rerollItem = ItemStackSerializer.deserialize("Reroll button", fileConfiguration); rerollSlot = ConfigurationEngine.setInt(fileConfiguration, "Reroll button slot", 4); - storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "Store item slots", Arrays.asList(9, 10, 11, 12, + storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "Store item slots", new ArrayList<>(List.of(9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53), false); + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53)), false); minTier = ConfigurationEngine.setInt(fileConfiguration, "Minimum store item tier", 0); maxTier = ConfigurationEngine.setInt(fileConfiguration, "Maximum store item tier", 5); messageFullInventory = ConfigurationEngine.setString(file, fileConfiguration, "Full inventory message", diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/QuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/QuestMenuConfig.java index 2cd71301a..ce93961c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/QuestMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/QuestMenuConfig.java @@ -3,12 +3,13 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class QuestMenuConfig extends MenusConfigFields { public static String menuName, questSelectorMenuTitle; @@ -30,9 +31,9 @@ public void processAdditionalFields() { "validTierButton", ItemStackGenerator.generateItemStack(Material.GREEN_STAINED_GLASS_PANE, "&2Take on a $rank &2quest!", - Arrays.asList( + new ArrayList<>(List.of( "&aAccept a $rank &aquest and", - "&aget special rewards!"), MetadataHandler.signatureID), + "&aget special rewards!")), MetadataHandler.signatureID), fileConfiguration); validTierButton = ItemStackSerializer.deserialize("validTierButton", fileConfiguration); @@ -48,10 +49,10 @@ public void processAdditionalFields() { "killObjectiveButton", ItemStackGenerator.generateItemStack(Material.YELLOW_STAINED_GLASS_PANE, "&2Kill $objectiveAmount $objectiveName", - Arrays.asList( + new ArrayList<>(List.of( "&aKill $objectiveAmount $objectiveName &amobs.", "&fProgress: &a$currentAmount &f/&c $objectiveAmount", - "&aReward: &e $rewardAmount"), MetadataHandler.signatureID), + "&aReward: &e $rewardAmount")), MetadataHandler.signatureID), fileConfiguration); killObjectiveButton = ItemStackSerializer.deserialize("killObjectiveButton", fileConfiguration); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/RepairMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/RepairMenuConfig.java index 7394d21bc..30132b9d4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/RepairMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/RepairMenuConfig.java @@ -3,12 +3,12 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class RepairMenuConfig extends MenusConfigFields { @@ -41,8 +41,8 @@ public void processAdditionalFields() { "infoButton", ItemStackGenerator.generateSkullItemStack("magmaguy", "&4&lEliteMobs &r&cby &4&lMagmaGuy", - Arrays.asList("&8Support the plugins you enjoy!", - "&aUse scrap to repair elite items!"), MetadataHandler.signatureID), + new ArrayList<>(List.of("&8Support the plugins you enjoy!", + "&aUse scrap to repair elite items!")), MetadataHandler.signatureID), fileConfiguration); infoButton = ItemStackSerializer.deserialize("infoButton", fileConfiguration); infoSlot = ConfigurationEngine.setInt(fileConfiguration, "infoButtonSlot", 4); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ScrapperMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ScrapperMenuConfig.java index b827faaf2..90b1cac0d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ScrapperMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ScrapperMenuConfig.java @@ -3,12 +3,12 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ScrapperMenuConfig extends MenusConfigFields { @@ -34,24 +34,24 @@ public void processAdditionalFields() { "infoButton", ItemStackGenerator.generateSkullItemStack("magmaguy", "&4&lEliteMobs &r&cby &4&lMagmaGuy", - Arrays.asList("&8Support the plugins you enjoy!", + new ArrayList<>(List.of("&8Support the plugins you enjoy!", "&4Warning!", "&cItems scrapped here are lost!", "&cThere is a $chance% chance to get", "&cscrap when scrapping items!", "&aUse scrap at the smelter,", - "&arepairman and refiner!"), MetadataHandler.signatureID), + "&arepairman and refiner!")), MetadataHandler.signatureID), fileConfiguration); infoButton = ItemStackSerializer.deserialize("infoButton", fileConfiguration); infoSlot = ConfigurationEngine.setInt(fileConfiguration, "infoButtonSlot", 4); - storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "scrapSlots", Arrays.asList(19, 20, 21, 22, 23, - 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43), false); + storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "scrapSlots", new ArrayList<>(List.of(19, 20, 21, 22, 23, + 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43)), false); ItemStackSerializer.serialize("cancelButton", ItemStackGenerator.generateItemStack(Material.BARRIER, "&4Cancel", List.of("&cCancel scrap!"), MetadataHandler.signatureID), fileConfiguration); cancelButton = ItemStackSerializer.deserialize("cancelButton", fileConfiguration); cancelSlot = ConfigurationEngine.setInt(fileConfiguration, "cancelButtonSlot", 27); ItemStackSerializer.serialize("confirmButton", ItemStackGenerator.generateItemStack(Material.EMERALD, - "&2Confirm Scrap", Arrays.asList("&aScrap items!", "&a$chance% chance of success!"), 31174), fileConfiguration); + "&2Confirm Scrap", new ArrayList<>(List.of("&aScrap items!", "&a$chance% chance of success!")), 31174), fileConfiguration); confirmButton = ItemStackSerializer.deserialize("confirmButton", fileConfiguration); confirmSlot = ConfigurationEngine.setInt(fileConfiguration, "confirmScrapSlot", 35); scrapChance = ConfigurationEngine.setDouble(fileConfiguration, "scrapChance", 0.75); diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/SellMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/SellMenuConfig.java index aad2197f3..97039ddad 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/SellMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/SellMenuConfig.java @@ -3,12 +3,12 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class SellMenuConfig extends MenusConfigFields { @@ -32,23 +32,23 @@ public void processAdditionalFields() { "infoButton", ItemStackGenerator.generateSkullItemStack("magmaguy", "&4&lEliteMobs &r&cby &4&lMagmaGuy", - Arrays.asList("&8Support the plugins you enjoy!", + new ArrayList<>(List.of("&8Support the plugins you enjoy!", "&4Warning!", "&cYou can only sell special", "&cElite Mobs drops in this", "&cshop! These should have", - "&ca value on their lore."), MetadataHandler.signatureID), + "&ca value on their lore.")), MetadataHandler.signatureID), fileConfiguration); infoButton = ItemStackSerializer.deserialize("infoButton", fileConfiguration); infoSlot = ConfigurationEngine.setInt(fileConfiguration, "infoButtonSlot", 4); - storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "sellSlots", Arrays.asList(19, 20, 21, 22, 23, - 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43), false); + storeSlots = ConfigurationEngine.setList(file, fileConfiguration, "sellSlots", new ArrayList<>(List.of(19, 20, 21, 22, 23, + 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43)), false); ItemStackSerializer.serialize("cancelButton", ItemStackGenerator.generateItemStack(Material.BARRIER, "&4Cancel", List.of("&cCancel purchase!"), MetadataHandler.signatureID), fileConfiguration); cancelButton = ItemStackSerializer.deserialize("cancelButton", fileConfiguration); cancelSlot = ConfigurationEngine.setInt(fileConfiguration, "cancelButtonSlot", 27); ItemStackSerializer.serialize("confirmButton", ItemStackGenerator.generateItemStack(Material.EMERALD, - "&2Confirm Sale", Arrays.asList("&aSell item for", "&a$currency_amount $currency_name"), MetadataHandler.signatureID), fileConfiguration); + "&2Confirm Sale", new ArrayList<>(List.of("&aSell item for", "&a$currency_amount $currency_name")), MetadataHandler.signatureID), fileConfiguration); confirmButton = ItemStackSerializer.deserialize("confirmButton", fileConfiguration); confirmSlot = ConfigurationEngine.setInt(fileConfiguration, "confirmSaleSlot", 35); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/UnbinderMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/UnbinderMenuConfig.java index 7360c8c3e..11b2c6af3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/menus/premade/UnbinderMenuConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/UnbinderMenuConfig.java @@ -3,13 +3,13 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.ItemStackSerializer; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class UnbinderMenuConfig extends MenusConfigFields { @@ -58,8 +58,8 @@ public void processAdditionalFields() { "infoButton", ItemStackGenerator.generateSkullItemStack("magmaguy", "&4&lEliteMobs &r&cby &4&lMagmaGuy", - Arrays.asList("&8Support the plugins you enjoy!", - "&aUse an &5Unbind Scroll &ato remove Soulbind from an item!"), MetadataHandler.signatureID), + new ArrayList<>(List.of("&8Support the plugins you enjoy!", + "&aUse an &5Unbind Scroll &ato remove Soulbind from an item!")), MetadataHandler.signatureID), fileConfiguration); infoButton = ItemStackSerializer.deserialize("infoButton", fileConfiguration); infoSlot = ConfigurationEngine.setInt(fileConfiguration, "infoButtonSlot", 4); diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java index 1ca3e2539..a643065ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -2,19 +2,18 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.mobproperties.premade.*; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.EntityType; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; +import java.util.List; public class MobPropertiesConfig { private static final HashMap mobProperties = new HashMap<>(); - private static final ArrayList mobPropertiesConfigFieldsList = new ArrayList(Arrays.asList( + private static final ArrayList mobPropertiesConfigFieldsList = new ArrayList(new ArrayList<>(List.of( new EliteBlazeConfig(), new EliteCaveSpiderConfig(), new EliteCreeperConfig(), @@ -44,16 +43,22 @@ public class MobPropertiesConfig { new EliteWolfConfig(), new EliteEnderDragon(), new EliteShulkerConfig(), - new SuperChickenConfig(), - new SuperCowConfig(), - new SuperMushroomCowConfig(), - new SuperPigConfig(), - new SuperSheepConfig(), new EliteKillerBunnyConfig(), new EliteLlamaConfig(), new EliteSlimeConfig(), - new EliteMagmaCubeConfig() - )); + new EliteMagmaCubeConfig(), + new EliteBoggedConfig(), + new EliteWardenConfig(), + new EliteGoatConfig(), + new EliteZombiefiedPiglin(), + new EliteZoglinConfig(), + new ElitePiglinConfig(), + new EliteHoglinConfig(), + new ElitePiglinBruteConfig(), + new EliteBeeConfig(), + new EliteBreezeConfig(), + new EliteWitherConfig() + ))); public static HashMap getMobProperties() { return mobProperties; @@ -64,30 +69,13 @@ public static void addMobProperties(EntityType entityType, MobPropertiesConfigFi } public static void initializeConfigs() { - if (!VersionChecker.serverVersionOlderThan(19, 0)) { - mobPropertiesConfigFieldsList.add(new EliteWardenConfig()); - } - if (!VersionChecker.serverVersionOlderThan(17, 0)) { - mobPropertiesConfigFieldsList.add(new EliteGoatConfig()); - } - - if (!VersionChecker.serverVersionOlderThan(16, 0)) { - mobPropertiesConfigFieldsList.add(new EliteZombiefiedPiglin()); - mobPropertiesConfigFieldsList.add(new EliteZoglinConfig()); - mobPropertiesConfigFieldsList.add(new ElitePiglinConfig()); - mobPropertiesConfigFieldsList.add(new EliteHoglinConfig()); - } - - if (!VersionChecker.serverVersionOlderThan(16, 2)) - mobPropertiesConfigFieldsList.add(new ElitePiglinBruteConfig()); - - if (!VersionChecker.serverVersionOlderThan(15, 0)) - mobPropertiesConfigFieldsList.add(new EliteBeeConfig()); + //Version checking goes here, only leaving this as an easy reference for post 1.21 versions +// if (!VersionChecker.serverVersionOlderThan(16, 2)) +// mobPropertiesConfigFieldsList.add(new ElitePiglinBruteConfig()); for (MobPropertiesConfigFields mobPropertiesConfigFields : mobPropertiesConfigFieldsList) initializeConfiguration(mobPropertiesConfigFields); - } /** diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfigFields.java index 83e3d75df..4f1721407 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfigFields.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config.mobproperties; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.EntityType; diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBoggedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBoggedConfig.java new file mode 100644 index 000000000..94b153a6b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBoggedConfig.java @@ -0,0 +1,17 @@ +package com.magmaguy.elitemobs.config.mobproperties.premade; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; +import org.bukkit.entity.EntityType; + +import java.util.List; + +public class EliteBoggedConfig extends MobPropertiesConfigFields { + public EliteBoggedConfig() { + super("elite_bogged", + EntityType.BOGGED, + true, + "&2Lvl &2$level &2Elite &eBogged", + List.of("$player &cwas poisoned by $entity!"), + 5); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java new file mode 100644 index 000000000..201efca76 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java @@ -0,0 +1,17 @@ +package com.magmaguy.elitemobs.config.mobproperties.premade; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; +import org.bukkit.entity.EntityType; + +import java.util.List; + +public class EliteBreezeConfig extends MobPropertiesConfigFields { + public EliteBreezeConfig() { + super("elite_breeze", + EntityType.BREEZE, + true, + "&2Lvl &2$level &2Elite &eBreeze", + List.of("$player &cwas blown away by $entity!"), + 1.5); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteCreeperConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteCreeperConfig.java index 10f4fe208..5c03f1190 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteCreeperConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteCreeperConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteCreeperConfig extends MobPropertiesConfigFields { public EliteCreeperConfig() { @@ -11,8 +12,8 @@ public EliteCreeperConfig() { EntityType.CREEPER, true, "&fLvl &2$level &fElite &2Creeper", - Arrays.asList("$player &cwas blasted away by $entity!", - "$entity &cjust oh man'd $player&c!"), + new ArrayList<>(List.of("$player &cwas blasted away by $entity!", + "$entity &cjust oh man'd $player&c!")), 64.5); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteDrownedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteDrownedConfig.java index 19c805ba9..b98fda444 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteDrownedConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteDrownedConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteDrownedConfig extends MobPropertiesConfigFields { public EliteDrownedConfig() { @@ -11,8 +12,8 @@ public EliteDrownedConfig() { EntityType.DROWNED, true, "&fLvl &2$level &fElite &3Drowned", - Arrays.asList("$player &chas been brought down to the depths by $entity!", - "$player &chas been drowned by $entity!"), + new ArrayList<>(List.of("$player &chas been brought down to the depths by $entity!", + "$player &chas been drowned by $entity!")), 4); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteEndermanConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteEndermanConfig.java index 379718b35..274ae1b13 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteEndermanConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteEndermanConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteEndermanConfig extends MobPropertiesConfigFields { public EliteEndermanConfig() { @@ -11,9 +12,9 @@ public EliteEndermanConfig() { EntityType.ENDERMAN, true, "&fLvl &2$level &fElite &5Enderman", - Arrays.asList("$entity &csent $player &cinto the void!", + new ArrayList<>(List.of("$entity &csent $player &cinto the void!", "$player &clooked at $entity &cwrong!", - "$player &cand $entity &cbecame best friends!"), + "$player &cand $entity &cbecame best friends!")), 10); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGhastConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGhastConfig.java index 9a90ecf1b..7e469fb0d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGhastConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGhastConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteGhastConfig extends MobPropertiesConfigFields { public EliteGhastConfig() { @@ -12,9 +13,9 @@ public EliteGhastConfig() { EntityType.GHAST, true, "&fLvl &2$level &fElite &fGhast", - Arrays.asList("$player &cdidn't dodge $entity&c &cfireballs!", + new ArrayList<>(List.of("$player &cdidn't dodge $entity&c &cfireballs!", "$player &cwas blown to bits $entity&c!", - "$entity &cgot $player's &cbacon!"), + "$entity &cgot $player's &cbacon!")), 22.5); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGoatConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGoatConfig.java index c77faa9fc..9e468bd2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGoatConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteGoatConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteGoatConfig extends MobPropertiesConfigFields { public EliteGoatConfig() { @@ -11,10 +12,10 @@ public EliteGoatConfig() { EntityType.GOAT, true, "&fLvl &2$level &fElite &5Goat", - Arrays.asList("$player &cwas rammed by $entity&c!", + new ArrayList<>(List.of("$player &cwas rammed by $entity&c!", "$player &cwas run over by $entity&c!", "$player &cwas trampled by $entity&c!", - "$player &cgot $entity&c horns!"), + "$player &cgot $entity&c horns!")), 3); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteHoglinConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteHoglinConfig.java index a7a01d08e..07e8fbdbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteHoglinConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteHoglinConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteHoglinConfig extends MobPropertiesConfigFields { public EliteHoglinConfig() { @@ -11,8 +12,8 @@ public EliteHoglinConfig() { EntityType.HOGLIN, true, "&fLvl &2$level &fElite &dHoglin", - Arrays.asList("$player &cmessed with the $entity &cand got the horns!", - "$entity &cgot $player's &cbacon!"), + new ArrayList<>(List.of("$player &cmessed with the $entity &cand got the horns!", + "$entity &cgot $player's &cbacon!")), 8); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteIronGolemConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteIronGolemConfig.java index f7adf0a7c..3755ccabb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteIronGolemConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteIronGolemConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteIronGolemConfig extends MobPropertiesConfigFields { public EliteIronGolemConfig() { @@ -11,8 +12,8 @@ public EliteIronGolemConfig() { EntityType.IRON_GOLEM, true, "&fLvl &2$level &fElite &fIron Golem", - Arrays.asList("$player &cmessed with the wrong $entity&c!", - "$player &chas been taught the way of fist by $entity&c!"), + new ArrayList<>(List.of("$player &cmessed with the wrong $entity&c!", + "$player &chas been taught the way of fist by $entity&c!")), 15); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteKillerBunnyConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteKillerBunnyConfig.java index 7185f8a64..640f39e74 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteKillerBunnyConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteKillerBunnyConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteKillerBunnyConfig extends MobPropertiesConfigFields { public EliteKillerBunnyConfig() { @@ -11,8 +12,8 @@ public EliteKillerBunnyConfig() { EntityType.RABBIT, true, "&fLvl &2$level &fElite &cKiller Rabbit", - Arrays.asList("$entity &cmade $player &cgo live in a farm upstate!", - "$entity &ceducated $player using a stick and not a carrot!"), + new ArrayList<>(List.of("$entity &cmade $player &cgo live in a farm upstate!", + "$entity &ceducated $player using a stick and not a carrot!")), 12); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteLlamaConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteLlamaConfig.java index 098986abd..584582952 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteLlamaConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteLlamaConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteLlamaConfig extends MobPropertiesConfigFields { public EliteLlamaConfig() { @@ -11,8 +12,8 @@ public EliteLlamaConfig() { EntityType.LLAMA, true, "&fLvl &2$level &fElite &5Llama", - Arrays.asList("$player &cwas spit on by $entity&c!", - "$player &cwas made $entity&c angry!"), + new ArrayList<>(List.of("$player &cwas spit on by $entity&c!", + "$player &cwas made $entity&c angry!")), 1); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteMagmaCubeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteMagmaCubeConfig.java index 23b813a0e..aa0a5b096 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteMagmaCubeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteMagmaCubeConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteMagmaCubeConfig extends MobPropertiesConfigFields { public EliteMagmaCubeConfig() { @@ -11,7 +12,7 @@ public EliteMagmaCubeConfig() { EntityType.MAGMA_CUBE, true, "&2Lvl &2$level &fElite &6Magma Cube", - Arrays.asList("$player was incinerated by $entity&f!", "$player got too close to $entity&f!"), + new ArrayList<>(List.of("$player was incinerated by $entity&f!", "$player got too close to $entity&f!")), 6); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePhantomConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePhantomConfig.java index 6616f5d86..7d1272bbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePhantomConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePhantomConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ElitePhantomConfig extends MobPropertiesConfigFields { public ElitePhantomConfig() { @@ -11,9 +12,9 @@ public ElitePhantomConfig() { EntityType.PHANTOM, true, "&fLvl &2$level &fElite &9Phantom", - Arrays.asList("$player &cjust had a bad nightmare about $entity&c!", + new ArrayList<>(List.of("$player &cjust had a bad nightmare about $entity&c!", "$player &cwill be having nightmares about $entity&c!", - "$entity &chas taught $player &cthe value of sleep!"), + "$entity &chas taught $player &cthe value of sleep!")), 9); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinBruteConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinBruteConfig.java index 42536bdc1..b984e49fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinBruteConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinBruteConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ElitePiglinBruteConfig extends MobPropertiesConfigFields { public ElitePiglinBruteConfig() { @@ -11,8 +12,8 @@ public ElitePiglinBruteConfig() { EntityType.PIGLIN_BRUTE, true, "&fLvl &2$level &fElite &cPiglin Brute", - Arrays.asList("$entity &ctenderized $player!", - "$entity &cbrutalized $player!"), + new ArrayList<>(List.of("$entity &ctenderized $player!", + "$entity &cbrutalized $player!")), 19.5); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinConfig.java index a5d0e69bb..8b5c70642 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePiglinConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ElitePiglinConfig extends MobPropertiesConfigFields { public ElitePiglinConfig() { @@ -11,8 +12,8 @@ public ElitePiglinConfig() { EntityType.PIGLIN, true, "&fLvl &2$level &fElite &ePiglin", - Arrays.asList("$entity &cwill fetch a good price for $player's remains!", - "$entity &ctaught $player &cthe value of gold!"), + new ArrayList<>(List.of("$entity &cwill fetch a good price for $player's remains!", + "$entity &ctaught $player &cthe value of gold!")), 13); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePillagerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePillagerConfig.java index c7b7a5b82..6568d8a3b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePillagerConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePillagerConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ElitePillagerConfig extends MobPropertiesConfigFields { public ElitePillagerConfig() { @@ -11,8 +12,8 @@ public ElitePillagerConfig() { EntityType.PILLAGER, true, "&fLvl &2$level &fElite &8Pillager", - Arrays.asList("$entity &cplundered $player&c!", - "$entity &cpillaged $player&c!"), + new ArrayList<>(List.of("$entity &cplundered $player&c!", + "$entity &cpillaged $player&c!")), 5); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePolarBearConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePolarBearConfig.java index da031bb3a..86fec980e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePolarBearConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/ElitePolarBearConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ElitePolarBearConfig extends MobPropertiesConfigFields { public ElitePolarBearConfig() { @@ -11,8 +12,8 @@ public ElitePolarBearConfig() { EntityType.POLAR_BEAR, true, "&fLvl &2$level &fElite &fPolar Bear", - Arrays.asList("$player &cwas clawed to death by $entity&c!", - "$player &cwas mauled to death by $entity&c!"), + new ArrayList<>(List.of("$player &cwas clawed to death by $entity&c!", + "$player &cwas mauled to death by $entity&c!")), 9); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSkeletonConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSkeletonConfig.java index 82ef52003..7e0422a7c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSkeletonConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSkeletonConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteSkeletonConfig extends MobPropertiesConfigFields { public EliteSkeletonConfig() { @@ -11,8 +12,8 @@ public EliteSkeletonConfig() { EntityType.SKELETON, true, "&fLvl &2$level &fElite &fSkeleton", - Arrays.asList("$player &cbecame $entity's &cpin cushion!", - "$entity &cwanted to see $player's &cbones!"), + new ArrayList<>(List.of("$player &cbecame $entity's &cpin cushion!", + "$entity &cwanted to see $player's &cbones!")), 5); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSlimeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSlimeConfig.java index f2ec18da0..4d4120ff1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSlimeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSlimeConfig.java @@ -3,15 +3,15 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.List; public class EliteSlimeConfig extends MobPropertiesConfigFields { - public EliteSlimeConfig(){ + public EliteSlimeConfig() { super("elite_slime", EntityType.SLIME, true, "&2Lvl &2$level &fElite &2Slime", - Arrays.asList("$player was squished by $entity&f!"), + List.of("$player was squished by $entity&f!"), 6); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSpiderConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSpiderConfig.java index 1d73f6bff..fcc70791a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSpiderConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteSpiderConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteSpiderConfig extends MobPropertiesConfigFields { public EliteSpiderConfig() { @@ -11,8 +12,8 @@ public EliteSpiderConfig() { EntityType.SPIDER, true, "&fLvl &2$level &fElite &7Spider", - Arrays.asList("$player &cbecame entangled in $entity's &cweb!", - "$entity &chas devoured $player&c!"), + new ArrayList<>(List.of("$player &cbecame entangled in $entity's &cweb!", + "$entity &chas devoured $player&c!")), 3); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitchConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitchConfig.java index bac58a188..238c7f26a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitchConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitchConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteWitchConfig extends MobPropertiesConfigFields { public EliteWitchConfig() { @@ -11,8 +12,8 @@ public EliteWitchConfig() { EntityType.WITCH, true, "&fLvl &2$level &fElite &5Witch", - Arrays.asList("$player &cbecame $entity's &ctest subject!", - "$player &chas been bewitched by $entity&c!"), + new ArrayList<>(List.of("$player &cbecame $entity's &ctest subject!", + "$player &chas been bewitched by $entity&c!")), 6); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java new file mode 100644 index 000000000..9996b3473 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java @@ -0,0 +1,19 @@ +package com.magmaguy.elitemobs.config.mobproperties.premade; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; +import org.bukkit.entity.EntityType; + +import java.util.ArrayList; +import java.util.List; + +public class EliteWitherConfig extends MobPropertiesConfigFields { + public EliteWitherConfig() { + super("elite_wither", + EntityType.WITHER, + true, + "&fLvl &2$level &7Elite &5Wither", + new ArrayList<>(List.of("$player &cangered $entity&c!", + "$player &chas met $entity's &cfury!")), + 12); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherSkeletonConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherSkeletonConfig.java index 22c0ea741..e1f3c7070 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherSkeletonConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherSkeletonConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteWitherSkeletonConfig extends MobPropertiesConfigFields { public EliteWitherSkeletonConfig() { @@ -11,8 +12,8 @@ public EliteWitherSkeletonConfig() { EntityType.WITHER_SKELETON, true, "&fLvl &2$level &fElite &8Wither Skeleton", - Arrays.asList("$entity's &carrows withered away $player&c!", - "$entity's &chas withered $player &caway!"), + new ArrayList<>(List.of("$entity's &carrows withered away $player&c!", + "$entity's &chas withered $player &caway!")), 12); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWolfConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWolfConfig.java index d641f529e..07d3ff86d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWolfConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWolfConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteWolfConfig extends MobPropertiesConfigFields { public EliteWolfConfig() { @@ -11,8 +12,8 @@ public EliteWolfConfig() { EntityType.WOLF, true, "[$level] Elite Wolf", - Arrays.asList("$entity tore $player apart!", - "$player was torn to shreds by $entity!"), + new ArrayList<>(List.of("$entity tore $player apart!", + "$player was torn to shreds by $entity!")), 6); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZoglinConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZoglinConfig.java index e575075fa..2749b9125 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZoglinConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZoglinConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteZoglinConfig extends MobPropertiesConfigFields { public EliteZoglinConfig() { @@ -11,8 +12,8 @@ public EliteZoglinConfig() { EntityType.ZOGLIN, true, "&fLvl &2$level &fElite &dZoglin", - Arrays.asList("$player &cmessed with the $entity &cand got the horns!", - "$entity &cgot $player's &cbacon!"), + new ArrayList<>(List.of("$player &cmessed with the $entity &cand got the horns!", + "$entity &cgot $player's &cbacon!")), 12); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombieConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombieConfig.java index 7c93e3097..c4a558f1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombieConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombieConfig.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteZombieConfig extends MobPropertiesConfigFields { public EliteZombieConfig() { @@ -11,8 +12,8 @@ public EliteZombieConfig() { EntityType.ZOMBIE, true, "&fLvl &2$level &fElite &2Zombie", - Arrays.asList("$player &cwas devoured by $entity&c!", - "$entity &cgot to $player's &cbrains!"), + new ArrayList<>(List.of("$player &cwas devoured by $entity&c!", + "$entity &cgot to $player's &cbrains!")), 5); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombiefiedPiglin.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombiefiedPiglin.java index 506a121f3..4f478e9ee 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombiefiedPiglin.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteZombiefiedPiglin.java @@ -3,7 +3,8 @@ import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; import org.bukkit.entity.EntityType; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EliteZombiefiedPiglin extends MobPropertiesConfigFields { public EliteZombiefiedPiglin() { @@ -11,8 +12,8 @@ public EliteZombiefiedPiglin() { EntityType.ZOMBIFIED_PIGLIN, true, "&fLvl &2$level &fElite &6Zombified Piglin", - Arrays.asList("$player &cwas mobbed to death by $entity&c!", - "$entity &cgot $player's &cbacon!"), + new ArrayList<>(List.of("$player &cwas mobbed to death by $entity&c!", + "$entity &cgot $player's &cbacon!")), 12); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperChickenConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperChickenConfig.java deleted file mode 100644 index 3dd9d8643..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperChickenConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.config.mobproperties.premade; - -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; -import org.bukkit.entity.EntityType; - -public class SuperChickenConfig extends MobPropertiesConfigFields { - public SuperChickenConfig() { - super("super_chicken", - EntityType.CHICKEN, - true, - "&2Super Chicken", - null, - 0); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperCowConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperCowConfig.java deleted file mode 100644 index 39beffeb9..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperCowConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.config.mobproperties.premade; - -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; -import org.bukkit.entity.EntityType; - -public class SuperCowConfig extends MobPropertiesConfigFields { - public SuperCowConfig() { - super("super_cow", - EntityType.COW, - true, - "&2Super Cow", - null, - 0); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperMushroomCowConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperMushroomCowConfig.java deleted file mode 100644 index ca1d3df67..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperMushroomCowConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.config.mobproperties.premade; - -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; -import org.bukkit.entity.EntityType; - -public class SuperMushroomCowConfig extends MobPropertiesConfigFields { - public SuperMushroomCowConfig() { - super("super_mushroom_cow", - EntityType.MUSHROOM_COW, - true, - "&2Super Mooshroom Cow", - null, - 0); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperPigConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperPigConfig.java deleted file mode 100644 index 458e3a5c3..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperPigConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.config.mobproperties.premade; - -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; -import org.bukkit.entity.EntityType; - -public class SuperPigConfig extends MobPropertiesConfigFields { - public SuperPigConfig() { - super("super_pig", - EntityType.PIG, - true, - "&dSuper Pig", - null, - 0); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperSheepConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperSheepConfig.java deleted file mode 100644 index abc72b8fd..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperSheepConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.config.mobproperties.premade; - -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; -import org.bukkit.entity.EntityType; - -public class SuperSheepConfig extends MobPropertiesConfigFields { - public SuperSheepConfig() { - super("super_sheep", - EntityType.SHEEP, - true, - "Super Sheep", - null, - 0); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfig.java index ddb4ed363..896165a63 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfig.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config.npcs; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.npcs.NPCEntity; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java index 7fb9c9a52..13ea6d0a3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java @@ -2,17 +2,16 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.npcs.NPCInteractions; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; -import org.bukkit.Bukkit; import org.bukkit.entity.Villager; import java.util.ArrayList; import java.util.List; -public class NPCsConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class NPCsConfigFields extends CustomConfigFields { @Getter @Setter @@ -76,6 +75,9 @@ public class NPCsConfigFields extends CustomConfigFields implements CustomConfig @Getter @Setter private boolean instanced = false; + @Getter + @Setter + private double scale = 1; public NPCsConfigFields(String fileName, boolean isEnabled, @@ -113,7 +115,7 @@ public void setSpawnLocation(String spawnLocation) { try { ConfigurationEngine.fileSaverCustomValues(fileConfiguration, this.file); } catch (Exception ex) { - Bukkit.getLogger().warning("[EliteMobs] Attempted to update the location status for an NPC with no config file! Did you delete it during runtime?"); + Logger.warn("Attempted to update the location status for an NPC with no config file! Did you delete it during runtime?"); } } @@ -122,7 +124,13 @@ public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, true, true); this.name = translatable(filename, "name", processString("name", name, "", true)); this.role = translatable(filename, "role", processString("role", role, "", true)); - this.profession = processEnum("profession", profession, Villager.Profession.NITWIT, Villager.Profession.class, true); + try { + this.profession = Villager.Profession.valueOf(processString("profession", profession.toString(), Villager.Profession.NITWIT.toString(), false)); + } catch (IncompatibleClassChangeError e) { + //The early 1.21 API still used the profession enum, which was later dropped. This works for later releases, but not the early ones. + } catch (Exception e){ + Logger.warn("NPC in configuration file " + filename + " has an invalid profession!"); + } this.spawnLocation = processString("spawnLocation", spawnLocation, null, true); this.locations = processStringList("spawnLocations", locations, null, false); this.greetings = translatable(filename, "greetings", processStringList("greetings", greetings, new ArrayList<>(), true)); @@ -140,6 +148,7 @@ public void processConfigFields() { this.arenaFilename = processString("arena", arenaFilename, null, false); this.command = processString("command", command, null, false); this.instanced = processBoolean("instanced", instanced, false, false); + this.scale = processDouble("scale", scale, 1, false); } public void setEnabled(boolean enabled) { @@ -148,7 +157,7 @@ public void setEnabled(boolean enabled) { try { ConfigurationEngine.fileSaverCustomValues(this.fileConfiguration, this.file); } catch (Exception e) { - Bukkit.getLogger().warning("[EliteMobs] Attempted to update the enabled status for an NPC with no config file! Did you delete it during runtime?"); + Logger.warn("Attempted to update the enabled status for an NPC with no config file! Did you delete it during runtime?"); } } @@ -159,7 +168,7 @@ public void removeNPC(String locationString) { try { ConfigurationEngine.fileSaverCustomValues(fileConfiguration, this.file); } catch (Exception ex) { - Bukkit.getLogger().warning("[EliteMobs] Attempted to update the location status for an NPC with no config file! Did you delete it during runtime?"); + Logger.warn("Attempted to update the location status for an NPC with no config file! Did you delete it during runtime?"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BarkeepConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BarkeepConfig.java index 3527c0a70..c295747f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BarkeepConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BarkeepConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class BarkeepConfig extends NPCsConfigFields { public BarkeepConfig() { @@ -14,16 +15,16 @@ public BarkeepConfig() { "", Villager.Profession.BUTCHER, "em_adventurers_guild,285.5,91,209.5,0,0", - Arrays.asList( + new ArrayList<>(List.of( "Need a drink?", "Want a drink", "Thirsty?", - "Howdy, partner."), - Arrays.asList( + "Howdy, partner.")), + new ArrayList<>(List.of( "Have one of our house specialties.", "Special drinks won't find them\\nanywhere else.", - "One taste and will keep you\\ncoming back from more."), - Arrays.asList( + "One taste and will keep you\\ncoming back from more.")), + new ArrayList<>(List.of( "Come back anytime", "Bottoms up!", "Kampai!", @@ -36,7 +37,7 @@ public BarkeepConfig() { "Salute!", "Saúde!", "Cheers!", - "乾杯!"), + "乾杯!")), true, 3, NPCInteractions.NPCInteractionType.BAR); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BinderOfWorldsNPCConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BinderOfWorldsNPCConfig.java index d388d2838..292866561 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BinderOfWorldsNPCConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BinderOfWorldsNPCConfig.java @@ -5,7 +5,7 @@ import org.bukkit.entity.Villager; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class BinderOfWorldsNPCConfig extends NPCsConfigFields { public BinderOfWorldsNPCConfig() { @@ -15,12 +15,12 @@ public BinderOfWorldsNPCConfig() { "<[200] Binder of Worlds Teleport>", Villager.Profession.ARMORER, "em_adventurers_guild,294.5,91,223.5,180,0", - Arrays.asList( + List.of( "You are not prepared."), - Arrays.asList( + new ArrayList<>(List.of( "The things I've seen...\\nYou wouldn't believe it.", "The End is near...\\nYou are not prepared.", - "I give the greatest challenge of them all.\\nExpect death."), + "I give the greatest challenge of them all.\\nExpect death.")), new ArrayList<>(), true, 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BlacksmithConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BlacksmithConfig.java index 914260c0a..5ea02dfcf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BlacksmithConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BlacksmithConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class BlacksmithConfig extends NPCsConfigFields { public BlacksmithConfig() { @@ -14,14 +15,14 @@ public BlacksmithConfig() { "", Villager.Profession.TOOLSMITH, "em_adventurers_guild,285.5,93,261.5,179,0", - Arrays.asList( + new ArrayList<>(List.of( "Welcome to our shop!", "Sell your goods here!", "Fresh goods, just for you!", "Got something to sell?", "Want to buy something good?", - "Fresh goods every time!"), - Arrays.asList( + "Fresh goods every time!")), + new ArrayList<>(List.of( "Higher level mobs drop\\nhigher value items!", "Items with lots of \\nenchantments are worth more!", "Higher level mobs drop\\nbetter items!", @@ -31,12 +32,12 @@ public BlacksmithConfig() { "Some items have unique\\neffects!", "The hunter enchantment\\nattracts elite mobs to your\\nlocation!", "Special weapons and armor\\ndropped by elite mobs can\\nbe sold here!", - "Higher guild ranks will\\nincrease the quality of the\\nloot from elite mobs!"), - Arrays.asList( + "Higher guild ranks will\\nincrease the quality of the\\nloot from elite mobs!")), + new ArrayList<>(List.of( "Thank you for your business!", "Come back soon!", "Come back any time!", - "Recommend this shop to your\\nfriends!"), + "Recommend this shop to your\\nfriends!")), true, 3, NPCInteractions.NPCInteractionType.PROCEDURALLY_GENERATED_SHOP); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BoneMonasteryTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BoneMonasteryTeleporter.java index 7a771ee35..d3a5dc5be 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BoneMonasteryTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BoneMonasteryTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class BoneMonasteryTeleporter extends NPCsConfigFields { - public BoneMonasteryTeleporter(){ + public BoneMonasteryTeleporter() { super("bone_monastery_teleporter", true, "Sister Frieda", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CombatInstructorConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CombatInstructorConfig.java index 23254b416..637b85026 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CombatInstructorConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CombatInstructorConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class CombatInstructorConfig extends NPCsConfigFields { public CombatInstructorConfig() { @@ -14,12 +15,12 @@ public CombatInstructorConfig() { "", Villager.Profession.NITWIT, "em_adventurers_guild,277.41,90.0,286.23,-214.85,-1.95", - Arrays.asList( + new ArrayList<>(List.of( "Want to learn about combat?", "Need a combat lesson?", "Want to know more about combat?", - "Ready to fight Elite Mobs?"), - Arrays.asList( + "Ready to fight Elite Mobs?")), + new ArrayList<>(List.of( "The items around Elite Mobs\\nshow what powers they have.", "The higher the level of\\nthe Elite Mob, the\\nmore powers they can have", "The higher the level of\\nthe Elite Mob, the\\nbetter the loot they can drop", @@ -54,7 +55,7 @@ public CombatInstructorConfig() { "Elite Mobs with floating\\nskulls summon reinforcements\\nwhen hit", "Elite Mobs with floating\\nbooks summon reinforcements\\nuntil you kill the summoner", "Elite Mobs with floating\\neggs summon reinforcements\\nwhen hit", - "Elite Mobs with floating\\nfireworks summon Team Rocket\\nwhen hit"), + "Elite Mobs with floating\\nfireworks summon Team Rocket\\nwhen hit")), null, true, 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CraftenminesLabSanctumTeleporterConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CraftenminesLabSanctumTeleporterConfig.java index 8d6f200b5..5e0cbc93c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CraftenminesLabSanctumTeleporterConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/CraftenminesLabSanctumTeleporterConfig.java @@ -6,7 +6,7 @@ import java.util.List; -public class CraftenminesLabSanctumTeleporterConfig extends NPCsConfigFields { +public class CraftenminesLabSanctumTeleporterConfig extends NPCsConfigFields { public CraftenminesLabSanctumTeleporterConfig() { super("craftenmines_lab_sanctum_teleporter", true, diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/EnchanterConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/EnchanterConfig.java index 91851251a..03e32bca5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/EnchanterConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/EnchanterConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class EnchanterConfig extends NPCsConfigFields { public EnchanterConfig() { @@ -14,20 +15,20 @@ public EnchanterConfig() { "", Villager.Profession.TOOLSMITH, "em_adventurers_guild,278.5,77,243.5,0,0", - Arrays.asList( + new ArrayList<>(List.of( "Need something enchanted?", "Feeling lucky?", "Got an item to improve?", - "Got enchanted books?"), - Arrays.asList( + "Got enchanted books?")), + new ArrayList<>(List.of( "Enchantment results are\\nnot guaranteed!", "Don't complain if it fails!", "Got an enchanted book?", - "Higher quality items are\\nriskier to enchant!"), - Arrays.asList( + "Higher quality items are\\nriskier to enchant!")), + new ArrayList<>(List.of( "Got what you wanted!", "How's your karma?", - "If at first you fail,\\ntry and try again!"), + "If at first you fail,\\ntry and try again!")), true, 3, NPCInteractions.NPCInteractionType.ENCHANTER); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide0Config.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide0Config.java index d6865d720..0fb9f06ce 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide0Config.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide0Config.java @@ -4,8 +4,9 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class Guide0Config extends NPCsConfigFields { public Guide0Config() { @@ -15,21 +16,21 @@ public Guide0Config() { "", Villager.Profession.NITWIT, "null", - Arrays.asList( + new ArrayList<>(List.of( "Heard about the AG?", "Been to the AG?", "Heard of the Adventurer's Guild?", - "Know about the Adventurer's Guild?"), - Arrays.asList( + "Know about the Adventurer's Guild?")), + new ArrayList<>(List.of( "Heard about the AG?", "Been to the AG?", "Heard of the Adventurer's Guild?", - "Know about the Adventurer's Guild?"), - Arrays.asList( + "Know about the Adventurer's Guild?")), + new ArrayList<>(List.of( "Come back anytime", "I'll be here if you need me!", "I'll be around!", - "See you later!"), + "See you later!")), true, 5, NPCInteractions.NPCInteractionType.CUSTOM_QUEST_GIVER); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide1Config.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide1Config.java index 5bdad198f..9afe33ee5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide1Config.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/Guide1Config.java @@ -4,8 +4,9 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class Guide1Config extends NPCsConfigFields { public Guide1Config() { @@ -15,20 +16,20 @@ public Guide1Config() { "", Villager.Profession.NITWIT, "em_adventurers_guild,215.5,87,239.5,131,0", - Arrays.asList( + new ArrayList<>(List.of( "Need guidance?", "Need a hint", "Are you lost?", - "Need help?"), - Arrays.asList( + "Need help?")), + new ArrayList<>(List.of( "I know everything about\\nthis place!", "Want to meet the other members\\nof the Adventurer's Guild?", - "Need to learn your way around\\nthis place?"), - Arrays.asList( + "Need to learn your way around\\nthis place?")), + new ArrayList<>(List.of( "Come back anytime", "I'll be here if you need me!", "I'll be around!", - "See you later!"), + "See you later!")), true, 5, NPCInteractions.NPCInteractionType.CUSTOM_QUEST_GIVER); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/GuildAttendantConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/GuildAttendantConfig.java index 66d66c469..b6419ef32 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/GuildAttendantConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/GuildAttendantConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class GuildAttendantConfig extends NPCsConfigFields { public GuildAttendantConfig() { @@ -14,21 +15,21 @@ public GuildAttendantConfig() { "", Villager.Profession.LIBRARIAN, "em_adventurers_guild,283.5,91,229.5,179,0", - Arrays.asList( + new ArrayList<>(List.of( "Welcome to the\\nAdventurer's Guild!", - "Welcome!"), - Arrays.asList( + "Welcome!")), + new ArrayList<>(List.of( "Check the questboard to\\nsee active quests!", "You can talk to me to\\nchange your guild rank!", "You can sell items to the\\nblacksmith for coins!", "You can talk to the arena\\nmaster to take the arena on!", "You can buy equipment from\\nthe blacksmith!", "You can talk to the combat\\nmaster to check your combat level!", - "Unlocking new guid tiers\\nincreases your maximum health!"), - Arrays.asList( + "Unlocking new guid tiers\\nincreases your maximum health!")), + new ArrayList<>(List.of( "See you soon!", "Thanks for stopping by!", - "Happy hunting!"), + "Happy hunting!")), true, 3, NPCInteractions.NPCInteractionType.GUILD_GREETER); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/QuestGiverConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/QuestGiverConfig.java index 82d6b6c05..c837a38e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/QuestGiverConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/QuestGiverConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class QuestGiverConfig extends NPCsConfigFields { public QuestGiverConfig() { @@ -14,24 +15,24 @@ public QuestGiverConfig() { "", Villager.Profession.FLETCHER, "em_adventurers_guild,278.5,91,215.5,0,0", - Arrays.asList( + new ArrayList<>(List.of( "Greetings, adventurer!\\nFancy a quest?", "You! I've got a quest!", - "Feeling... adventurous?"), - Arrays.asList( + "Feeling... adventurous?")), + new ArrayList<>(List.of( "Complete guild quests\\nfor cool rewards!", "Higher tier quests have\\nbetter rewards!", "Higher tier quests make\\nyou hunt higher level mobs!", "Want a harder challenge?\\nIncrease your guild rank!", - "Make sure you're well equipped\\nfor these quests!"), - Arrays.asList( + "Make sure you're well equipped\\nfor these quests!")), + new ArrayList<>(List.of( "Safe travels, friend.", "Happy hunting!", "Live long and prosper!", "Come back with your shield,\\n or on it.", "Life before death!", "Strength before weakness!", - "Journey before destination!"), + "Journey before destination!")), true, 3, NPCInteractions.NPCInteractionType.QUEST_GIVER); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/RepairmanConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/RepairmanConfig.java index 3dd167cb7..fd81233d7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/RepairmanConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/RepairmanConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class RepairmanConfig extends NPCsConfigFields { public RepairmanConfig() { @@ -14,22 +15,22 @@ public RepairmanConfig() { "", Villager.Profession.WEAPONSMITH, "em_adventurers_guild,278.5,81,263.5,-90,0", - Arrays.asList( + new ArrayList<>(List.of( "Get your items repaired!", "Repairing items for scrap!", "Turn that scrap into durability!", "Need a repair?", - "Got damaged items?"), - Arrays.asList( + "Got damaged items?")), + new ArrayList<>(List.of( "Best repairs in town!", "I got your fix!", "Need a fix?", "I'll repair your items!", - "Need elite items repaired?"), - Arrays.asList( + "Need elite items repaired?")), + new ArrayList<>(List.of( "Don't forget to do maintenance!", "I'll be here if you need me!", - "Call me beep me if you wanna reach me,\\nif you wanna page me that's ok"), + "Call me beep me if you wanna reach me,\\nif you wanna page me that's ok")), true, 3, NPCInteractions.NPCInteractionType.REPAIRMAN); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SantaConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SantaConfig.java index bd5b495b9..6c6e73174 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SantaConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SantaConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -18,10 +18,10 @@ public SantaConfig() { "em_adventurers_guild,212.5,88,236.5,104,0", List.of( "Ho ho ho!"), - Arrays.asList( + new ArrayList<>(List.of( "I have lost some presents, \\ncan you help me?", "Dear traveller, I have\\na request for you!", - "Can you help an old man\\nin his time of need?"), + "Can you help an old man\\nin his time of need?")), List.of( "Ho ho ho!"), true, diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ScrapperConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ScrapperConfig.java index 317bb2913..7ebe75770 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ScrapperConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ScrapperConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class ScrapperConfig extends NPCsConfigFields { public ScrapperConfig() { @@ -14,22 +15,22 @@ public ScrapperConfig() { "", Villager.Profession.WEAPONSMITH, "em_adventurers_guild,292.5,81,263.5,90,0", - Arrays.asList( + new ArrayList<>(List.of( "Want to get rid of items?", "Need to recycle items?", "Looking to scrap?", "It's scrap 'o clock!", - "Scrap time!"), - Arrays.asList( + "Scrap time!")), + new ArrayList<>(List.of( "Scrappy deals!", "Get your scrap here!", "75% chance to work!", "There are no refunds.", - "Recycle, reuse, reduce!"), - Arrays.asList( + "Recycle, reuse, reduce!")), + new ArrayList<>(List.of( "Come back when you have\\nmore to scrap", "Don't forget to make that\\nscrap useful!", - "Happy scrapping!"), + "Happy scrapping!")), true, 3, NPCInteractions.NPCInteractionType.SCRAPPER); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SpecialBlacksmithConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SpecialBlacksmithConfig.java index e32123f83..cc919a417 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SpecialBlacksmithConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/SpecialBlacksmithConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class SpecialBlacksmithConfig extends NPCsConfigFields { public SpecialBlacksmithConfig() { @@ -14,24 +15,24 @@ public SpecialBlacksmithConfig() { "", Villager.Profession.WEAPONSMITH, "em_adventurers_guild,282.5,93,258.5,-90,0", - Arrays.asList( + new ArrayList<>(List.of( "Need something?", "Got anything good?", "We have nothing but the best", "Got anything worth selling?", - "We only buy elite mob gear."), - Arrays.asList( + "We only buy elite mob gear.")), + new ArrayList<>(List.of( "We buy low and sell high.", "No refunds.", "Absolutely no refunds.", "There are no refunds.", "No taksies backsies.", - "Shop purchases are final."), - Arrays.asList( + "Shop purchases are final.")), + new ArrayList<>(List.of( "Come back when you have\\nmore to spend", "Don't get yourself killed,\\nwe want you to bring us\\nmore gear.", "Next time buy something \\nmore expensive.", - "Don't forget, no refunds."), + "Don't forget, no refunds.")), true, 3, NPCInteractions.NPCInteractionType.CUSTOM_SHOP); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/StoryDungeonsQuestGiver.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/StoryDungeonsQuestGiver.java index d10f9c1cc..2e39fcfaf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/StoryDungeonsQuestGiver.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/StoryDungeonsQuestGiver.java @@ -27,12 +27,12 @@ public StoryDungeonsQuestGiver() { "story_dungeons_quest_2_broiled.yml", "story_dungeons_quest_3_the_soulweaver.yml", "story_dungeons_quest_4_bridged.yml", - "story_dungeons_quest_5_the_underground.yml" - , "story_dungeons_quest_6_the_monarch.yml" - , "story_dungeons_quest_7_down_below.yml" - //,"story_dungeons_quest_8_deep_down.yml" - //,"story_dungeons_quest_9_nether_vacation.yml" - //,"story_dungeons_quest_10_the_void_bell.yml" + "story_dungeons_quest_5_the_underground.yml", + "story_dungeons_quest_6_the_monarch.yml", + "story_dungeons_quest_7_down_below.yml", + "story_dungeons_quest_8_deep_down.yml", + "story_dungeons_quest_9_nether_vacation.yml", + "story_dungeons_quest_10_the_void_bell.yml" )); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCaveTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCaveTeleporter.java index 3cfef43df..c3f023d8c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCaveTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCaveTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class TheCaveTeleporter extends NPCsConfigFields { - public TheCaveTeleporter(){ + public TheCaveTeleporter() { super("the_cave_teleporter", true, "Village Mother Diane", @@ -22,6 +22,6 @@ public TheCaveTeleporter(){ NPCInteractions.NPCInteractionType.COMMAND); setCommand("em dungeontp the_cave_sanctum.yml"); setDisguise("custom:elitemobs_the_cave_teleporter"); - setCustomDisguiseData("player elitemobs_the_cave_teleporter setskin {\"id\":\"acb830c3-4415-40b8-aec4-16f32c2f0424\",\"name\":\"Unknown\",\"properties\":[{\"name\":\"textures\",\"value\":\"ewogICJ0aW1lc3RhbXAiIDogMTY3NTg2MzQ2NDg5OCwKICAicHJvZmlsZUlkIiA6ICIzZmM3ZmRmOTM5NjM0YzQxOTExOTliYTNmN2NjM2ZlZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJZZWxlaGEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2I1MDg2NmE1ZjEzZTQxNmRhZGYxZDY2ZTNjOGJmOTY2NGI2MGE2N2RmNTBlZDM2ZWRiMWRiZjIxYjI1Mjc2NiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9\",\"signature\":\"SFgkH/mIf2EL0V4DVNkdt6DcJh85XcLmwiM0cixad7x+ZTQA3nynhQJkUzM/0x4NsYEbvSbRINRPcI3CxuPg6XNwkYTRBKBoGHO33e/py5GJbah6t/Cqn4HG8CHs3kmlSbaOBirXsbclRlKfsEtbpxgNpjYRROyfZUPnDiFjDCKF9j0mO5EFPufEGmErYoJCvgZh4Cu9WFvImrVXVdI9/CR0yWU2isBS+sot9iCK97d7C9GSZL4ThTpxzDVajhBPVwccA4WsIdtyxyzN6DHkIeOmoKvan9U2HtttEUcGxwfuMmZEk8zqQHVSgkKpvDC7ZtzEKULfDx5+5l3getpbLFoVBur6XOPT+GgSMplfbx250fT20yCC62hr/z2h2aV2v9gHvFx18cPphqHaCcuSUpOPgdXoRA34xsarv6xZfZYkQ3h3vh9q6+Vii/hCHzcfJ9AZ2CVC8de2J0RGuQ3Q/F6FOzp6ZchuxqDpToQHjEWO8Ql3U+XvMYYdEUqHKQHFgucnk/z0hGadjQxvLQqqqILi2BGrvvXScupBpFlx+D4bRIXpX5NAw57hBAAO9bZqy6BST0/LS7LaAScl/ijgqcsczYi6TIe3ouWpDkAdF82Rt2geseZ1vBOAFTJY/Em6iG2H4YXDmH1qW/NyFeD8jzdC8Y+oM0V0wcwYxcEwY7Y=\"}],\"legacy\":false}"); + setCustomDisguiseData("player elitemobs_the_cave_teleporter setskin {\"id\":\"acb830c3-4415-40b8-aec4-16f32c2f0424\",\"name\":\"Unknown\",\"properties\":[{\"name\":\"textures\",\"value\":\"ewogICJ0aW1lc3RhbXAiIDogMTY3NTg2MzQ2NDg5OCwKICAicHJvZmlsZUlkIiA6ICIzZmM3ZmRmOTM5NjM0YzQxOTExOTliYTNmN2NjM2ZlZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJZZWxlaGEiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2I1MDg2NmE1ZjEzZTQxNmRhZGYxZDY2ZTNjOGJmOTY2NGI2MGE2N2RmNTBlZDM2ZWRiMWRiZjIxYjI1Mjc2NiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9\",\"signature\":\"SFgkH/mIf2EL0V4DVNkdt6DcJh85XcLmwiM0cixad7x+ZTQA3nynhQJkUzM/0x4NsYEbvSbRINRPcI3CxuPg6XNwkYTRBKBoGHO33e/py5GJbah6t/Cqn4HG8CHs3kmlSbaOBirXsbclRlKfsEtbpxgNpjYRROyfZUPnDiFjDCKF9j0mO5EFPufEGmErYoJCvgZh4Cu9WFvImrVXVdI9/CR0yWU2isBS+sot9iCK97d7C9GSZL4ThTpxzDVajhBPVwccA4WsIdtyxyzN6DHkIeOmoKvan9U2HtttEUcGxwfuMmZEk8zqQHVSgkKpvDC7ZtzEKULfDx5+5l3getpbLFoVBur6XOPT+GgSMplfbx250fT20yCC62hr/z2h2aV2v9gHvFx18cPphqHaCcuSUpOPgdXoRA34xsarv6xZfZYkQ3h3vh9q6+Vii/hCHzcfJ9AZ2CVC8de2J0RGuQ3Q/F6FOzp6ZchuxqDpToQHjEWO8Ql3U+XvMYYdEUqHKQHFgucnk/z0hGadjQxvLQqqqILi2BGrvvXScupBpFlx+D4bRIXpX5NAw57hBAAO9bZqy6BST0/LS7LaAScl/ijgqcsczYi6TIe3ouWpDkAdF82Rt2geseZ1vBOAFTJY/Em6iG2H4YXDmH1qW/NyFeD8jzdC8Y+oM0V0wcwYxcEwY7Y=\"}],\"legacy\":false}"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCityTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCityTeleporter.java index 73734e80d..d13203243 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCityTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheCityTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class TheCityTeleporter extends NPCsConfigFields { - public TheCityTeleporter(){ + public TheCityTeleporter() { super("the_city_teleporter", true, "Dwarf Olav", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheClimbTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheClimbTeleporter.java index a55ab5f93..9b13967ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheClimbTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheClimbTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class TheClimbTeleporter extends NPCsConfigFields { - public TheClimbTeleporter(){ + public TheClimbTeleporter() { super("the_climb_teleporter", true, "Miner Regulus", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheDeepMinesTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheDeepMinesTeleporter.java index 45ccb73c6..ec972daf5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheDeepMinesTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheDeepMinesTeleporter.java @@ -6,8 +6,8 @@ import java.util.List; -public class TheDeepMinesTeleporter extends NPCsConfigFields { - public TheDeepMinesTeleporter(){ +public class TheDeepMinesTeleporter extends NPCsConfigFields { + public TheDeepMinesTeleporter() { super("the_deep_mines", true, "Nether Lurk", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheMinesTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheMinesTeleporter.java index 75b209b80..9057f73c5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheMinesTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheMinesTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class TheMinesTeleporter extends NPCsConfigFields { - public TheMinesTeleporter(){ + public TheMinesTeleporter() { super( "the_mines_teleporter", true, diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherBellTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherBellTeleporter.java new file mode 100644 index 000000000..f7c778eb5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherBellTeleporter.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.config.npcs.premade; + +import com.magmaguy.elitemobs.config.npcs.NPCsConfigFields; +import com.magmaguy.elitemobs.npcs.NPCInteractions; +import org.bukkit.entity.Villager; + +import java.util.List; + +public class TheNetherBellTeleporter extends NPCsConfigFields { + public TheNetherBellTeleporter() { + super("the_nether_bell_teleported", + true, + "Ancient Corpse", + "<[50] The Nether Bell Teleporter>", + Villager.Profession.ARMORER, + "em_adventurers_guild,293.5,78.18,196.5,-90,0", + List.of(""), + List.of(), + List.of(), + true, + 1, + NPCInteractions.NPCInteractionType.COMMAND); + setCommand("em dungeontp the_nether_bell_sanctum.yml"); + setDisguise("BOGGED"); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherWastesTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherWastesTeleporter.java index adafba876..1a5ca48aa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherWastesTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherWastesTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class TheNetherWastesTeleporter extends NPCsConfigFields { - public TheNetherWastesTeleporter(){ + public TheNetherWastesTeleporter() { super("the_nether_wastes_teleporter", true, "Nether Shroom", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ThePalaceTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ThePalaceTeleporter.java index 53a1bbc05..aef54ac47 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ThePalaceTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/ThePalaceTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class ThePalaceTeleporter extends NPCsConfigFields { - public ThePalaceTeleporter(){ + public ThePalaceTeleporter() { super("the_palace_teleporter", true, "Royal Guard Sven", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheQuarryTeleporter.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheQuarryTeleporter.java index c8dc80d04..60c665dc2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheQuarryTeleporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheQuarryTeleporter.java @@ -7,7 +7,7 @@ import java.util.List; public class TheQuarryTeleporter extends NPCsConfigFields { - public TheQuarryTeleporter(){ + public TheQuarryTeleporter() { super("the_quarry_teleporter", true, "Dwarf Berge", diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TravellingMerchantConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TravellingMerchantConfig.java index 3cbb39e08..35172fc7a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TravellingMerchantConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TravellingMerchantConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class TravellingMerchantConfig extends NPCsConfigFields { public TravellingMerchantConfig() { @@ -14,20 +15,20 @@ public TravellingMerchantConfig() { "", Villager.Profession.LIBRARIAN, null, - Arrays.asList( + new ArrayList<>(List.of( "Got something to sell?", "You called?", - "Huh?"), - Arrays.asList( + "Huh?")), + new ArrayList<>(List.of( "I'll buy it on the cheap!", "Got something for me?", - "Time is money!"), - Arrays.asList( + "Time is money!")), + new ArrayList<>(List.of( "Call me again anytime!", "Was that all?", "Safe travels!", "Don't get yourself killed!", - "Good hunting!"), + "Good hunting!")), true, 3, NPCInteractions.NPCInteractionType.SELL); diff --git a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/UnbinderConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/UnbinderConfig.java index 4a10e8e87..f2959d112 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/UnbinderConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/UnbinderConfig.java @@ -4,7 +4,8 @@ import com.magmaguy.elitemobs.npcs.NPCInteractions; import org.bukkit.entity.Villager; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class UnbinderConfig extends NPCsConfigFields { public UnbinderConfig() { @@ -14,19 +15,19 @@ public UnbinderConfig() { "", Villager.Profession.WEAPONSMITH, "em_adventurers_guild,296.5,81,253.5,90,0", - Arrays.asList( + new ArrayList<>(List.of( "Greetings.", "Well met.", "Hail, friend.", "Yes?", - "May I help you?"), - Arrays.asList( + "May I help you?")), + new ArrayList<>(List.of( "I will unbind your items\\nfor an extremely rare unbind scroll.", "I am the only one qualified\\nto unbind your goods.", - "Have an unbind scroll?"), - Arrays.asList( + "Have an unbind scroll?")), + new ArrayList<>(List.of( "Remember: Use unbind\\nscrolls wisely.", - "Safe travels, friend."), + "Safe travels, friend.")), true, 3, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java index b517caa87..a16b6db8d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java @@ -5,44 +5,53 @@ import org.bukkit.configuration.file.FileConfiguration; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; public class PotionEffectsConfig { private static final HashMap potionEffects = new HashMap(); - private static final List potionEffectsConfigFields = new ArrayList<>(Arrays.asList( + private static final List potionEffectsConfigFields = new ArrayList<>(new ArrayList<>(List.of( new AbsorptionConfig(), new BlindnessConfig(), new ConduitPowerConfig(), - new ConfusionConfig(), - new DamageResistanceConfig(), + new NauseaConfig(), + new ResistanceConfig(), new DolphinsGraceConfig(), - new FastDiggingConfig(), + new HasteConfig(), new FireResistanceConfig(), new GlowingConfig(), - new HarmConfig(), - new HealConfig(), + new InstantDamageConfig(), + new InstantHealthConfig(), new HealthBoostConfig(), new HungerConfig(), - new IncreaseDamageConfig(), + new StrengthConfig(), new InvisibilityConfig(), - new JumpConfig(), + new JumpBoostConfig(), new LevitationConfig(), new LuckConfig(), new NightVisionConfig(), new PoisonConfig(), new RegenerationConfig(), new SaturationConfig(), - new SlowConfig(), - new SlowDiggingConfig(), + new SlownessConfig(), + new MiningFatigueConfig(), new SlowFallingConfig(), new SpeedConfig(), new UnluckConfig(), new WaterBreathingConfig(), new WeaknessConfig(), new WitherConfig(), - new DarknessConfig() - )); + new DarknessConfig(), + new InfestedConfig(), + new OozingConfig(), + new RaidOmenConfig(), + new TrialOmenConfig(), + new WeavingConfig(), + new WindChargedConfig() + ))); public static void addPotionEffect(String fileName, PotionEffectsConfigFields powersConfigFields) { potionEffects.put(fileName, powersConfigFields); diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/FastDiggingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HasteConfig.java similarity index 64% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/FastDiggingConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HasteConfig.java index 47e2aa1fd..a866f27b7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/FastDiggingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HasteConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class FastDiggingConfig extends PotionEffectsConfigFields { - public FastDiggingConfig() { - super("fast_digging", +public class HasteConfig extends PotionEffectsConfigFields { + public HasteConfig() { + super("haste", true, "Haste", 30, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InfestedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InfestedConfig.java new file mode 100644 index 000000000..82295efb2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InfestedConfig.java @@ -0,0 +1,13 @@ +package com.magmaguy.elitemobs.config.potioneffects.premade; + +import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; + +public class InfestedConfig extends PotionEffectsConfigFields { + public InfestedConfig() { + super("infested", + true, + "Infested", + 3 * 60 * 20, + 10); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HarmConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InstantDamageConfig.java similarity index 64% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HarmConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InstantDamageConfig.java index 282a83915..34d59bc51 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HarmConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InstantDamageConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class HarmConfig extends PotionEffectsConfigFields { - public HarmConfig() { - super("harm", +public class InstantDamageConfig extends PotionEffectsConfigFields { + public InstantDamageConfig() { + super("instant_damage", true, "Instant Damage", 1, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HealConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InstantHealthConfig.java similarity index 64% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HealConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InstantHealthConfig.java index 6b7cd9c0e..d204c0f52 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/HealConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InstantHealthConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class HealConfig extends PotionEffectsConfigFields { - public HealConfig() { - super("heal", +public class InstantHealthConfig extends PotionEffectsConfigFields { + public InstantHealthConfig() { + super("instant_health", true, "Instant Health", 1, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/JumpConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/JumpBoostConfig.java similarity index 66% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/JumpConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/JumpBoostConfig.java index b5b8ebff8..f76eb9174 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/JumpConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/JumpBoostConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class JumpConfig extends PotionEffectsConfigFields { - public JumpConfig() { - super("jump", +public class JumpBoostConfig extends PotionEffectsConfigFields { + public JumpBoostConfig() { + super("jump_boost", true, "Jump Boost", 10, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlowDiggingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/MiningFatigueConfig.java similarity index 64% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlowDiggingConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/MiningFatigueConfig.java index 5a74071e4..0736a8f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlowDiggingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/MiningFatigueConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class SlowDiggingConfig extends PotionEffectsConfigFields { - public SlowDiggingConfig() { - super("slow_digging", +public class MiningFatigueConfig extends PotionEffectsConfigFields { + public MiningFatigueConfig() { + super("mining_fatigue", true, "Mining Fatigue", 10, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/ConfusionConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/NauseaConfig.java similarity index 65% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/ConfusionConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/NauseaConfig.java index 1a0d05578..63da227dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/ConfusionConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/NauseaConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class ConfusionConfig extends PotionEffectsConfigFields { - public ConfusionConfig() { - super("confusion", +public class NauseaConfig extends PotionEffectsConfigFields { + public NauseaConfig() { + super("nausea", true, "Nausea", 10, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/OozingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/OozingConfig.java new file mode 100644 index 000000000..7a14c18e9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/OozingConfig.java @@ -0,0 +1,13 @@ +package com.magmaguy.elitemobs.config.potioneffects.premade; + +import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; + +public class OozingConfig extends PotionEffectsConfigFields { + public OozingConfig() { + super("oozing", + true, + "Oozing", + 3 * 60 * 20, + 10); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/RaidOmenConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/RaidOmenConfig.java new file mode 100644 index 000000000..2c595b3aa --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/RaidOmenConfig.java @@ -0,0 +1,13 @@ +package com.magmaguy.elitemobs.config.potioneffects.premade; + +import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; + +public class RaidOmenConfig extends PotionEffectsConfigFields { + public RaidOmenConfig() { + super("raid_omen", + true, + "Raid Omen", + 20 * 30, + 10); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/DamageResistanceConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/ResistanceConfig.java similarity index 62% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/DamageResistanceConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/ResistanceConfig.java index 62760cf3e..13c203e1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/DamageResistanceConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/ResistanceConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class DamageResistanceConfig extends PotionEffectsConfigFields { - public DamageResistanceConfig() { - super("damage_resistance", +public class ResistanceConfig extends PotionEffectsConfigFields { + public ResistanceConfig() { + super("resistance", true, "Resistance", 30, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlowConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlownessConfig.java similarity index 66% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlowConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlownessConfig.java index 0d6ebdfbf..8f18ec095 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlowConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/SlownessConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class SlowConfig extends PotionEffectsConfigFields { - public SlowConfig() { - super("slow", +public class SlownessConfig extends PotionEffectsConfigFields { + public SlownessConfig() { + super("slowness", true, "Slowness", 15, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/IncreaseDamageConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/StrengthConfig.java similarity index 63% rename from src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/IncreaseDamageConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/StrengthConfig.java index 10c3221ff..3d24d2fbb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/IncreaseDamageConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/StrengthConfig.java @@ -2,9 +2,9 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; -public class IncreaseDamageConfig extends PotionEffectsConfigFields { - public IncreaseDamageConfig() { - super("increase_damage", +public class StrengthConfig extends PotionEffectsConfigFields { + public StrengthConfig() { + super("strength", true, "Strength", 30, diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/TrialOmenConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/TrialOmenConfig.java new file mode 100644 index 000000000..d9639e945 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/TrialOmenConfig.java @@ -0,0 +1,13 @@ +package com.magmaguy.elitemobs.config.potioneffects.premade; + +import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; + +public class TrialOmenConfig extends PotionEffectsConfigFields { + public TrialOmenConfig() { + super("trial_omen", + true, + "Trial Omen", + 60 * 20 * 15, + 10); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WeavingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WeavingConfig.java new file mode 100644 index 000000000..2a01de3dc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WeavingConfig.java @@ -0,0 +1,13 @@ +package com.magmaguy.elitemobs.config.potioneffects.premade; + +import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; + +public class WeavingConfig extends PotionEffectsConfigFields { + public WeavingConfig() { + super("weaving", + true, + "Weaving", + 3 * 60 * 20, + 10); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WindChargedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WindChargedConfig.java new file mode 100644 index 000000000..9feb9c40d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WindChargedConfig.java @@ -0,0 +1,13 @@ +package com.magmaguy.elitemobs.config.potioneffects.premade; + +import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfigFields; + +public class WindChargedConfig extends PotionEffectsConfigFields { + public WindChargedConfig() { + super("wind_charged", + true, + "Wind Charged", + 3 * 60 * 20, + 10); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfig.java index 64abd73a5..d7b170c4c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfig.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config.powers; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.config.CustomConfig; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfigFields.java index 76bfdede3..1ae1358df 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/PowersConfigFields.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.CustomConfigFields; import com.magmaguy.elitemobs.powers.meta.ElitePower; import com.magmaguy.elitemobs.powers.scripts.caching.EliteScriptBlueprint; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.configuration.ConfigurationSection; @@ -128,7 +128,7 @@ public void initializeScripts() { try { if (scripts != null) eliteScriptBlueprints = EliteScriptBlueprint.parseBossScripts(scripts, this); } catch (Exception exception) { - new WarningMessage("You have a script with invalid data! Script in " + filename + " is not valid."); + Logger.warn("You have a script with invalid data! Script in " + filename + " is not valid."); exception.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ArrowRainConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ArrowRainConfig.java index f184caf6e..9907c4901 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ArrowRainConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ArrowRainConfig.java @@ -8,7 +8,7 @@ public class ArrowRainConfig extends PowersConfigFields { public ArrowRainConfig() { super("arrow_rain", true, - Particle.DRIP_WATER.toString(), + Particle.DRIPPING_WATER.toString(), ArrowRain.class, PowerType.OFFENSIVE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackBlindingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackBlindingConfig.java index b6fe47c7d..5d5a63fc0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackBlindingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackBlindingConfig.java @@ -10,7 +10,7 @@ public class AttackBlindingConfig extends PowersConfigFields { public AttackBlindingConfig() { super("attack_blinding", true, - Particle.SPELL_MOB.toString(), + Particle.WITCH.toString(), addScriptEntry("BlindPlayer", List.of("PlayerDamagedByEliteMobEvent"), null, diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackConfusingConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackConfusingConfig.java index f864503c7..4c120f901 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackConfusingConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/AttackConfusingConfig.java @@ -10,7 +10,7 @@ public class AttackConfusingConfig extends PowersConfigFields { public AttackConfusingConfig() { super("attack_confusing", true, - Particle.SPELL_MOB.toString(), + Particle.WITCH.toString(), addScriptEntry("ConfusePlayer", List.of("PlayerDamagedByEliteMobEvent"), null, diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/GoldShotgunConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/GoldShotgunConfig.java index c7410a7b1..ce39081bd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/GoldShotgunConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/GoldShotgunConfig.java @@ -8,8 +8,8 @@ public GoldShotgunConfig() { super("gold_shotgun", true, null, - 20*20, - 20*7, + 20 * 20, + 20 * 7, GoldShotgun.class, PowerType.UNIQUE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/LightningBoltsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/LightningBoltsConfig.java index 9fcd52bf6..9df34383c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/LightningBoltsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/LightningBoltsConfig.java @@ -10,8 +10,8 @@ public LightningBoltsConfig() { super("lightning_bolts", true, null, - 20*20, - 20*5, + 20 * 20, + 20 * 5, LightningBolts.class, PowerType.OFFENSIVE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/TauntConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/TauntConfig.java index b0b4f8899..adace69c9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/TauntConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/TauntConfig.java @@ -5,7 +5,7 @@ import com.magmaguy.elitemobs.powers.Taunt; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class TauntConfig extends PowersConfigFields { @@ -21,7 +21,7 @@ public TauntConfig() { @Override public void processAdditionalFields() { - onDamaged = ConfigurationEngine.setList(file, fileConfiguration, "onDamaged", Arrays.asList( + onDamaged = ConfigurationEngine.setList(file, fileConfiguration, "onDamaged", new ArrayList<>(List.of( "Ow!", "Oi!", "Stop that!", @@ -69,9 +69,9 @@ public void processAdditionalFields() { "Valhalla!", "Notch save me!", "No retreat!", - "Hit me with your best shot!"), true); + "Hit me with your best shot!")), true); - onDamagedByBow = ConfigurationEngine.setList(file, fileConfiguration, "onDamagedByBow", Arrays.asList( + onDamagedByBow = ConfigurationEngine.setList(file, fileConfiguration, "onDamagedByBow", new ArrayList<>(List.of( "Fight me like a Player!", "Afraid to come up-close?", "I can smell your fear from here!", @@ -132,9 +132,9 @@ public void processAdditionalFields() { "Valhalla!", "Notch save me!", "No retreat!", - "Hit me with your best shot!"), true); + "Hit me with your best shot!")), true); - onDamage = ConfigurationEngine.setList(file, fileConfiguration, "onDamage", Arrays.asList( + onDamage = ConfigurationEngine.setList(file, fileConfiguration, "onDamage", new ArrayList<>(List.of( "A solid hit!", "He shoots, and he scores!", "You'll feel that in the morning!", @@ -197,9 +197,9 @@ public void processAdditionalFields() { "Still standing?", "Face your defeat!", "A taste of pain to come!", - "I'll make you endangered!"), true); + "I'll make you endangered!")), true); - onDeath = ConfigurationEngine.setList(file, fileConfiguration, "onDeath", Arrays.asList( + onDeath = ConfigurationEngine.setList(file, fileConfiguration, "onDeath", new ArrayList<>(List.of( "Alas, poor Yorick!", "The rest is silence", "I shall return", @@ -242,9 +242,9 @@ public void processAdditionalFields() { "Not fair I was lagging", "You win, this time", "You monster...", - "Mediocre..."), true); + "Mediocre...")), true); - onTarget = ConfigurationEngine.setList(file, fileConfiguration, "onTarget", Arrays.asList( + onTarget = ConfigurationEngine.setList(file, fileConfiguration, "onTarget", new ArrayList<>(List.of( "OI! Get over here!", "What's that I see? A coward?", "Sir, prepare your fisticuffs!", @@ -307,7 +307,7 @@ public void processAdditionalFields() { "Hit me with your best shot!", "Witness me!", "Witness me blood bag!", - "I go all shiny and chrome!"), true); + "I go all shiny and chrome!")), true); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieBloatConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieBloatConfig.java index 54fd4eae5..5e6c1f634 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieBloatConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieBloatConfig.java @@ -8,7 +8,7 @@ public class ZombieBloatConfig extends PowersConfigFields { public ZombieBloatConfig() { super("zombie_bloat", true, - Particle.TOTEM.toString(), + Particle.TOTEM_OF_UNDYING.toString(), ZombieBloat.class, PowerType.MAJOR_ZOMBIE); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieFriendsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieFriendsConfig.java index e680b5e52..dcb5fbac5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieFriendsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieFriendsConfig.java @@ -5,7 +5,7 @@ import com.magmaguy.elitemobs.powers.ZombieFriends; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ZombieFriendsConfig extends PowersConfigFields { @@ -26,16 +26,16 @@ public void processAdditionalFields() { friend1Name = ConfigurationEngine.setString(file, fileConfiguration, "friend1Name", "BFF #1", true); friend2Name = ConfigurationEngine.setString(file, fileConfiguration, "friend2Name", "BFF #2", true); - friendDeathMessage = ConfigurationEngine.setList(file, fileConfiguration, "friendDeathMessage", Arrays.asList( + friendDeathMessage = ConfigurationEngine.setList(file, fileConfiguration, "friendDeathMessage", new ArrayList<>(List.of( "Noooo!", "Mediocre!", "Zacharias!", "He's deader than before!", "Vengeance!", "Revenge!", - "I can't believe you've done this."), true); + "I can't believe you've done this.")), true); - originalEntityDialog = ConfigurationEngine.setList(file, fileConfiguration, "originalEntityDialog", Arrays.asList( + originalEntityDialog = ConfigurationEngine.setList(file, fileConfiguration, "originalEntityDialog", new ArrayList<>(List.of( "Let's play ZombieCraft later!", "Feel the power of friendship!", "El pueblo, unido!", @@ -43,9 +43,9 @@ public void processAdditionalFields() { "BFF power!", "One for all!", "Get him!", - "Screw you guys, I'm going home!"), true); + "Screw you guys, I'm going home!")), true); - reinforcementDialog = ConfigurationEngine.setList(file, fileConfiguration, "reinforcementDialog", Arrays.asList( + reinforcementDialog = ConfigurationEngine.setList(file, fileConfiguration, "reinforcementDialog", new ArrayList<>(List.of( "Don't mess with our friends!", "We got your back Zach!", "Backup has arrived!", @@ -62,6 +62,6 @@ public void processAdditionalFields() { "Together we are better!", "The more the merrier!", "I got you fam!", - "All for one!"), true); + "All for one!")), true); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieParentsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieParentsConfig.java index f677e9bcd..38229cb49 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieParentsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/powers/premade/ZombieParentsConfig.java @@ -6,7 +6,7 @@ import lombok.Getter; import org.bukkit.Material; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ZombieParentsConfig extends PowersConfigFields { @@ -29,7 +29,7 @@ public ZombieParentsConfig() { @Override public void processAdditionalFields() { - deathMessage = ConfigurationEngine.setList(file, fileConfiguration, "deathMessage", Arrays.asList( + deathMessage = ConfigurationEngine.setList(file, fileConfiguration, "deathMessage", new ArrayList<>(List.of( "You monster!", "My baby!", "What have you done!?", @@ -39,9 +39,9 @@ public void processAdditionalFields() { "Eh, he was adopted", "He's dead! Again!", "He's deader than before!", - "You broke him!"), true); + "You broke him!")), true); - bossEntityDialog = ConfigurationEngine.setList(file, fileConfiguration, "bossEntityDialog", Arrays.asList( + bossEntityDialog = ConfigurationEngine.setList(file, fileConfiguration, "bossEntityDialog", new ArrayList<>(List.of( "You're embarrassing me!", "He's bullying me!", "He's the one picking on me!", @@ -50,9 +50,9 @@ public void processAdditionalFields() { "Stop following me around!", "God this is so embarrassing!", "He took my lunch money!", - "He's bullying me!"), true); + "He's bullying me!")), true); - zombieDad = ConfigurationEngine.setList(file, fileConfiguration, "zombieDad", Arrays.asList( + zombieDad = ConfigurationEngine.setList(file, fileConfiguration, "zombieDad", new ArrayList<>(List.of( "Get away from my son!", "Stand up for yourself son!", "I'll deal with him!", @@ -61,9 +61,9 @@ public void processAdditionalFields() { "I'll talk to your parents!", "You go kiddo!", "Show him who's boss kiddo!", - "Nice punch kiddo!"), true); + "Nice punch kiddo!")), true); - zombieMom = ConfigurationEngine.setList(file, fileConfiguration, "zombieMom", Arrays.asList( + zombieMom = ConfigurationEngine.setList(file, fileConfiguration, "zombieMom", new ArrayList<>(List.of( "Hands off my child!", "Are you hurt sweetie?", "Did he hurt you sweetie?", @@ -73,7 +73,7 @@ public void processAdditionalFields() { "Posture, sweetheart", "Break it up!", "Stop this!", - "Did you take out the garbage?"), true); + "Did you take out the garbage?")), true); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfig.java index 48fd83a2a..777e0d172 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfig.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config.translations; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.CustomConfig; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import java.util.HashMap; @@ -30,7 +30,7 @@ public static String add(String filename, String key, String value) { return value; TranslationsConfigFields selectedLanguage = translationConfigs.get(DefaultConfig.getLanguage()); if (selectedLanguage == null) { - new WarningMessage("Failed to get valid language from " + filename + " , defaulting to English! (String)"); + Logger.warn("Failed to get valid language from " + filename + " , defaulting to English! (String)"); return value; } selectedLanguage.add(filename, key, value); @@ -42,7 +42,7 @@ public static List add(String filename, String key, List value) return value; TranslationsConfigFields selectedLanguage = translationConfigs.get(DefaultConfig.getLanguage()); if (selectedLanguage == null) { - new WarningMessage("Failed to get valid language from " + filename + " , defaulting to English! (List)"); + Logger.warn("Failed to get valid language from " + filename + " , defaulting to English! (List)"); return value; } selectedLanguage.add(filename, key, value); diff --git a/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfigFields.java index 365269941..cb8a724e3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/translations/TranslationsConfigFields.java @@ -1,13 +1,11 @@ package com.magmaguy.elitemobs.config.translations; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -20,7 +18,7 @@ import java.util.ArrayList; import java.util.List; -public class TranslationsConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class TranslationsConfigFields extends CustomConfigFields { private final List outdatedCustomKeys = new ArrayList<>(); boolean saving = false; @@ -56,7 +54,7 @@ public TranslationsConfigFields(String filename, boolean isEnabled) { inputStreamReader.close(); bufferedReader.close(); } catch (Exception ex) { - new InfoMessage("Translation filename " + parsedFilename + " is not prepackaged. This is fine if it is meant to be a custom translation."); + Logger.info("Translation filename " + parsedFilename + " is not prepackaged. This is fine if it is meant to be a custom translation."); customLanguage = true; } } @@ -79,7 +77,7 @@ public void processConfigFields() { try { dataPath.toFile().createNewFile(); } catch (Exception ex) { - new InfoMessage("Failed to create language data file for file " + filename + " backup file should've been " + languageDataFilename); + Logger.info("Failed to create language data file for file " + filename + " backup file should've been " + languageDataFilename); } @@ -87,7 +85,7 @@ public void processConfigFields() { try { translationData = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(translationDataFile), StandardCharsets.UTF_8)); } catch (Exception ex) { - new WarningMessage("Failed to read translation data!"); + Logger.warn("Failed to read translation data!"); return; } /* @@ -107,7 +105,7 @@ public void processConfigFields() { Object liveValue = fileConfiguration.get(path); if (premadeValue == null) { - new WarningMessage("Something went wrong updating the translations, report this to the developer!"); + Logger.warn("Something went wrong updating the translations, report this to the developer!"); continue; } @@ -117,7 +115,7 @@ public void processConfigFields() { if (liveValue != null) { //If that is the case, the value is custom and the admin should be notified that it didn't update outdatedCustomKeys.add(path); - new InfoMessage("Did not modify " + path + " because the value was custom"); + Logger.info("Did not modify " + path + " because the value was custom"); } else //If there is no value set yet, set the default value fileConfiguration.set(path, premadeValue); @@ -128,11 +126,11 @@ else if (!premadeValue.equals(dataValue)) { if (!dataValue.equals(liveValue)) { //The value is custom outdatedCustomKeys.add(path); - new InfoMessage("Did not modify " + path + " because the value was custom"); + Logger.info("Did not modify " + path + " because the value was custom"); } else { //The value is not custom, can safely be autoupdated fileConfiguration.set(path, premadeValue); - new InfoMessage("Updated translation entry " + path + " for language " + filename); + Logger.info("Updated translation entry " + path + " for language " + filename); } } @@ -146,7 +144,7 @@ else if (!premadeValue.equals(dataValue)) { translationData.save(translationDataFile); fileConfiguration.save(file); } catch (Exception exception) { - new WarningMessage("Failed to save language files, report this to the developer!"); + Logger.warn("Failed to save language files, report this to the developer!"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfig.java index 077c2337e..1289e7493 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfig.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config.wormholes; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.wormhole.Wormhole; +import com.magmaguy.magmacore.config.CustomConfig; import lombok.Getter; import java.util.HashMap; diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java index fd0cbe976..212d31f73 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java @@ -2,14 +2,13 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.wormhole.Wormhole; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; -public class WormholeConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { +public class WormholeConfigFields extends CustomConfigFields { @Getter @Setter @@ -28,7 +27,7 @@ public class WormholeConfigFields extends CustomConfigFields implements CustomCo private String permission; @Getter @Setter - private Wormhole.WormholeStyle style; + private Wormhole.WormholeStyle style = Wormhole.WormholeStyle.CUBE; @Getter @Setter private int particleColor; diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGAirshipWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGAirshipWormholeConfig.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGAirshipWormholeConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGAirshipWormholeConfig.off diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGBeastsSanctuaryWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGBeastsSanctuaryWormholeConfig.java index 1a31fbc01..0abaee021 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGBeastsSanctuaryWormholeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGBeastsSanctuaryWormholeConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.wormhole.Wormhole; public class AGBeastsSanctuaryWormholeConfig extends WormholeConfigFields { - public AGBeastsSanctuaryWormholeConfig(){ + public AGBeastsSanctuaryWormholeConfig() { super("ag_beasts_sanctuary_wormhole", true, "em_adventurers_guild,296.5,106,296.5,90,0", diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGCatacombsWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGCatacombsWormholeConfig.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGCatacombsWormholeConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGCatacombsWormholeConfig.off diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGColosseumWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGColosseumWormholeConfig.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGColosseumWormholeConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGColosseumWormholeConfig.off diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGDarkCathedralWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGDarkCathedralWormholeConfig.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGDarkCathedralWormholeConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGDarkCathedralWormholeConfig.off diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGKnightsCastleWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGKnightsCastleWormholeConfig.java index 42e3c388c..46fecb7df 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGKnightsCastleWormholeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGKnightsCastleWormholeConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.wormhole.Wormhole; public class AGKnightsCastleWormholeConfig extends WormholeConfigFields { - public AGKnightsCastleWormholeConfig(){ + public AGKnightsCastleWormholeConfig() { super("ag_knights_castle_lair_wormhole", true, "em_adventurers_guild,281.5,104.5,302.5,-45,0", diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGRuinsWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGRuinsWormholeConfig.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGRuinsWormholeConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGRuinsWormholeConfig.off diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGUnderGroveWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGUnderGroveWormholeConfig.java index 1babc0aee..b15b23177 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGUnderGroveWormholeConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGUnderGroveWormholeConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.wormhole.Wormhole; public class AGUnderGroveWormholeConfig extends WormholeConfigFields { - public AGUnderGroveWormholeConfig(){ + public AGUnderGroveWormholeConfig() { super("ag_under_grove_wormhole", true, "em_adventurers_guild,284.5,109,296.5,0,0", diff --git a/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGVampireManorWormholeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGVampireManorWormholeConfig.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGVampireManorWormholeConfig.java rename to src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/AGVampireManorWormholeConfig.off diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java new file mode 100644 index 000000000..829acdaf7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -0,0 +1,197 @@ +package com.magmaguy.elitemobs.dungeons; + +import com.magmaguy.elitemobs.config.DungeonsConfig; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.*; +import org.bukkit.event.entity.*; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffectType; + +import java.util.HashSet; +import java.util.Locale; +import java.util.UUID; + +public class DungeonProtector implements Listener { + private static final HashSet bypassingPlayers = new HashSet<>(); + + public static boolean toggleBypass(UUID playerUUID) { + if (bypassingPlayers.contains(playerUUID)) { + bypassingPlayers.remove(playerUUID); + return false; + } + bypassingPlayers.add(playerUUID); + return true; + } + + private boolean shouldBypass(Player player) { + return bypassingPlayers.contains(player.getUniqueId()); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockDamage(BlockDamageEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (shouldBypass(event.getPlayer())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockBreak(BlockBreakEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (shouldBypass(event.getPlayer())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockBurnDamage(BlockBurnEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockPlace(BlockCanBuildEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (event.getPlayer() != null && shouldBypass(event.getPlayer())) return; + event.setBuildable(false); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockExplosionEvent(BlockExplodeEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + EliteMobsWorld eliteMobsWorld = EliteMobsWorld.getEliteMobsWorld(event.getBlock().getWorld().getUID()); + if (!eliteMobsWorld.isAllowExplosions()) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventEntityExplosionEvent(EntityExplodeEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getLocation().getWorld().getUID())) return; + EliteMobsWorld eliteMobsWorld = EliteMobsWorld.getEliteMobsWorld(event.getLocation().getWorld().getUID()); + if (!eliteMobsWorld.isAllowExplosions()) + event.blockList().clear(); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventTntPrimeEvent(TNTPrimeEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + EliteMobsWorld eliteMobsWorld = EliteMobsWorld.getEliteMobsWorld(event.getBlock().getWorld().getUID()); + if (!eliteMobsWorld.isAllowExplosions()) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockFadeEvent(BlockFadeEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (event.getBlock().getType().equals(Material.FROSTED_ICE)) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBonemeal(BlockFertilizeEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (event.getPlayer() != null && shouldBypass(event.getPlayer())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidFlow(BlockFromToEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (EliteMobsWorld.getEliteMobsWorld(event.getBlock().getWorld().getUID()).getDungeonPackagerConfigFields().isAllowLiquidFlow()) + return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockFire(BlockIgniteEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockPlace(BlockPlaceEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (shouldBypass(event.getPlayer())) return; + event.setCancelled(true); + } + + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidPlace(PlayerBucketEmptyEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + if (shouldBypass(event.getPlayer())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLeafDecay(LeavesDecayEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventVanillaMobSpawning(CreatureSpawnEvent event) { + if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.CUSTOM)) return; + if (!EliteMobsWorld.isEliteMobsWorld(event.getLocation().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { + if (DungeonsConfig.isFriendlyFireInDungeons()) return; + if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getLocation().getWorld().getUID())) return; + if (!(event.getEntity() instanceof Player)) return; + if (event.getDamager() instanceof Player || event.getDamager() instanceof Projectile projectile && projectile.getShooter() instanceof Player) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventDoorOpeningSpawning(PlayerInteractEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getPlayer().getWorld().getUID())) return; + if (event.getClickedBlock() == null) return; + if (shouldBypass(event.getPlayer())) return; + Material material = event.getClickedBlock().getType(); + if (material.toString().toLowerCase(Locale.ROOT).endsWith("_door") || + material.toString().toLowerCase(Locale.ROOT).endsWith("_trapdoor")) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventDoorOpeningSpawning(EntityChangeBlockEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventCobwebPotions(LingeringPotionSplashEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return; + if (event.getEntity().getShooter() == null) return; + if (!(event.getEntity().getShooter() instanceof Player)) return; + event.getEntity().getEffects().forEach(potionEffect -> { + if (potionEffect.getType().equals(PotionEffectType.WEAVING)) event.setCancelled(true); + }); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventCobwebPotions(PotionSplashEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return; + if (event.getEntity().getShooter() == null) return; + if (!(event.getEntity().getShooter() instanceof Player)) return; + event.getEntity().getEffects().forEach(potionEffect -> { + if (potionEffect.getType().equals(PotionEffectType.WEAVING)) event.setCancelled(true); + }); + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onPlayerInteract(PlayerInteractEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getClickedBlock().getWorld().getUID())) return; + if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.RESPAWN_ANCHOR) { + event.setCancelled(true); + } + } + +} diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 9c9270745..28622a17f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -7,7 +7,7 @@ import com.magmaguy.elitemobs.npcs.NPCEntity; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.entity.Player; @@ -72,28 +72,17 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - new SchematicDungeonPackage(dungeonPackagerConfigFields); - break; - } - } else { - //This is maintained for legacy reasons. Moving forward this should no longer be used - switch (dungeonPackagerConfigFields.getDungeonLocationType()) { - case WORLD: - if (dungeonPackagerConfigFields.getWorldName() == null) { - new WarningMessage("Dungeon world name for dungeon package " + dungeonPackagerConfigFields.getFilename() + " is not set correctly! This dungeon will not work."); - return; - } - if (dungeonPackagerConfigFields.getWorldName().equals("em_adventurers_guild")) - new WorldDungeonPackage(dungeonPackagerConfigFields); - new WorldDungeonPackage(dungeonPackagerConfigFields); - break; - case SCHEMATIC: - new SchematicDungeonPackage(dungeonPackagerConfigFields); + Logger.warn("Tried to load schematic dungeon " + dungeonPackagerConfigFields.getFilename() + "! This will not work because schematic dungeons have been removed as of EliteMobs 9.0 and replaced with world dungeons. If you want the schematic dungeon experience, I recommend you use BetterStructures with the elite shrines packages, which work better than schematics ever could. Fix this by deleting it from the dungeonpackager file."); break; } } } + public boolean isOutOfDate() { + if (!isInstalled) return false; + return outOfDate; + } + /** * Very first initialization - checks if content is downloaded / installed, loads worlds */ @@ -126,7 +115,7 @@ public boolean install(Player player) { * @param player Player installing the content * @return Whether the content was installed correctly */ - public boolean install(Player player, boolean paste) { + public boolean install() { DungeonInstallEvent event = new DungeonInstallEvent(dungeonPackagerConfigFields); new EventCaller(event); if (!event.isCancelled()) isInstalled = true; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java new file mode 100644 index 000000000..abac43260 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -0,0 +1,44 @@ +package com.magmaguy.elitemobs.dungeons; + +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import lombok.Getter; + +import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.UUID; + +public class EliteMobsWorld { + private static final HashMap eliteMobsWorlds = new HashMap<>(); + @Getter + private final DungeonPackagerConfigFields dungeonPackagerConfigFields; + @Getter + private final boolean allowExplosions; + + private EliteMobsWorld(UUID worldUUID, DungeonPackagerConfigFields dungeonPackagerConfigFields) { + this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; + this.allowExplosions = dungeonPackagerConfigFields.isAllowExplosions(); + eliteMobsWorlds.put(worldUUID, this); + } + + public static void shutdown() { + eliteMobsWorlds.clear(); + } + + @Nullable + public static EliteMobsWorld getEliteMobsWorld(UUID worldUUID) { + return eliteMobsWorlds.get(worldUUID); + } + + public static boolean isEliteMobsWorld(UUID worldUUID) { + return eliteMobsWorlds.containsKey(worldUUID); + } + + public static void create(UUID woldUUID, DungeonPackagerConfigFields dungeonPackagerConfigFields) { + new EliteMobsWorld(woldUUID, dungeonPackagerConfigFields); + } + + public static void destroy(UUID worldUUID) { + eliteMobsWorlds.remove(worldUUID); + } + +} diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/SchematicDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/SchematicDungeonPackage.java deleted file mode 100644 index 326930de7..000000000 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/SchematicDungeonPackage.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.magmaguy.elitemobs.dungeons; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.api.internal.RemovalReason; -import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; -import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields; -import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig; -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.dungeons.utility.DungeonUtils; -import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; -import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.WarningMessage; -import lombok.Getter; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -public class SchematicDungeonPackage extends SchematicPackage implements Dungeon { - private final HashSet rawSpawnLocations = new HashSet<>(); - private final HashSet rawChestLocations = new HashSet<>(); - private int lowestLevel; - private int highestLevel; - - public SchematicDungeonPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { - super(dungeonPackagerConfigFields); - for (String string : dungeonPackagerConfigFields.getRelativeBossLocations()) { - try { - Vector vector = getVectorFromConfig(string.split(":")[1]); - if (vector == null) continue; - rawSpawnLocations.add(new RawContainer(string.split(":")[0], vector)); - } catch (Exception ex) { - new WarningMessage("Failed to correctly read entry " + string + " in schematic dungeon " + dungeonPackagerConfigFields.getFilename()); - } - } - if (!dungeonPackagerConfigFields.getRelativeTreasureChestLocations().isEmpty()) - for (String string : dungeonPackagerConfigFields.getRelativeTreasureChestLocations()) { - try { - Vector vector = getVectorFromConfig(string.split(":")[1]); - if (vector == null) continue; - rawChestLocations.add(new RawContainer(string.split(":")[0], vector)); - } catch (Exception ex) { - new WarningMessage("Failed to correctly read entry " + string + " in schematic dungeon " + dungeonPackagerConfigFields.getFilename()); - } - } - } - - private void getEntities() { - //Get the real spawn locations - HashMap parsedBossLocations = new HashMap<>(); - for (RawContainer rawContainer : rawSpawnLocations) - parsedBossLocations.put(rawContainer.getFilename(), dungeonPackagerConfigFields.getAnchorPoint().clone().add(rawContainer.getVector())); - //A bit dirty but this should get every boss in the dungeon - for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntitySet()) - for (Map.Entry entry : parsedBossLocations.entrySet()) - if (regionalBossEntity.getCustomBossesConfigFields().getFilename().equals(entry.getKey())) - customBossEntityList.add(regionalBossEntity); - } - - private Vector getVectorFromConfig(String string) { - try { - String[] rawValues = string.split(","); - double x = Double.parseDouble(rawValues[0]); - double y = Double.parseDouble(rawValues[1]); - double z = Double.parseDouble(rawValues[2]); - return new Vector(x, y, z); - } catch (Exception ex) { - new WarningMessage("Failed to retrieve valid vector from " + string + " in configuration file " + dungeonPackagerConfigFields.getFilename()); - return null; - } - } - - @Override - public void baseInitialization() { - super.baseInitialization(); - for (String string : dungeonPackagerConfigFields.getRelativeBossLocations()) - if (!string.isEmpty()) { - String parsedString = string.split(":")[0]; - if (!parsedString.isEmpty()) - content.put(parsedString, this); - } - - for (String string : dungeonPackagerConfigFields.getRelativeTreasureChestLocations()) - if (!string.isEmpty()) { - String parsedString = string.split(":")[0]; - if (!parsedString.isEmpty()) - content.put(parsedString, this); - } - } - - @Override - public void initializeContent() { - super.initializeContent(); - if (isInstalled) { - getEntities(); - qualifyEntities(); - getChests(); - } - } - - private void getChests() { - //Get the real chest locations - HashMap parsedChestLocations = new HashMap<>(); - for (RawContainer rawContainer : rawChestLocations) - parsedChestLocations.put(rawContainer.getFilename(), dungeonPackagerConfigFields.getAnchorPoint().clone().add(rawContainer.getVector())); - for (TreasureChest treasureChest : TreasureChest.getTreasureChestHashMap().values()) - for (Map.Entry entry : parsedChestLocations.entrySet()) - if (treasureChest.getCustomTreasureChestConfigFields().getFilename().equals(entry.getKey())) - treasureChestList.add(treasureChest); - } - - private void qualifyEntities() { - //Initialize data related to the highest and lowest levels for informational purposes - DungeonUtils.Pair lowestAndHighestValues = DungeonUtils.getLowestAndHighestLevels(customBossEntityList); - this.lowestLevel = lowestAndHighestValues.getLowestValue(); - this.highestLevel = lowestAndHighestValues.getHighestValue(); - } - - private void installBosses() { - for (RawContainer rawContainer : rawSpawnLocations) { - CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(rawContainer.getFilename()); - if (customBossesConfigFields == null) { - new WarningMessage("Failed to get Regional Boss " + rawContainer.getFilename() + " in schematic dungeon " + dungeonPackagerConfigFields.getFilename() + " !"); - continue; - } - Location bossLocation = toRealPosition(rawContainer.getVector()); - RegionalBossEntity regionalBossEntity = RegionalBossEntity.createPermanentRegionalBossEntity(customBossesConfigFields, bossLocation); - regionalBossEntity.setEmPackage(this); - regionalBossEntity.spawn(false); - customBossEntityList.add(regionalBossEntity); - } - } - - @Override - public boolean install(Player player, boolean paste) { - if (!super.install(player, paste)) return false; - installBosses(); - installChests(); - player.sendMessage(ChatColorConverter.convert("&2Schematic dungeon sucessfully installed! You can uninstall it in the &c/em setup &2menu if you do not like where it got placed.")); - player.sendMessage("Schematic-based dungeons install where you are, as opposed to world-based dungeons which create a new world!"); - player.sendMessage("Make sure to uninstall the dungeon as soon as possible if you do not like the location, as it will not be able to remove the build after you restart!"); - return true; - } - - private void installChests() { - for (RawContainer rawContainer : rawChestLocations) { - CustomTreasureChestConfigFields customTreasureChestConfigFields = CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().get(rawContainer.getFilename()); - if (customTreasureChestConfigFields == null) { - new WarningMessage("Failed to get Treasure Chest " + rawContainer.getFilename() + " in schematic dungeon " + dungeonPackagerConfigFields.getFilename() + " !"); - continue; - } - Location chestLocation = toRealPosition(rawContainer.getVector()); - //todo: this doesn't rotate the treasure chest orientations for now. That will be added later - TreasureChest treasureChest = customTreasureChestConfigFields.addTreasureChest(chestLocation, 0); - treasureChest.setEmPackage(this); - treasureChestList.add(treasureChest); - } - } - - @Override - public boolean uninstall(Player player) { - if (!super.uninstall(player)) return false; - customBossEntityList.forEach(customBossEntity -> customBossEntity.remove(RemovalReason.REMOVE_COMMAND)); - treasureChestList.forEach(TreasureChest::removeTreasureChest); - customBossEntityList.clear(); - treasureChestList.clear(); - return true; - } - - @Override - public int getLowestLevel() { - return lowestLevel; - } - - @Override - public int getHighestLevel() { - return highestLevel; - } - - public void removeBoss(RegionalBossEntity regionalBossEntity) { - Vector bossVector = regionalBossEntity.getSpawnLocation().subtract(dungeonPackagerConfigFields.getAnchorPoint()).toVector().rotateAroundY(dungeonPackagerConfigFields.getCalculatedRotation()); - getDungeonPackagerConfigFields().removeRelativeBossLocation(regionalBossEntity.getCustomBossesConfigFields(), bossVector); - } - - public void addBoss(CustomBossesConfigFields customBossesConfigFields, Location location) { - getDungeonPackagerConfigFields().addRelativeBossLocation(customBossesConfigFields, toRelativePosition(location)); - } - - public void addChest(String treasureChestFilename, Location location) { - getDungeonPackagerConfigFields().addRelativeTreasureChests(treasureChestFilename, toRelativePosition(location)); - } - - private class RawContainer { - @Getter - private final String filename; - @Getter - private final Vector vector; - - public RawContainer(String filename, Vector vector) { - this.filename = filename; - this.vector = vector; - } - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/SchematicPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/SchematicPackage.java deleted file mode 100644 index 44d20a097..000000000 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/SchematicPackage.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.magmaguy.elitemobs.dungeons; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.thirdparty.worldedit.WorldEditUtils; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.wormhole.Wormhole; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Paths; - -public class SchematicPackage extends EMPackage { - private static boolean warnedAboutWorldEdit = false; - - public SchematicPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { - super(dungeonPackagerConfigFields); - } - - @Override - public void baseInitialization() { - super.baseInitialization(); - if (dungeonPackagerConfigFields.getAnchorPoint() != null) { - this.isInstalled = this.isDownloaded = true; - dungeonPackagerConfigFields.initializeSchematic(); - return; - } - - if (this.dungeonPackagerConfigFields.getSchematicName() == null || this.dungeonPackagerConfigFields.getSchematicName().isEmpty()) { - this.isDownloaded = false; - new WarningMessage("The schematic package " + this.dungeonPackagerConfigFields.getFilename() + " does not have a valid schematic file name!"); - } - - this.isDownloaded = Files.exists(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath() - + File.separator + "schematics" + File.separator + dungeonPackagerConfigFields.getSchematicName())); - - - //If worldedit isn't installed, the checks can't be continued - if (!Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) { - this.isDownloaded = false; - if (!warnedAboutWorldEdit) { - warnedAboutWorldEdit = true; - new WarningMessage("Schematic dungeons are downloaded but neither WorldEdit nor FastAsyncWorldEdit are installed! As such, you will not be able to install the dungeons."); - } - } - - } - - public Vector toRelativePosition(Location location) { - return dungeonPackagerConfigFields.getAnchorPoint().clone().subtract(location).toVector().rotateAroundY(Math.toRadians(getDungeonPackagerConfigFields().getCalculatedRotation())); - } - - public Location toRealPosition(Vector vector) { - return dungeonPackagerConfigFields.getAnchorPoint().clone().add(vector.clone().rotateAroundY(Math.toRadians(getDungeonPackagerConfigFields().getCalculatedRotation()))); - } - - @Override - public boolean install(Player player, boolean paste) { - if (!super.install(player, paste)) return false; - //Determine rotation based on the direction that is set as facing for the schematic creation - int currentRotation = Math.round(player.getLocation().getYaw() / 90); - SchematicRotation pastedRotation; - switch (currentRotation) { - case 0: - pastedRotation = SchematicRotation.SOUTH; - break; - case 1: - pastedRotation = SchematicRotation.EAST; - break; - case -1: - pastedRotation = SchematicRotation.WEST; - break; - case 2: - case -2: - pastedRotation = SchematicRotation.NORTH; - break; - default: - pastedRotation = SchematicRotation.SOUTH; - } - dungeonPackagerConfigFields.setCalculatedRotation(pastedRotation.value - dungeonPackagerConfigFields.getDefaultSchematicRotation().value); - Location anchorLocation = player.getLocation().getBlock().getLocation().add(new Vector(0.5, 1, 0.5)); - anchorLocation.setDirection(player.getLocation().getDirection()); - //Places the schematic using the WorldEdit API - if (paste && - !WorldEditUtils.place( - dungeonPackagerConfigFields.getSchematicName(), - getDungeonPackagerConfigFields().getCalculatedRotation(), - anchorLocation.clone().subtract(new Vector(0, 1, 0)), - this)) - return false; - dungeonPackagerConfigFields.installSchematic(anchorLocation, getDungeonPackagerConfigFields().getCalculatedRotation(), this); - WorldGuardCompatibility.defineMinidungeon( - toRealPosition(dungeonPackagerConfigFields.getCorner1()), - toRealPosition(dungeonPackagerConfigFields.getCorner2()), - dungeonPackagerConfigFields.getAnchorPoint(), - dungeonPackagerConfigFields.getSchematicName(), - this); - for (Wormhole wormhole : Wormhole.getWormholes()) - wormhole.onDungeonInstall(dungeonPackagerConfigFields.getFilename()); - player.sendMessage("[EliteMobs] Successfully installed " + dungeonPackagerConfigFields.getName() + "! To uninstall, do /em setup again and click on this content again."); - return true; - } - - @Override - public boolean uninstall(Player player) { - if (!super.uninstall(player)) return false; - WorldEditUtils.undo(this); - WorldGuardCompatibility.removeMinidungeon(dungeonPackagerConfigFields.getSchematicName(), dungeonPackagerConfigFields.getAnchorPoint()); - dungeonPackagerConfigFields.uninstallSchematic(); - for (Wormhole wormhole : Wormhole.getWormholes()) - wormhole.onDungeonUninstall(dungeonPackagerConfigFields.getFilename()); - return true; - } - - public enum SchematicRotation { - NORTH(180), - SOUTH(0), - EAST(-90), - WEST(90); - - public final int value; - - SchematicRotation(int value) { - this.value = value; - } - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldDungeonPackage.java index 0c7781d87..81b150fa3 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldDungeonPackage.java @@ -1,20 +1,16 @@ package com.magmaguy.elitemobs.dungeons; -import com.magmaguy.elitemobs.EliteMobs; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; import com.magmaguy.elitemobs.dungeons.utility.DungeonUtils; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; -import java.util.Objects; - /** * This class is specifically for world-based dungeons */ @@ -38,9 +34,7 @@ private void initializeWormholeWorld() { if (dungeonPackagerConfigFields.getWormholeWorldName() != null && !dungeonPackagerConfigFields.getWormholeWorldName().isEmpty() && Bukkit.getWorld(dungeonPackagerConfigFields.getWormholeWorldName()) == null) { - wormholeWorld = DungeonUtils.loadWorld(this.getDungeonPackagerConfigFields().getWormholeWorldName(), this.getDungeonPackagerConfigFields().getEnvironment()); - if (wormholeWorld != null && EliteMobs.worldGuardIsEnabled) - WorldGuardCompatibility.protectWorldMinidugeonArea(Objects.requireNonNull(wormholeWorld).getSpawnLocation(), this); + wormholeWorld = DungeonUtils.loadWorld(this.getDungeonPackagerConfigFields().getWormholeWorldName(), this.getDungeonPackagerConfigFields().getEnvironment(), dungeonPackagerConfigFields); } } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index bdb189387..efee487af 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -1,9 +1,12 @@ package com.magmaguy.elitemobs.dungeons; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.io.File; @@ -25,6 +28,17 @@ public void baseInitialization() { this.isDownloaded = false; this.isInstalled = false; return; + } else { + //This removes all instanced worlds not previously correctly removed + for (File worldFile : Bukkit.getWorldContainer().listFiles()){ + if (worldFile.getName().contains(file.getName()) && worldFile.getName().matches(".*_\\d{1,2}$")) { + try{ + FileUtils.deleteDirectory(worldFile); + Logger.info("Removing previously instanced world " + worldFile.getName());}catch (Exception e){ + Logger.warn("Failed to remove previously instanced world " + worldFile.getName()); + } + } + } } this.isDownloaded = true; this.isInstalled = dungeonPackagerConfigFields.isEnabled(); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 8b8df85eb..dac8d1c87 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.dungeons; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; import com.magmaguy.elitemobs.dungeons.utility.DungeonUtils; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomMusic; import com.magmaguy.elitemobs.wormhole.Wormhole; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.World; @@ -29,7 +29,7 @@ public void baseInitialization() { super.baseInitialization(); if (dungeonPackagerConfigFields.getWorldName() == null || dungeonPackagerConfigFields.getWorldName().isEmpty()) { this.isDownloaded = this.isInstalled = false; - new WarningMessage("Packaged content " + dungeonPackagerConfigFields.getFilename() + " does not have a valid world name in the dungeon packager!"); + Logger.warn("Packaged content " + dungeonPackagerConfigFields.getFilename() + " does not have a valid world name in the dungeon packager!"); return; } @@ -42,6 +42,7 @@ public void baseInitialization() { if (Bukkit.getWorld(dungeonPackagerConfigFields.getWorldName()) != null) { this.isDownloaded = this.isInstalled = true; world = Bukkit.getWorld(dungeonPackagerConfigFields.getWorldName()); + EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); dungeonPackagerConfigFields.initializeWorld(); return; } @@ -54,8 +55,10 @@ public void baseInitialization() { if (isDownloaded && isInstalled) { world = DungeonUtils.loadWorld(this); + if (dungeonPackagerConfigFields.getSong() != null) + new CustomMusic(dungeonPackagerConfigFields.getSong(), dungeonPackagerConfigFields, world); dungeonPackagerConfigFields.initializeWorld(); - } + } else isInstalled = false; } @@ -66,7 +69,9 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); - WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); + if (dungeonPackagerConfigFields.getSong() != null) + new CustomMusic(dungeonPackagerConfigFields.getSong(), dungeonPackagerConfigFields, world); +// WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); for (Wormhole wormhole : Wormhole.getWormholes()) wormhole.onDungeonInstall(dungeonPackagerConfigFields.getFilename()); player.sendMessage(ChatColorConverter.convert("[EliteMobs] Successfully installed " + dungeonPackagerConfigFields.getName() + "! To uninstall, do /em setup again and click on this content again.")); @@ -86,4 +91,5 @@ public boolean uninstall(Player player) { world = null; return true; } + } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java index 342595d74..65069d565 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -1,22 +1,17 @@ package com.magmaguy.elitemobs.dungeons.utility; +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.dungeons.WorldPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.WorldLoader; import lombok.Getter; import org.bukkit.Bukkit; -import org.bukkit.Difficulty; import org.bukkit.World; -import org.bukkit.WorldCreator; import org.bukkit.entity.Player; -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.List; -import java.util.logging.Filter; public class DungeonUtils { public static Pair getLowestAndHighestLevels(List customBossEntities) { @@ -37,43 +32,17 @@ public static Pair getLowestAndHighestLevels(List customBossEn public static World loadWorld(WorldPackage worldPackage) { String worldName = worldPackage.getDungeonPackagerConfigFields().getWorldName(); World.Environment environment = worldPackage.getDungeonPackagerConfigFields().getEnvironment(); - World world = loadWorld(worldName, environment); + World world = loadWorld(worldName, environment, worldPackage.getDungeonPackagerConfigFields()); if (worldPackage.getDungeonPackagerConfigFields().getWormholeWorldName() != null) - loadWorld(worldPackage.getDungeonPackagerConfigFields().getWormholeWorldName(), environment); + loadWorld(worldPackage.getDungeonPackagerConfigFields().getWormholeWorldName(), environment, worldPackage.getDungeonPackagerConfigFields()); if (world != null) worldPackage.setInstalled(true); return world; } - public static World loadWorld(String worldName, World.Environment environment) { - File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); - - if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { - new WarningMessage("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); - return null; - } - - new InfoMessage("Loading world " + worldName + " !"); - - Filter filter = newFilter -> false; - - Filter previousFilter = Bukkit.getLogger().getFilter(); - - Bukkit.getLogger().setFilter(filter); - - try { - WorldCreator worldCreator = new WorldCreator(worldName); - worldCreator.environment(environment); - World world = Bukkit.createWorld(worldCreator); - if (world != null) world.setKeepSpawnInMemory(false); - world.setDifficulty(Difficulty.HARD); - Bukkit.getLogger().setFilter(previousFilter); - return world; - } catch (Exception exception) { - Bukkit.getLogger().setFilter(previousFilter); - new WarningMessage("Failed to load world " + worldName + " !"); - exception.printStackTrace(); - } - return null; + public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { + World world = WorldLoader.loadVoidTemporaryWorld(worldName, environment); + if (world != null) EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + return world; } public static boolean unloadWorld(WorldPackage worldPackage) { @@ -90,6 +59,9 @@ public static boolean unloadWorld(WorldPackage worldPackage) { Bukkit.unloadWorld(worldPackage.getWorld(), false); if (worldPackage instanceof WorldDungeonPackage && ((WorldDungeonPackage) worldPackage).getWormholeWorld() != null) Bukkit.unloadWorld(((WorldDungeonPackage) worldPackage).getWormholeWorld(), false); + + EliteMobsWorld.destroy(worldPackage.getWorld().getUID()); + return true; } diff --git a/src/main/java/com/magmaguy/elitemobs/economy/EconomyHandler.java b/src/main/java/com/magmaguy/elitemobs/economy/EconomyHandler.java index d0a127f1f..9a7c05450 100644 --- a/src/main/java/com/magmaguy/elitemobs/economy/EconomyHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/economy/EconomyHandler.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.economy; import com.magmaguy.elitemobs.playerdata.database.PlayerData; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.Round; import java.util.UUID; diff --git a/src/main/java/com/magmaguy/elitemobs/economy/VaultCompatibility.java b/src/main/java/com/magmaguy/elitemobs/economy/VaultCompatibility.java index 54bfe15eb..169169996 100644 --- a/src/main/java/com/magmaguy/elitemobs/economy/VaultCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/economy/VaultCompatibility.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.economy; import com.magmaguy.elitemobs.config.EconomySettingsConfig; +import com.magmaguy.magmacore.util.Logger; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; import org.bukkit.plugin.RegisteredServiceProvider; @@ -14,9 +15,9 @@ public class VaultCompatibility { public static void vaultSetup() { if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault")) { - Bukkit.getLogger().info("[(EliteMobs] Vault detected."); + Logger.info("[(EliteMobs] Vault detected."); if (EconomySettingsConfig.isUseVault()) { - Bukkit.getLogger().warning("[EliteMobs] Vault preference detected. This is not the recommended setting. " + + Logger.warn("Vault preference detected. This is not the recommended setting. " + "Ask the dev or check the wiki as to why."); VAULT_ENABLED = true; VaultCompatibility.setupEconomy(); @@ -45,7 +46,7 @@ public static void subtractCurrency(UUID user, double amount) { } public static void setCurrency(UUID user, double amount) { - Bukkit.getLogger().warning("[EliteMobs] Someone just attempted to set the Vault currency through EliteMobs." + + Logger.warn("Someone just attempted to set the Vault currency through EliteMobs." + " For safety reasons, this command is off. Please use your dedicated economy plugin for this."); } @@ -54,7 +55,7 @@ public static double checkCurrency(UUID user) { try { currency = econ.getBalance(Bukkit.getOfflinePlayer(user)); } catch (NullPointerException e) { - Bukkit.getLogger().warning("[EliteMobs] Player tried to check currency when they had no economy entry" + + Logger.warn("Player tried to check currency when they had no economy entry" + "associated to them. This is an issue with your Vault/economy implementation, not EliteMobs."); } return currency; diff --git a/src/main/java/com/magmaguy/elitemobs/entitytracker/EntityTracker.java b/src/main/java/com/magmaguy/elitemobs/entitytracker/EntityTracker.java index e0a438fa8..9b2aaaeff 100644 --- a/src/main/java/com/magmaguy/elitemobs/entitytracker/EntityTracker.java +++ b/src/main/java/com/magmaguy/elitemobs/entitytracker/EntityTracker.java @@ -4,7 +4,6 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteMobSpawnEvent; import com.magmaguy.elitemobs.api.NPCEntitySpawnEvent; -import com.magmaguy.elitemobs.api.SuperMobSpawnEvent; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; @@ -29,7 +28,9 @@ import org.bukkit.scheduler.BukkitRunnable; import javax.annotation.Nullable; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.UUID; public class EntityTracker implements Listener { @@ -72,37 +73,6 @@ public static void unregisterEliteEntity(Entity entity, RemovalReason removalRea eliteEntity.remove(removalReason); } - //Super Mobs - public static void registerSuperMob(LivingEntity livingEntity) { - SuperMobSpawnEvent superMobSpawnEvent = new SuperMobSpawnEvent(livingEntity); - new EventCaller(superMobSpawnEvent); - if (superMobSpawnEvent.isCancelled()) return; - PersistentTagger.tagSuperMob(livingEntity); - } - - public static boolean isSuperMob(Entity entity) { - return PersistentTagger.isSuperMob(entity); - } - - public static List getSuperMobs() { - List superMobs = new ArrayList<>(); - for (World world : Bukkit.getWorlds()) - for (Entity entity : world.getEntities()) - if (isSuperMob(entity)) - superMobs.add((LivingEntity) entity); - return superMobs; - } - - //Visual effects - usually trails around elites - public static List getItemVisualEffects() { - List visualEffects = new ArrayList<>(); - for (World world : Bukkit.getWorlds()) - for (Entity entity : world.getEntities()) - if (isSuperMob(entity)) - visualEffects.add(entity); - return visualEffects; - } - public static void registerVisualEffects(Entity entity) { PersistentTagger.tagVisualEffect(entity); } diff --git a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 006f73e15..43dd58b52 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -7,8 +7,7 @@ import com.magmaguy.elitemobs.config.customevents.CustomEventsConfig; import com.magmaguy.elitemobs.config.customevents.CustomEventsConfigFields; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -56,9 +55,7 @@ public static void initializeBlueprintEvents() { for (CustomEventsConfigFields customEventsConfigFields : CustomEventsConfig.getCustomEvents().values()) { if (customEventsConfigFields.isEnabled()) switch (customEventsConfigFields.getEventType()) { - case BREAK_BLOCK: - case FISH: - case TILL_SOIL: + case BREAK_BLOCK, FISH, TILL_SOIL: blueprintEvents.add(new ActionEvent(customEventsConfigFields)); break; default: @@ -93,7 +90,7 @@ public void instantiateEvent(Location location, Player player) { for (String filename : primaryCustomBossFilenames) { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(filename); if (customBossEntity == null) { - new WarningMessage("Failed to generate custom boss " + filename + " ! This has cancelled action event " + customEventsConfigFields.getFilename() + " !"); + Logger.warn("Failed to generate custom boss " + filename + " ! This has cancelled action event " + customEventsConfigFields.getFilename() + " !"); return; } customBossEntity.spawn(actionEvent.getEventStartLocation(), false); @@ -153,8 +150,7 @@ public void onTillSoil(PlayerInteractEvent event) { event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.GOLDEN_HOE) || event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.STONE_HOE) || event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.WOODEN_HOE) || - !VersionChecker.serverVersionOlderThan(16, 0) && - event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.NETHERITE_HOE))) + event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.NETHERITE_HOE))) return; if (!(event.getClickedBlock().getType().equals(Material.DIRT) || event.getClickedBlock().getType().equals(Material.GRASS_BLOCK))) return; diff --git a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java index 8ed92029a..b5873d709 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java @@ -6,12 +6,12 @@ import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.config.ValidWorldsConfig; import com.magmaguy.elitemobs.config.customevents.CustomEventsConfigFields; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker; import com.magmaguy.elitemobs.utils.CommandRunner; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.scheduler.BukkitRunnable; @@ -58,6 +58,8 @@ public CustomEvent(CustomEventsConfigFields customEventsConfigFields) { public static boolean isLocationValid(Location location) { if (!ValidWorldsConfig.getValidWorlds().contains(Objects.requireNonNull(location.getWorld()).getName())) return false; + if (EliteMobsWorld.isEliteMobsWorld(location.getWorld().getUID())) + return false; return !(EliteMobs.worldGuardIsEnabled && !WorldGuardFlagChecker.checkFlag(location, WorldGuardCompatibility.getELITEMOBS_EVENTS())); } @@ -88,10 +90,10 @@ public void setEventStartLocation(Location eventStartLocation) { public void start() { startModifiers(); if (primaryEliteMobs.isEmpty()) { - new WarningMessage("Event " + customEventsConfigFields.getFilename() + " has failed to start because the bosses failed to spawn correctly!" + + Logger.warn("Event " + customEventsConfigFields.getFilename() + " has failed to start because the bosses failed to spawn correctly!" + "This could be due to an issue with the configuration of the bosses in the event, with the configuration" + " of the event or due to a protection in the target location!"); - new WarningMessage("Target location: " + getEventStartLocation().toString()); + Logger.warn("Target location: " + getEventStartLocation().toString()); } if (this.startMessage != null) AnnouncementPriority.announce(this.startMessage, eventStartLocation.getWorld(), this.announcementPriority); @@ -153,7 +155,7 @@ public void commonWatchdogBehavior() { * Starts the end of the event, deletes all EliteMobEntities spawned by the event and queues further event completion requirements */ public void end() { - new InfoMessage("Event " + customEventsConfigFields.getFilename() + " ended!"); + Logger.info("Event " + customEventsConfigFields.getFilename() + " ended!"); if (eventWatchdog != null) eventWatchdog.cancel(); primaryEliteMobs.forEach(eliteMobEntity -> { diff --git a/src/main/java/com/magmaguy/elitemobs/events/MoonPhaseDetector.java b/src/main/java/com/magmaguy/elitemobs/events/MoonPhaseDetector.java index 4b33aae5e..fec10ff81 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/MoonPhaseDetector.java +++ b/src/main/java/com/magmaguy/elitemobs/events/MoonPhaseDetector.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.events; -import org.bukkit.Bukkit; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.World; public class MoonPhaseDetector { @@ -29,7 +29,7 @@ public static MoonPhase detectMoonPhase(World eventWorld) { case 7: return MoonPhase.WAXING_GIBBOUS; default: - Bukkit.getLogger().info("Unhandled moon phase. Phase " + phase + " was " + days + ". Defaulting to full moon..."); + Logger.info("Unhandled moon phase. Phase " + phase + " was " + days + ". Defaulting to full moon..."); return MoonPhase.FULL_MOON; } diff --git a/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java b/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java index 82172ae44..32c87af61 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java @@ -8,8 +8,8 @@ import com.magmaguy.elitemobs.config.customevents.CustomEventsConfigFields; import com.magmaguy.elitemobs.mobconstructor.CustomSpawn; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.WeightedProbability; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -28,6 +28,8 @@ public class TimedEvent extends CustomEvent implements Listener { //stores the time of the last global trigger @Getter private static double nextEventTrigger = System.currentTimeMillis() + 5D * 60D * 1000D; + @Getter + private static double nextEventStartMinimum = System.currentTimeMillis(); private final double localCooldown; private final double globalCooldown; private final double weight; @@ -105,7 +107,7 @@ private static void pickEvent() { * on a delay. */ public void instantiateEvent() { - new InfoMessage("Event " + getCustomEventsConfigFields().getFilename() + " has been queued!"); + Logger.info("Event " + getCustomEventsConfigFields().getFilename() + " has been queued!"); TimedEvent timedEvent = new TimedEvent(customEventsConfigFields); CustomEventStartEvent customEventStartEvent = new CustomEventStartEvent(timedEvent); if (customEventStartEvent.isCancelled()) return; @@ -148,9 +150,9 @@ public void queueEvent() { for (CustomBossEntity customBossEntity : primaryEliteMobs) if (!customBossEntity.exists()) { if (!silentRetry) { - new InfoMessage("Boss " + customBossEntity.getCustomBossesConfigFields().getFilename() + " for event " + + Logger.info("Boss " + customBossEntity.getCustomBossesConfigFields().getFilename() + " for event " + getCustomEventsConfigFields().getFilename() + " wasn't considered to be valid. Trying spawn again ."); - new InfoMessage("Note: further failures will be silent. EliteMobs can only predict WorldGuard protections," + + Logger.info("Note: further failures will be silent. EliteMobs can only predict WorldGuard protections," + " so it will keep trying to spawn things until plugins preventing spawning allow it to do so. This might take a while."); silentRetry = true; } @@ -166,6 +168,7 @@ public void queueEvent() { //Hardcoded 5 minute minimum wait time between events before the next event can get queued setNextEventTrigger(5); + nextEventStartMinimum = System.currentTimeMillis() + (EventsConfig.getTimedEventMinimumCooldown() * 60 * 1000D); start(); } diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index abf08c100..848fe63e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java +++ b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java @@ -17,6 +17,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.block.*; import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -319,7 +320,10 @@ private void fullBlockRestore(BlockState blockState, boolean isShutdown) { public static class ExplosionEvent implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void entityExplodeEvent(EntityExplodeEvent event) { - EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity()); + Entity entity = event.getEntity(); + if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) + entity = shooter; + EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity); if (eliteEntity != null) { generateExplosion(event); return; diff --git a/src/main/java/com/magmaguy/elitemobs/gamemodes/nightmaremodeworld/DaylightWatchdog.java b/src/main/java/com/magmaguy/elitemobs/gamemodes/nightmaremodeworld/DaylightWatchdog.java deleted file mode 100644 index c7c44fe4a..000000000 --- a/src/main/java/com/magmaguy/elitemobs/gamemodes/nightmaremodeworld/DaylightWatchdog.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.magmaguy.elitemobs.gamemodes.nightmaremodeworld; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.EliteMobs; -import com.magmaguy.elitemobs.MetadataHandler; -import org.bukkit.World; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerBedEnterEvent; -import org.bukkit.scheduler.BukkitRunnable; - -public class DaylightWatchdog implements Listener { - - public static void preventDaylight(World world) { - - new BukkitRunnable() { - @Override - public void run() { - long time = world.getTime(); - if (time < 12000) - world.setTime(time + 4); - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); - - } - - @EventHandler - public void onSleep(PlayerBedEnterEvent event) { - if (EliteMobs.nightmareWorlds.contains(event.getPlayer().getWorld())) { - event.setCancelled(true); - event.getPlayer().sendMessage(ChatColorConverter.convert("&7[EM] &4Sleep can't save you now...")); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/EliteChunk.java b/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/EliteChunk.java deleted file mode 100644 index 8abbbd00a..000000000 --- a/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/EliteChunk.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.magmaguy.elitemobs.gamemodes.zoneworld; - -import com.magmaguy.elitemobs.utils.ChunkVectorizer; - -import java.util.HashMap; -import java.util.Vector; - -public class EliteChunk { - - private static final int gridSize = 50; - public static HashMap eliteChunks = new HashMap<>(); - private final int xCoord; - private final int zCoord; - - public EliteChunk(int xCoord, int zCoord) { - this.xCoord = xCoord; - this.zCoord = zCoord; - registerChunkLocation(this); - } - - public static EliteChunk getEliteChunk(String hashCode) { - return eliteChunks.get(hashCode); - } - - public static EliteChunk getEliteChunk(int xCoord, int zCoord) { - return eliteChunks.get(ChunkVectorizer.hash(xCoord, zCoord)); - } - - private static void registerChunkLocation(EliteChunk eliteChunk) { - eliteChunks.put(ChunkVectorizer.hash(eliteChunk.getxCoord(), eliteChunk.getzCoord()), eliteChunk); - } - - public static int getGridSize() { - return gridSize; - } - - public int getxCoord() { - return xCoord; - } - - public int getzCoord() { - return zCoord; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/Grid.java b/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/Grid.java deleted file mode 100644 index 02420252f..000000000 --- a/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/Grid.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.magmaguy.elitemobs.gamemodes.zoneworld; - -import org.bukkit.Location; -import org.bukkit.util.Vector; - -import java.util.HashMap; -import java.util.concurrent.ThreadLocalRandom; - -public class Grid { - - private static final HashMap chunkMap = new HashMap<>(); - - public static HashMap getChunkMap() { - return chunkMap; - } - - private static void registerChunk(EliteChunk eliteChunk, int tier) { - chunkMap.put(eliteChunk, tier); - } - - public static void initializeGrid() { - for (int x = -100; x < 101; x++) - for (int z = -100; z < 101; z++) { - EliteChunk eliteChunk = new EliteChunk(x, z); - int value = (Math.abs(x) + Math.abs(z)) / 2; - int tier = 0; - if (value > 1) { - tier = ThreadLocalRandom.current().nextInt(value) + value; - if (ThreadLocalRandom.current().nextInt() < 0.05) - tier = ThreadLocalRandom.current().nextInt(value); - if (ThreadLocalRandom.current().nextInt() < 0.05) - tier = ThreadLocalRandom.current().nextInt(value * 2) + value; - } - registerChunk(eliteChunk, tier); - } - } - - public static double getMobTierFromLocation(Location location) { - return ThreadLocalRandom.current().nextDouble() + chunkMap.get(getEliteChunk(location)); - } - - public static EliteChunk getEliteChunk(Location location) { - Location customSpawnLocation = location.getWorld().getSpawnLocation(); - //Get the 0,0 chunk location - customSpawnLocation = customSpawnLocation.subtract(new Vector(EliteChunk.getGridSize() / 2, 0, EliteChunk.getGridSize() / 2)); - //Assuming the chunks increment in 100 - int chunkX = (int) Math.floor((location.getX() - customSpawnLocation.getX()) / EliteChunk.getGridSize()); - int chunkZ = (int) Math.floor((location.getZ() - customSpawnLocation.getZ()) / EliteChunk.getGridSize()); - - if (chunkX > 100) - chunkX = 100; - if (chunkX < -100) - chunkX = -100; - if (chunkZ > 100) - chunkZ = 100; - if (chunkZ < -100) - chunkZ = -100; - - return EliteChunk.getEliteChunk(chunkX, chunkZ); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/ZoneWarner.java b/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/ZoneWarner.java deleted file mode 100644 index 6399bdbc3..000000000 --- a/src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/ZoneWarner.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.magmaguy.elitemobs.gamemodes.zoneworld; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.ValidWorldsConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; - -import java.util.HashMap; - -public class ZoneWarner implements Listener { - - public static HashMap playerLocations = new HashMap<>(); - - private static void sendMessage(Player player) { - try { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, - TextComponent.fromLegacyText( - ChatColorConverter.convert("&8[EM] &7You've entered a tier &c" - + Grid.getChunkMap().get(Grid.getEliteChunk(player.getLocation())) - + " &7zone (" + Grid.getEliteChunk(player.getLocation()).getxCoord() + "," + - Grid.getEliteChunk(player.getLocation()).getzCoord() + ")"))); - } catch (Exception ex) { - new WarningMessage("Failed to get the chunk region. This may be normal if you're trying to move around while EliteMobs is still starting up."); - } - } - - @EventHandler - public void onPlayerMove(PlayerMoveEvent event) { - - if (!ValidWorldsConfig.getZoneBasedWorlds().contains(event.getPlayer().getWorld().getName())) - return; - - if (!playerLocations.containsKey(event.getPlayer())) { - playerLocations.put(event.getPlayer(), Grid.getEliteChunk(event.getPlayer().getLocation())); - sendMessage(event.getPlayer()); - } - - if (Grid.getEliteChunk(event.getPlayer().getLocation()).equals(playerLocations.get(event.getPlayer()))) return; - playerLocations.put(event.getPlayer(), Grid.getEliteChunk(event.getPlayer().getLocation())); - sendMessage(event.getPlayer()); - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java index 85f0346c6..ffd3842a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java +++ b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.initialsetup; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.magmacore.util.ChatColorConverter; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -23,12 +23,12 @@ public void onPlayerLogin(PlayerJoinEvent event) { public void run() { if (!event.getPlayer().isOnline()) return; event.getPlayer().sendMessage("----------------------------------------------------"); - event.getPlayer().sendMessage(ChatColorConverter.convert("&7[EliteMobs] &fFirst time setup message:")); + event.getPlayer().sendMessage(ChatColorConverter.convert("&7[EliteMobs] &fInitial setup message:")); event.getPlayer().sendMessage(ChatColorConverter.convert("&7Welcome to EliteMobs!" + - " &c&lIt looks like you haven't set up EliteMobs yet! &2To install EliteMobs, do &a/em setup &2!")); + " &c&lIt looks like you may not have set up EliteMobs yet! &2To install EliteMobs, do &a/em setup &2!")); event.getPlayer().sendMessage(ChatColorConverter.convert("&7Need command help? &6&l/em help")); event.getPlayer().sendMessage(ChatColorConverter.convert("&7You can get support over at &9&n" + DiscordLinks.mainLink)); - TextComponent setupMessage = new TextComponent(ChatColorConverter.convert("&cDon't want to see this message again? ")); + TextComponent setupMessage = new TextComponent(ChatColorConverter.convert("&cAlready completed your installation?")); TextComponent setupDone = new TextComponent(ChatColorConverter.convert("&c&nClick here!")); setupDone.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Never show this again!").create())); setupDone.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/elitemobs setup done")); diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index 529bfcc05..696e75ff1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -1,16 +1,16 @@ package com.magmaguy.elitemobs.instanced; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.utils.VisualArmorStand; +import com.magmaguy.elitemobs.utils.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; +import org.bukkit.entity.TextDisplay; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; @@ -21,9 +21,9 @@ public class InstanceDeathLocation { @Getter private Player deadPlayer; private Location deathLocation = null; - private ArmorStand nameTag; - private ArmorStand livesLeft; - private ArmorStand instructions; + private TextDisplay nameTag; + private TextDisplay livesLeft; + private TextDisplay instructions; protected InstanceDeathLocation(Player player, MatchInstance matchInstance) { @@ -33,9 +33,9 @@ protected InstanceDeathLocation(Player player, MatchInstance matchInstance) { this.deadPlayer = player; this.bannerBlock = player.getLocation().getBlock(); findBannerLocation(player.getLocation()); - instructions = VisualArmorStand.VisualArmorStand(deathLocation.clone().add(new Vector(0, 2.2, 0)), ChatColorConverter.convert("&2Punch to rez!")); - nameTag = VisualArmorStand.VisualArmorStand(deathLocation.clone().add(new Vector(0, 2, 0)), player.getDisplayName()); - livesLeft = VisualArmorStand.VisualArmorStand(deathLocation.clone().add(new Vector(0, 1.8, 0)), matchInstance.playerLives.get(deadPlayer) + " lives left!"); + instructions = VisualDisplay.generateTemporaryTextDisplay(deathLocation.clone().add(new Vector(0, 2.2, 0)), ChatColorConverter.convert("&2Punch to rez!")); + nameTag = VisualDisplay.generateTemporaryTextDisplay(deathLocation.clone().add(new Vector(0, 2, 0)), player.getDisplayName()); + livesLeft = VisualDisplay.generateTemporaryTextDisplay(deathLocation.clone().add(new Vector(0, 1.8, 0)), matchInstance.playerLives.get(deadPlayer) + " lives left!"); if (deathLocation != null) matchInstance.deathBanners.put(bannerBlock, this); diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/InstancePlayerManager.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstancePlayerManager.java index 5540b4131..ac8ea6c47 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstancePlayerManager.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstancePlayerManager.java @@ -101,8 +101,7 @@ public static void removePlayer(Player player, MatchInstance matchInstance) { matchInstance.state != MatchInstance.InstancedRegionState.COMPLETED_VICTORY && matchInstance.players.isEmpty()) { matchInstance.defeat(); - } - else + } else //Remove lives matchInstance.playerLives.remove(player); } diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java index 9b3cbb538..a888875c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.instanced; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.instanced.MatchDestroyEvent; import com.magmaguy.elitemobs.api.instanced.MatchInstantiateEvent; @@ -10,6 +9,7 @@ import com.magmaguy.elitemobs.config.ArenasConfig; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -138,14 +138,17 @@ public void removeAnyKind(Player player) { } private void startWatchdogs() { - new BukkitRunnable() { - @Override - public void run() { - playerWatchdog(); - spectatorWatchdog(); - intruderWatchdog(); - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + new WatchdogTask().runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + } + + public void countdownMatch() { + if (state != InstancedRegionState.WAITING) return; + if (players.size() < minPlayers) { + announce(ArenasConfig.getNotEnoughPlayersMessage().replace("$amount", minPlayers + "")); + return; + } + state = InstancedRegionState.STARTING; + new CountdownTask().runTaskTimer(MetadataHandler.PLUGIN, 0L, 20L); } private void playerWatchdog() { @@ -194,32 +197,33 @@ protected void announce(String message) { participants.forEach(player -> player.sendMessage(ChatColorConverter.convert(message))); } - public void countdownMatch() { - if (state != InstancedRegionState.WAITING) return; - if (players.size() < minPlayers) { - announce(ArenasConfig.getNotEnoughPlayersMessage().replace("$amount", minPlayers + "")); - return; + private class WatchdogTask extends BukkitRunnable { + @Override + public void run() { + playerWatchdog(); + spectatorWatchdog(); + intruderWatchdog(); } - state = InstancedRegionState.STARTING; - new BukkitRunnable() { - int counter = 0; - - @Override - public void run() { - if (players.size() < minPlayers) { - cancel(); - endMatch(); - return; - } - counter++; - players.forEach(player -> startMessage(counter, player)); - spectators.forEach(player -> startMessage(counter, player)); - if (counter >= 3) { - startMatch(); - cancel(); - } + } + + private class CountdownTask extends BukkitRunnable { + int counter = 0; + + @Override + public void run() { + if (players.size() < minPlayers) { + cancel(); + endMatch(); + return; } - }.runTaskTimer(MetadataHandler.PLUGIN, 0L, 20L); + counter++; + players.forEach(player -> startMessage(counter, player)); + spectators.forEach(player -> startMessage(counter, player)); + if (counter >= 3) { + startMatch(); + cancel(); + } + } } private void startMessage(int counter, Player player) { diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java index aeddbb268..d489b4bb7 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -1,22 +1,25 @@ package com.magmaguy.elitemobs.instanced.arena; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.ArenaCompleteEvent; import com.magmaguy.elitemobs.api.ArenaStartEvent; import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent; import com.magmaguy.elitemobs.api.EliteMobDeathEvent; import com.magmaguy.elitemobs.api.internal.RemovalReason; +import com.magmaguy.elitemobs.config.AdventurersGuildConfig; import com.magmaguy.elitemobs.config.ArenasConfig; +import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfigFields; import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; +import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.thirdparty.mythicmobs.MythicMobsInterface; import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.Cylinder; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -58,6 +61,7 @@ public class ArenaInstance extends MatchInstance { @Getter private ArenaState arenaState = ArenaState.IDLE; private Cylinder cylinder; + private int highestArenaMobLevel = -1; public ArenaInstance(CustomArenasConfigFields customArenasConfigFields, Location corner1, Location corner2, Location startLocation, Location exitLocation) { super(startLocation, exitLocation, customArenasConfigFields.getMinimumPlayerCount(), customArenasConfigFields.getMaximumPlayerCount()); @@ -113,14 +117,14 @@ public ArenaInstance(CustomArenasConfigFields customArenasConfigFields, Location try { wave = Integer.parseInt(finalString[1]); } catch (Exception ex) { - new WarningMessage("Failed to parse wave for entry " + subString + " for arena " + customArenasConfigFields.getFilename()); + Logger.warn("Failed to parse wave for entry " + subString + " for arena " + customArenasConfigFields.getFilename()); } break; case "message": message = finalString[1]; break; default: - new WarningMessage("Failed to parse arena message entry " + subString + " for arena " + customArenasConfigFields.getFilename()); + Logger.warn("Failed to parse arena message entry " + subString + " for arena " + customArenasConfigFields.getFilename()); } } if (!message.isEmpty() && wave > 0) waveMessage.put(wave, ChatColorConverter.convert(message)); @@ -135,11 +139,11 @@ public static void initializeArena(CustomArenasConfigFields customArenasConfigFi Location startLocation = ConfigurationLocation.serialize(customArenasConfigFields.getStartLocation()); Location exitLocation = ConfigurationLocation.serialize(customArenasConfigFields.getExitLocation()); if (corner1 == null || corner2 == null || startLocation == null || exitLocation == null) { - //new WarningMessage("Failed to correctly initialize arena " + customArenasConfigFields.getFilename() + " due to invalid locations for corner1/corner2/startLocation/exitLocation"); + //Logger.warn("Failed to correctly initialize arena " + customArenasConfigFields.getFilename() + " due to invalid locations for corner1/corner2/startLocation/exitLocation"); return; } if (corner1.getWorld() == null || corner2.getWorld() == null || startLocation.getWorld() == null || exitLocation.getWorld() == null) { - //new WarningMessage("Failed to correctly initialize arena " + customArenasConfigFields.getFilename() + " due to invalid world for corner1/corner2/startLocation/exitLocation"); + //Logger.warn("Failed to correctly initialize arena " + customArenasConfigFields.getFilename() + " due to invalid world for corner1/corner2/startLocation/exitLocation"); return; } new ArenaInstance(customArenasConfigFields, corner1, corner2, startLocation, exitLocation); @@ -160,7 +164,7 @@ public void addSpawnPoints(List rawSpawnPoints) { location = splitSubEntry[1]; break; default: - new WarningMessage("Invalid entry for the spawn points of instanced content: " + splitSubEntry[0]); + Logger.warn("Invalid entry for the spawn points of instanced content: " + splitSubEntry[0]); break; } } @@ -212,7 +216,6 @@ private void nextWave() { }, 20L * customArenasConfigFields.getDelayBetweenWaves()); } - private void arenaWatchdog() { new BukkitRunnable() { @Override @@ -238,13 +241,13 @@ public void removeBoss(Entity nonEliteEntity) { } private void spawnBosses() { - if (arenaWaves.getWaveEntities(currentWave) == null) return; + highestArenaMobLevel = -1; for (ArenaEntity arenaEntity : arenaWaves.getWaveEntities(currentWave)) { if (!arenaEntity.isMythicMob()) { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(arenaEntity.getBossfile()); if (customBossEntity == null) { - new WarningMessage("Failed to generate custom boss " + arenaEntity.getBossfile() + " because the filename was not valid!"); + Logger.warn("Failed to generate custom boss " + arenaEntity.getBossfile() + " because the filename was not valid!"); continue; } customBossEntity.setNormalizedCombat(); @@ -252,8 +255,10 @@ private void spawnBosses() { customBossEntity.setVanillaLoot(false); customBossEntity.setRandomLoot(false); customBossEntity.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), true); + if (customBossEntity.getLevel() > highestArenaMobLevel) + highestArenaMobLevel = customBossEntity.getLevel(); if (!customBossEntity.exists()) { - new WarningMessage("Arena " + getCustomArenasConfigFields().getArenaName() + " failed to spawn boss " + customBossEntity.getCustomBossesConfigFields().getFilename()); + Logger.warn("Arena " + getCustomArenasConfigFields().getArenaName() + " failed to spawn boss " + customBossEntity.getCustomBossesConfigFields().getFilename()); continue; } else customBosses.add(customBossEntity); @@ -262,9 +267,10 @@ private void spawnBosses() { try { Entity mythicMob = MythicMobsInterface.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), arenaEntity.getBossfile(), arenaEntity.getLevel()); if (mythicMob != null) nonEliteMobsEntities.add(mythicMob); - else new WarningMessage("Failed to spawn MythicMobs entity '"+ arenaEntity.getBossfile() +"' at spawn point " + arenaEntity.getSpawnPointName() + " with level " + arenaEntity.getLevel() + " because MythicMobs did not recognize the name of the entity!"); - } catch (Exception e){ - new WarningMessage("Failed to spawn MythicMobs entity '"+ arenaEntity.getBossfile() +"' at spawn point " + arenaEntity.getSpawnPointName() + " with level " + arenaEntity.getLevel() + " due to a MythicMobs error - there is a high chance mob spawning is being prevented in this area!"); + else + Logger.warn("Failed to spawn MythicMobs entity '" + arenaEntity.getBossfile() + "' at spawn point " + arenaEntity.getSpawnPointName() + " with level " + arenaEntity.getLevel() + " because MythicMobs did not recognize the name of the entity!"); + } catch (Exception e) { + Logger.warn("Failed to spawn MythicMobs entity '" + arenaEntity.getBossfile() + "' at spawn point " + arenaEntity.getSpawnPointName() + " with level " + arenaEntity.getLevel() + " due to a MythicMobs error - there is a high chance mob spawning is being prevented in this area!"); } } } @@ -282,7 +288,23 @@ private void doRewards() { minimumDamageThreshold = totalDamage * .1; for (Map.Entry entry : roundDamage.entrySet()) if (entry.getValue() >= minimumDamageThreshold) validPlayers.add(entry.getKey()); - super.players.forEach(player -> customArenasConfigFields.getArenaRewards().arenaReward(player, currentWave - 1)); + + + super.players.forEach(player -> { + if (highestArenaMobLevel > 0) { + if (AdventurersGuildConfig.isGuildLootLimiter() && + PlayerData.getMaxGuildLevel(player.getUniqueId()) < highestArenaMobLevel / 10) { + Logger.sendSimpleMessage(player, AdventurersGuildConfig.getLootLimiterMessage()); + return; + } else if (Math.abs(ElitePlayerInventory.getPlayer(player).getFullPlayerTier(true) - highestArenaMobLevel) > ItemSettingsConfig.getLootLevelDifferenceLockout()) { + Logger.sendSimpleMessage(player, ItemSettingsConfig.getLevelRangeTooDifferent() + .replace("$playerLevel", ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(false) + "") + .replace("$bossLevel", highestArenaMobLevel + "")); + return; + } + } + customArenasConfigFields.getArenaRewards().arenaReward(player, currentWave - 1); + }); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaWaves.java b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaWaves.java index f2f8a9b00..d1ad17e7a 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaWaves.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaWaves.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.instanced.arena; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import java.util.ArrayList; import java.util.HashMap; @@ -44,7 +44,7 @@ public ArenaWaves(List rawBosses) { try { wave = Integer.valueOf(waveString); } catch (Exception exception) { - new WarningMessage("Invalid value for wave in arena wave: " + waveString); + Logger.warn("Invalid value for wave in arena wave: " + waveString); continue; } boolean mythicMob; @@ -53,14 +53,14 @@ public ArenaWaves(List rawBosses) { try { mythicMob = Boolean.valueOf(mythicMobString); } catch (Exception exception) { - new WarningMessage("Invalid value for mythic mob in arena wave: " + waveString); + Logger.warn("Invalid value for mythic mob in arena wave: " + waveString); continue; } int level = -1; if (!levelString.isEmpty()) try { level = Integer.valueOf(levelString); } catch (Exception exception) { - new WarningMessage("Invalid value for level in: " + levelString); + Logger.warn("Invalid value for level in: " + levelString); continue; } ArenaEntity arenaEntity = new ArenaEntity(spawnpointString, wave, boss); diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java index 041a2958a..94b26f0c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,9 +14,14 @@ import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.*; +import com.magmaguy.elitemobs.treasurechest.TreasureChest; +import com.magmaguy.elitemobs.utils.ConfigurationLocation; +import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.elitemobs.utils.MapListInterpreter; +import com.magmaguy.elitemobs.utils.WorldInstantiator; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; +import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -67,14 +72,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, this.difficultyName = difficultyName; setDifficulty(difficultyName); addNewPlayer(player); - DungeonInstance dungeonInstance = this; - new BukkitRunnable() { - @Override - public void run() { - instancedBossEntities = InstancedBossEntity.initializeInstancedBosses(dungeonPackagerConfigFields.getWorldName(), world, players.size(), dungeonInstance); - NPCEntity.initializeInstancedNPCs(dungeonPackagerConfigFields.getWorldName(), world, players.size(), dungeonInstance); - } - }.runTaskLater(MetadataHandler.PLUGIN, 20*3L); + new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -100,12 +98,7 @@ public static void setupInstancedDungeon(Player player, String instancedDungeonC cloneWorldFiles(instancedDungeonsConfigFields, instancedWorldName, player)); future.thenAccept(file -> { if (file == null) return; - new BukkitRunnable() { - @Override - public void run() { - initializeInstancedWorld(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName); - } - }.runTask(MetadataHandler.PLUGIN); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); }); } @@ -136,13 +129,11 @@ protected static DungeonInstance initializeInstancedWorld(DungeonPackagerConfigF Player player, File targetFile, String difficultyName) { - World world = DungeonUtils.loadWorld(instancedWordName, instancedDungeonsConfigFields.getEnvironment()); + World world = DungeonUtils.loadWorld(instancedWordName, instancedDungeonsConfigFields.getEnvironment(), instancedDungeonsConfigFields); if (world == null) { player.sendMessage("[EliteMobs] Failed to load the world! Report this to the dev. The dungeon will not start."); return null; } - if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) - WorldGuardCompatibility.protectWorldMinidugeonArea(world); //Location where players are teleported to start completing the dungeon Location startLocation = ConfigurationLocation.serialize(instancedDungeonsConfigFields.getStartLocationString()); @@ -201,14 +192,7 @@ public void endMatch() { return; } announce(DungeonsConfig.getInstancedDungeonCompleteMessage()); - announce("MagmaGuy's note: This is still a work in progress, please be patient! Hope you enjoyed your run."); - new BukkitRunnable() { - - @Override - public void run() { - destroyMatch(); - } - }.runTaskLater(MetadataHandler.PLUGIN, 2 * 60 * 20L); + new DestroyMatchTask().runTaskLater(MetadataHandler.PLUGIN, 2 * 60 * 20L); } @Override @@ -224,33 +208,11 @@ public void removeInstance() { instances.remove(this); DungeonInstance dungeonInstance = this; if (world == null) { - new WarningMessage("Instanced dungeon's world was already unloaded before removing the entities in it! This shouldn't happen, but doesn't break anything."); + Logger.warn("Instanced dungeon's world was already unloaded before removing the entities in it! This shouldn't happen, but doesn't break anything."); return; } world.getEntities().forEach(entity -> EntityTracker.unregister(entity, RemovalReason.WORLD_UNLOAD)); - new BukkitRunnable() { - @Override - public void run() { - //The world might get removed before this timer - //if (world != null) { - //Arrays.stream(world.getLoadedChunks()).forEach(chunk -> chunk.unload(false)); - - new EventCaller(new InstancedDungeonRemoveEvent(dungeonInstance)); - dungeonInstances.remove(dungeonInstance); - - if (!Bukkit.unloadWorld(world, false)) { - new WarningMessage("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); - return; - } - new BukkitRunnable() { - @Override - public void run() { - WorldInstantiator.recursivelyDelete(instancedWorldFile); - } - }.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20L * 60 * 2); //wait 2 minutes after unloading world before removing files - //} - } - }.runTaskLater(MetadataHandler.PLUGIN, 20*30L); //wait 30 seconds before unloading world + new RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); } private void setDifficulty(String difficultyName) { @@ -265,7 +227,7 @@ private void setDifficulty(String difficultyName) { break; } if (difficulty == null) { - new WarningMessage("Failed to set difficulty " + difficulty + " for instanced dungeon " + dungeonPackagerConfigFields.getFilename()); + Logger.warn("Failed to set difficulty " + difficulty + " for instanced dungeon " + dungeonPackagerConfigFields.getFilename()); return; } @@ -273,7 +235,7 @@ private void setDifficulty(String difficultyName) { try { this.levelSync = MapListInterpreter.parseInteger("levelSync", difficulty.get("levelSync"), dungeonPackagerConfigFields.getFilename()); } catch (Exception exception) { - new WarningMessage("Incorrect level sync entry for dungeon " + dungeonPackagerConfigFields.getFilename() + " ! Value: " + levelSync + " . No level sync will be applied!"); + Logger.warn("Incorrect level sync entry for dungeon " + dungeonPackagerConfigFields.getFilename() + " ! Value: " + levelSync + " . No level sync will be applied!"); this.levelSync = 0; } } else @@ -290,4 +252,83 @@ protected boolean isInRegion(Location location) { return location.getWorld().equals(startLocation.getWorld()); } + private static class InitializeInstancedWorldTask extends BukkitRunnable { + private final DungeonPackagerConfigFields instancedDungeonsConfigFields; + private final String instancedWorldName; + private final Player player; + private final File file; + private final String difficultyName; + + public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, + String instancedWorldName, + Player player, + File file, + String difficultyName) { + this.instancedDungeonsConfigFields = instancedDungeonsConfigFields; + this.instancedWorldName = instancedWorldName; + this.player = player; + this.file = file; + this.difficultyName = difficultyName; + } + + @Override + public void run() { + initializeInstancedWorld(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName); + } + } + + private class InitializeEntitiesTask extends BukkitRunnable { + private final DungeonInstance dungeonInstance; + private final DungeonPackagerConfigFields dungeonPackagerConfigFields; + private final World world; + + public InitializeEntitiesTask(DungeonInstance dungeonInstance, DungeonPackagerConfigFields dungeonPackagerConfigFields, World world) { + this.dungeonInstance = dungeonInstance; + this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; + this.world = world; + } + + @Override + public void run() { + instancedBossEntities = InstancedBossEntity.initializeInstancedBosses(dungeonPackagerConfigFields.getWorldName(), world, players.size(), dungeonInstance); + NPCEntity.initializeInstancedNPCs(dungeonPackagerConfigFields.getWorldName(), world, players.size(), dungeonInstance); + TreasureChest.initializeInstancedTreasureChests(dungeonPackagerConfigFields.getWorldName(), world); + } + } + + private class DestroyMatchTask extends BukkitRunnable { + @Override + public void run() { + destroyMatch(); + } + } + + private class RemoveInstanceTask extends BukkitRunnable { + private final DungeonInstance dungeonInstance; + private final File instancedWorldFile; + + public RemoveInstanceTask(DungeonInstance dungeonInstance, File instancedWorldFile) { + this.dungeonInstance = dungeonInstance; + this.instancedWorldFile = instancedWorldFile; + } + + @Override + public void run() { + new EventCaller(new InstancedDungeonRemoveEvent(dungeonInstance)); + dungeonInstances.remove(dungeonInstance); + + if (!Bukkit.unloadWorld(world, false)) { + Logger.warn("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); + return; + } + new BukkitRunnable() { + @Override + public void run() { + try{FileUtils.deleteDirectory(instancedWorldFile);} catch (Exception e){ + Logger.warn("Failed to delete " + instancedWorldFile + " ! This is bad, report this to the developer!"); + } + } + }.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20L * 60 * 2); //wait 2 minutes after unloading world before removing files + } + } } diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillPercentageObjective.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillPercentageObjective.java index c87cdacca..448dd13ee 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillPercentageObjective.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillPercentageObjective.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.instanced.dungeons; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import java.util.ArrayList; import java.util.List; @@ -20,10 +20,10 @@ public DungeonKillPercentageObjective(DungeonInstance dungeonInstance, String ob try { this.percentage = Double.parseDouble(separatedByEquals[1]); } catch (Exception ex) { - new WarningMessage("Value " + separatedByEquals[1] + " is not a valid integer amount!"); + Logger.warn("Value " + separatedByEquals[1] + " is not a valid integer amount!"); } } else { - new WarningMessage("Invalid entry for objective string! " + objectiveString + " could not be parsed correctly."); + Logger.warn("Invalid entry for objective string! " + objectiveString + " could not be parsed correctly."); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillTargetObjective.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillTargetObjective.java index 681d1a866..ec0f9d6ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillTargetObjective.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonKillTargetObjective.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.api.EliteMobDeathEvent; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -31,10 +31,10 @@ public DungeonKillTargetObjective(DungeonInstance dungeonInstance, String object try { this.targetAmount = Integer.parseInt(separatedByEquals[1]); } catch (Exception ex) { - new WarningMessage("Value " + separatedByEquals[1] + " is not a valid integer amount!"); + Logger.warn("Value " + separatedByEquals[1] + " is not a valid integer amount!"); } } else { - new WarningMessage("Invalid entry for objective string! " + objectiveString + " could not be parsed correctly."); + Logger.warn("Invalid entry for objective string! " + objectiveString + " could not be parsed correctly."); } } initializeObjective(dungeonInstance); diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/EnchantmentDungeonInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/EnchantmentDungeonInstance.java index f986c7c92..ec4b511e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/EnchantmentDungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/EnchantmentDungeonInstance.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.instanced.dungeons; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.SpecialItemSystemsConfig; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; import com.magmaguy.elitemobs.menus.ItemEnchantmentMenu; import com.magmaguy.elitemobs.utils.WorldInstantiator; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; diff --git a/src/main/java/com/magmaguy/elitemobs/items/EliteEnchantments.java b/src/main/java/com/magmaguy/elitemobs/items/EliteEnchantments.java index 4dbda589b..533ceb90d 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteEnchantments.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteEnchantments.java @@ -7,14 +7,14 @@ public class EliteEnchantments { public static boolean isPotentialEliteEnchantment(Enchantment enchantment) { if (!ItemSettingsConfig.isUseEliteEnchantments()) return false; - return enchantment.getKey().equals(Enchantment.DAMAGE_ALL.getKey()) || - enchantment.getKey().equals(Enchantment.ARROW_DAMAGE.getKey()) || - enchantment.getKey().equals(Enchantment.PROTECTION_ENVIRONMENTAL.getKey()) || - enchantment.getKey().equals(Enchantment.DAMAGE_ARTHROPODS.getKey()) || - enchantment.getKey().equals(Enchantment.DAMAGE_UNDEAD.getKey()) || - enchantment.getKey().equals(Enchantment.PROTECTION_EXPLOSIONS.getKey()) || - enchantment.getKey().equals(Enchantment.PROTECTION_FIRE.getKey()) || - enchantment.getKey().equals(Enchantment.PROTECTION_PROJECTILE.getKey()) || + return enchantment.getKey().equals(Enchantment.SHARPNESS.getKey()) || + enchantment.getKey().equals(Enchantment.POWER.getKey()) || + enchantment.getKey().equals(Enchantment.PROTECTION.getKey()) || + enchantment.getKey().equals(Enchantment.BANE_OF_ARTHROPODS.getKey()) || + enchantment.getKey().equals(Enchantment.SMITE.getKey()) || + enchantment.getKey().equals(Enchantment.BLAST_PROTECTION.getKey()) || + enchantment.getKey().equals(Enchantment.FIRE_PROTECTION.getKey()) || + enchantment.getKey().equals(Enchantment.PROJECTILE_PROTECTION.getKey()) || enchantment.getKey().equals(Enchantment.THORNS.getKey()); } diff --git a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 3b6cab566..3edba4109 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ItemSettingsConfig; @@ -11,8 +10,9 @@ import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffect; import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffectContainer; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.Round; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.Round; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.enchantments.Enchantment; @@ -52,7 +52,7 @@ public class EliteItemLore { public EliteItemLore(ItemStack itemStack, boolean showItemWorth) { if (!EliteItemManager.isEliteMobsItem(itemStack)) { - new WarningMessage("Attempted to rewrite the lore of a non-elitemobs item! This is not supposed to happen."); + Logger.warn("Attempted to rewrite the lore of a non-elitemobs item! This is not supposed to happen."); return; } @@ -104,14 +104,14 @@ private void constructVanillaEnchantments() { } private void parseAllEliteEnchantments() { - parseEliteEnchantments(Enchantment.DAMAGE_ALL); - parseEliteEnchantments(Enchantment.ARROW_DAMAGE); - parseEliteEnchantments(Enchantment.PROTECTION_ENVIRONMENTAL); - parseEliteEnchantments(Enchantment.DAMAGE_ARTHROPODS); - parseEliteEnchantments(Enchantment.DAMAGE_UNDEAD); - parseEliteEnchantments(Enchantment.PROTECTION_EXPLOSIONS); - parseEliteEnchantments(Enchantment.PROTECTION_FIRE); - parseEliteEnchantments(Enchantment.PROTECTION_PROJECTILE); + parseEliteEnchantments(Enchantment.SHARPNESS); + parseEliteEnchantments(Enchantment.POWER); + parseEliteEnchantments(Enchantment.PROTECTION); + parseEliteEnchantments(Enchantment.BANE_OF_ARTHROPODS); + parseEliteEnchantments(Enchantment.SMITE); + parseEliteEnchantments(Enchantment.BLAST_PROTECTION); + parseEliteEnchantments(Enchantment.FIRE_PROTECTION); + parseEliteEnchantments(Enchantment.PROJECTILE_PROTECTION); parseEliteEnchantments(Enchantment.THORNS); } @@ -200,16 +200,16 @@ private void constructCustomLore() { private void constructPotionEffects() { for (ElitePotionEffect elitePotionEffect : ElitePotionEffectContainer.getElitePotionEffectContainer(itemMeta, ItemTagger.continuousPotionEffectKey)) potionListLore.add(ChatColorConverter.convert(PotionEffectsConfig.getPotionEffect( - elitePotionEffect.getPotionEffect().getType().getName().toLowerCase(Locale.ROOT) + ".yml").getName() + elitePotionEffect.getPotionEffect().getType().getKey().getKey().toLowerCase(Locale.ROOT) + ".yml").getName() + ItemSettingsConfig.getPotionEffectContinuousLore() + " " + (elitePotionEffect.getPotionEffect().getAmplifier() + 1))); for (ElitePotionEffect elitePotionEffect : ElitePotionEffectContainer.getElitePotionEffectContainer(itemMeta, ItemTagger.onHitPotionEffectKey)) if (elitePotionEffect.getTarget().equals(ElitePotionEffect.Target.SELF)) potionListLore.add(ChatColorConverter.convert(PotionEffectsConfig.getPotionEffect( - elitePotionEffect.getPotionEffect().getType().getName().toLowerCase(Locale.ROOT) + ".yml").getName() + elitePotionEffect.getPotionEffect().getType().getKey().getKey().toLowerCase(Locale.ROOT) + ".yml").getName() + ItemSettingsConfig.getPotionEffectOnHitSelfLore() + " " + (elitePotionEffect.getPotionEffect().getAmplifier() + 1))); else potionListLore.add(ChatColorConverter.convert(PotionEffectsConfig.getPotionEffect( - elitePotionEffect.getPotionEffect().getType().getName().toLowerCase(Locale.ROOT) + ".yml").getName() + elitePotionEffect.getPotionEffect().getType().getKey().getKey().toLowerCase(Locale.ROOT) + ".yml").getName() + ItemSettingsConfig.getPotionEffectOnHitTargetLore() + " " + (elitePotionEffect.getPotionEffect().getAmplifier() + 1))); } diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index 19d0c6ac1..71782f7d2 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.config.EconomySettingsConfig; @@ -9,9 +8,10 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.Round; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.Round; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -30,8 +30,9 @@ import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import java.util.Arrays; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; @@ -54,10 +55,11 @@ public ItemLootShower(double itemLevel, double mobLevel, Location location, Play > ItemSettingsConfig.getLootLevelDifferenceLockout()) { new BukkitRunnable() { int counter = 0; + @Override public void run() { counter++; - if (!player.isValid() || counter > 20 * 5){ + if (!player.isValid() || counter > 20 * 5) { cancel(); return; } @@ -200,12 +202,12 @@ private void addDirectly(double eliteMobTier) { private Item generateCurrencyItem(Material material, Location location, double value) { ItemStack currencyItemStack = SoulbindEnchantment.addEnchantment(ItemStackGenerator.generateItemStack(material, "", - Arrays.asList("EliteMobsCurrencyItem", value + "", ThreadLocalRandom.current().nextDouble() + "")), player); + new ArrayList<>(List.of("EliteMobsCurrencyItem", value + "", ThreadLocalRandom.current().nextDouble() + ""))), player); int model = 1; try { model = EconomySettingsConfig.getThisConfiguration().getInt("lootShowerData." + (int) value); } catch (Exception ex) { - new WarningMessage("Failed to get coin model for value " + value + " !"); + Logger.warn("Failed to get coin model for value " + value + " !"); } setCoinModel(currencyItemStack, model); Item currencyItem = location.getWorld().dropItem(location.clone().add(new Vector(0, 1, 0)), currencyItemStack); @@ -231,7 +233,7 @@ private void dropOne(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial1()), location, 1); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 1 is invalid. Defaulting to gold nugget."); + Logger.warn("Material for EliteMob shower 1 is invalid. Defaulting to gold nugget."); currencyItem = generateCurrencyItem(Material.GOLD_NUGGET, location, 1); } @@ -246,7 +248,7 @@ private void dropFive(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial5()), location, 5); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 5 is invalid. Defaulting to gold ingot."); + Logger.warn("Material for EliteMob shower 5 is invalid. Defaulting to gold ingot."); currencyItem = generateCurrencyItem(Material.GOLD_INGOT, location, 5); } @@ -260,7 +262,7 @@ private void dropTen(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial10()), location, 10); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 10 is invalid. Defaulting to Gold block."); + Logger.warn("Material for EliteMob shower 10 is invalid. Defaulting to Gold block."); currencyItem = generateCurrencyItem(Material.GOLD_BLOCK, location, 10); } @@ -274,7 +276,7 @@ private void dropTwenty(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial20()), location, 20); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 20 is invalid. Defaulting to emerald."); + Logger.warn("Material for EliteMob shower 20 is invalid. Defaulting to emerald."); currencyItem = generateCurrencyItem(Material.EMERALD, location, 20); } @@ -288,7 +290,7 @@ private void dropFifty(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial50()), location, 50); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 50 is invalid. Defaulting to emerald block."); + Logger.warn("Material for EliteMob shower 50 is invalid. Defaulting to emerald block."); currencyItem = generateCurrencyItem(Material.EMERALD_BLOCK, location, 50); } @@ -301,7 +303,7 @@ private void dropOneHundred(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial100()), location, 100); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 100 is invalid. Defaulting to diamond."); + Logger.warn("Material for EliteMob shower 100 is invalid. Defaulting to diamond."); currencyItem = generateCurrencyItem(Material.DIAMOND, location, 100); } @@ -314,7 +316,7 @@ private void dropFiveHundred(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial500()), location, 500); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 500 is invalid. Defaulting to diamond block."); + Logger.warn("Material for EliteMob shower 500 is invalid. Defaulting to diamond block."); currencyItem = generateCurrencyItem(Material.DIAMOND_BLOCK, location, 500); } @@ -327,7 +329,7 @@ private void dropOneThousand(Location location) { try { currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial1000()), location, 1000); } catch (Exception ex) { - new WarningMessage("Material for EliteMob shower 1000 is invalid. Defaulting to nether star."); + Logger.warn("Material for EliteMob shower 1000 is invalid. Defaulting to nether star."); currencyItem = generateCurrencyItem(Material.NETHER_STAR, location, 1000); } diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemTagger.java b/src/main/java/com/magmaguy/elitemobs/items/ItemTagger.java index 9dbebc535..4d2df3b0a 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemTagger.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemTagger.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig; @@ -10,7 +9,8 @@ import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffectContainer; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.utils.PersistentVanillaData; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -304,7 +304,7 @@ public static HashMap getItemEnchantmentConfi if (enchantmentLevel > 0) { EnchantmentsConfigFields enchantmentsConfigFields = EnchantmentsConfig.getEnchantment(enchantment.getName().toLowerCase(Locale.ROOT) + ".yml"); if (enchantmentsConfigFields == null) { - new WarningMessage("Failed to get configuration file for enchantment called " + enchantment.getName().toLowerCase(Locale.ROOT) + ".yml"); + Logger.warn("Failed to get configuration file for enchantment called " + enchantment.getName().toLowerCase(Locale.ROOT) + ".yml"); continue; } itemEnchantmentFilenames.put(enchantmentsConfigFields, enchantmentLevel); diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemWorthCalculator.java b/src/main/java/com/magmaguy/elitemobs/items/ItemWorthCalculator.java index aaef89924..842bdd18a 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemWorthCalculator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemWorthCalculator.java @@ -6,7 +6,7 @@ import com.magmaguy.elitemobs.items.customenchantments.CustomEnchantment; import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffect; import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffectContainer; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.Round; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/items/LootTables.java b/src/main/java/com/magmaguy/elitemobs/items/LootTables.java index 1978ddeb3..6fcc717f7 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/LootTables.java +++ b/src/main/java/com/magmaguy/elitemobs/items/LootTables.java @@ -14,9 +14,8 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.playerdata.database.PlayerData; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.WeightedProbability; +import com.magmaguy.magmacore.util.Logger; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Location; @@ -138,7 +137,7 @@ public static ItemStack generateLoot(int itemTier, EliteEntity eliteEntity, Play String selectedLootSystem = pickWeighedProbability(weightedProbability); if (selectedLootSystem == null) { - new InfoMessage("Your EliteMobs loot configuration resulted in no loot getting dropped. This is not a bug. " + "If you want! players to be able to progress at all in the EliteMobs plugin, review your configuration settings."); + Logger.info("Your EliteMobs loot configuration resulted in no loot getting dropped. This is not a bug. " + "If you want! players to be able to progress at all in the EliteMobs plugin, review your configuration settings."); return null; } @@ -282,7 +281,7 @@ private static ItemStack generateWeighedFixedItemStack(Player player) { for (ItemStack itemStack : CustomItem.getWeighedFixedItems().keySet()) { Double shouldntBeNull = CustomItem.getWeighedFixedItems().get(itemStack); if (shouldntBeNull != null) totalWeight += CustomItem.getWeighedFixedItems().get(itemStack); - else new WarningMessage("Item " + itemStack.getItemMeta().getDisplayName() + " reported a null weight!"); + else Logger.warn("Item " + itemStack.getItemMeta().getDisplayName() + " reported a null weight!"); } ItemStack generatedItemStack = null; diff --git a/src/main/java/com/magmaguy/elitemobs/items/ScalableItemConstructor.java b/src/main/java/com/magmaguy/elitemobs/items/ScalableItemConstructor.java index 48c8231ce..9fcc16397 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ScalableItemConstructor.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ScalableItemConstructor.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import com.magmaguy.elitemobs.items.itemconstructor.ItemConstructor; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/items/ShareItem.java b/src/main/java/com/magmaguy/elitemobs/items/ShareItem.java index a5ba90d3c..54c58554d 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ShareItem.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ShareItem.java @@ -38,7 +38,7 @@ public static void setItemHoverEvent(TextComponent textComponent, ItemStack item textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(stringList).create())); } - public static TextComponent hoverableItemTextComponent(ItemStack itemStack){ + public static TextComponent hoverableItemTextComponent(ItemStack itemStack) { TextComponent textComponent = new TextComponent(); String stringList = ""; if (itemStack.getItemMeta().hasLore()) diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java index 0ddaedf2e..7e3553b1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java @@ -40,7 +40,7 @@ public static void doEarthquakeEnchantment(int earthquakeLevel, Player player) { doLanding(earthquakeLevel, player); return; } - player.getWorld().spawnParticle(Particle.REDSTONE, player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), + player.getWorld().spawnParticle(Particle.DUST, player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), 20, 0.1, 0.1, 0.1, 1, new Particle.DustOptions(Color.fromRGB( ThreadLocalRandom.current().nextInt(80, 100), ThreadLocalRandom.current().nextInt(20, 40), @@ -59,7 +59,7 @@ public static void doLanding(int level, Player player) { try { entity.setVelocity(entity.getLocation().subtract(player.getLocation()).toVector().normalize().setY(.3).multiply(distance / 2d)); } catch (Exception e) { - //non finite values, doesn't really matter + //non finite values, doesn't really matter } } else { entity.setVelocity(entity.getLocation().subtract(player.getLocation()).toVector().normalize().setY(.3) diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/FlamethrowerEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/FlamethrowerEnchantment.java index 653da6a60..91f205f2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/FlamethrowerEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/FlamethrowerEnchantment.java @@ -85,7 +85,7 @@ public void onInteract(PlayerInteractEvent event) { doFlamethrowerPhase1(player, player.getTargetBlock(null, 30).getLocation().clone().add(0.5, 1, 0.5)); CooldownHandler.initialize(playersUsingFlamethrower, player, 3 * 60); - player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 5 * 20, 20)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 5 * 20, 20)); } @@ -104,7 +104,7 @@ public void run() { return; } - doParticleEffect(player, targetLocation, Particle.SMOKE_NORMAL); + doParticleEffect(player, targetLocation, Particle.SMOKE); counter++; if (counter < 20) return; @@ -168,7 +168,7 @@ public void run() { return; } timer++; - doParticleEffect(player, fixedPlayerLocation, Particle.SMOKE_NORMAL); + doParticleEffect(player, fixedPlayerLocation, Particle.SMOKE); if (timer < 20) return; cancel(); } diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/LightningEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/LightningEnchantment.java index 129dc79f9..9751f1e20 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/LightningEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/LightningEnchantment.java @@ -10,6 +10,8 @@ import com.magmaguy.elitemobs.utils.EventCaller; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.damage.DamageSource; +import org.bukkit.damage.DamageType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -37,7 +39,7 @@ public static void playerLightning(Player player, Location location) { if (eliteEntity == null) return; double damage = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getWeaponLevel(true) * 2.5; EliteMobDamagedByPlayerEvent.EliteMobDamagedByPlayerEventFilter.bypass = true; - EntityDamageByEntityEvent entityDamageByEntityEvent = new EntityDamageByEntityEvent(player, eliteEntity.getLivingEntity(), EntityDamageEvent.DamageCause.CUSTOM, damage); + EntityDamageByEntityEvent entityDamageByEntityEvent = new EntityDamageByEntityEvent(player, eliteEntity.getLivingEntity(), EntityDamageEvent.DamageCause.CUSTOM, DamageSource.builder(DamageType.MOB_ATTACK).build(), damage); new EventCaller(entityDamageByEntityEvent); })); } diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/MeteorShowerEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/MeteorShowerEnchantment.java index fdc0cae8f..d4899d964 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/MeteorShowerEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/MeteorShowerEnchantment.java @@ -61,7 +61,7 @@ private static void doCloudEffect(Location location) { int randY = ThreadLocalRandom.current().nextInt(2); int randZ = ThreadLocalRandom.current().nextInt(30) - 15; Location newLocation = location.clone().add(new Vector(randX, randY, randZ)); - location.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, newLocation, 1, 0, 0, 0, 0); + location.getWorld().spawnParticle(Particle.EXPLOSION, newLocation, 1, 0, 0, 0, 0); } } diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/PlasmaBootsEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/PlasmaBootsEnchantment.java index 4d3619fee..c1cd9a0b2 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/PlasmaBootsEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/PlasmaBootsEnchantment.java @@ -38,7 +38,7 @@ public static void doPlasmaBootsEnchantment(int level, Player player) { doLanding(level, player); return; } - player.getWorld().spawnParticle(Particle.REDSTONE, player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), + player.getWorld().spawnParticle(Particle.DUST, player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), 20, 0.1, 0.1, 0.1, 1, new Particle.DustOptions(Color.fromRGB( ThreadLocalRandom.current().nextInt(0, 100), ThreadLocalRandom.current().nextInt(122, 255), @@ -100,7 +100,7 @@ private static void doDamage(Player player, LivingEntity livingEntity) { private static void doVisualEffect(Location currentLocation) { Objects.requireNonNull(currentLocation.getWorld()) - .spawnParticle(Particle.REDSTONE, currentLocation.getX(), currentLocation.getY(), currentLocation.getZ(), + .spawnParticle(Particle.DUST, currentLocation.getX(), currentLocation.getY(), currentLocation.getZ(), 5, 0.1, 0.1, 0.1, 1, new Particle.DustOptions(Color.fromRGB( ThreadLocalRandom.current().nextInt(0, 100), ThreadLocalRandom.current().nextInt(122, 255), diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/RepairEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/RepairEnchantment.java index bfdba695d..e5a762f7c 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/RepairEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/RepairEnchantment.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.items.customitems.CustomItem; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -32,7 +32,7 @@ public static ItemStack generateScrap(ItemStack itemToScrap, Player player, Elit default -> CustomItem.getCustomItem("elite_scrap_tiny.yml"); }; if (scrapItem == null) { - new WarningMessage("Failed to generate scrap! Was the default elite scrap disabled?"); + Logger.warn("Failed to generate scrap! Was the default elite scrap disabled?"); return null; } return scrapItem.generateItemStack(scrapLevel, player, eliteEntity); diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java index 1fc333fbf..cf24b7dba 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items.customenchantments; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.api.internal.RemovalReason; @@ -8,13 +7,14 @@ import com.magmaguy.elitemobs.config.enchantments.premade.SoulbindConfig; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.items.EliteItemLore; -import com.magmaguy.elitemobs.utils.VisualArmorStand; +import com.magmaguy.elitemobs.utils.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Item; import org.bukkit.entity.Player; +import org.bukkit.entity.TextDisplay; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -64,7 +64,7 @@ public static void addPhysicalDisplay(Item item, Player player) { public void run() { if (item == null) return; - ArmorStand soulboundPlayer = VisualArmorStand.VisualArmorStand(item.getLocation().clone().add(new Vector(0, -50, 0)), ChatColorConverter.convert( + TextDisplay soulboundPlayer = VisualDisplay.generateTemporaryTextDisplay(item.getLocation().clone().add(new Vector(0, -50, 0)), ChatColorConverter.convert( SoulbindConfig.hologramStrings.replace("$player", player.getDisplayName()))); new BukkitRunnable() { final Location lastLocation = item.getLocation().clone(); diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonMerchantEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonMerchantEnchantment.java index c2925467b..04fcec804 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonMerchantEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonMerchantEnchantment.java @@ -1,10 +1,10 @@ package com.magmaguy.elitemobs.items.customenchantments; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig; import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.npcs.NPCEntity; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonWolfEnchantment.java b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonWolfEnchantment.java index 496f8e3df..b5c51789f 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonWolfEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SummonWolfEnchantment.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; @@ -47,7 +47,7 @@ private static Wolf summonGenericWolf(Player player) { customBossEntity.setLevel(ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true)); customBossEntity.spawn(false); if (customBossEntity.getCustomBossesConfigFields().getEntityType() != EntityType.WOLF) { - new WarningMessage("snoopy.yml boss file was not set to a wolf entity type! It must be a wolf for the summon mechanic to work correctly!"); + Logger.warn("snoopy.yml boss file was not set to a wolf entity type! It must be a wolf for the summon mechanic to work correctly!"); return null; } return (Wolf) customBossEntity.getLivingEntity(); @@ -58,7 +58,7 @@ private static Wolf summonSnoopy(Player player) { customBossEntity.setSpawnLocation(player.getLocation()); customBossEntity.setLevel(ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true)); if (customBossEntity.getLivingEntity().getType() != EntityType.WOLF) { - new WarningMessage("snoopy.yml boss file was not set to a wolf entity type! It must be a wolf for the summon mechanic to work correctly!"); + Logger.warn("snoopy.yml boss file was not set to a wolf entity type! It must be a wolf for the summon mechanic to work correctly!"); return null; } return (Wolf) customBossEntity.getLivingEntity(); diff --git a/src/main/java/com/magmaguy/elitemobs/items/customitems/CustomItem.java b/src/main/java/com/magmaguy/elitemobs/items/customitems/CustomItem.java index 68b923909..4c09742b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customitems/CustomItem.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customitems/CustomItem.java @@ -11,9 +11,8 @@ import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; import com.magmaguy.elitemobs.items.itemconstructor.ItemConstructor; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Item; @@ -154,7 +153,7 @@ public static void initializeCustomItems() { try { new CustomItem(configFields); } catch (Exception ex) { - new WarningMessage("Failed to generate custom item in file " + configFields.getFilename() + " !"); + Logger.warn("Failed to generate custom item in file " + configFields.getFilename() + " !"); ex.printStackTrace(); } } @@ -204,11 +203,11 @@ private void parseEnchantments() { try { level = Integer.parseInt(string.split(",")[1]); } catch (Exception ex) { - Bukkit.getLogger().warning("[EliteMobs] Custom Item Entry " + customItemsConfigFields.getFilename() + " has an invalid enchantment entry."); - Bukkit.getLogger().warning("[EliteMobs} Enchantment " + name + " is missing a level."); - Bukkit.getLogger().warning("[EliteMobs] Reminder - The correct format for these is [enchantmentName],[level]"); - Bukkit.getLogger().warning("[EliteMobs] The name should follow the API names and the level should be above 0."); - Bukkit.getLogger().warning("[EliteMobs] Defaulting " + name + " to level 1."); + Logger.warn("Custom Item Entry " + customItemsConfigFields.getFilename() + " has an invalid enchantment entry."); + Logger.warn("Enchantment " + name + " is missing a level."); + Logger.warn("Reminder - The correct format for these is [enchantmentName],[level]"); + Logger.warn("The name should follow the API names and the level should be above 0."); + Logger.warn("Defaulting " + name + " to level 1."); } if (CustomEnchantment.isCustomEnchantment(name)) { @@ -222,19 +221,19 @@ private void parseEnchantments() { if (enchantment == null) throw new Exception("Null enchantment"); } catch (Exception ex) { - Bukkit.getLogger().warning("[EliteMobs] Custom Item Entry " + customItemsConfigFields.getFilename() + " has an invalid enchantment entry."); - Bukkit.getLogger().warning("[EliteMobs] Enchantment " + name + " is not a valid enchantment. Check the Spigot API for the correct names!"); - Bukkit.getLogger().warning("[EliteMobs] The invalid entry will be skipped."); + Logger.warn("Custom Item Entry " + customItemsConfigFields.getFilename() + " has an invalid enchantment entry."); + Logger.warn("Enchantment " + name + " is not a valid enchantment. Check the Spigot API for the correct names!"); + Logger.warn("The invalid entry will be skipped."); continue; } enchantments.put(enchantment, level); } catch (Exception ex) { - Bukkit.getLogger().warning("[EliteMobs] Invalid enchantment entry for item " + customItemsConfigFields.getFilename()); - Bukkit.getLogger().warning("[EliteMobs] [" + string + "] is not a valid entry and will be ignored."); - Bukkit.getLogger().warning("[EliteMobs] Reminder - The correct format for these is [enchantmentName],[level]"); - Bukkit.getLogger().warning("[EliteMobs] The name should follow the API names and the level should be above 0."); + Logger.warn("Invalid enchantment entry for item " + customItemsConfigFields.getFilename()); + Logger.warn("[" + string + "] is not a valid entry and will be ignored."); + Logger.warn("Reminder - The correct format for these is [enchantmentName],[level]"); + Logger.warn("The name should follow the API names and the level should be above 0."); } } @@ -257,7 +256,7 @@ private boolean parseDropWeight() { this.dropWeight = Double.parseDouble(this.customItemsConfigFields.getDropWeight()); return true; } catch (Exception e) { - Bukkit.getLogger().warning("[EliteMobs] Item " + customItemsConfigFields.getFilename() + " does not have a valid itemWeight."); + Logger.warn("Item " + customItemsConfigFields.getFilename() + " does not have a valid itemWeight."); } return false; } @@ -285,7 +284,7 @@ private void parseScalability() { this.scalability = Scalability.SCALABLE; if (!itemType.equals(ItemType.UNIQUE)) scalableItems.add(this); - Bukkit.getLogger().warning("Item " + customItemsConfigFields.getFilename() + " does not have a valid scalability type! Defaulting to scalable."); + Logger.warn("Item " + customItemsConfigFields.getFilename() + " does not have a valid scalability type! Defaulting to scalable."); } } diff --git a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java index 1cdd85ce5..ef49f86ae 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java @@ -6,7 +6,7 @@ import com.magmaguy.elitemobs.economy.EconomyHandler; import com.magmaguy.elitemobs.items.ItemLootShower; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -74,15 +74,18 @@ public CurrencyCustomLootEntry(List entries, String rawString, entries.add(this); } - public CurrencyCustomLootEntry(List entries, Map configMap, String configFilename) { + public CurrencyCustomLootEntry(List entries, Map configMap, String configFilename) { for (Map.Entry mapEntry : configMap.entrySet()) { String key = (String) mapEntry.getKey(); switch (key.toLowerCase(Locale.ROOT)) { - case "chance" -> super.setChance(MapListInterpreter.parseDouble(key, mapEntry.getValue(), configFilename)); - case "permission" -> super.setPermission(MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename)); + case "chance" -> + super.setChance(MapListInterpreter.parseDouble(key, mapEntry.getValue(), configFilename)); + case "permission" -> + super.setPermission(MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename)); case "amount" -> setAmount(MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename)); - case "currencyamount" -> currencyAmount = MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename); - default -> new WarningMessage("Failed to read custom loot option " + key + " in " + configFilename); + case "currencyamount" -> + currencyAmount = MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename); + default -> Logger.warn("Failed to read custom loot option " + key + " in " + configFilename); } } entries.add(this); diff --git a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootEntry.java index c4b037a98..988009efc 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootEntry.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.items.customloottable; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -31,7 +31,7 @@ public CustomLootEntry() { } public static void errorMessage(String rawString, String configFilename, String reason) { - new WarningMessage("Failed to parse entry " + rawString + " for file " + configFilename + " due to invalid: " + reason); + Logger.warn("Failed to parse entry " + rawString + " for file " + configFilename + " due to invalid: " + reason); } public boolean willDrop(Player player) { diff --git a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java index fc818de4d..7e3df5e43 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items.customloottable; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfigFields; @@ -8,6 +7,7 @@ import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfigFields; import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -64,7 +64,7 @@ else if (rawString.contains("material=")) else if (object instanceof Map configMap) { //This is used for the instanced loot if (((Map) object).containsKey("currencyAmount") || - ((Map) object).containsKey("currencyamount")){ + ((Map) object).containsKey("currencyamount")) { new CurrencyCustomLootEntry(entries, configMap, filename); } new EliteCustomLootEntry(entries, configMap, filename); diff --git a/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java index 1de98f5a4..f1b748ccc 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java @@ -8,7 +8,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -48,11 +48,14 @@ public EliteCustomLootEntry(List entries, Map configMap, String key = (String) mapEntry.getKey(); switch (key.toLowerCase(Locale.ROOT)) { case "filename" -> filename = MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename); - case "chance" -> super.setChance(MapListInterpreter.parseDouble(key, mapEntry.getValue(), configFilename)); - case "difficultyid" -> difficultyID = MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename); - case "permission" -> super.setPermission(MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename)); + case "chance" -> + super.setChance(MapListInterpreter.parseDouble(key, mapEntry.getValue(), configFilename)); + case "difficultyid" -> + difficultyID = MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename); + case "permission" -> + super.setPermission(MapListInterpreter.parseString(key, mapEntry.getValue(), configFilename)); case "amount" -> setAmount(MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename)); - default -> new WarningMessage("Failed to read custom loot option " + key + " in " + configFilename); + default -> Logger.warn("Failed to read custom loot option " + key + " in " + configFilename); } } entries.add(this); @@ -155,9 +158,9 @@ public void locationDrop(int itemTier, Player player, Location location) { public void locationDrop(int itemTier, Player player, Location location, EliteEntity eliteEntity) { if (isGroupLoot(itemTier, player, eliteEntity)) return; if (generateCustomItem() == null) { - new WarningMessage("Invalid loot entry for boss " + eliteEntity.getName() + "! Entry: " + filename); + Logger.warn("Invalid loot entry for boss " + eliteEntity.getName() + "! Entry: " + filename); if (eliteEntity instanceof CustomBossEntity customBossEntity) - new WarningMessage("Boss filename: " + customBossEntity.getCustomBossesConfigFields().getFilename()); + Logger.warn("Boss filename: " + customBossEntity.getCustomBossesConfigFields().getFilename()); return; } for (int i = 0; i < getAmount(); i++) @@ -216,13 +219,13 @@ private void addGroupLoot(int itemTier, EliteEntity eliteEntity) { for (int i = 0; i < getAmount(); i++) { CustomItem customItem = generateCustomItem(); if (customItem == null) { - new WarningMessage("Failed to generate a custom item for the boss " + eliteEntity.getName() + "! The configuration file for one of its loot items is not correctly configured."); + Logger.warn("Failed to generate a custom item for the boss " + eliteEntity.getName() + "! The configuration file for one of its loot items is not correctly configured."); return; } ItemStack itemStack = customItem.generateItemStack(itemTier, null, eliteEntity); if (sharedLootTable == null) sharedLootTable = new SharedLootTable(eliteEntity); if (itemStack == null) { - new WarningMessage("A custom item for boss " + eliteEntity.getName() + " was null! This item will be skipped."); + Logger.warn("A custom item for boss " + eliteEntity.getName() + " was null! This item will be skipped."); return; } sharedLootTable.addLoot(itemStack); diff --git a/src/main/java/com/magmaguy/elitemobs/items/customloottable/ItemStackCustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/ItemStackCustomLootEntry.java index e906d7075..3706fe409 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/ItemStackCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/ItemStackCustomLootEntry.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.items.customloottable; import com.magmaguy.elitemobs.utils.ObjectSerializer; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -21,7 +21,7 @@ public ItemStack generateItemStack() { try { return ObjectSerializer.itemStackArrayFromBase64(serializedItemStack); } catch (Exception ex) { - new WarningMessage("Failed to serialize item stack from Custom Loot Table"); + Logger.warn("Failed to serialize item stack from Custom Loot Table"); return null; } } diff --git a/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java index 0c4c21e8a..3beeedbcd 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items.customloottable; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.items.EliteItemLore; @@ -8,6 +7,7 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import com.magmaguy.elitemobs.menus.LootMenu; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -61,7 +61,6 @@ private void endLoot() { @Override public void run() { distribute(); - return; } }.runTaskLater(MetadataHandler.PLUGIN, 1); return; diff --git a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java index 30b0145cd..725ce0426 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java @@ -20,7 +20,7 @@ public class EnchantmentGenerator { public static ItemMeta generateEnchantments(ItemMeta itemMeta, HashMap enchantmentMap) { for (Map.Entry entry : enchantmentMap.entrySet()) { if (entry == null) continue; - EnchantmentsConfigFields enchantmentsConfigFields = EnchantmentsConfig.getEnchantment(entry.getKey().getName().toLowerCase(Locale.ROOT) + ".yml"); + EnchantmentsConfigFields enchantmentsConfigFields = EnchantmentsConfig.getEnchantment(entry.getKey().getKey().getKey().toLowerCase(Locale.ROOT) + ".yml"); if (enchantmentsConfigFields == null || !enchantmentsConfigFields.isEnabled()) continue; if (enchantmentMap.get(entry.getKey()) > entry.getKey().getMaxLevel()) { if (EliteEnchantments.isPotentialEliteEnchantment(entry.getKey())) { @@ -71,32 +71,32 @@ public static HashMap generateEnchantments(double itemTier case IRON_SWORD: case STONE_SWORD: case WOODEN_SWORD: - validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); - validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); - validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("SHARPNESS")); + validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("SMITE")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); - validEnchantments.putAll(validateEnchantments("LOOT_BONUS_MOBS")); + validEnchantments.putAll(validateEnchantments("LOOTING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("SWEEPING_EDGE")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case BOW: - validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); - validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); - validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); - validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("POWER")); + validEnchantments.putAll(validateEnchantments("FLAME")); + validEnchantments.putAll(validateEnchantments("INFINITY")); + validEnchantments.putAll(validateEnchantments("PUNCH")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case CROSSBOW: - validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); + validEnchantments.putAll(validateEnchantments("POWER")); validEnchantments.putAll(validateEnchantments("QUICK_CHARGE")); validEnchantments.putAll(validateEnchantments("MULTISHOT")); validEnchantments.putAll(validateEnchantments("PIERCING")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -105,13 +105,13 @@ public static HashMap generateEnchantments(double itemTier case IRON_PICKAXE: case STONE_PICKAXE: case WOODEN_PICKAXE: - validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); //TODO: this doesn't take config into account if (ThreadLocalRandom.current().nextDouble() < 0.5) { - validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); + validEnchantments.putAll(validateEnchantments("FORTUNE")); } else { validEnchantments.putAll(validateEnchantments("SILK_TOUCH")); } @@ -121,12 +121,12 @@ public static HashMap generateEnchantments(double itemTier case IRON_SHOVEL: case STONE_SHOVEL: case WOODEN_SHOVEL: - validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { - validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); + validEnchantments.putAll(validateEnchantments("FORTUNE")); } else { validEnchantments.putAll(validateEnchantments("SILK_TOUCH")); } @@ -137,19 +137,19 @@ public static HashMap generateEnchantments(double itemTier case STONE_HOE: case WOODEN_HOE: if (ItemSettingsConfig.isUseHoesAsWeapons()) - validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); - validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("SHARPNESS")); + validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { - validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); + validEnchantments.putAll(validateEnchantments("FORTUNE")); } else { validEnchantments.putAll(validateEnchantments("SILK_TOUCH")); } break; case SHIELD: - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -158,14 +158,14 @@ public static HashMap generateEnchantments(double itemTier case IRON_AXE: case STONE_AXE: case WOODEN_AXE: - validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); - validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); - validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("SHARPNESS")); + validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("SMITE")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); - validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); + validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("FORTUNE")); break; case CHAINMAIL_HELMET: case DIAMOND_HELMET: @@ -173,29 +173,29 @@ public static HashMap generateEnchantments(double itemTier case IRON_HELMET: case LEATHER_HELMET: case TURTLE_HELMET: - validEnchantments.putAll(validateEnchantments("PROTECTION_ENVIRONMENTAL")); + validEnchantments.putAll(validateEnchantments("PROTECTION")); validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("OXYGEN")); - validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); - validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); - validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); + validEnchantments.putAll(validateEnchantments("RESPIRATION")); + validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); + validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); - validEnchantments.putAll(validateEnchantments("WATER_WORKER")); + validEnchantments.putAll(validateEnchantments("AQUA_AFFINITY")); break; case CHAINMAIL_CHESTPLATE: case DIAMOND_CHESTPLATE: case GOLDEN_CHESTPLATE: case IRON_CHESTPLATE: case LEATHER_CHESTPLATE: - validEnchantments.putAll(validateEnchantments("PROTECTION_ENVIRONMENTAL")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("PROTECTION")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); - validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); - validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); + validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); + validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -204,13 +204,13 @@ public static HashMap generateEnchantments(double itemTier case GOLDEN_LEGGINGS: case IRON_LEGGINGS: case LEATHER_LEGGINGS: - validEnchantments.putAll(validateEnchantments("PROTECTION_ENVIRONMENTAL")); + validEnchantments.putAll(validateEnchantments("PROTECTION")); validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); - validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); - validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); + validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); + validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -219,14 +219,14 @@ public static HashMap generateEnchantments(double itemTier case GOLDEN_BOOTS: case IRON_BOOTS: case LEATHER_BOOTS: - validEnchantments.putAll(validateEnchantments("PROTECTION_ENVIRONMENTAL")); + validEnchantments.putAll(validateEnchantments("PROTECTION")); validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); - validEnchantments.putAll(validateEnchantments("PROTECTION_FALL")); - validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); - validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); + validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); + validEnchantments.putAll(validateEnchantments("FEATHER_FALLING")); + validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("DEPTH_STRIDER")); @@ -234,17 +234,17 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("SOUL_SPEED")); break; case FISHING_ROD: - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("LUCK")); + validEnchantments.putAll(validateEnchantments("LUCK_OF_THE_SEA")); validEnchantments.putAll(validateEnchantments("LURE")); break; case SHEARS: - validEnchantments.putAll(validateEnchantments("DIG_SPEED")); + validEnchantments.putAll(validateEnchantments("EFFICIENCY")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); break; } diff --git a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java index 0d29cfaad..71a2cc1c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.items.itemconstructor; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.items.EliteItemLore; @@ -8,7 +7,8 @@ import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffectContainer; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; diff --git a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java index 305f27c9d..06e304329 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java @@ -152,7 +152,7 @@ private static ItemMeta colorizeBoldNameAndLore(ChatColor chatColor, ItemMeta it Cancel colorization in case item already has a color (for custom and unique items) */ if (itemMeta.getDisplayName().equals(ChatColor.stripColor(itemMeta.getDisplayName()))) - itemMeta.setDisplayName(chatColor + "" + ChatColor.BOLD + "" + itemMeta.getDisplayName()); + itemMeta.setDisplayName(chatColor + "" + ChatColor.BOLD + itemMeta.getDisplayName()); List list = new ArrayList(); @@ -162,7 +162,7 @@ Cancel colorization in case item already has a color (for custom and unique item if (!string.isEmpty()) { - String colorizedString = chatColor + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + string; + String colorizedString = chatColor + "" + ChatColor.BOLD + ChatColor.ITALIC + string; list.add(colorizedString); } @@ -189,23 +189,23 @@ private static int maxRankCalculator(ItemStack itemStack) { case IRON_SWORD: case STONE_SWORD: case WOODEN_SWORD: - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DAMAGE_ARTHROPODS).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.BANE_OF_ARTHROPODS).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FIRE_ASPECT).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.KNOCKBACK).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.LOOT_BONUS_BLOCKS).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FORTUNE).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DAMAGE_ALL).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DAMAGE_UNDEAD).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SHARPNESS).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SMITE).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SWEEPING_EDGE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); break; case BOW: - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.ARROW_FIRE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.ARROW_INFINITE).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FLAME).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.INFINITY).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.ARROW_DAMAGE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.ARROW_KNOCKBACK).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.POWER).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PUNCH).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); break; case DIAMOND_PICKAXE: case GOLDEN_PICKAXE: @@ -217,11 +217,11 @@ private static int maxRankCalculator(ItemStack itemStack) { case IRON_SHOVEL: case STONE_SHOVEL: case WOODEN_SHOVEL: - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DIG_SPEED).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.LOOT_BONUS_BLOCKS).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.EFFICIENCY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FORTUNE).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SILK_TOUCH).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); break; case DIAMOND_HOE: case GOLDEN_HOE: @@ -229,48 +229,48 @@ private static int maxRankCalculator(ItemStack itemStack) { case STONE_HOE: case WOODEN_HOE: maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); break; case DIAMOND_AXE: case GOLDEN_AXE: case IRON_AXE: case STONE_AXE: case WOODEN_AXE: - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DAMAGE_ARTHROPODS).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DIG_SPEED).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.LOOT_BONUS_BLOCKS).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.BANE_OF_ARTHROPODS).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.EFFICIENCY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FORTUNE).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DAMAGE_ALL).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SHARPNESS).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SILK_TOUCH).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DAMAGE_UNDEAD).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.SMITE).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); break; case CHAINMAIL_HELMET: case DIAMOND_HELMET: case GOLDEN_HELMET: case IRON_HELMET: case LEATHER_HELMET: - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.OXYGEN).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_EXPLOSIONS).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_FIRE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_PROJECTILE).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.RESPIRATION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.BLAST_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FIRE_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROJECTILE_PROTECTION).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.THORNS).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.WATER_WORKER).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.AQUA_AFFINITY).getMaxLevel(); break; case CHAINMAIL_CHESTPLATE: case DIAMOND_CHESTPLATE: case GOLDEN_CHESTPLATE: case IRON_CHESTPLATE: case LEATHER_CHESTPLATE: - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_EXPLOSIONS).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_FIRE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_PROJECTILE).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.BLAST_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FIRE_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROJECTILE_PROTECTION).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.THORNS).getMaxLevel(); break; @@ -281,45 +281,45 @@ private static int maxRankCalculator(ItemStack itemStack) { material.equals(Material.GOLDEN_LEGGINGS) || material.equals(Material.IRON_LEGGINGS) || material.equals(Material.LEATHER_LEGGINGS)) { - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_EXPLOSIONS).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_FIRE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_PROJECTILE).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.BLAST_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FIRE_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROJECTILE_PROTECTION).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.THORNS).getMaxLevel(); } else if (material.equals(Material.CHAINMAIL_BOOTS) || material.equals(Material.DIAMOND_BOOTS) || material.equals(Material.GOLDEN_BOOTS) || material.equals(Material.IRON_BOOTS) || material.equals(Material.LEATHER_BOOTS)) { - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_EXPLOSIONS).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_FALL).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_FIRE).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION_PROJECTILE).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.BLAST_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FEATHER_FALLING).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FIRE_PROTECTION).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.PROJECTILE_PROTECTION).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.THORNS).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DEPTH_STRIDER).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.FROST_WALKER).getMaxLevel(); } else if (material.equals(Material.SHEARS)) { - EnchantmentsConfig.getEnchantment(Enchantment.DIG_SPEED).getMaxLevel(); + EnchantmentsConfig.getEnchantment(Enchantment.EFFICIENCY).getMaxLevel(); EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); } else if (material.equals(Material.FISHING_ROD)) { - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.LUCK).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.LUCK_OF_THE_SEA).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.LURE).getMaxLevel(); } else if (material.equals(Material.SHIELD)) { - maxRank += EnchantmentsConfig.getEnchantment(Enchantment.DURABILITY).getMaxLevel(); + maxRank += EnchantmentsConfig.getEnchantment(Enchantment.UNBREAKING).getMaxLevel(); maxRank += EnchantmentsConfig.getEnchantment(Enchantment.MENDING).getMaxLevel(); } diff --git a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/MaterialGenerator.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/MaterialGenerator.java index 46bd45989..740ae4a13 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/MaterialGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/MaterialGenerator.java @@ -3,8 +3,7 @@ import com.magmaguy.elitemobs.combatsystem.CombatSystem; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.ProceduralItemGenerationSettingsConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; -import org.bukkit.Bukkit; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Material; import java.util.ArrayList; @@ -97,9 +96,9 @@ public static void initializeValidProceduralMaterials() { validProceduralMaterials.clear(); if (ProceduralItemGenerationSettingsConfig.getValidMaterials().isEmpty()) { - ProceduralItemGenerationSettingsConfig.cacheMaterials(); + ProceduralItemGenerationSettingsConfig.getInstance().cacheMaterials(); if (ProceduralItemGenerationSettingsConfig.getValidMaterials().isEmpty()) { - new WarningMessage("No valid materials detected for the procedural item settings. If you are trying to disable" + + Logger.warn("No valid materials detected for the procedural item settings. If you are trying to disable" + " them, use the 'dropProcedurallyGeneratedItems' option instead. Warn the developer."); return; } @@ -109,7 +108,7 @@ public static void initializeValidProceduralMaterials() { try { validProceduralMaterials.add(getMaterial(string)); } catch (Exception e) { - Bukkit.getLogger().info("Invalid material type detected: " + string); + Logger.info("Invalid material type detected: " + string); } } diff --git a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/NameGenerator.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/NameGenerator.java index 91ecc0eb0..548fcac2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/NameGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/NameGenerator.java @@ -1,9 +1,8 @@ package com.magmaguy.elitemobs.items.itemconstructor; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ProceduralItemGenerationSettingsConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; -import org.bukkit.Bukkit; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Material; import java.util.List; @@ -108,12 +107,12 @@ private static String materialStringParser(Material material) { return ProceduralItemGenerationSettingsConfig.getCrossbowName(); } - if (ProceduralItemGenerationSettingsConfig.getFileConfiguration().getString("materialNames." + material.toString().toLowerCase(Locale.ROOT)) != null) - return ProceduralItemGenerationSettingsConfig.getFileConfiguration().getString("materialNames." + material.toString().toLowerCase(Locale.ROOT)); + if (ProceduralItemGenerationSettingsConfig.getInstance().getFileConfiguration().getString("materialNames." + material.toString().toLowerCase(Locale.ROOT)) != null) + return ProceduralItemGenerationSettingsConfig.getInstance().getFileConfiguration().getString("materialNames." + material.toString().toLowerCase(Locale.ROOT)); - Bukkit.getLogger().warning("[EliteMobs] Found unexpected material type in procedurally generated loot. Can't generate item type name."); - Bukkit.getLogger().warning("[EliteMobs] Material name: " + material); - new WarningMessage("If you're trying to set a non-default item type, you need to add the name format like this under materialNames: " + material.toString().toLowerCase(Locale.ROOT) + ": Name"); + Logger.warn("Found unexpected material type in procedurally generated loot. Can't generate item type name."); + Logger.warn("Material name: " + material); + Logger.warn("If you're trying to set a non-default item type, you need to add the name format like this under materialNames: " + material.toString().toLowerCase(Locale.ROOT) + ": Name"); return ""; } diff --git a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java index 694343fc2..268cd32ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -1,7 +1,10 @@ package com.magmaguy.elitemobs.items.potioneffects; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -18,10 +21,15 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - if (PotionEffectType.getByName(stringObject[0].toLowerCase(Locale.ROOT)).equals(PotionEffectType.NIGHT_VISION)) + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); + if (potionEffectType == null) { + Logger.warn("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); + return; + } + if (potionEffectType.equals(PotionEffectType.NIGHT_VISION)) duration = 15 * 20; - this.potionEffect = new PotionEffect(PotionEffectType.getByName(stringObject[0].toLowerCase(Locale.ROOT)), duration, Integer.parseInt(stringObject[1])); - this.value = PotionEffectsConfig.getPotionEffect(potionEffect.getType().getName()).getValue(); + this.potionEffect = new PotionEffect(potionEffectType, duration, Integer.parseInt(stringObject[1])); + this.value = PotionEffectsConfig.getPotionEffect(potionEffectType.getKey().getKey()).getValue(); if (stringObject.length < 3) { this.target = Target.SELF; this.applicationMethod = ApplicationMethod.CONTINUOUS; @@ -38,12 +46,12 @@ public ElitePotionEffect(String string) { this.applicationMethod = ApplicationMethod.valueOf(stringObject[3].toUpperCase(Locale.ROOT)); if (this.applicationMethod.equals(ApplicationMethod.ONHIT)) - this.potionEffect = new PotionEffect(PotionEffectType.getByName(stringObject[0].toLowerCase(Locale.ROOT)), - PotionEffectsConfig.getPotionEffect(potionEffect.getType().getName()).getOnHitDuration() * 20, + this.potionEffect = new PotionEffect(potionEffectType, + PotionEffectsConfig.getPotionEffect(potionEffect.getType().getKey().getKey()).getOnHitDuration() * 20, Integer.parseInt(stringObject[1])); } catch (Exception ex) { - new WarningMessage("Detected invalid potion effect entry: " + string); + Logger.warn("Detected invalid potion effect entry: " + string); ex.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/PlayerPotionEffects.java b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/PlayerPotionEffects.java index 29e165fe9..57787dc66 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/PlayerPotionEffects.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/PlayerPotionEffects.java @@ -63,7 +63,7 @@ private void doContinuousPotionEffect(ElitePotionEffect elitePotionEffect, Playe player.getPotionEffect(elitePotionEffect.getPotionEffect().getType()).getAmplifier() > elitePotionEffect.getPotionEffect().getAmplifier()) return; - if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.HEAL)) { + if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.INSTANT_HEALTH)) { Heal.doHeal(player, elitePotionEffect); return; } @@ -73,7 +73,7 @@ private void doContinuousPotionEffect(ElitePotionEffect elitePotionEffect, Playe return; } - if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.HARM)) { + if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.INSTANT_DAMAGE)) { Harm.doHarm(player, elitePotionEffect); return; } @@ -111,7 +111,7 @@ private void doOnHitPotionEffect(ElitePotionEffect elitePotionEffect, Player pla if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.HEALTH_BOOST)) return; switch (elitePotionEffect.getTarget()) { case SELF: - if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.HEAL)) { + if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.INSTANT_HEALTH)) { Heal.doHeal(player, elitePotionEffect); break; } @@ -121,7 +121,7 @@ private void doOnHitPotionEffect(ElitePotionEffect elitePotionEffect, Player pla break; } - if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.HARM)) { + if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.INSTANT_DAMAGE)) { Harm.doHarm(player, elitePotionEffect); return; } @@ -129,7 +129,7 @@ private void doOnHitPotionEffect(ElitePotionEffect elitePotionEffect, Player pla break; case TARGET: if (elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.LEVITATION) || - elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.SLOW) || + elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.SLOWNESS) || elitePotionEffect.getPotionEffect().getType().equals(PotionEffectType.BLINDNESS)) { EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(damagee); if (eliteEntity != null && eliteEntity.getHealthMultiplier() > 1) diff --git a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/custom/Saturation.java b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/custom/Saturation.java index 4b7cf1085..d83f73047 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/custom/Saturation.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/custom/Saturation.java @@ -15,7 +15,7 @@ public static void doSaturation(Player player, ElitePotionEffect elitePotionEffe PlayerPotionEffects.addOnHitCooldown(saturationCooldown, player, 20 * 5); double foodRestoredAmount = (elitePotionEffect.getPotionEffect().getAmplifier() + 1); foodRestoredAmount = foodRestoredAmount + player.getFoodLevel() > 20 ? - 20-player.getFoodLevel() : foodRestoredAmount; + 20 - player.getFoodLevel() : foodRestoredAmount; player.setFoodLevel((int) (player.getFoodLevel() + foodRestoredAmount)); } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java index 2141e4441..44544f352 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ArenasConfig; +import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.DungeonsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.ArenaMenuConfig; import com.magmaguy.elitemobs.instanced.arena.ArenaInstance; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -26,7 +26,7 @@ public void constructArenaMenu(Player player, String arenaFilename) { return; } String menuName = ArenaMenuConfig.getMenuName() + arenaInstance.getCustomArenasConfigFields().getArenaName(); - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = "\uF801\uDB80\uDD0B\uF805 " + menuName; Inventory shopInventory = Bukkit.createInventory(player, 9, menuName); shopInventory.setItem(ArenaMenuConfig.getPlayerItemSlot(), ArenaMenuConfig.getPlayerItem()); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/BuyOrSellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/BuyOrSellMenu.java index a863aeb1d..91c0656fb 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/BuyOrSellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/BuyOrSellMenu.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.menus; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; +import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.menus.premade.BuyOrSellMenuConfig; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -24,14 +24,14 @@ public class BuyOrSellMenu { public static void constructBuyOrSellMenu(Player player, ItemStack buyItemStack) { String inventoryName = BuyOrSellMenuConfig.SHOP_NAME; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) inventoryName = ChatColor.WHITE + "\uF801\uDB80\uDC7B\uF805 " + inventoryName; Inventory shopInventory = Bukkit.createInventory(player, 18, inventoryName); menus.add(shopInventory); //information item ItemStack info = BuyOrSellMenuConfig.INFORMATION_ITEM; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { info.setType(Material.PAPER); ItemMeta itemMeta = info.getItemMeta(); itemMeta.setCustomModelData(MetadataHandler.signatureID); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/CustomShopMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/CustomShopMenu.java index 71d58044f..edfdcac3d 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/CustomShopMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/CustomShopMenu.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.menus; import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.BuyOrSellMenuConfig; import com.magmaguy.elitemobs.config.menus.premade.CustomShopMenuConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; @@ -60,7 +60,7 @@ public static void customShopInitializer(Player player) { */ public static void customShopConstructor(Player player) { String menuName = CustomShopMenuConfig.shopName; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC8B\uF805 " + menuName; Inventory shopInventory = Bukkit.createInventory(player, 54, menuName); populateShop(shopInventory, player); @@ -76,7 +76,7 @@ public static void customShopConstructor(Player player) { private static void populateShop(Inventory shopInventory, Player player) { ItemStack rerollButton = CustomShopMenuConfig.rerollItem; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { rerollButton.setType(Material.PAPER); ItemMeta itemMeta = rerollButton.getItemMeta(); itemMeta.setCustomModelData(MetadataHandler.signatureID); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/GetLootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/GetLootMenu.java index 3218ddaa2..769c81215 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/GetLootMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/GetLootMenu.java @@ -12,15 +12,18 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; /** * Created by MagmaGuy on 04/05/2017. */ public class GetLootMenu extends EliteMenu implements Listener { - private static final List lootSlots = new ArrayList<>(Arrays.asList(10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, - 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 46, 47, 48, 49, 50, 51, 52)); + private static final List lootSlots = new ArrayList<>(new ArrayList<>(List.of(10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, + 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 46, 47, 48, 49, 50, 51, 52))); public static HashMap inventories = new HashMap<>(); private final String shopName = GetLootMenuConfig.menuName; public int currentHeaderPage = 1; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index 3c4f8869f..e9bdefa43 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.DungeonsConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.dungeons.WorldInstancedDungeonPackage; import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -115,7 +115,8 @@ public void onInventoryInteract(InventoryClickEvent event) { dungeonInstance.addSpectator((Player) event.getWhoClicked(), false); } case WAITING -> dungeonInstance.addNewPlayer((Player) event.getWhoClicked()); - case COMPLETED -> event.getWhoClicked().sendMessage("[EliteMobs] This match already ended! Can't join it!"); + case COMPLETED -> + event.getWhoClicked().sendMessage("[EliteMobs] This match already ended! Can't join it!"); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index 5beb89dc2..b0bf40320 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,8 +1,7 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.SpecialItemSystemsConfig; import com.magmaguy.elitemobs.config.menus.premade.ItemEnchantmentMenuConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; @@ -11,7 +10,8 @@ import com.magmaguy.elitemobs.items.ShareItem; import com.magmaguy.elitemobs.items.upgradesystem.EliteEnchantmentItems; import com.magmaguy.elitemobs.items.upgradesystem.UpgradeSystem; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Round; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -56,7 +56,7 @@ public class ItemEnchantmentMenu extends EliteMenu { public ItemEnchantmentMenu(Player player) { String name = MENU_NAME; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) name = ChatColor.WHITE + "\uF801\uDB80\uDC2A\uF805 " + MENU_NAME; Inventory inventory = Bukkit.createInventory(player, 54, name); ItemEnchantMenuEvents.menus.add(inventory); @@ -212,8 +212,9 @@ private void handleBottomInventory(InventoryClickEvent event) { if (event.getInventory().getItem(ENCHANTED_BOOK_SLOT) == null) moveOneItemUp(ENCHANTED_BOOK_SLOT, event); else - //Make sure enchant books themselves can't be enchanted - return; + //Make sure enchant books themselves can't be enchanted + { + } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && event.getView().getTopInventory().getItem(LUCKY_TICKET_SLOT) == null) { moveOneItemUp(LUCKY_TICKET_SLOT, event); @@ -312,7 +313,7 @@ public void onClose(InventoryCloseEvent event) { if (menus.contains(event.getInventory())) { menus.remove(event.getInventory()); EliteMenu.cancel(event.getPlayer(), event.getView().getTopInventory(), event.getView().getBottomInventory(), - Arrays.asList(ITEM_SLOT, ENCHANTED_BOOK_SLOT, LUCKY_TICKET_SLOT)); + new ArrayList<>(List.of(ITEM_SLOT, ENCHANTED_BOOK_SLOT, LUCKY_TICKET_SLOT))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 612e92c2e..6f12a408c 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.items.customloottable.SharedLootTable; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ProceduralShopMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ProceduralShopMenu.java index cad1a3cff..9a3adf8c6 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ProceduralShopMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ProceduralShopMenu.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.menus; import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.BuyOrSellMenuConfig; import com.magmaguy.elitemobs.config.menus.premade.ProceduralShopMenuConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; @@ -48,7 +48,7 @@ public static void shopInitializer(Player player) { public static void shopConstructor(Player player) { String menuName = ProceduralShopMenuConfig.shopName; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC8B\uF805 " + menuName; Inventory shopInventory = Bukkit.createInventory(player, 54, menuName); populateShop(shopInventory, player); @@ -60,7 +60,7 @@ public static void shopConstructor(Player player) { private static void populateShop(Inventory shopInventory, Player player) { ItemStack rerollButton = ProceduralShopMenuConfig.rerollItem; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { rerollButton.setType(Material.PAPER); ItemMeta itemMeta = rerollButton.getItemMeta(); itemMeta.setCustomModelData(MetadataHandler.signatureID); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java index 933ee6a43..be98f13ea 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -3,10 +3,9 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.RepairMenuConfig; import com.magmaguy.elitemobs.items.customenchantments.RepairEnchantment; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -20,7 +19,10 @@ import org.bukkit.inventory.meta.Damageable; import org.bukkit.inventory.meta.ItemMeta; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; public class RepairMenu extends EliteMenu { private static final int eliteItemInputSlot = RepairMenuConfig.eliteItemInputSlot; @@ -42,7 +44,7 @@ private static void calculateOutput(Inventory repairInventory) { int baselineRepair = 100; int newDamage = baselineRepair * scrapLevel; Damageable damageable = (Damageable) outputItem.getItemMeta(); - int damage = Math.min(damageable.getDamage() - newDamage, damageable.getDamage()); + int damage = Math.min(Math.max((damageable.getDamage() - newDamage), 0), damageable.getDamage()); damageable.setDamage(damage); outputItem.setItemMeta(damageable); repairInventory.setItem(outputSlot, outputItem); @@ -55,7 +57,7 @@ private static void calculateOutput(Inventory repairInventory) { */ public void constructRepairMenu(Player player) { String menuName = RepairMenuConfig.shopName; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC2A\uF805 " + menuName; Inventory repairInventory = Bukkit.createInventory(player, 54, menuName); @@ -64,7 +66,7 @@ public void constructRepairMenu(Player player) { if (i == RepairMenuConfig.infoSlot) { ItemStack infoButton = RepairMenuConfig.infoButton; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { infoButton.setType(Material.PAPER); ItemMeta itemMeta = infoButton.getItemMeta(); itemMeta.setCustomModelData(MetadataHandler.signatureID); @@ -196,7 +198,7 @@ public void onInteract(InventoryClickEvent event) { public void onClose(InventoryCloseEvent event) { if (inventories.contains(event.getInventory())) { inventories.remove(event.getInventory()); - EliteMenu.cancel(event.getPlayer(), event.getView().getTopInventory(), event.getView().getBottomInventory(), Arrays.asList(eliteItemInputSlot, scrapItemInputSlot)); + EliteMenu.cancel(event.getPlayer(), event.getView().getTopInventory(), event.getView().getBottomInventory(), new ArrayList<>(List.of(eliteItemInputSlot, scrapItemInputSlot))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 73ef13cd0..55c881ab7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -1,16 +1,15 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ItemSettingsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.ScrapperMenuConfig; import com.magmaguy.elitemobs.items.customenchantments.RepairEnchantment; import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -42,7 +41,7 @@ public class ScrapperMenu extends EliteMenu { public void constructScrapMenu(Player player) { String menuName = ScrapperMenuConfig.shopName; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC2B\uF805 " + menuName; Inventory scrapInventory = Bukkit.createInventory(player, 54, menuName); @@ -51,7 +50,7 @@ public void constructScrapMenu(Player player) { if (i == ScrapperMenuConfig.infoSlot) { ItemStack infoButton = ScrapperMenuConfig.infoButton; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { infoButton.setType(Material.PAPER); ItemMeta itemMeta = infoButton.getItemMeta(); itemMeta.setCustomModelData(MetadataHandler.signatureID); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java index 1f2b36ea6..653e6e536 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -1,16 +1,15 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.SellMenuConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; import com.magmaguy.elitemobs.items.ItemWorthCalculator; import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.magmacore.util.Round; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -67,7 +66,7 @@ private static ItemStack updateConfirmButton(double itemWorth) { public void constructSellMenu(Player player) { String menuName = SellMenuConfig.shopName; - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC5B\uF805 " + menuName; Inventory sellInventory = Bukkit.createInventory(player, 54, menuName); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SharedShopElements.java b/src/main/java/com/magmaguy/elitemobs/menus/SharedShopElements.java index 46852e5af..dc3d6d1f3 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SharedShopElements.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SharedShopElements.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index 92cdcf069..e55eca9bd 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -3,12 +3,11 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.UnbinderMenuConfig; import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment; import com.magmaguy.elitemobs.items.customenchantments.UnbindEnchantment; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -50,7 +49,7 @@ private static void calculateOutput(Inventory UnbinderInventory) { */ public void constructUnbinderMenu(Player player) { String menuName = UnbinderMenuConfig.getShopName(); - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC9B\uF805 " + menuName; Inventory UnbinderInventory = Bukkit.createInventory(player, 54, menuName); @@ -58,7 +57,7 @@ public void constructUnbinderMenu(Player player) { if (i == UnbinderMenuConfig.getInfoSlot()) { ItemStack infoButton = UnbinderMenuConfig.getInfoButton(); - if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { + if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { infoButton.setType(Material.PAPER); ItemMeta itemMeta = infoButton.getItemMeta(); itemMeta.setCustomModelData(MetadataHandler.signatureID); @@ -173,7 +172,7 @@ public void onInteract(InventoryClickEvent event) { unbinderInventory.setItem(UnbinderMenuConfig.getEliteItemInputSlot(), null); unbinderInventory.setItem(UnbinderMenuConfig.getEliteUnbindInputSlot(), null); if (unbinderInventory.getItem(outputSlot) != null) { - HashMapmap =player.getInventory().addItem(unbinderInventory.getItem(outputSlot)); + HashMap map = player.getInventory().addItem(unbinderInventory.getItem(outputSlot)); if (!map.isEmpty()) map.forEach((key, itemStack) -> { itemStack.setAmount(key); player.getWorld().dropItem(player.getLocation(), itemStack); @@ -192,7 +191,7 @@ public void onInteract(InventoryClickEvent event) { public void onClose(InventoryCloseEvent event) { if (inventories.contains(event.getInventory())) { inventories.remove(event.getInventory()); - EliteMenu.cancel(event.getPlayer(), event.getView().getTopInventory(), event.getView().getBottomInventory(), Arrays.asList(eliteItemInputSlot, unbindScrollItemInputSlot)); + EliteMenu.cancel(event.getPlayer(), event.getView().getTopInventory(), event.getView().getBottomInventory(), new ArrayList<>(List.of(eliteItemInputSlot, unbindScrollItemInputSlot))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java new file mode 100644 index 000000000..4009119dd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -0,0 +1,9 @@ +package com.magmaguy.elitemobs.mobconstructor; + +public enum BossType { + NORMAL, + MINIBOSS, + BOSS, + REINFORCEMENT, + EVENT +} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java index ed04d7c2e..2fcb4547a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -8,14 +8,13 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig; import com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfigFields; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.events.MoonPhaseDetector; import com.magmaguy.elitemobs.events.TimedEvent; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker; -import com.magmaguy.elitemobs.utils.DebugMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.*; @@ -59,14 +58,14 @@ public CustomSpawn(String customSpawnConfig, List customBossesFilenames, this.timedEvent = timedEvent; if (customSpawnConfigFields == null) { - new WarningMessage("Invalid custom spawn detected for file " + customSpawnConfig + " in event " + timedEvent.getCustomEventsConfigFields().getFilename()); + Logger.warn("Invalid custom spawn detected for file " + customSpawnConfig + " in event " + timedEvent.getCustomEventsConfigFields().getFilename()); return; } customBossesFilenames.forEach(bossString -> { CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(bossString); if (customBossesConfigFields == null) { - new WarningMessage("Attempted to pass invalid boss into CustomSpawn: " + bossString); + Logger.warn("Attempted to pass invalid boss into CustomSpawn: " + bossString); return; } CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields); @@ -78,7 +77,7 @@ public CustomSpawn(String customSpawnConfig, List customBossesFilenames, public CustomSpawn(String customSpawnConfig, CustomBossEntity customBossEntity) { this.customSpawnConfigFields = CustomSpawnConfig.getCustomEvent(customSpawnConfig); if (customSpawnConfigFields == null) { - new WarningMessage("Invalid custom spawn detected for file " + customSpawnConfig); + Logger.warn("Invalid custom spawn detected for file " + customSpawnConfig); return; } customBossEntities.add(customBossEntity); @@ -116,7 +115,6 @@ public void run() { }.runTaskAsynchronously(MetadataHandler.PLUGIN); else spawn(); - } private void spawn() { @@ -130,7 +128,7 @@ public void run() { return; } //One last check - //Last line of defense - spawn a test mob. If some uknown protection system prevents spawning it should prevent this + //Last line of defense - spawn a test mob. If some unknown protection system prevents spawning it should prevent this LivingEntity testEntity = spawnLocation.getWorld().spawn(spawnLocation, Zombie.class); if (!testEntity.isValid()) { spawnLocation = null; @@ -166,13 +164,12 @@ public void run() { private void generateCustomSpawn() { //If the global cooldown if enforced and this is a timed event wait for the cd to be over - /* - if (timedEvent != null && System.currentTimeMillis() < TimedEvent.getNextEventTrigger()) { + + if (timedEvent != null && System.currentTimeMillis() < TimedEvent.getNextEventStartMinimum()) { Bukkit.getScheduler().scheduleAsyncDelayedTask(MetadataHandler.PLUGIN, this::generateCustomSpawn, 20 * 60L); return; } - */ int maxTries = 100; int tries = 0; @@ -192,8 +189,6 @@ private void generateCustomSpawn() { @Override public void run() { generateCustomSpawn(); - if (timedEvent != null) - new DebugMessage("Failed to spawn " + timedEvent.getCustomEventsConfigFields().getFilename() + " after " + allTries + " tries. Will try again in 1 minute."); } }.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20 * 60); } else { @@ -203,22 +198,21 @@ public void run() { })); } } else { - if (isEvent) new DebugMessage("Spawned bosses for event after " + allTries + " tries"); spawn(); } } public Location generateRandomSpawnLocation() { if (customSpawnConfigFields == null) { - new WarningMessage("Something tried to spawn but has invalid custom spawn config fields! This isn't good.", true); - new WarningMessage("Bosses: "); + Logger.warn("Something tried to spawn but has invalid custom spawn config fields! This isn't good.", true); + Logger.warn("Bosses: "); getCustomBossEntities().forEach((customBossEntity) -> { if (customBossEntity != null) if (customBossEntity.getName() != null) - new WarningMessage(customBossEntity.getCustomBossesConfigFields().getName()); + Logger.warn(customBossEntity.getCustomBossesConfigFields().getName()); }); if (timedEvent != null) { - new WarningMessage("Event: " + timedEvent.getCustomEventsConfigFields().getFilename()); + Logger.warn("Event: " + timedEvent.getCustomEventsConfigFields().getFilename()); timedEvent.end(); } return null; @@ -241,7 +235,9 @@ public Location generateRandomSpawnLocation() { Location playerLocation = player.getLocation(); if (!ValidWorldsConfig.getValidWorlds().contains(playerLocation.getWorld().getName())) continue; - if (Boolean.FALSE.equals(playerLocation.getWorld().getGameRuleValue(GameRule.DO_MOB_SPAWNING))) continue; + if (timedEvent != null && EliteMobsWorld.isEliteMobsWorld(player.getWorld().getUID())) continue; + if (Boolean.FALSE.equals(playerLocation.getWorld().getGameRuleValue(GameRule.DO_MOB_SPAWNING))) + continue; if (!customSpawnConfigFields.getValidWorlds().isEmpty()) if (!customSpawnConfigFields.getValidWorlds().contains(playerLocation.getWorld())) continue; @@ -275,10 +271,7 @@ public Location generateRandomSpawnLocation() { //Temp location - do not run checks on it yet Location location = selectedPlayer.getLocation().clone().add(randomizedVector); //This doesn't matter too much since it will be parsed later, also these values are already tweaked for 1.18. - if (VersionChecker.serverVersionOlderThan(18, 1)) - location.setY(ThreadLocalRandom.current().nextInt(-0, 256)); - else - location.setY(ThreadLocalRandom.current().nextInt(-64, 256)); + location.setY(ThreadLocalRandom.current().nextInt(-0, 256)); World world = location.getWorld(); if (!customSpawnConfigFields.getValidBiomes().isEmpty() && !customSpawnConfigFields.getValidBiomes().contains(location.getBlock().getBiome())) diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index f76df593c..bb4e7e568 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.mobconstructor; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteMobHealEvent; import com.magmaguy.elitemobs.api.internal.RemovalReason; @@ -22,8 +21,8 @@ import com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance; import com.magmaguy.elitemobs.tagger.PersistentTagger; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -247,7 +246,7 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR this.entityType = livingEntity.getType(); this.livingEntity.setCanPickupItems(false); - if (livingEntity.getEquipment() != null){ + if (livingEntity.getEquipment() != null) { livingEntity.getEquipment().setItemInMainHandDropChance(0); livingEntity.getEquipment().setItemInOffHandDropChance(0); livingEntity.getEquipment().setHelmetDropChance(0); @@ -279,18 +278,21 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR KeepNeutralsAngry.showMeYouWarFace(this); } - //todo: this should become configurable real soon for the primis gladius event if (entityType.equals(EntityType.IRON_GOLEM) && this instanceof CustomBossEntity) KeepNeutralsAngry.showMeYouWarFace(this); - if (!VersionChecker.serverVersionOlderThan(17, 0) && entityType.equals(EntityType.GOAT)) { + if (entityType.equals(EntityType.GOAT)) { ((Goat) livingEntity).setScreaming(true); } - if (!VersionChecker.serverVersionOlderThan(15, 0) && livingEntity instanceof Bee) { + if (livingEntity instanceof Bee) { KeepNeutralsAngry.showMeYouWarFace(this); ((Bee) livingEntity).setCannotEnterHiveTicks(Integer.MAX_VALUE); } + + if (livingEntity instanceof Wither wither) + wither.getBossBar().setVisible(false); + this.spawnReason = spawnReason; //This sets whether the entity gets despawned when beyond a certain distance from the player, should only happen @@ -494,7 +496,7 @@ public void applyPowers(HashSet configFields, int availableP else this.minorPowerCount++; } catch (Exception ex) { - new WarningMessage("Failed to instance new power!"); + Logger.warn("Failed to instance new power!"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/MergeHandler.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/MergeHandler.java deleted file mode 100644 index e74b75492..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/MergeHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor; - -import com.magmaguy.elitemobs.config.ValidWorldsConfig; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; -import com.magmaguy.elitemobs.mobs.passive.PassiveEliteMobDeathHandler; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntitySpawnEvent; - -/** - * Created by MagmaGuy on 15/07/2017. - */ -public class MergeHandler implements Listener { - - @EventHandler (ignoreCancelled = true) - public void onDamageMerge(EntityDamageEvent event) { - - if (!ValidWorldsConfig.getFileConfiguration().getBoolean("Valid worlds." + event.getEntity().getWorld().getName())) - return; - validateEntityType(event.getEntity()); - - } - - @EventHandler (ignoreCancelled = true) - public void onSpawnMerge(EntitySpawnEvent event) { - - if (!ValidWorldsConfig.getFileConfiguration().getBoolean("Valid worlds." + event.getEntity().getWorld().getName())) - return; - validateEntityType(event.getEntity()); - - } - - private void validateEntityType(Entity eventEntity) { - - if (eventEntity == null) return; - if (!(eventEntity instanceof LivingEntity)) return; - - if (SuperMobProperties.isValidSuperMobType(eventEntity)) - PassiveEliteMobDeathHandler.SuperMobScanner.newSuperMobScan((LivingEntity) eventEntity); - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/PersistentObjectHandler.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/PersistentObjectHandler.java index e7162993c..a9190b581 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/PersistentObjectHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/PersistentObjectHandler.java @@ -169,7 +169,7 @@ public void chunkUnloadEvent(ChunkUnloadEvent event) { } @EventHandler - public void onInstanceRemove(InstancedDungeonRemoveEvent event){ + public void onInstanceRemove(InstancedDungeonRemoveEvent event) { persistentObjects.removeAll(event.getDungeonInstance().getInstancedWorldName()); } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/SuperMobConstructor.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/SuperMobConstructor.java deleted file mode 100644 index d20cb0bcb..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/SuperMobConstructor.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; -import org.bukkit.Bukkit; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; - - -public class SuperMobConstructor { - private SuperMobConstructor() { - } - - /* - This class assumes that the entity has already been filtered and validated before being invoked - */ - public static LivingEntity constructSuperMob(LivingEntity livingEntity) { - - if (!SuperMobProperties.isValidSuperMobType(livingEntity)) { - Bukkit.getLogger().warning("[EliteMobs] Attempted to construct an invalid supermob. Report this to the dev!"); - return null; - } - - String name = ChatColorConverter.convert(SuperMobProperties.getDataInstance(livingEntity).getName()); - double newMaxHealth = SuperMobProperties.getDataInstance(livingEntity).getDefaultMaxHealth() * DefaultConfig.getSuperMobStackAmount(); - - livingEntity.setCustomName(name); - livingEntity.setCustomNameVisible(true); - livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(newMaxHealth); - livingEntity.setHealth(newMaxHealth); - - EntityTracker.registerSuperMob(livingEntity); - - return livingEntity; - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java deleted file mode 100644 index a31a596d6..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.custombosses; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; -import lombok.Getter; -import org.bukkit.Location; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitTask; - -import java.util.HashMap; -import java.util.Map; - - -public class BossMusic { - private final HashMap players = new HashMap<>(); - @Getter - private String name; - @Getter - private int durationTicks; - @Getter - private String name2 = null; - @Getter - private int durationTicks2 = -1; - private BukkitTask bukkitTask = null; - private final CustomBossEntity customBossEntity; - - //Format: name=rsp.name length=durations_ticks->name=rsp.name length=duration_ticks - public BossMusic(String rawString, CustomBossEntity customBossEntity) { - this.customBossEntity = customBossEntity; - if (!rawString.contains("->")) { - parse(rawString, 1); - } else { - String[] rawEntries = rawString.split("->"); - parse(rawEntries[0], 1); - parse(rawEntries[1], 2); - } - } - - private void parse(String rawString, int entryNumber) { - String[] strings = rawString.split(" "); - for (String string : strings) { - String[] parsed = string.split("="); - switch (parsed[0]) { - case "name": - if (entryNumber == 1) name = parsed[1]; - else name2 = parsed[1]; - break; - case "length": - if (entryNumber == 1) { - durationTicks = (int) (Integer.parseInt(parsed[1]) / 1000D * 20D); - } else { - durationTicks2 = (int) (Integer.parseInt(parsed[1]) / 1000D * 20D); - } - break; - default: - new WarningMessage("Failed to get value for boss music!"); - } - } - } - - public void start(CustomBossEntity customBossEntity) { - if (bukkitTask != null) { - bukkitTask.cancel(); - } - bukkitTask = new BukkitRunnable() { - @Override - public void run() { - if (!customBossEntity.exists()) { - stop(); - return; - } - play(customBossEntity.getLocation(), customBossEntity.getCustomBossesConfigFields().getFollowDistance()); - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); - } - - public void stop() { - if (bukkitTask != null) { - bukkitTask.cancel(); - } - for (Map.Entry entry : players.entrySet()) { - entry.getKey().stopSound(name); - if (name2 != null) - entry.getKey().stopSound(name2); - entry.getValue().cancel(); - } - } - - private void play(Location location, double range) { - location.getWorld() - .getNearbyEntities( - location, - range, - range, - range, - entity -> entity.getType().equals(EntityType.PLAYER)) - .forEach(player -> { - if (!players.containsKey((Player) player)) { - ((Player) player).playSound(player.getLocation(), name, 1f, 1f); - startLoopingTask((Player) player, durationTicks); - } - }); - } - - private void startLoopingTask(Player player, int durationTicks) { - BukkitTask songTask; - //Case for a song with no transition - if (name2 == null) { - songTask = new BukkitRunnable() { - @Override - public void run() { - if (!customBossEntity.exists()) { - cancel(); - return; - } - player.playSound(player.getLocation(), name, 1f, 1f); - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, durationTicks); - } - //case for a song with a transition - else { - player.playSound(player.getLocation(), name, 1f, 1f); - songTask = new BukkitRunnable() { - @Override - public void run() { - if (!customBossEntity.exists()) { - cancel(); - return; - } - player.playSound(player.getLocation(), name2, 1f, 1f); - } - }.runTaskTimer(MetadataHandler.PLUGIN, durationTicks, durationTicks2); - } - - players.put(player, songTask); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossTrace.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossTrace.java deleted file mode 100644 index deb8ce765..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossTrace.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.custombosses; - -import com.magmaguy.elitemobs.api.internal.RemovalReason; -import com.magmaguy.elitemobs.utils.DebugMessage; -import com.magmaguy.elitemobs.utils.ServerTime; -import com.magmaguy.elitemobs.utils.WarningMessage; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.List; - -public class BossTrace { - private final long creationTimeStamp; - private final double creationTicksStamp; - //Welcome to my garden of insanity. This is necessary because Minecraft just refuses to cooperate - private final List trace = new ArrayList<>(); - - public BossTrace() { - creationTimeStamp = System.currentTimeMillis(); - creationTicksStamp = ServerTime.getTime(); - String creationString = ChatColor.DARK_GREEN + "Creation timestamp: " + creationTimeStamp; - trace.add(creationString); - } - - - public void spawnPreprocessor(int version) { - if (!DebugMessage.isDebugMode()) return; - String spawnString = ChatColor.YELLOW + getPrefix() + "Spawn preprocessor " + version + "/2"; - trace.add(spawnString); - } - - public void setSpawn() { - if (!DebugMessage.isDebugMode()) return; - String spawnString = ChatColor.GREEN + getPrefix() + "Spawn!"; - trace.add(spawnString); - } - - public void setRemove(RemovalReason removalReason) { - if (!DebugMessage.isDebugMode()) return; - String removeString = ChatColor.RED + getPrefix() + "Remove! Reason: " + removalReason; - trace.add(removeString); - } - - private String getPrefix() { - return "[" + (ServerTime.getTime() - creationTicksStamp) + "t] "; - } - - public void postLog(Player player) { - if (!DebugMessage.isDebugMode()) - player.sendMessage(ChatColor.RED + "[EliteMobs] Debug mode must be on for this to work! Do " + ChatColor.GREEN + "/em debugmode"); - player.sendMessage(ChatColor.GREEN + "[EliteMobs] Here is the full activity log for this boss. A copy is also logged into console!"); - new WarningMessage("Sequential code execution list for boss:"); - for (String string : trace) { - player.sendMessage(string); - new WarningMessage(string); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java index 8ccde70f3..51655d24e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; -import com.magmaguy.elitemobs.utils.Round; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.Round; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -31,6 +31,7 @@ public class CustomBossBossBar { private final Map bossBars = new HashMap<>(); private final HashSet trackingPlayers = new HashSet<>(); private BukkitTask bossBarUpdater; + private boolean warned = false; public CustomBossBossBar(CustomBossEntity customBossEntity) { this.customBossEntity = customBossEntity; @@ -42,7 +43,7 @@ private void sendLocation() { for (Player player : Bukkit.getOnlinePlayers()) { if (!player.getWorld().equals(customBossEntity.getLocation().getWorld())) continue; TextComponent interactiveMessage = new TextComponent(MobCombatSettingsConfig.getBossLocationMessage()); - interactiveMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/elitemobs trackcustomboss " + customBossEntity.getEliteUUID())); + interactiveMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/elitemobs track boss " + customBossEntity.getEliteUUID())); interactiveMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(DefaultConfig.getTrackMessage().replace("$name", customBossEntity.getName())).create())); player.spigot().sendMessage(interactiveMessage); } @@ -147,8 +148,6 @@ public void run() { }.runTaskTimer(MetadataHandler.PLUGIN, 0, 5); } - private boolean warned = false; - private void createBossBar(Player player) { String locationString = (int) customBossEntity.getLocation().getX() + ", " + (int) customBossEntity.getLocation().getY() + @@ -159,8 +158,8 @@ private void createBossBar(Player player) { if (customBossEntity.getHealth() / customBossEntity.getMaxHealth() > 1 || customBossEntity.getHealth() / customBossEntity.getMaxHealth() < 0) { if (!warned) { - new WarningMessage("The following boss had more health than it should: " + customBossEntity.getName()); - new WarningMessage("This is a problem usually caused by running more than one plugin that modifies mob health!" + + Logger.warn("The following boss had more health than it should: " + customBossEntity.getName()); + Logger.warn("This is a problem usually caused by running more than one plugin that modifies mob health!" + " EliteMobs can't fix this issue because it is being caused by another plugin." + " If you want EliteMobs to work correctly, find a way to fix this issue with whatever other plugin is causing it."); warned = true; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java index eab7964bf..d4654b4fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.EliteMobDeathEvent; import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; import com.magmaguy.elitemobs.ondeathcommands.OnDeathCommands; import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Round; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java index 118c72f87..ecc48c5d1 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteMobEnterCombatEvent; import com.magmaguy.elitemobs.api.EliteMobExitCombatEvent; @@ -24,7 +23,11 @@ import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; import com.magmaguy.elitemobs.thirdparty.libsdisguises.DisguiseEntity; -import com.magmaguy.elitemobs.utils.*; +import com.magmaguy.elitemobs.utils.ChunkLocationChecker; +import com.magmaguy.elitemobs.utils.CommandRunner; +import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -42,9 +45,7 @@ import org.bukkit.scheduler.BukkitTask; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; +import java.util.*; public class CustomBossEntity extends EliteEntity implements Listener, PersistentObject, PersistentMovingEntity { @@ -52,8 +53,6 @@ public class CustomBossEntity extends EliteEntity implements Listener, Persisten protected static HashSet trackableCustomBosses = new HashSet<>(); private final List globalReinforcements = new ArrayList<>(); @Getter - private final BossTrace bossTrace = new BossTrace(); - @Getter protected CustomBossesConfigFields customBossesConfigFields; protected CustomBossEntity customBossMount = null; protected LivingEntity livingEntityMount = null; @@ -91,7 +90,7 @@ public class CustomBossEntity extends EliteEntity implements Listener, Persisten private boolean normalizedCombat; @Getter @Setter - private BossMusic bossMusic = null; + private CustomMusic bossMusic = null; @Getter @Setter private double followDistance; @@ -101,7 +100,7 @@ public class CustomBossEntity extends EliteEntity implements Listener, Persisten @Getter @Setter private boolean dynamicLevel = false; - private BukkitTask dynamicLevelUpdater = null; + public static Set dynamicLevelBossEntities = new HashSet<>(); /** * Uses a builder pattern in order to construct a CustomBossEntity at an arbitrary point in the future. Does not @@ -115,7 +114,7 @@ public CustomBossEntity(CustomBossesConfigFields customBossesConfigFields) { //This creates a placeholder empty EliteMobEntity to be filled in later super(); if (customBossesConfigFields.getSong() != null) - bossMusic = new BossMusic(customBossesConfigFields.getSong(), this); + bossMusic = new CustomMusic(customBossesConfigFields.getSong(), this); //This stores everything that will need to be initialized for the EliteMobEntity setCustomBossesConfigFields(customBossesConfigFields); super.setPersistent(customBossesConfigFields.isPersistent()); @@ -171,14 +170,12 @@ public void setCustomBossesConfigFields(CustomBossesConfigFields customBossesCon } public void spawn(Location spawnLocation, int level, boolean silent) { - bossTrace.spawnPreprocessor(1); super.level = level; super.spawnLocation = spawnLocation; spawn(spawnLocation, silent); } public void spawn(Location spawnLocation, boolean silent) { - bossTrace.spawnPreprocessor(2); if (spawnLocation != null && spawnLocation.getWorld() != null && lastTick == spawnLocation.getWorld().getFullTime()) attemptsCounter++; else @@ -187,7 +184,7 @@ public void spawn(Location spawnLocation, boolean silent) { lastTick = spawnLocation.getWorld().getFullTime(); //Use exists() here as the persistent entities will not try to respawn through this method if (exists()) { - new WarningMessage("Warning: " + customBossesConfigFields.getFilename() + " attempted to double spawn " + attemptsCounter + " times!", true); + Logger.warn("Warning: " + customBossesConfigFields.getFilename() + " attempted to double spawn " + attemptsCounter + " times!", true); return; } super.spawnLocation = spawnLocation; @@ -196,7 +193,6 @@ public void spawn(Location spawnLocation, boolean silent) { } public void spawn(boolean silent) { - bossTrace.setSpawn(); if (livingEntity != null && livingEntity.isValid()) return; @@ -205,7 +201,7 @@ public void spawn(boolean silent) { else if (isPersistent) persistentObjectHandler.updatePersistentLocation(spawnLocation); if (spawnLocation == null) { - new WarningMessage("Boss " + customBossesConfigFields.getFilename() + " has a null location! This is probably due to an incorrectly configured regional location!"); + Logger.warn("Boss " + customBossesConfigFields.getFilename() + " has a null location! This is probably due to an incorrectly configured regional location!"); return; } @@ -219,7 +215,7 @@ public void spawn(boolean silent) { super.livingEntity = new CustomBossMegaConsumer(this).spawn(); setNormalizedHealth(); if (super.livingEntity == null) - new WarningMessage("Something just prevented EliteMobs from spawning a Custom Boss! More info up next."); + Logger.warn("Something just prevented EliteMobs from spawning a Custom Boss! More info up next."); } if (!exists()) { existsFailureCount++; @@ -233,25 +229,25 @@ public void spawn(boolean silent) { } if (existsFailureCount > 10) { if (existsFailureCount == 11) { - new WarningMessage("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " " + existsFailureCount + "times, probably due to regional protections or third party plugin incompatibilities."); - new WarningMessage("To avoid cluttering up console, these warnings will now only appear once 6000 attempts for this boss. "); + Logger.warn("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " " + existsFailureCount + "times, probably due to regional protections or third party plugin incompatibilities."); + Logger.warn("To avoid cluttering up console, these warnings will now only appear once 6000 attempts for this boss. "); } if (existsFailureCount % 6000 == 0) { - new WarningMessage("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " " + existsFailureCount + "times, probably due to regional protections or third party plugin incompatibilities."); - new WarningMessage("To avoid cluttering up console, these warnings will now only appear once 6000 attempts for this boss. "); + Logger.warn("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " " + existsFailureCount + "times, probably due to regional protections or third party plugin incompatibilities."); + Logger.warn("To avoid cluttering up console, these warnings will now only appear once 6000 attempts for this boss. "); } return; } if (existsFailureCount > 1) { - new WarningMessage("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " " + existsFailureCount + "times, probably due to regional protections."); + Logger.warn("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " " + existsFailureCount + "times, probably due to regional protections."); return; } - new WarningMessage("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " . Possible reasons for this:"); - new WarningMessage("- The region was protected by a plugin (most likely)"); - new WarningMessage("- The spawn was interfered with by some incompatible third party plugin"); - new WarningMessage("Debug data: "); - new WarningMessage("Chunk is loaded: " + ChunkLocationChecker.locationIsLoaded(spawnLocation)); - new WarningMessage("Attempted spawn location: " + spawnLocation.toString(), true); + Logger.warn("EliteMobs tried and failed to spawn " + customBossesConfigFields.getFilename() + " . Possible reasons for this:"); + Logger.warn("- The region was protected by a plugin (most likely)"); + Logger.warn("- The spawn was interfered with by some incompatible third party plugin"); + Logger.warn("Debug data: "); + Logger.warn("Chunk is loaded: " + ChunkLocationChecker.locationIsLoaded(spawnLocation)); + Logger.warn("Attempted spawn location: " + spawnLocation.toString(), true); return; } @@ -366,6 +362,45 @@ private void spawnMessage() { if (customBossesConfigFields.getAnnouncementPriority() < 3) return; new DiscordSRVAnnouncement(ChatColorConverter.convert(customBossesConfigFields.getSpawnMessage())); } + private static BukkitTask dynamicLevelUpdater = null; + + public static void addToUpdatingDynamicLevels(CustomBossEntity customBossEntity){ + if (!customBossEntity.dynamicLevel) return; + dynamicLevelBossEntities.add(customBossEntity); + } + + public static void startUpdatingDynamicLevels(){ + dynamicLevelUpdater = new BukkitRunnable() { + @Override + public void run() { + Iterator iterator = dynamicLevelBossEntities.iterator(); + while (iterator.hasNext()) { + CustomBossEntity customBossEntity = iterator.next(); + if (!customBossEntity.isValid()) { + iterator.remove(); // Remove from the list instead of canceling + continue; // Skip to the next iteration + } + int currentLevel = customBossEntity.getLevel(); + customBossEntity.getDynamicLevel(customBossEntity.getLocation()); + int newLevel = customBossEntity.getLevel(); + + if (currentLevel == newLevel) { + continue; // Skip to the next iteration if the level hasn't changed + } + + // In theory, the damage should update automatically; the only thing that needs updating should be the health + customBossEntity.setMaxHealth(); + customBossEntity.setNormalizedHealth(); + CustomBossMegaConsumer.setName(customBossEntity.getLivingEntity(), customBossEntity, customBossEntity.level); + } + } + }.runTaskTimer(MetadataHandler.PLUGIN, 20 * 5L, 20 * 5L); + } + + public static void shutdown(){ + dynamicLevelUpdater.cancel(); + dynamicLevelBossEntities.clear(); + } public void getDynamicLevel(Location bossLocation) { int bossLevel = 1; @@ -380,39 +415,16 @@ public void getDynamicLevel(Location bossLocation) { bossLevel = level; } } - updateDynamicLevel(); + startUpdatingDynamicLevel(); super.setLevel(bossLevel); } /** * Upsettingly due to how chunk generation works regional bosses in general don't play along well with dynamic bosses */ - private void updateDynamicLevel() { + private void startUpdatingDynamicLevel() { if (dynamicLevelUpdater != null) return; - CustomBossEntity customBossEntity = this; - dynamicLevelUpdater = new BukkitRunnable() { - @Override - public void run() { - if (customBossEntity.isInCombat()) return; - if (!customBossEntity.isValid() && !customBossEntity.isPersistent) { - cancel(); - return; - } - //for unloaded but persistent bosses - if (customBossEntity.getLivingEntity() == null || !customBossEntity.isValid()) { - return; - } - int currentLevel = customBossEntity.getLevel(); - customBossEntity.getDynamicLevel(customBossEntity.getLocation()); - int newLevel = customBossEntity.getLevel(); - if (currentLevel == newLevel) return; - //In theory the damage should update automatically, the only thing that needs updating should be the health - customBossEntity.setMaxHealth(); - setNormalizedHealth(); - CustomBossMegaConsumer.setName(getLivingEntity(), customBossEntity, level); - - } - }.runTaskTimer(MetadataHandler.PLUGIN, 20 * 5L, 20 * 5L); + dynamicLevelBossEntities.add(this); } private void startBossTrails() { @@ -490,11 +502,7 @@ public void fullHeal() { @Override public void remove(RemovalReason removalReason) { - bossTrace.setRemove(removalReason); - if (dynamicLevelUpdater != null) dynamicLevelUpdater.cancel(); - if (DebugMessage.isDebugMode()) - if (this instanceof RegionalBossEntity && this.phaseBossEntity != null) - new DebugMessage("Regional + Phase boss removal. Reason: " + removalReason); + dynamicLevelBossEntities.remove(this); if (livingEntity != null) persistentLocation = livingEntity.getLocation(); //Remove the living entity super.remove(removalReason); @@ -619,6 +627,12 @@ public void onExitCombat(EliteMobExitCombatEvent event) { return; ((CustomBossEntity) event.getEliteMobEntity()).cullReinforcements(false); } + + @EventHandler + public void onEliteSpawnEvent(EliteMobSpawnEvent event){ + if (event.getEliteMobEntity() instanceof CustomBossEntity customBossEntity) + addToUpdatingDynamicLevels(customBossEntity); + } } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEscapeMechanism.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEscapeMechanism.java index 5c0760d8f..4ca03b294 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEscapeMechanism.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEscapeMechanism.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java index 37a4a8edf..9056b374f 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.EliteMobs; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; @@ -11,7 +10,8 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardSpawnEventBypasser; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.attribute.Attribute; @@ -50,6 +50,19 @@ public CustomBossMegaConsumer(CustomBossEntity customBossEntity) { this.bypassesWorldGuardSpawn = customBossEntity.getBypassesProtections(); } + protected static void setName(LivingEntity livingEntity, CustomBossEntity customBossEntity, int level) { + String parsedName = ChatColorConverter.convert(customBossEntity.customBossesConfigFields.getName().replace("$level", level + "") + .replace("$normalLevel", ChatColorConverter.convert("&2[&a" + level + "&2]&f")) + .replace("$minibossLevel", ChatColorConverter.convert("&6〖&e" + level + "&6〗&f")) + .replace("$bossLevel", ChatColorConverter.convert("&4『&c" + level + "&4』&f")) + .replace("$reinforcementLevel", ChatColorConverter.convert("&8〔&7") + level + "&8〕&f") + .replace("$eventBossLevel", ChatColorConverter.convert("&4「&c" + level + "&4」&f"))); + livingEntity.setCustomName(parsedName); + livingEntity.setCustomNameVisible(DefaultConfig.isAlwaysShowNametags()); + DisguiseEntity.setDisguiseNameVisibility(DefaultConfig.isAlwaysShowNametags(), livingEntity, parsedName); + customBossEntity.setName(parsedName, false); + } + /** * Attempts to spawn a {@link CustomBossEntity} whose spawn location has already been set. * @@ -57,12 +70,12 @@ public CustomBossMegaConsumer(CustomBossEntity customBossEntity) { */ public LivingEntity spawn() { if (spawnLocation == null) { - new WarningMessage("Custom Boss Entity " + customBossesConfigFields.getFilename() + " tried to spawn without a valid spawn location getting assigned! Report this to the developer!"); + Logger.warn("Custom Boss Entity " + customBossesConfigFields.getFilename() + " tried to spawn without a valid spawn location getting assigned! Report this to the developer!"); return null; } if (EliteMobs.worldGuardIsEnabled) { if (!WorldGuardFlagChecker.checkFlag(spawnLocation, WorldGuardCompatibility.getELITEMOBS_SPAWN_FLAG())) { - new WarningMessage("Attempted to spawn " + customBossesConfigFields.getFilename() + " in location " + + Logger.warn("Attempted to spawn " + customBossesConfigFields.getFilename() + " in location " + spawnLocation + " which is protected by WorldGuard with elitemobs-spawning deny! This should not have happened."); return null; } @@ -78,19 +91,6 @@ public LivingEntity spawn() { return livingEntity; } - protected static void setName(LivingEntity livingEntity, CustomBossEntity customBossEntity, int level) { - String parsedName = ChatColorConverter.convert(customBossEntity.customBossesConfigFields.getName().replace("$level", level + "") - .replace("$normalLevel", ChatColorConverter.convert("&2[&a" + level + "&2]&f")) - .replace("$minibossLevel", ChatColorConverter.convert("&6〖&e" + level + "&6〗&f")) - .replace("$bossLevel", ChatColorConverter.convert("&4『&c" + level + "&4』&f")) - .replace("$reinforcementLevel", ChatColorConverter.convert("&8〔&7") + level + "&8〕&f") - .replace("$eventBossLevel", ChatColorConverter.convert("&4「&c" + level + "&4」&f"))); - livingEntity.setCustomName(parsedName); - livingEntity.setCustomNameVisible(DefaultConfig.isAlwaysShowNametags()); - DisguiseEntity.setDisguiseNameVisibility(DefaultConfig.isAlwaysShowNametags(), livingEntity, parsedName); - customBossEntity.setName(parsedName, false); - } - private void setBaby(LivingEntity livingEntity) { if (livingEntity instanceof Ageable) if (customBossesConfigFields.isBaby()) @@ -111,7 +111,7 @@ private void setDisguise(LivingEntity livingEntity) { try { DisguiseEntity.disguise(customBossesConfigFields.getDisguise(), livingEntity, customBossesConfigFields.getCustomDisguiseData(), customBossesConfigFields.getFilename()); } catch (Exception ex) { - new WarningMessage("Failed to load LibsDisguises disguise correctly!"); + Logger.warn("Failed to load LibsDisguises disguise correctly!"); } } @@ -123,7 +123,7 @@ private void setCustomModel(LivingEntity livingEntity) { customBossEntity.setCustomModel(CustomModel.generateCustomModel(livingEntity, customBossesConfigFields.getCustomModel(), customBossEntity.getName())); } catch (Exception exception) { customBossEntity.setCustomModel(null); - new WarningMessage("Failed to initialize Custom Model for Custom Boss " + customBossesConfigFields.getFilename()); + Logger.warn("Failed to initialize Custom Model for Custom Boss " + customBossesConfigFields.getFilename()); exception.printStackTrace(); } } @@ -150,7 +150,7 @@ private void setEquipment(LivingEntity livingEntity) { } } } catch (Exception ex) { - new WarningMessage("Tried to assign a material slot to an invalid entity! Boss is from file" + customBossesConfigFields.getFilename()); + Logger.warn("Tried to assign a material slot to an invalid entity! Boss is from file" + customBossesConfigFields.getFilename()); } } @@ -164,6 +164,7 @@ public void applyBossFeatures(LivingEntity livingEntity) { setFollowRange(livingEntity); setMovementSpeed(livingEntity); setFrozen(livingEntity); + setScale(livingEntity); customBossEntity.setMovementSpeedAttribute(livingEntity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue()); customBossEntity.setFollowDistance(livingEntity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).getBaseValue()); @@ -173,8 +174,8 @@ public void applyBossFeatures(LivingEntity livingEntity) { ((EnderDragon) livingEntity).getDragonBattle().generateEndPortal(false); } - if (livingEntity instanceof Slime){ - ((Slime)livingEntity).setSize(customBossEntity.getCustomBossesConfigFields().getSlimeSize()); + if (livingEntity instanceof Slime) { + ((Slime) livingEntity).setSize(customBossEntity.getCustomBossesConfigFields().getSlimeSize()); } customBossEntity.setUnsyncedLivingEntity(livingEntity); EntityTracker.registerEliteMob(customBossEntity, livingEntity); @@ -192,4 +193,8 @@ private void setMovementSpeed(LivingEntity livingEntity) { livingEntity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(customBossesConfigFields.getMovementSpeedAttribute()); } + private void setScale(LivingEntity livingEntity) { + if (customBossesConfigFields.getScale() != 1D) + livingEntity.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(customBossesConfigFields.getScale()); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMount.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMount.java index d1e34b47d..66e8d4b28 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMount.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMount.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.combatsystem.antiexploit.PreventMountExploit; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.scheduler.BukkitRunnable; @@ -17,7 +17,7 @@ private CustomBossMount() { public static CustomBossEntity generateMount(CustomBossEntity customBossEntity) { if (customBossEntity.customBossesConfigFields.getMountedEntity() == null) return null; if (customBossEntity.getLivingEntity() == null) { - new WarningMessage("Could not spawn mount for boss " + customBossEntity.customBossesConfigFields.getFilename() + " because the boss has no living entity! This probably means some other plugin is preventing this boss from spawning."); + Logger.warn("Could not spawn mount for boss " + customBossEntity.customBossesConfigFields.getFilename() + " because the boss has no living entity! This probably means some other plugin is preventing this boss from spawning."); return null; } try { @@ -34,7 +34,7 @@ public static CustomBossEntity generateMount(CustomBossEntity customBossEntity) if (customBossesConfigFields != null) { CustomBossEntity mountEntity = CustomBossEntity.createCustomBossEntity(customBossEntity.customBossesConfigFields.getMountedEntity()); if (mountEntity == null) { - new WarningMessage("Mount for boss " + customBossEntity.getCustomBossesConfigFields().getFilename() + " is not valid!"); + Logger.warn("Mount for boss " + customBossEntity.getCustomBossesConfigFields().getFilename() + " is not valid!"); return null; } mountEntity.setSpawnLocation(customBossEntity.getLivingEntity().getLocation()); @@ -61,7 +61,7 @@ public void run() { return mountEntity; } - new WarningMessage("Attempted to make Custom Boss " + customBossEntity.customBossesConfigFields.getFilename() + " mount invalid" + + Logger.warn("Attempted to make Custom Boss " + customBossEntity.customBossesConfigFields.getFilename() + " mount invalid" + " entity or boss " + customBossEntity.customBossesConfigFields.getMountedEntity() + " . Fix this in the configuration file."); } return null; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 25340e4a3..8bac40bfb 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -4,8 +4,7 @@ import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.powerstances.VisualItemInitializer; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; @@ -36,7 +35,7 @@ private void startBossTrails() { for (String string : customBossEntity.customBossesConfigFields.getTrails()) { try { Particle particle = Particle.valueOf(string); - if (particle.equals(Particle.BLOCK_DUST)) return; + if (particle.equals(Particle.BLOCK)) return; doParticleTrail(particle); } catch (Exception ex) { } @@ -49,7 +48,13 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - if (!VersionChecker.serverVersionOlderThan(18, 0) && particle.equals(Particle.BLOCK_MARKER)) + if (particle.equals(Particle.BLOCK_MARKER) || + particle.equals(Particle.ENTITY_EFFECT) || + particle.equals(Particle.DUST_PILLAR) || + particle.equals(Particle.FALLING_DUST) || + particle.equals(Particle.BLOCK) || + particle.equals(Particle.ITEM) || + particle.equals(Particle.DUST)) return; bukkitTasks.add(new BukkitRunnable() { @Override diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomMusic.java new file mode 100644 index 000000000..dc548b0b9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomMusic.java @@ -0,0 +1,243 @@ +package com.magmaguy.elitemobs.mobconstructor.custombosses; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.elitemobs.api.PlayerTeleportEvent; +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; +import com.magmaguy.magmacore.util.Logger; +import lombok.Getter; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import java.util.HashMap; +import java.util.Map; + + +public class CustomMusic { + private static final HashMap playerSongSingleton = new HashMap<>(); + private static final HashMap dungeonMusic = new HashMap<>(); + private final HashMap players = new HashMap<>(); + private final ContentType contentType; + private CustomBossEntity customBossEntity = null; + private DungeonPackagerConfigFields dungeonPackagerConfigFields = null; + @Getter + private String name; + @Getter + private int durationTicks; + @Getter + private String name2 = null; + @Getter + private int durationTicks2 = -1; + private BukkitTask bossScannerTask = null; + private BukkitTask songTask = null; + private World world; + + //Format: name=rsp.name length=durations_milliseconds->name=rsp.name length=duration_milliseconds + public CustomMusic(String rawString, CustomBossEntity customBossEntity) { + this.customBossEntity = customBossEntity; + contentType = ContentType.BOSS; + if (!rawString.contains("->")) { + parse(rawString, 1); + } else { + String[] rawEntries = rawString.split("->"); + parse(rawEntries[0], 1); + parse(rawEntries[1], 2); + } + } + + public CustomMusic(String rawString, DungeonPackagerConfigFields dungeonPackagerConfigFields, World world) { + this.world = world; + this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; + contentType = ContentType.DUNGEON; + if (!rawString.contains("->")) { + parse(rawString, 1); + } else { + String[] rawEntries = rawString.split("->"); + parse(rawEntries[0], 1); + parse(rawEntries[1], 2); + } + dungeonMusic.put(world, this); + } + + public static void shutdown() { + dungeonMusic.clear(); + playerSongSingleton.clear(); + } + + private void parse(String rawString, int entryNumber) { + String[] strings = rawString.split(" "); + for (String string : strings) { + String[] parsed = string.split("="); + switch (parsed[0]) { + case "name": + if (entryNumber == 1) name = parsed[1]; + else name2 = parsed[1]; + break; + case "length": + if (entryNumber == 1) { + durationTicks = (int) (Integer.parseInt(parsed[1]) / 1000D * 20D); + } else { + durationTicks2 = (int) (Integer.parseInt(parsed[1]) / 1000D * 20D); + } + break; + default: + Logger.warn("Failed to get value for boss music!"); + } + } + } + + public void start(CustomBossEntity customBossEntity) { + if (bossScannerTask != null) { + bossScannerTask.cancel(); + } + bossScannerTask = new BukkitRunnable() { + @Override + public void run() { + if (!customBossEntity.exists()) { + stop(); + return; + } + play(customBossEntity.getLocation(), customBossEntity.getCustomBossesConfigFields().getFollowDistance()); + } + }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + } + + public void stop() { + if (bossScannerTask != null) { + bossScannerTask.cancel(); + } + for (Map.Entry entry : players.entrySet()) { + entry.getKey().stopSound(name); + if (name2 != null) + entry.getKey().stopSound(name2); + entry.getValue().songTask.cancel(); + } + } + + private void play(Location location, double range) { + location.getWorld() + .getNearbyEntities( + location, + range, + range, + range, + entity -> entity.getType().equals(EntityType.PLAYER)) + .forEach(player -> { + CustomMusic currentCustomMusic = playerSongSingleton.get((Player) player); + if (currentCustomMusic != null && !currentCustomMusic.equals(this)) { + currentCustomMusic.songTask.cancel(); + ((Player) player).stopSound(currentCustomMusic.name); + if (name2 != null) + ((Player) player).stopSound(currentCustomMusic.name2); + playerSongSingleton.remove((Player) player); + } + if (!players.containsKey((Player) player)) { + ((Player) player).playSound(player.getLocation(), name, 1f, 1f); + startLoopingTask((Player) player, durationTicks); + } + }); + } + + private void play(Player player) { + startLoopingTask(player, durationTicks); + players.put(player, this); + //Boss music overrides dungeon music + if (playerSongSingleton.containsKey(player) && !players.get(player).equals(this)) return; + player.playSound(player.getLocation(), name, 1f, 1f); + playerSongSingleton.put(player, this); + } + + private void startLoopingTask(Player player, int durationTicks) { + //Case for a song with no transition + CustomMusic customMusic = this; + if (name2 == null) { + songTask = new BukkitRunnable() { + @Override + public void run() { + if (contentType == ContentType.BOSS && !customBossEntity.exists() || + contentType == ContentType.BOSS && player.getLocation().distanceSquared(customBossEntity.getLivingEntity().getLocation()) > Math.pow(customBossEntity.getFollowDistance() * 1.5, 2) || + contentType == ContentType.DUNGEON && !player.getWorld().equals(world)) { + cancel(); + players.remove(player); + playerSongSingleton.remove(player); + return; + } + if (playerSongSingleton.containsKey(player) && !players.get(player).equals(customMusic)) return; + if (!playerSongSingleton.containsKey(player)) playerSongSingleton.put(player, customMusic); + player.playSound(player.getLocation(), name, 1f, 1f); + } + }.runTaskTimer(MetadataHandler.PLUGIN, 0, durationTicks); + } + //case for a song with a transition + else { + player.playSound(player.getLocation(), name, 1f, 1f); + songTask = new BukkitRunnable() { + @Override + public void run() { + if (contentType == ContentType.BOSS && !customBossEntity.exists() || + contentType == ContentType.BOSS && player.getLocation().distanceSquared(customBossEntity.getLivingEntity().getLocation()) > Math.pow(customBossEntity.getFollowDistance() * 1.5, 2) || + contentType == ContentType.DUNGEON && !player.getWorld().equals(world)) { + cancel(); + players.remove(player); + playerSongSingleton.remove(player); + return; + } + player.playSound(player.getLocation(), name2, 1f, 1f); + } + }.runTaskTimer(MetadataHandler.PLUGIN, durationTicks, durationTicks2); + } + + players.put(player, this); + } + + private enum ContentType { + BOSS, + DUNGEON + } + + public static class CustomMusicEvents implements Listener { + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onTeleport(PlayerTeleportEvent event) { + EliteMobsWorld eliteMobsWorld = EliteMobsWorld.getEliteMobsWorld(event.getDestination().getWorld().getUID()); + if (eliteMobsWorld == null || eliteMobsWorld.getDungeonPackagerConfigFields().getSong() == null) return; + CustomMusic customMusic = dungeonMusic.get(event.getDestination().getWorld()); + if (customMusic == null) { + Logger.warn("aFailed to get custom music for " + event.getDestination().getWorld().getName()); + return; + } + //Wait for a second after teleporting, just to make sure + new BukkitRunnable() { + @Override + public void run() { + customMusic.play(event.getPlayer()); + } + }.runTaskLater(MetadataHandler.PLUGIN, 20); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onLogin(PlayerJoinEvent event) { + EliteMobsWorld eliteMobsWorld = EliteMobsWorld.getEliteMobsWorld(event.getPlayer().getWorld().getUID()); + if (eliteMobsWorld == null || eliteMobsWorld.getDungeonPackagerConfigFields().getSong() == null) return; + CustomMusic customMusic = dungeonMusic.get(event.getPlayer().getWorld()); + if (customMusic == null) { + Logger.warn("Failed to get custom music for " + event.getPlayer().getWorld().getName()); + return; + } + //Wait for a second after teleporting, just to make sure + new BukkitRunnable() { + @Override + public void run() { + customMusic.play(event.getPlayer()); + } + }.runTaskLater(MetadataHandler.PLUGIN, 20); + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java index e544b1c1d..5e5a59a2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java @@ -3,12 +3,13 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import com.magmaguy.elitemobs.config.powers.PowersConfig; import com.magmaguy.elitemobs.config.powers.PowersConfigFields; +import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.BonusCoins; import com.magmaguy.elitemobs.powers.meta.CustomSummonPower; import com.magmaguy.elitemobs.powers.meta.ElitePower; import com.magmaguy.elitemobs.powers.scripts.EliteScript; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import java.util.ArrayList; import java.util.HashSet; @@ -18,7 +19,7 @@ public class ElitePowerParser { public static HashSet parsePowers(CustomBossesConfigFields customBossesConfigFields, CustomBossEntity customBossEntity) { - HashSet elitePowers = new HashSet<>(EliteScript.generateBossScripts(customBossesConfigFields.getEliteScript())); + HashSet elitePowers = new HashSet<>(EliteScript.generateBossScripts(customBossesConfigFields.getEliteScript(), customBossEntity)); if (customBossesConfigFields.getPowers() == null) return elitePowers; CustomSummonPower customSummonPower = null; List powers = new ArrayList<>(customBossesConfigFields.getPowers()); @@ -35,14 +36,14 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos customSummonPower.addEntry(powerName, customBossesConfigFields.getFilename()); else { String[] parsedPowerName = powerName.split(":"); - ElitePower elitePower = addPower(parsedPowerName[0], elitePowers, customBossesConfigFields); + ElitePower elitePower = addPower(parsedPowerName[0], elitePowers, customBossesConfigFields, customBossEntity); if (elitePower == null) continue; if (elitePower.getPowersConfigFields().getFilename().equals("bonus_coins.yml")) if (parsedPowerName.length > 1) try { ((BonusCoins) elitePower).setCoinMultiplier(Double.parseDouble(parsedPowerName[1])); } catch (Exception ex) { - new WarningMessage("Multiplier " + parsedPowerName[1] + " for Bonus Coins power is not a valid multiplier!"); + Logger.warn("Multiplier " + parsedPowerName[1] + " for Bonus Coins power is not a valid multiplier!"); } } //Parses more advanced powers, like reinforcements and powers with difficulty settings @@ -84,23 +85,23 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos if (string != null && !string.isEmpty()) { PowersConfigFields powersConfigFields = PowersConfig.getPower(string); if (powersConfigFields == null) { - new WarningMessage("Invalid power name " + string + " in file " + customBossesConfigFields.getFilename()); + Logger.warn("Invalid power name " + string + " in file " + customBossesConfigFields.getFilename()); } else { - addPower(string, elitePowers, customBossesConfigFields); + addPower(string, elitePowers, customBossesConfigFields, customBossEntity); } } else - new WarningMessage("No valid power name in boss config " + customBossesConfigFields.getFilename()); + Logger.warn("No valid power name in boss config " + customBossesConfigFields.getFilename()); } } } return elitePowers; } - private static ElitePower addPower(String powerName, HashSet elitePowers, CustomBossesConfigFields customBossesConfigFields) { + private static ElitePower addPower(String powerName, HashSet elitePowers, CustomBossesConfigFields customBossesConfigFields, EliteEntity eliteEntity) { PowersConfigFields powersConfigFields = PowersConfig.getPower(powerName); if (powersConfigFields != null) { if (!powersConfigFields.getEliteScriptBlueprints().isEmpty()) { - elitePowers.addAll(EliteScript.generateBossScripts(powersConfigFields.getEliteScriptBlueprints())); + elitePowers.addAll(EliteScript.generateBossScripts(powersConfigFields.getEliteScriptBlueprints(), eliteEntity)); return null; } ElitePower elitePower; @@ -109,11 +110,11 @@ private static ElitePower addPower(String powerName, HashSet elitePo elitePowers.add(elitePower); return elitePower; } catch (Exception ex) { - new WarningMessage("Could not process power " + powerName); + Logger.warn("Could not process power " + powerName); return null; } } else - new WarningMessage("Warning: power name " + powerName + " for boss " + customBossesConfigFields.getFilename() + " is not registered! Skipping it for custom mob construction..."); + Logger.warn("Warning: power name " + powerName + " for boss " + customBossesConfigFields.getFilename() + " is not registered! Skipping it for custom mob construction..."); return null; } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/InstancedBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/InstancedBossEntity.java index 0814f415d..c3e2d980b 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/InstancedBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/InstancedBossEntity.java @@ -8,7 +8,7 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.World; @@ -28,7 +28,7 @@ public InstancedBossEntity(CustomBossesConfigFields customBossesConfigFields, Lo super.elitePowers = ElitePowerParser.parsePowers(customBossesConfigFields, this); if (level == -1) { if (dungeonInstance.getPlayers().isEmpty()) - new WarningMessage("Failed to get players for new instance when assigning dynamic level! The bosses will default to level 1."); + Logger.warn("Failed to get players for new instance when assigning dynamic level! The bosses will default to level 1."); else level = ElitePlayerInventory.getPlayer(dungeonInstance.getPlayers().stream().findFirst().get()).getNaturalMobSpawnLevel(true); } @@ -41,7 +41,7 @@ public static void shutdown() { public static void add(String stringLocation, CustomBossesConfigFields customBossesConfigFields) { String blueprintWorldName = stringLocation.split(",")[0]; if (blueprintWorldName == null || blueprintWorldName.isEmpty()) { - new WarningMessage("Failed to get blueprint world location for custom boss " + customBossesConfigFields.getFilename() + " !"); + Logger.warn("Failed to get blueprint world location for custom boss " + customBossesConfigFields.getFilename() + " !"); return; } instancedBossEntities.put(blueprintWorldName, new InstancedBossContainer(ConfigurationLocation.serialize(stringLocation, true), customBossesConfigFields)); diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java index e12947d37..6bad14855 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java @@ -8,7 +8,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.event.EventHandler; @@ -34,7 +34,7 @@ public PhaseBossEntity(CustomBossEntity customBossEntity) { for (String phaseConfigFile : customBossEntity.getCustomBossesConfigFields().getPhases()) { CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(phaseConfigFile.split(":")[0]); if (customBossesConfigFields == null) { - new WarningMessage("Phase boss " + customBossEntity.getCustomBossesConfigFields() + " has an invalid config entry for phase " + phaseConfigFile.split(":")[0] + " - this file could not be found. The boss will not be able to do this phase until it is fixed!"); + Logger.warn("Phase boss " + customBossEntity.getCustomBossesConfigFields() + " has an invalid config entry for phase " + phaseConfigFile.split(":")[0] + " - this file could not be found. The boss will not be able to do this phase until it is fixed!"); } double healthPercentage = Double.parseDouble(phaseConfigFile.split(":")[1]); unsortedBossPhases.add(new BossPhase(customBossesConfigFields, healthPercentage)); @@ -43,7 +43,7 @@ public PhaseBossEntity(CustomBossEntity customBossEntity) { this.bossPhases = unsortedBossPhases; currentPhase = bossPhases.get(0); } catch (Exception ex) { - new WarningMessage("Your phase boss " + customBossEntity.customBossesConfigFields.getFilename() + " does not have a valid phases setup. Its phases will not work."); + Logger.warn("Your phase boss " + customBossEntity.customBossesConfigFields.getFilename() + " does not have a valid phases setup. Its phases will not work."); } } @@ -54,19 +54,19 @@ public boolean isInFirstPhase() { private void switchPhase(BossPhase bossPhase, RemovalReason removalReason, double healthPercentage) { if (isInFirstPhase()) originalSpawnLocation = customBossEntity.getSpawnLocation().clone(); if (bossPhase.equals(currentPhase)) { - new WarningMessage("Attempted to change the boss phase to what it already was.", true); + Logger.warn("Attempted to change the boss phase to what it already was.", true); return; } customBossEntity.remove(removalReason); if (customBossEntity.getCustomModel() != null) customBossEntity.getCustomModel().switchPhase(); if (bossPhase.customBossesConfigFields == null) { - new WarningMessage("A phase for phase boss " + bossPhases.get(0).customBossesConfigFields.getFilename() + " was not valid! The boss will not be able to switch phases until it is fixed."); + Logger.warn("A phase for phase boss " + bossPhases.get(0).customBossesConfigFields.getFilename() + " was not valid! The boss will not be able to switch phases until it is fixed."); return; } customBossEntity.setCustomBossesConfigFields(bossPhase.customBossesConfigFields); if (removalReason.equals(RemovalReason.PHASE_BOSS_RESET)) { if (bossPhase.customBossesConfigFields.getSong() != null) - customBossEntity.setBossMusic(new BossMusic(bossPhase.customBossesConfigFields.getSong(), customBossEntity)); + customBossEntity.setBossMusic(new CustomMusic(bossPhase.customBossesConfigFields.getSong(), customBossEntity)); //Necessary to reset phase bosses which move their spawn point via teleportation customBossEntity.setSpawnLocation(originalSpawnLocation); customBossEntity.setRespawnOverrideLocation(originalSpawnLocation); @@ -89,11 +89,14 @@ private void switchPhase(BossPhase bossPhase, RemovalReason removalReason, doubl customBossEntity.setRespawnOverrideLocation(customBossEntity.getLocation()); } //Handle music, soundtrack shouldn't change if the new one is the same - if (bossPhase.customBossesConfigFields.getSong() != null - && currentPhase.customBossesConfigFields.getSong() != null) { + if (bossPhase.customBossesConfigFields.getSong() != null) { + if (currentPhase.customBossesConfigFields.getSong() == null){ + customBossEntity.setBossMusic(new CustomMusic(bossPhase.customBossesConfigFields.getSong(), customBossEntity)); + customBossEntity.getBossMusic().start(customBossEntity); + } if (!bossPhase.customBossesConfigFields.getSong().equals(currentPhase.customBossesConfigFields.getSong())) { if (customBossEntity.getBossMusic() != null) customBossEntity.getBossMusic().stop(); - customBossEntity.setBossMusic(new BossMusic(bossPhase.customBossesConfigFields.getSong(), customBossEntity)); + customBossEntity.setBossMusic(new CustomMusic(bossPhase.customBossesConfigFields.getSong(), customBossEntity)); } } //Make sure the chunk is loaded so the boss can be initialized properly, or else you'll have some issues with health diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java index 2058b84d8..937ac2233 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java @@ -3,7 +3,6 @@ import com.google.common.collect.ArrayListMultimap; import com.magmaguy.easyminecraftgoals.NMSManager; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.api.internal.NewSchematicPackageRelativeBossLocationEvent; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; @@ -15,14 +14,12 @@ import com.magmaguy.elitemobs.pathfinding.Navigation; import com.magmaguy.elitemobs.powers.SpiritWalk; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.attribute.Attribute; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; @@ -51,6 +48,7 @@ public class RegionalBossEntity extends CustomBossEntity implements PersistentOb @Getter @Setter private List onRemoveTransitiveBlocks; + @Getter private boolean removed = false; private BukkitTask respawnTask = null; @@ -144,7 +142,7 @@ public static void save() { try { customBossesConfigFields.getFileConfiguration().save(customBossesConfigFields.getFile()); } catch (Exception ex) { - new WarningMessage("Failed to save respawn timer for " + customBossesConfigFields.getFileConfiguration().getName() + " !"); + Logger.warn("Failed to save respawn timer for " + customBossesConfigFields.getFileConfiguration().getName() + " !"); } } } @@ -180,7 +178,7 @@ public boolean isRespawning() { public void saveNewLocation() { if (spawnLocation == null) { - new WarningMessage("Failed to save regional boss because it failed to spawn correctly!"); + Logger.warn("Failed to save regional boss because it failed to spawn correctly!"); } customBossesConfigFields.setFilesOutOfSync(true); rawString = ConfigurationLocation.deserialize(spawnLocation); @@ -241,7 +239,7 @@ public void checkLeash() { SpiritWalk.spiritWalkRegionalBossAnimation(regionalBossEntity, getLivingEntity().getLocation(), getSpawnLocation()); } catch (Exception ex) { ex.printStackTrace(); - new WarningMessage("Async leash task errored!"); + Logger.warn("Async leash task errored!"); } }, 20L * 3, 20L * 3); } @@ -310,21 +308,12 @@ private void permanentlyRemove() { @Override public void chunkLoad() { super.chunkLoad(); - //checkLeash(); - } - - public static class RegionalBossEntityEvents implements Listener { - @EventHandler(ignoreCancelled = true) - public void onNewMinidungeonRelativeBossLocationEvent(NewSchematicPackageRelativeBossLocationEvent event) { - new RegionalBossEntity(event.getCustomBossesConfigFields(), ConfigurationLocation.deserialize(event.getRealLocation())); - event.getCustomBossesConfigFields().setFilesOutOfSync(true); - } } public void removeSlow() { if (getCustomBossesConfigFields().isAlert() || getLivingEntity() == null) return; - getLivingEntity().getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(getFollowDistance()); - getLivingEntity().getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(getMovementSpeedAttribute()); + getLivingEntity().getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(getFollowDistance()); + getLivingEntity().getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(getMovementSpeedAttribute()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlock.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlock.java index 927d5d363..f51a2ff88 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlock.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlock.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.elitemobs.config.LegacyValueConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -35,10 +36,10 @@ public static List serializeTransitiveBlocks(List deser double x = Double.parseDouble(vector[0]); double y = Double.parseDouble(vector[1]); double z = Double.parseDouble(vector[2]); - BlockData blockData = Bukkit.getServer().createBlockData(elements[1]); + BlockData blockData = Bukkit.getServer().createBlockData(LegacyValueConverter.parseDeserializedBlocks(elements[1])); transitiveBlocks.add(new TransitiveBlock(blockData, new Vector(x, y, z))); } catch (Exception ex) { - new WarningMessage("Failed to serialize Transitive Block! Issue with entry " + deserializedString + " in file " + filename); + Logger.warn("Failed to serialize Transitive Block! Issue with entry " + deserializedString + " in file " + filename); } } return transitiveBlocks; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlockCommand.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlockCommand.java index 8f61e3dc3..2e1d9233b 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlockCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlockCommand.java @@ -5,7 +5,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import com.magmaguy.elitemobs.mobconstructor.custombosses.PhaseBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.ChatColor; @@ -51,7 +51,7 @@ public TransitiveBlockCommand(Player player, CustomBossesConfigFields customBoss for (PhaseBossEntity.BossPhase bossPhase : iteratedRegionalBossEntity.getPhaseBossEntity().getBossPhases()) { if (bossPhase.customBossesConfigFields == null) { String message = "Could not find valid custom boss config fields for phase boss! This is probably a configuration issue. Check why your phase boss isn't valid on console logs on /em reload and make sure to test the phases in-game!"; - new WarningMessage(message); + Logger.warn(message); player.sendMessage(message); } if (bossPhase.customBossesConfigFields.equals(customBossesConfigFields)) { diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBossBlock.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBossBlock.java index 193a30a5a..9b7e89f0d 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBossBlock.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBossBlock.java @@ -2,10 +2,9 @@ import com.magmaguy.elitemobs.api.EliteMobRemoveEvent; import com.magmaguy.elitemobs.api.EliteMobSpawnEvent; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.utils.ChunkLocationChecker; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -20,8 +19,6 @@ private static void setBlockData(RegionalBossEntity regionalBossEntity, Transiti Location location; if (!ChunkLocationChecker.locationIsLoaded(spawnLocation)) return; double rotation = 0; - if (regionalBossEntity.getEmPackage() instanceof SchematicPackage) - rotation = regionalBossEntity.getEmPackage().getDungeonPackagerConfigFields().getCalculatedRotation(); BlockData blockData = transitiveBlock.getBlockData().clone(); @@ -56,7 +53,7 @@ private static int blockFaceToInt(BlockFace blockFace) { case WEST: return 4; default: - new WarningMessage("Attempted to rotate a block through the transitive block system that does not have a north / south / east / west face. This is not currently supported."); + Logger.warn("Attempted to rotate a block through the transitive block system that does not have a north / south / east / west face. This is not currently supported."); return 1; } } @@ -72,7 +69,7 @@ private static BlockFace intToBlockFace(int blockFaceValue) { case 4: return BlockFace.WEST; default: - new WarningMessage("Attempted to rotate a block through the transitive block system that does not have a north / south / east / west face. This is not currently supported."); + Logger.warn("Attempted to rotate a block through the transitive block system that does not have a north / south / east / west face. This is not currently supported."); return BlockFace.NORTH; } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/PluginMobProperties.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/PluginMobProperties.java index 8d36e1c58..d857624db 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/PluginMobProperties.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/PluginMobProperties.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; import org.bukkit.entity.EntityType; public abstract class PluginMobProperties { @@ -14,7 +13,6 @@ public abstract class PluginMobProperties { public double baseDamage; public static void initializePluginMobValues() { - SuperMobProperties.initializeSuperMobValues(); EliteMobProperties.initializeEliteMobValues(); } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBee.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBee.java index 136b5e507..fa108666e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBee.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBee.java @@ -1,15 +1,11 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class EliteBee extends EliteMobProperties { public EliteBee() { - if (VersionChecker.serverVersionOlderThan(15, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.BEE).getName(); this.entityType = EntityType.BEE; this.defaultMaxHealth = 10; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBogged.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBogged.java new file mode 100644 index 000000000..a929f0cb7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBogged.java @@ -0,0 +1,16 @@ +package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; +import org.bukkit.entity.EntityType; + +public class EliteBogged extends EliteMobProperties { + + public EliteBogged() { + this.name = MobPropertiesConfig.getMobProperties().get(EntityType.BOGGED).getName(); + this.entityType = EntityType.BOGGED; + this.defaultMaxHealth = 16; + this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.BOGGED).getBaseDamage(); + this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.BOGGED).isEnabled(); + eliteMobData.add(this); + } +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBreeze.java new file mode 100644 index 000000000..43fdb24bd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBreeze.java @@ -0,0 +1,16 @@ +package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; +import org.bukkit.entity.EntityType; + +public class EliteBreeze extends EliteMobProperties { + + public EliteBreeze() { + this.name = MobPropertiesConfig.getMobProperties().get(EntityType.BREEZE).getName(); + this.entityType = EntityType.BREEZE; + this.defaultMaxHealth = 30; + this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.BREEZE).getBaseDamage(); + this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.BREEZE).isEnabled(); + eliteMobData.add(this); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteGoat.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteGoat.java index 778378d4a..df8b1b73f 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteGoat.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteGoat.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class EliteGoat extends EliteMobProperties { public EliteGoat() { - if (VersionChecker.serverVersionOlderThan(17, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.GOAT).getName(); this.entityType = EntityType.GOAT; this.defaultMaxHealth = 10; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteHoglin.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteHoglin.java index 0f4529dc9..73f223ff0 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteHoglin.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteHoglin.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class EliteHoglin extends EliteMobProperties { public EliteHoglin() { - if (VersionChecker.serverVersionOlderThan(16, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.HOGLIN).getName(); this.entityType = EntityType.HOGLIN; this.defaultMaxHealth = 40; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteMobProperties.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteMobProperties.java index e15041f91..6f8ba741f 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteMobProperties.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteMobProperties.java @@ -72,6 +72,9 @@ public static void initializeEliteMobValues() { new EliteWarden(); new EliteSlime(); new EliteMagmaCube(); + new EliteBogged(); + new EliteBreeze(); + new EliteWither(); } public static boolean isValidEliteMobType(Entity entity) { diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglin.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglin.java index 7d624c7a5..b809d6d98 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglin.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglin.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class ElitePiglin extends EliteMobProperties { public ElitePiglin() { - if (VersionChecker.serverVersionOlderThan(16, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.PIGLIN).getName(); this.entityType = EntityType.PIGLIN; this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.PIGLIN).getBaseDamage(); diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglinBrute.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglinBrute.java index 33dcd7816..363171457 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglinBrute.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/ElitePiglinBrute.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class ElitePiglinBrute extends EliteMobProperties { public ElitePiglinBrute() { - if (VersionChecker.serverVersionOlderThan(16, 2)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.PIGLIN_BRUTE).getName(); this.entityType = EntityType.PIGLIN_BRUTE; this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.PIGLIN_BRUTE).getBaseDamage(); diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWarden.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWarden.java index 4057516b9..fdbf04ac4 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWarden.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWarden.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class EliteWarden extends EliteMobProperties { public EliteWarden() { - if (VersionChecker.serverVersionOlderThan(19, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.WARDEN).getName(); this.entityType = EntityType.WARDEN; this.defaultMaxHealth = 500; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWither.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWither.java new file mode 100644 index 000000000..30484eec1 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWither.java @@ -0,0 +1,17 @@ +package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; +import org.bukkit.entity.EntityType; + +public class EliteWither extends EliteMobProperties { + + public EliteWither() { + this.name = MobPropertiesConfig.getMobProperties().get(EntityType.WITHER).getName(); + this.entityType = EntityType.WITHER; + this.defaultMaxHealth = 300; + this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.WITHER).getBaseDamage(); + this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.WITHER).isEnabled(); + eliteMobData.add(this); + } + +} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZoglin.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZoglin.java index 8d51509ff..26a1521ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZoglin.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZoglin.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class EliteZoglin extends EliteMobProperties { public EliteZoglin() { - if (VersionChecker.serverVersionOlderThan(16, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.ZOGLIN).getName(); this.entityType = EntityType.ZOGLIN; this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.ZOGLIN).getBaseDamage(); diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZombifiedPiglin.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZombifiedPiglin.java index 9622b5a87..5915832bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZombifiedPiglin.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteZombifiedPiglin.java @@ -1,14 +1,10 @@ package com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.entity.EntityType; public class EliteZombifiedPiglin extends EliteMobProperties { public EliteZombifiedPiglin() { - if (VersionChecker.serverVersionOlderThan(16, 0)) { - return; - } this.name = MobPropertiesConfig.getMobProperties().get(EntityType.ZOMBIFIED_PIGLIN).getName(); this.entityType = EntityType.ZOMBIFIED_PIGLIN; this.baseDamage = MobPropertiesConfig.getMobProperties().get(EntityType.ZOMBIFIED_PIGLIN).getBaseDamage(); diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperChicken.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperChicken.java deleted file mode 100644 index ac02adf4b..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperChicken.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import org.bukkit.entity.EntityType; - -public class SuperChicken extends SuperMobProperties { - - public SuperChicken() { - - this.name = ChatColorConverter.convert(MobPropertiesConfig.getMobProperties().get(EntityType.CHICKEN).getName()); - - this.entityType = EntityType.CHICKEN; - - this.defaultMaxHealth = 4; - - this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.CHICKEN).isEnabled(); - - if (this.isEnabled) { - superMobTypeList.add(this.entityType); - superMobData.add(this); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperCow.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperCow.java deleted file mode 100644 index 492c9487c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperCow.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import org.bukkit.entity.EntityType; - -public class SuperCow extends SuperMobProperties { - - public SuperCow() { - - this.name = ChatColorConverter.convert(MobPropertiesConfig.getMobProperties().get(EntityType.COW).getName()); - - this.entityType = EntityType.COW; - - this.defaultMaxHealth = 10; - - this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.COW).isEnabled(); - - if (this.isEnabled) { - superMobTypeList.add(this.entityType); - superMobData.add(this); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMobProperties.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMobProperties.java deleted file mode 100644 index 1b049af51..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMobProperties.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs; - -import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; -import org.bukkit.Bukkit; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; - -import java.util.HashSet; - -public abstract class SuperMobProperties extends PluginMobProperties { - - public static HashSet superMobTypeList = new HashSet<>(); - public static HashSet superMobData = new HashSet<>(); - - public static void initializeSuperMobValues() { - SuperChicken superChicken = new SuperChicken(); - SuperCow superCow = new SuperCow(); - SuperMushroomCow superMushroomCow = new SuperMushroomCow(); - SuperPig superPig = new SuperPig(); - SuperSheep superSheep = new SuperSheep(); - } - - public static boolean isValidSuperMobType(EntityType entityType) { - return superMobTypeList.contains(entityType); - } - - public static boolean isValidSuperMobType(Entity entity) { - if (entity instanceof LivingEntity) - return isValidSuperMobType(entity.getType()); - return false; - } - - public static SuperMobProperties getDataInstance(EntityType entityType) { - - for (SuperMobProperties superMobType : superMobData) - if (superMobType.getEntityType().equals(entityType)) - return superMobType; - - Bukkit.getLogger().warning("[EliteMobs] Something is wrong with the Super Mob data, notify the dev!"); - return null; - - } - - public static SuperMobProperties getDataInstance(Entity entity) { - return getDataInstance(entity.getType()); - } - - public static double getSuperMobMaxHealth(Entity entity) { - return getDataInstance(entity.getType()).getSuperMobMaxHealth(); - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMushroomCow.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMushroomCow.java deleted file mode 100644 index 9c74cd56c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMushroomCow.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import org.bukkit.entity.EntityType; - -public class SuperMushroomCow extends SuperMobProperties { - - public SuperMushroomCow() { - - this.name = ChatColorConverter.convert(MobPropertiesConfig.getMobProperties().get(EntityType.MUSHROOM_COW).getName()); - - this.entityType = EntityType.MUSHROOM_COW; - - this.defaultMaxHealth = 10; - - this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.MUSHROOM_COW).isEnabled(); - - if (this.isEnabled) { - superMobTypeList.add(this.entityType); - superMobData.add(this); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperPig.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperPig.java deleted file mode 100644 index f806b82b9..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperPig.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import org.bukkit.entity.EntityType; - -public class SuperPig extends SuperMobProperties { - - public SuperPig() { - - this.name = ChatColorConverter.convert(MobPropertiesConfig.getMobProperties().get(EntityType.PIG).getName()); - - this.entityType = EntityType.PIG; - - this.defaultMaxHealth = 10; - - this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.PIG).isEnabled(); - - if (this.isEnabled) { - superMobTypeList.add(this.entityType); - superMobData.add(this); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperSheep.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperSheep.java deleted file mode 100644 index 4aa991fda..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperSheep.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; -import org.bukkit.entity.EntityType; - -public class SuperSheep extends SuperMobProperties { - - public SuperSheep() { - - this.name = ChatColorConverter.convert(MobPropertiesConfig.getMobProperties().get(EntityType.SHEEP).getName()); - - this.entityType = EntityType.SHEEP; - - this.defaultMaxHealth = 8; - - this.isEnabled = MobPropertiesConfig.getMobProperties().get(EntityType.SHEEP).isEnabled(); - - if (this.isEnabled) { - superMobTypeList.add(this.entityType); - superMobData.add(this); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/ChickenHandler.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/ChickenHandler.java deleted file mode 100644 index 4d9b7952d..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/ChickenHandler.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.magmaguy.elitemobs.mobs.passive; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.api.SuperMobDamageEvent; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.items.ItemDropVelocity; -import org.bukkit.Material; -import org.bukkit.entity.*; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryPickupItemEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.scheduler.BukkitRunnable; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import static org.bukkit.Material.CHICKEN; -import static org.bukkit.Material.FEATHER; - -/** - * Created by MagmaGuy on 19/12/2016. - */ -public class ChickenHandler implements Listener { - - /* - Augmented egg drops - There's no egg dropping event and listening for new eggs can be extremely inaccurate due to high chicken density - Use events to add and remove loaded chicken and use the scanner to update the list of active chicken - */ - - private final List lore = new ArrayList<>(List.of("SuperChicken Egg")); - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void superDrops(SuperMobDamageEvent event) { - - if (event.getEntityDamageEvent().getFinalDamage() < 1) - return; - - if (event.getLivingEntity().getType().equals(EntityType.CHICKEN)) { - - Random random = new Random(); - - Chicken chicken = (Chicken) event.getLivingEntity(); - - double damage = event.getEntityDamageEvent().getFinalDamage(); - //health is hardcoded here, maybe change it at some point? - double dropChance = damage / 4; - double dropRandomizer = random.nextDouble(); - //this rounds down - int dropMinAmount = (int) dropChance; - - ItemStack featherStack = new ItemStack(FEATHER, (random.nextInt(2) + 1)); - ItemStack poultryStack = new ItemStack(CHICKEN, 1); - - for (int i = 0; i < dropMinAmount; i++) { - - chicken.getWorld().dropItem(chicken.getLocation(), featherStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - chicken.getWorld().dropItem(chicken.getLocation(), poultryStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = chicken.getWorld().spawn(chicken.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - } - - if (dropChance > dropRandomizer) { - - chicken.getWorld().dropItem(chicken.getLocation(), featherStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - chicken.getWorld().dropItem(chicken.getLocation(), poultryStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = chicken.getWorld().spawn(chicken.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - } - - } - - } - - //Egg drop chance is based on the underlying timer - public void dropEggs() { - - ItemStack eggStack = new ItemStack(Material.EGG, 1); - ItemMeta eggMeta = eggStack.getItemMeta(); - eggMeta.setLore(lore); - eggStack.setItemMeta(eggMeta); - - Iterator superChickenIterator = EntityTracker.getSuperMobs().iterator(); - - while (superChickenIterator.hasNext()) { - - LivingEntity chicken = superChickenIterator.next(); - - if (!(chicken instanceof Chicken)) continue; - - if (chicken == null || !chicken.isValid()) { - - superChickenIterator.remove(); - - } else { - - Item droppedItem = chicken.getWorld().dropItem(chicken.getLocation(), eggStack); - droppedItem.setVelocity(ItemDropVelocity.ItemDropVelocity()); - new BukkitRunnable() { - - @Override - public void run() { - - if (droppedItem.isValid()) { - - droppedItem.remove(); - - } - - } - - }.runTaskLater(MetadataHandler.PLUGIN, 20 * 60); - - } - - } - - } - - @EventHandler - public void onHopperSuperEggPickup(InventoryPickupItemEvent event) { - - if (event.getItem().getItemStack().getType() == Material.EGG && - event.getItem().getItemStack().hasItemMeta() && event.getItem().getItemStack().getItemMeta().hasLore() && - event.getItem().getItemStack().getItemMeta().getLore().equals(lore)) { - - event.setCancelled(true); - - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/CowHandler.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/CowHandler.java deleted file mode 100644 index 085ababc8..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/CowHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.magmaguy.elitemobs.mobs.passive; - -import com.magmaguy.elitemobs.api.SuperMobDamageEvent; -import com.magmaguy.elitemobs.items.ItemDropVelocity; -import org.bukkit.entity.Cow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; - -import java.util.Random; - -import static org.bukkit.Material.BEEF; -import static org.bukkit.Material.LEATHER; - -/** - * Created by MagmaGuy on 19/12/2016. - */ -public class CowHandler implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void superDrops(SuperMobDamageEvent event) { - - if (event.getEntityDamageEvent().getFinalDamage() < 1) - return; - - if (event.getLivingEntity().getType().equals(EntityType.COW)) { - - Random random = new Random(); - - Cow cow = (Cow) event.getLivingEntity(); - - double damage = event.getEntityDamageEvent().getFinalDamage(); - //health is hardcoded here, maybe change it at some point? - double dropChance = damage / 10; - double dropRandomizer = random.nextDouble(); - //this rounds down - int dropMinAmount = (int) dropChance; - - ItemStack beefStack = new ItemStack(BEEF, (random.nextInt(3) + 1)); - //leather can drop 0, meaning that it could create visual artifacts. Have to filter that out. - ItemStack leatherStack = new ItemStack(LEATHER, (random.nextInt(2))); - - for (int i = 0; i < dropMinAmount; i++) { - - cow.getWorld().dropItem(cow.getLocation(), beefStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = cow.getWorld().spawn(cow.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - if (leatherStack.getAmount() != 0) { - - cow.getWorld().dropItem(cow.getLocation(), leatherStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - } - - if (dropChance > dropRandomizer) { - - cow.getWorld().dropItem(cow.getLocation(), beefStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = cow.getWorld().spawn(cow.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - if (leatherStack.getAmount() != 0) { - - cow.getWorld().dropItem(cow.getLocation(), leatherStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - } - - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/EggRunnable.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/EggRunnable.java deleted file mode 100644 index 2840dd5b7..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/EggRunnable.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.magmaguy.elitemobs.mobs.passive; - -import org.bukkit.scheduler.BukkitRunnable; - -public class EggRunnable extends BukkitRunnable { - - static final ChickenHandler CHICKEN_HANDLER = new ChickenHandler(); - - @Override - public void run() { - - //drops 1 egg for every loaded super chicken - CHICKEN_HANDLER.dropEggs(); - - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/MushroomCowHandler.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/MushroomCowHandler.java deleted file mode 100644 index 6d6a181fb..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/MushroomCowHandler.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.magmaguy.elitemobs.mobs.passive; - -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.items.ItemDropVelocity; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.MushroomCow; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerShearEntityEvent; -import org.bukkit.inventory.ItemStack; - -import java.util.Random; - -import static org.bukkit.Material.*; - -/** - * Created by MagmaGuy on 19/12/2016. - */ -public class MushroomCowHandler implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void superDrops(EntityDamageEvent event) { - - if (event.getFinalDamage() < 1) - return; - - if (event.getEntity() instanceof MushroomCow mushroomCow && EntityTracker.isSuperMob(event.getEntity())) { - - Random random = new Random(); - - double damage = event.getFinalDamage(); - //health is hardcoded here, maybe change it at some point? - double dropChance = damage / 10; - double dropRandomizer = random.nextDouble(); - //this rounds down - int dropMinAmount = (int) dropChance; - - ItemStack beefStack = new ItemStack(BEEF, (random.nextInt(3) + 1)); - //leather can drop 0, meaning that it could create visual artifacts. Have to filter that out. - ItemStack leatherStack = new ItemStack(LEATHER, (random.nextInt(2))); - - for (int i = 0; i < dropMinAmount; i++) { - - mushroomCow.getWorld().dropItem(mushroomCow.getLocation(), beefStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = mushroomCow.getWorld().spawn(mushroomCow.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - if (leatherStack.getAmount() != 0) { - - mushroomCow.getWorld().dropItem(mushroomCow.getLocation(), leatherStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - } - - if (dropChance > dropRandomizer) { - - mushroomCow.getWorld().dropItem(mushroomCow.getLocation(), beefStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = mushroomCow.getWorld().spawn(mushroomCow.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - if (leatherStack.getAmount() != 0) { - - mushroomCow.getWorld().dropItem(mushroomCow.getLocation(), leatherStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - } - - - } - - } - - - @EventHandler - public void onShear(PlayerShearEntityEvent event) { - - if (event.getEntity() instanceof MushroomCow mushroomCow && EntityTracker.isSuperMob(event.getEntity())) { - - ItemStack mushroomStack = new ItemStack(RED_MUSHROOM, 5); - - for (int i = 0; i < 50; i++) { - - mushroomCow.getWorld().dropItem(mushroomCow.getLocation(), mushroomStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/PassiveEliteMobDeathHandler.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/PassiveEliteMobDeathHandler.java deleted file mode 100644 index 978c21220..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/PassiveEliteMobDeathHandler.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.magmaguy.elitemobs.mobs.passive; - -import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.mobconstructor.SuperMobConstructor; -import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties; -import org.bukkit.World; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDeathEvent; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Objects; -import java.util.concurrent.ThreadLocalRandom; - -import static com.magmaguy.elitemobs.EliteMobs.validWorldList; - -/** - * Created by MagmaGuy on 03/05/2017. - */ -public class PassiveEliteMobDeathHandler implements Listener { - - @EventHandler(priority = EventPriority.LOWEST) - public void onDeath(EntityDeathEvent event) { - if (EntityTracker.isSuperMob(event.getEntity())) { - event.getEntity().getLocation().getWorld().spawnEntity(event.getEntity().getLocation(), event.getEntityType()); - event.getEntity().getLocation().getWorld().spawnEntity(event.getEntity().getLocation(), event.getEntityType()); - } - } - - public static class SuperMobScanner { - private static final int passiveRange = MobCombatSettingsConfig.getSuperMobsStackRange(); - - public static void scanSuperMobs() { - for (World world : validWorldList) { - if (world.getLivingEntities().isEmpty()) continue; - Iterator iterator = world.getLivingEntities().iterator(); - while (iterator.hasNext()) { - LivingEntity livingEntity = iterator.next(); - if (!SuperMobProperties.isValidSuperMobType(livingEntity)) continue; - /* - Re-register lost passive mob - */ - checkLostSuperMob(livingEntity); - /* - Check passive mobs to register new super mobs - */ - newSuperMobScan(livingEntity); - } - } - } - - private static void checkLostSuperMob(LivingEntity livingEntity) { - if (Objects.requireNonNull(livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue() != - SuperMobProperties.getSuperMobMaxHealth(livingEntity)) - return; - if (!EntityTracker.isSuperMob(livingEntity)) - EntityTracker.registerSuperMob(livingEntity); - } - - public static void newSuperMobScan(LivingEntity livingEntity) { - if (livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() == - SuperMobProperties.getSuperMobMaxHealth(livingEntity)) - return; - if (ThreadLocalRandom.current().nextDouble() < 1 / (DefaultConfig.getSuperMobStackAmount() + 0D)) - return; - ArrayList livingEntities = new ArrayList<>(); - for (Entity entity : livingEntity.getNearbyEntities(passiveRange, passiveRange, passiveRange)) { - if (!entity.getType().equals(livingEntity.getType())) continue; - if (EntityTracker.isSuperMob(entity)) continue; - livingEntities.add((LivingEntity) entity); - if (livingEntities.size() >= DefaultConfig.getSuperMobStackAmount()) - break; - } - - if (livingEntities.size() < DefaultConfig.getSuperMobStackAmount()) - return; - - SuperMobConstructor.constructSuperMob(livingEntity); - for (Entity entity : livingEntities) { - entity.remove(); - } - - } - - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/PigHandler.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/PigHandler.java deleted file mode 100644 index 799099ac4..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/PigHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.magmaguy.elitemobs.mobs.passive; - -import com.magmaguy.elitemobs.api.SuperMobDamageEvent; -import com.magmaguy.elitemobs.items.ItemDropVelocity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.Pig; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.inventory.ItemStack; - -import java.util.Random; - -import static org.bukkit.Material.PORKCHOP; - -/** - * Created by MagmaGuy on 19/12/2016. - */ -public class PigHandler implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void superDrops(SuperMobDamageEvent event) { - - if (event.getEntityDamageEvent().getFinalDamage() < 1) - return; - - if (!event.getLivingEntity().getType().equals(EntityType.PIG)) return; - - Random random = new Random(); - - Pig pig = (Pig) event.getLivingEntity(); - - double damage = event.getEntityDamageEvent().getFinalDamage(); - //health is hardcoded here, maybe change it at some point? - double dropChance = damage / 10; - double dropRandomizer = random.nextDouble(); - //this rounds down - int dropMinAmount = (int) dropChance; - - ItemStack porkchopStack = new ItemStack(PORKCHOP, random.nextInt(3) + 1); - - for (int i = 0; i < dropMinAmount; i++) { - - pig.getWorld().dropItem(pig.getLocation(), porkchopStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = pig.getWorld().spawn(pig.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - } - - if (dropChance > dropRandomizer) { - - pig.getWorld().dropItem(pig.getLocation(), porkchopStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - ExperienceOrb xpDrop = pig.getWorld().spawn(pig.getLocation(), ExperienceOrb.class); - xpDrop.setExperience(random.nextInt(3) + 1); - - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobs/passive/SheepHandler.java b/src/main/java/com/magmaguy/elitemobs/mobs/passive/SheepHandler.java deleted file mode 100644 index ce3b37cdf..000000000 --- a/src/main/java/com/magmaguy/elitemobs/mobs/passive/SheepHandler.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.magmaguy.elitemobs.mobs.passive; - -import com.magmaguy.elitemobs.api.SuperMobDamageEvent; -import com.magmaguy.elitemobs.api.SuperMobDeathEvent; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.items.ItemDropVelocity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Sheep; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerShearEntityEvent; -import org.bukkit.inventory.ItemStack; - -import java.util.Random; - -import static org.bukkit.Bukkit.getLogger; -import static org.bukkit.Material.*; - -/** - * Created by MagmaGuy on 19/12/2016. - */ -public class SheepHandler implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void superDrops(SuperMobDamageEvent event) { - - if (event.getEntityDamageEvent().getFinalDamage() < 1) - return; - - if (!event.getLivingEntity().getType().equals(EntityType.SHEEP)) return; - - Random random = new Random(); - - Sheep sheep = (Sheep) event.getLivingEntity(); - - double damage = event.getEntityDamageEvent().getFinalDamage(); - //health is hardcoded here, maybe change it at some point? - double dropChance = damage / 8; - double dropRandomizer = random.nextDouble(); - //this rounds down - int dropMinAmount = (int) dropChance; - - ItemStack muttonStack = new ItemStack(MUTTON, random.nextInt(2) + 1); - ItemStack woolStack = new ItemStack(WHITE_WOOL, 1); - - //for different wool colors - switch (sheep.getColor()) { - case WHITE: - woolStack = new ItemStack(WHITE_WOOL, 1); - break; - case ORANGE: - woolStack = new ItemStack(ORANGE_WOOL, 1); - break; - case MAGENTA: - woolStack = new ItemStack(MAGENTA_WOOL, 1); - break; - case LIGHT_BLUE: - woolStack = new ItemStack(LIGHT_BLUE_WOOL, 1); - break; - case YELLOW: - woolStack = new ItemStack(YELLOW_WOOL, 1); - break; - case LIME: - woolStack = new ItemStack(LIME_WOOL, 1); - break; - case PINK: - woolStack = new ItemStack(PINK_WOOL, 1); - break; - case GRAY: - woolStack = new ItemStack(GRAY_WOOL, 1); - break; - case LIGHT_GRAY: - woolStack = new ItemStack(LIGHT_GRAY_WOOL, 1); - break; - case CYAN: - woolStack = new ItemStack(CYAN_WOOL, 1); - break; - case PURPLE: - woolStack = new ItemStack(PURPLE_WOOL, 1); - break; - case BLUE: - woolStack = new ItemStack(BLUE_WOOL, 1); - break; - case BROWN: - woolStack = new ItemStack(BROWN_WOOL, 1); - break; - case GREEN: - woolStack = new ItemStack(GREEN_WOOL, 1); - break; - case RED: - woolStack = new ItemStack(RED_WOOL, 1); - break; - case BLACK: - woolStack = new ItemStack(BLACK_WOOL, 1); - break; - default: - getLogger().info("Something went wrong with the sheep colors, one is missing. Contact the dev."); - break; - } - - for (int i = 0; i < dropMinAmount; i++) { - - sheep.getWorld().dropItem(sheep.getLocation(), muttonStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - sheep.getWorld().dropItem(sheep.getLocation(), woolStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - if (dropChance > dropRandomizer) { - - sheep.getWorld().dropItem(sheep.getLocation(), muttonStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - sheep.getWorld().dropItem(sheep.getLocation(), woolStack).setVelocity(ItemDropVelocity.ItemDropVelocity()); - - } - - } - - @EventHandler(ignoreCancelled = true) - public void onDeath(SuperMobDeathEvent event) { - if (!event.getLivingEntity().getType().equals(EntityType.SHEEP)) return; - Sheep sheep = (Sheep) event.getLivingEntity(); - ItemStack sheepMonsterEgg = new ItemStack(SHEEP_SPAWN_EGG, 2); - sheep.getWorld().dropItem(sheep.getLocation(), sheepMonsterEgg); - } - - @EventHandler(ignoreCancelled = true) - public void onShear(PlayerShearEntityEvent event) { - if (!event.getEntity().getType().equals(EntityType.SHEEP)) return; - if (!EntityTracker.isSuperMob(event.getEntity())) return; - Sheep sheep = (Sheep) event.getEntity(); - - for (int i = 0; i < 50; i++) - sheep.getWorld().dropItem(sheep.getLocation(), woolStackRandomizer(sheep)).setVelocity(ItemDropVelocity.ItemDropVelocity()); - } - - public ItemStack woolStackRandomizer(Sheep sheep) { - - Random random = new Random(); - - ItemStack woolStack = new ItemStack(WHITE_WOOL, ((random.nextInt(3) + 1) * 50)); - - switch (sheep.getColor()) { - case WHITE: - woolStack = new ItemStack(WHITE_WOOL, (random.nextInt(3) + 1)); - break; - case ORANGE: - woolStack = new ItemStack(ORANGE_WOOL, ((random.nextInt(3) + 1))); - break; - case MAGENTA: - woolStack = new ItemStack(MAGENTA_WOOL, ((random.nextInt(3) + 1))); - break; - case LIGHT_BLUE: - woolStack = new ItemStack(LIGHT_BLUE_WOOL, ((random.nextInt(3) + 1))); - break; - case YELLOW: - woolStack = new ItemStack(YELLOW_WOOL, ((random.nextInt(3) + 1))); - break; - case LIME: - woolStack = new ItemStack(LIME_WOOL, ((random.nextInt(3) + 1))); - break; - case PINK: - woolStack = new ItemStack(PINK_WOOL, ((random.nextInt(3) + 1))); - break; - case GRAY: - woolStack = new ItemStack(GRAY_WOOL, ((random.nextInt(3) + 1))); - break; - case LIGHT_GRAY: - woolStack = new ItemStack(LIGHT_GRAY_WOOL, ((random.nextInt(3) + 1))); - break; - case CYAN: - woolStack = new ItemStack(CYAN_WOOL, ((random.nextInt(3) + 1))); - break; - case PURPLE: - woolStack = new ItemStack(PURPLE_WOOL, ((random.nextInt(3) + 1))); - break; - case BLUE: - woolStack = new ItemStack(BLUE_WOOL, ((random.nextInt(3) + 1))); - break; - case BROWN: - woolStack = new ItemStack(BROWN_WOOL, ((random.nextInt(3) + 1))); - break; - case GREEN: - woolStack = new ItemStack(GREEN_WOOL, ((random.nextInt(3) + 1))); - break; - case RED: - woolStack = new ItemStack(RED_WOOL, ((random.nextInt(3) + 1))); - break; - case BLACK: - woolStack = new ItemStack(BLACK_WOOL, ((random.nextInt(3) + 1))); - break; - default: - getLogger().info("Something went wrong with the sheep colors, one is missing. Contact the dev."); - break; - } - - return woolStack; - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java index c3b1f21f1..a834e9ece 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java @@ -8,7 +8,6 @@ import com.magmaguy.elitemobs.config.ValidWorldsConfig; import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig; import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import com.magmaguy.elitemobs.gamemodes.zoneworld.Grid; import com.magmaguy.elitemobs.items.MobTierCalculator; import com.magmaguy.elitemobs.items.customenchantments.HunterEnchantment; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; @@ -19,7 +18,6 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker; import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardSpawnEventBypasser; import com.magmaguy.elitemobs.utils.PlayerScanner; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Location; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -86,9 +84,8 @@ public void onSpawn(CreatureSpawnEvent event) { if (event.getSpawnReason().equals(DROWNED) || event.getSpawnReason().equals(BREEDING)) return; - if (!VersionChecker.serverVersionOlderThan(15, 0)) - if (event.getEntity().getType().equals(EntityType.BEE)) - return; + if (event.getEntity().getType().equals(EntityType.BEE)) + return; if (MobPropertiesConfig.getMobProperties().get(event.getEntityType()) == null || @@ -109,7 +106,7 @@ public void onSpawn(CreatureSpawnEvent event) { if (!MobCombatSettingsConfig.isDoNaturalMobSpawning()) return; - if (!ValidWorldsConfig.getFileConfiguration().getBoolean("Valid worlds." + event.getEntity().getWorld().getName())) + if (!ValidWorldsConfig.getInstance().getFileConfiguration().getBoolean("Valid worlds." + event.getEntity().getWorld().getName())) return; if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER) && !MobCombatSettingsConfig.isDoSpawnersSpawnEliteMobs() || @@ -131,9 +128,6 @@ public void onSpawn(CreatureSpawnEvent event) { double huntingGearChanceAdder = HunterEnchantment.getHuntingGearBonus(nearbyPlayers); validChance += huntingGearChanceAdder; - if (ValidWorldsConfig.getNightmareWorlds().contains(event.getEntity().getWorld().getName())) - validChance += DefaultConfig.getNightmareWorldSpawnBonus(); - AtomicInteger peacefulModeDebuffs = new AtomicInteger(); nearbyPlayers.forEach(player -> { //Handles situations where fake players got caught in the detection @@ -145,14 +139,6 @@ public void onSpawn(CreatureSpawnEvent event) { if (ThreadLocalRandom.current().nextDouble() >= validChance) return; - if (ValidWorldsConfig.getZoneBasedWorlds().contains(livingEntity.getWorld().getName())) { - int eliteMobLevel = (int) (Grid.getMobTierFromLocation(livingEntity.getLocation())); - EliteEntity eliteEntity = new EliteEntity(livingEntity, eliteMobLevel, event.getSpawnReason()); - if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER)) - eliteEntity.setEliteLoot(false); - return; - } - int eliteMobLevel = getNaturalMobLevel(livingEntity.getLocation(), nearbyPlayers); //Takes worldguard minimum and maximum level flags into account diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCDamageEvent.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCDamageEvent.java index e4d0fef59..cec2fa74b 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCDamageEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCDamageEvent.java @@ -7,7 +7,7 @@ public class NPCDamageEvent implements Listener { - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onNPCDamage(EntityDamageEvent event) { if (!EntityTracker.isNPCEntity(event.getEntity())) return; event.setCancelled(true); diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java index e337528f9..480d7af16 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.npcs; import com.google.common.collect.ArrayListMultimap; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.config.npcs.NPCsConfig; @@ -18,11 +17,13 @@ import com.magmaguy.elitemobs.utils.ChunkLocationChecker; import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.utils.NonSolidBlockTypes; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; +import org.bukkit.attribute.Attribute; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -41,8 +42,17 @@ public class NPCEntity implements PersistentObject, PersistentMovingEntity { private static final ArrayListMultimap instancedNPCEntities = ArrayListMultimap.create(); + public final NPCsConfigFields npCsConfigFields; + @Getter + private final UUID uuid = UUID.randomUUID(); private boolean isInstancedDuplicate = false; - + private PersistentObjectHandler persistentObjectHandler; + private Villager villager = null; + private Location spawnLocation; + private boolean isTalking = false; + private ArmorStand roleDisplay; + private boolean isDisguised = false; + private String locationString; /** * Spawns NPC based off of the values in the NPCsConfig config file. Runs at startup and on reload. */ @@ -64,7 +74,6 @@ public NPCEntity(NPCsConfigFields npCsConfigFields, String locationString) { spawn(); persistentObjectHandler = new PersistentObjectHandler(this); } - /** * Spawns NPCs for dungeon instancing. */ @@ -78,16 +87,22 @@ public NPCEntity(NPCsConfigFields npCsConfigFields, Location location) { persistentObjectHandler = new PersistentObjectHandler(this); } - public final NPCsConfigFields npCsConfigFields; - @Getter - private final UUID uuid = UUID.randomUUID(); - private PersistentObjectHandler persistentObjectHandler; - private Villager villager = null; - private Location spawnLocation; - private boolean isTalking = false; - private ArmorStand roleDisplay; - private boolean isDisguised = false; - private String locationString; + /** + * For the travelling merchant + * + * @param location + */ + public NPCEntity(Location location) { + this.npCsConfigFields = NPCsConfig.getNpcEntities().get("travelling_merchant.yml"); + if (!npCsConfigFields.isEnabled()) return; + Location potentialLocation = location.clone(); + potentialLocation.add(potentialLocation.getDirection().normalize()).setY(location.getY()); + if (NonSolidBlockTypes.isPassthrough(potentialLocation.getBlock().getType())) + this.spawnLocation = potentialLocation; + else this.spawnLocation = location.clone(); + this.spawnLocation.setDirection(this.spawnLocation.getDirection().multiply(-1)); + spawn(); + } public static void shutdown() { instancedNPCEntities.clear(); @@ -102,6 +117,15 @@ public static void initializeInstancedNPCs(String blueprintWorldName, World newW } } + public static void initializeNPCs(NPCsConfigFields npCsConfigFields) { + if (npCsConfigFields.getLocations() != null && !npCsConfigFields.getLocations().isEmpty()) { + for (String locationString : npCsConfigFields.getLocations()) + new NPCEntity(npCsConfigFields, locationString); + } else if (npCsConfigFields.getSpawnLocation() != null && !npCsConfigFields.getSpawnLocation().isEmpty()) { + new NPCEntity(npCsConfigFields, npCsConfigFields.getSpawnLocation()); + } + } + public void remove(RemovalReason removalReason) { if (roleDisplay != null) roleDisplay.remove(); @@ -134,32 +158,6 @@ public void remove(RemovalReason removalReason) { persistentObjectHandler.remove(); } - /** - * For the travelling merchant - * - * @param location - */ - public NPCEntity(Location location) { - this.npCsConfigFields = NPCsConfig.getNpcEntities().get("travelling_merchant.yml"); - if (!npCsConfigFields.isEnabled()) return; - Location potentialLocation = location.clone(); - potentialLocation.add(potentialLocation.getDirection().normalize()).setY(location.getY()); - if (NonSolidBlockTypes.isPassthrough(potentialLocation.getBlock().getType())) - this.spawnLocation = potentialLocation; - else this.spawnLocation = location.clone(); - this.spawnLocation.setDirection(this.spawnLocation.getDirection().multiply(-1)); - spawn(); - } - - public static void initializeNPCs(NPCsConfigFields npCsConfigFields) { - if (npCsConfigFields.getLocations() != null && !npCsConfigFields.getLocations().isEmpty()) { - for (String locationString : npCsConfigFields.getLocations()) - new NPCEntity(npCsConfigFields, locationString); - } else if (npCsConfigFields.getSpawnLocation() != null && !npCsConfigFields.getSpawnLocation().isEmpty()) { - new NPCEntity(npCsConfigFields, npCsConfigFields.getSpawnLocation()); - } - } - private void spawn() { if (spawnLocation == null || spawnLocation.getWorld() == null || @@ -173,6 +171,7 @@ private void spawn() { villagerInstance.setCustomName(ChatColorConverter.convert(npCsConfigFields.getName())); villagerInstance.setCustomNameVisible(true); villagerInstance.setProfession(npCsConfigFields.getProfession()); + villagerInstance.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(npCsConfigFields.getScale()); if (getNPCsConfigFields().getCustomModel() != null && !getNPCsConfigFields().getCustomModel().isEmpty()) setCustomModel(villagerInstance); else @@ -192,7 +191,7 @@ private void setDisguise(LivingEntity livingEntity) { livingEntity.setCustomNameVisible(true); isDisguised = true; } catch (Exception ex) { - new WarningMessage("Failed to load LibsDisguises disguise correctly!"); + Logger.warn("Failed to load LibsDisguises disguise correctly!"); ex.printStackTrace(); } } @@ -281,7 +280,7 @@ private void initializeRole() { roleDisplay = this.villager.getWorld().spawn(villager.getLocation().add(offSet), ArmorStand.class, new Consumer() { @Override public void accept(ArmorStand armorStand) { - armorStand.setCustomName(npCsConfigFields.getRole()); + armorStand.setCustomName(ChatColorConverter.convert(npCsConfigFields.getRole())); armorStand.setCustomNameVisible(true); armorStand.setMarker(true); armorStand.setVisible(false); @@ -315,18 +314,6 @@ public void run() { }.runTaskLater(MetadataHandler.PLUGIN, (long) (npCsConfigFields.getTimeout() * 20 * 60)); } - private class InstancedNPCContainer { - @Getter - private final Location location; - @Getter - private final NPCEntity npcEntity; - - public InstancedNPCContainer(Location location, NPCEntity npcEntity) { - this.location = location; - this.npcEntity = npcEntity; - } - } - /** * Sends a greeting to a player from the list of greetings the NPCEntity has * @@ -366,7 +353,6 @@ private String selectString(List strings) { return null; } - public static class NPCEntityEvents implements Listener { @EventHandler public void worldUnloadEvent(WorldUnloadEvent event) { @@ -378,4 +364,16 @@ public void worldUnloadEvent(WorldUnloadEvent event) { } } + private class InstancedNPCContainer { + @Getter + private final Location location; + @Getter + private final NPCEntity npcEntity; + + public InstancedNPCContainer(Location location, NPCEntity npcEntity) { + this.location = location; + this.npcEntity = npcEntity; + } + } + } diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java index 5b2a5f821..e9723135c 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.npcs; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRankMenuHandler; import com.magmaguy.elitemobs.api.PlayerPreTeleportEvent; @@ -8,7 +7,8 @@ import com.magmaguy.elitemobs.menus.*; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.QuestInteractionHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -60,7 +60,7 @@ public void run() { npcEntity.sayDialog(event.getPlayer()); break; case CUSTOM_SHOP: - if (event.getPlayer().hasPermission("elitemobs.customshop.npc")) + if (event.getPlayer().hasPermission("elitemobs.shop.custom.npc")) new BukkitRunnable() { @Override public void run() { @@ -70,7 +70,7 @@ public void run() { break; case PROCEDURALLY_GENERATED_SHOP: - if (event.getPlayer().hasPermission("elitemobs.shop.npc")) + if (event.getPlayer().hasPermission("elitemobs.shop.dynamic.npc")) new BukkitRunnable() { @Override public void run() { @@ -94,7 +94,7 @@ public void run() { event.getPlayer().sendMessage("[EliteMobs] This feature is coming soon!"); break; case SELL: - if (event.getPlayer().hasPermission("elitemobs.shop.npc")) + if (event.getPlayer().hasPermission("elitemobs.shop.sell.npc")) new BukkitRunnable() { @Override public void run() { @@ -160,7 +160,7 @@ public void run() { break; case COMMAND: if (npcEntity.getNPCsConfigFields().getCommand() == null) { - new WarningMessage("Failed to run NPC command because none is configured for " + npcEntity.getNPCsConfigFields().getFilename()); + Logger.warn("Failed to run NPC command because none is configured for " + npcEntity.getNPCsConfigFields().getFilename()); return; } new BukkitRunnable() { diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCChatBubble.java b/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCChatBubble.java index 2d5fa2bd0..d0c13efa0 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCChatBubble.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCChatBubble.java @@ -2,10 +2,10 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.npcs.NPCEntity; -import com.magmaguy.elitemobs.utils.VisualArmorStand; +import com.magmaguy.elitemobs.utils.VisualDisplay; import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; +import org.bukkit.entity.TextDisplay; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; @@ -30,9 +30,9 @@ public NPCChatBubble(String message, NPCEntity npcEntity, Player player) { Location newLocation = npcEntity.getVillager().getEyeLocation().clone() .add(player.getLocation().clone().subtract(npcEntity.getVillager().getLocation()).toVector().normalize().multiply(0.5)) - .add(new Vector(0, -0.8 - (0.2 * lineCounter), 0)); + .add(new Vector(0, -0.4 - (0.2 * lineCounter), 0)); - ArmorStand visualArmorStand = VisualArmorStand.VisualArmorStand(newLocation, substring); + TextDisplay visualArmorStand = VisualDisplay.generateTemporaryTextDisplay(newLocation, substring); new BukkitRunnable() { int counter = 0; diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCProximitySensor.java b/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCProximitySensor.java index 6ffc1c8c3..1389aa013 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCProximitySensor.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/chatter/NPCProximitySensor.java @@ -9,14 +9,14 @@ import com.magmaguy.elitemobs.quests.CustomQuest; import com.magmaguy.elitemobs.quests.DynamicQuest; import com.magmaguy.elitemobs.quests.Quest; -import com.magmaguy.elitemobs.utils.VisualArmorStand; +import com.magmaguy.elitemobs.utils.VisualDisplay; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.TextDisplay; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryCloseEvent; @@ -138,7 +138,7 @@ private void generateIndicator(NPCEntity npcEntity, Player player, String messag Location newLocation = npcEntity.getVillager().getEyeLocation().clone() .add(player.getLocation().clone().subtract(npcEntity.getVillager().getLocation()).toVector().normalize().multiply(0.5)) .add(new Vector(0, -0.1, 0)); - ArmorStand visualArmorStand = VisualArmorStand.VisualArmorStand(newLocation, messageUp); + TextDisplay visualArmorStand = VisualDisplay.generateTemporaryTextDisplay(newLocation, messageUp); AtomicInteger counter = new AtomicInteger(); AtomicBoolean up = new AtomicBoolean(true); Bukkit.getScheduler().runTaskTimer(MetadataHandler.PLUGIN, task -> { diff --git a/src/main/java/com/magmaguy/elitemobs/ondeathcommands/OnDeathCommands.java b/src/main/java/com/magmaguy/elitemobs/ondeathcommands/OnDeathCommands.java index 5181f4341..2623443a3 100644 --- a/src/main/java/com/magmaguy/elitemobs/ondeathcommands/OnDeathCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/ondeathcommands/OnDeathCommands.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.api.EliteMobDeathEvent; import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -134,7 +134,7 @@ public RunChance(String commandString) { String fullString = "$chance=" + chanceString + "$"; string = string.replace(fullString, ""); } catch (Exception ex) { - new WarningMessage("Failed to get the chance value of the command " + string + " . The correct format should be $chance=X.Y$", true); + Logger.warn("Failed to get the chance value of the command " + string + " . The correct format should be $chance=X.Y$", true); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index b6b8d4ae3..f9599c613 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -3,17 +3,26 @@ import com.magmaguy.easyminecraftgoals.NMSManager; import com.magmaguy.easyminecraftgoals.events.WanderBackToPointEndEvent; import com.magmaguy.easyminecraftgoals.events.WanderBackToPointStartEvent; +import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; +import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; +import org.bukkit.Location; import org.bukkit.attribute.Attribute; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; + +import java.util.HashMap; public class Navigation implements Listener { + private static final HashMap currentlyNavigating = new HashMap(); + public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; if (regionalBossEntity.getUnsyncedLivingEntity() != null && @@ -37,18 +46,53 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; if (regionalBossEntity.getUnsyncedLivingEntity() != null && regionalBossEntity.getUnsyncedLivingEntity().getType() == EntityType.ENDER_DRAGON) return; - NMSManager.getAdapter().wanderBackToPoint( - regionalBossEntity.getLivingEntity(), - regionalBossEntity.getSpawnLocation(), - regionalBossEntity.getLeashRadius(), - 20 * 5) - .setSpeed(2f) - .setStopReturnDistance(0) - .setGoalRefreshCooldownTicks(20 * 3) - .setHardObjective(true) - .setTeleportOnFail(true) - .setStartWithCooldown(true) - .register(); + NMSManager.getAdapter().wanderBackToPoint( + regionalBossEntity.getLivingEntity(), + regionalBossEntity.getSpawnLocation(), + regionalBossEntity.getLeashRadius(), + 20 * 5) + .setSpeed(2f) + .setStopReturnDistance(0) + .setGoalRefreshCooldownTicks(20 * 3) + .setHardObjective(true) + .setTeleportOnFail(true) + .setStartWithCooldown(true) + .register(); + } + + public static void shutdown() { + currentlyNavigating.values().forEach(BukkitTask::cancel); + currentlyNavigating.clear(); + } + + public static void navigateTo(CustomBossEntity customBossEntity, Double speed, Location destination, boolean force, int duration) { + if (duration == 0) duration = 20 * 5; + if (customBossEntity.getLivingEntity() == null) return; + if (destination == null || destination.getWorld() == null) return; + if (speed == null) + speed = customBossEntity.getLivingEntity().getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getValue(); + Double finalSpeed = speed; + if (currentlyNavigating.get(customBossEntity) != null) currentlyNavigating.get(customBossEntity).cancel(); + int finalDuration = duration; + currentlyNavigating.put(customBossEntity, new BukkitRunnable() { + int counter = 0; + + @Override + public void run() { + if (counter >= finalDuration || + !customBossEntity.exists() || + customBossEntity.getLivingEntity().getLocation().distanceSquared(destination) < Math.pow(1, 2)) { + if (counter >= finalDuration && force) { + customBossEntity.getLivingEntity().teleport(destination); + } + cancel(); + currentlyNavigating.remove(customBossEntity); + return; + } + NMSManager.getAdapter().move(customBossEntity.getLivingEntity(), finalSpeed.floatValue(), destination); + counter++; + } + }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1)); } @EventHandler(ignoreCancelled = true) diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index 56dec7027..dfcd53f2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -2,17 +2,21 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; +import com.magmaguy.elitemobs.config.ItemSettingsConfig; import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig; import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance; import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.items.customenchantments.*; import com.magmaguy.elitemobs.items.potioneffects.ElitePotionEffect; import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.elitemobs.utils.BossBarUtil; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.Damageable; import java.util.ArrayList; @@ -38,6 +42,8 @@ public class PlayerItem { private double blastProtection = 0; private double loudStrikesBonus = 0; + private boolean displayingAsBroken = false; + /** * Stores an instance of the custom EliteMobs values of what a player is wearing. This is used to reduce the amount * of checks done by EliteMobs during combat and for passive potion effect applications. It should (largely) only update @@ -53,6 +59,14 @@ public PlayerItem(ItemStack itemStack, EquipmentSlot equipmentSlot, Player playe fullUpdate(itemStack); } + private boolean isOnLastDamage(ItemStack itemStack) { + if (!itemStack.hasItemMeta()) return false; + if (!ItemTagger.isEliteItem(itemStack)) return false; + if (!(itemStack.getItemMeta() instanceof Damageable)) return false; + if (itemStack.getType().getMaxDurability() == 0) return false; + return ((Damageable) itemStack.getItemMeta()).getDamage() + 1 >= itemStack.getType().getMaxDurability(); + } + private boolean fullUpdate(ItemStack itemStack) { //case when both are null @@ -63,6 +77,21 @@ private boolean fullUpdate(ItemStack itemStack) { if (itemStack == null) return fillNullItem(); + if (isOnLastDamage(itemStack)) { + if (!displayingAsBroken) { + BossBarUtil.DisplayBrokenItemBossBar(equipmentSlot, player, ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace("$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + displayingAsBroken = true; + } +// player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace( +// "$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + return fillNullItem(); + } + + if (displayingAsBroken) { + BossBarUtil.HideBrokenItemBossBar(equipmentSlot, player); + displayingAsBroken = false; + } + // //case when it's the same item as before - best performance todo: causes issues with the prestige system // if (itemStack.isSimilar(this.itemStack)) // return false; @@ -102,10 +131,10 @@ private boolean fullUpdate(ItemStack itemStack) { //Enchantments are global, any inventory slot will add to the total of any enchantment this.eliteDamageReduction = EliteItemManager.getEliteDefense(itemStack) + EliteItemManager.getBonusEliteDefense(itemStack); - this.protectionProjectile = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION_PROJECTILE.getKey()); - this.blastProtection = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION_EXPLOSIONS.getKey()); - this.damageArthropodsLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.DAMAGE_ARTHROPODS.getKey()); - this.damageUndeadLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.DAMAGE_UNDEAD.getKey()); + this.protectionProjectile = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROJECTILE_PROTECTION.getKey()); + this.blastProtection = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.BLAST_PROTECTION.getKey()); + this.damageArthropodsLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.BANE_OF_ARTHROPODS.getKey()); + this.damageUndeadLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.SMITE.getKey()); this.critChance = ItemTagger.getEnchantment(itemStack.getItemMeta(), new NamespacedKey(MetadataHandler.PLUGIN, CriticalStrikesEnchantment.key)) / 10D; this.lightningChance = Math.pow(ItemTagger.getEnchantment(itemStack.getItemMeta(), new NamespacedKey(MetadataHandler.PLUGIN, LightningEnchantment.key)), 2) / 1000D; this.plasmaBootsLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), new NamespacedKey(MetadataHandler.PLUGIN, PlasmaBootsEnchantment.key)); diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java b/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java index f0d2f9e6b..eecd9e4ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.playerdata.database; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import java.sql.DatabaseMetaData; import java.sql.ResultSet; @@ -58,14 +57,14 @@ private static void addEntryIfEmpty(String columnName, ColumnValues columnValues DatabaseMetaData metaData = PlayerData.getConnection().getMetaData(); ResultSet resultSet = metaData.getColumns(null, null, PlayerData.getPLAYER_DATA_TABLE_NAME(), columnName); if (resultSet.next()) { - //Developer.message("Database already had " + columnName); + //Logger.message("Database already had " + columnName); } else { - new InfoMessage("Adding new database column " + columnName); + Logger.info("Adding new database column " + columnName); addColumn(columnName, columnValues); } resultSet.close(); } catch (Exception ex) { - new WarningMessage("Could not process column " + columnName); + Logger.warn("Could not process column " + columnName); ex.printStackTrace(); } } @@ -77,7 +76,7 @@ private static void addColumn(String columnName, ColumnValues type) { statement.executeUpdate(sql); statement.close(); } catch (Exception ex) { - new WarningMessage("Failed to insert new column " + columnName); + Logger.warn("Failed to insert new column " + columnName); ex.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/database/PlayerData.java b/src/main/java/com/magmaguy/elitemobs/playerdata/database/PlayerData.java index 3c6a73e06..5686ed26a 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/database/PlayerData.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/database/PlayerData.java @@ -7,9 +7,8 @@ import com.magmaguy.elitemobs.quests.Quest; import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ObjectSerializer; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -90,7 +89,7 @@ public class PlayerData { public PlayerData(UUID uuid) { Player player = Bukkit.getPlayer(uuid); if (player == null) { - new WarningMessage("EliteMobs did not initialize player data for uuid " + uuid + " because Minecraft does not recognize this as a valid player!"); + Logger.warn("EliteMobs did not initialize player data for uuid " + uuid + " because Minecraft does not recognize this as a valid player!"); return; } PermissionAttachment permissionAttachment = player.addAttachment(MetadataHandler.PLUGIN); @@ -114,12 +113,12 @@ public void run() { try { statement.close(); } catch (SQLException throwables) { - new WarningMessage("Failed to close statement after failing player data creation!"); + Logger.warn("Failed to close statement after failing player data creation!"); throwables.printStackTrace(); } } - new WarningMessage("Something went wrong while generating a new player entry. This is bad! Tell the dev."); - new WarningMessage(e.getClass().getName() + ": " + e.getMessage()); + Logger.warn("Something went wrong while generating a new player entry. This is bad! Tell the dev."); + Logger.warn(e.getClass().getName() + ": " + e.getMessage()); } } }.runTaskAsynchronously(MetadataHandler.PLUGIN); @@ -136,7 +135,7 @@ public static void updateQuestStatus(UUID uuid) { if (playerDataHashMap.containsKey(uuid)) playerDataHashMap.get(uuid).quests = playerQuests; } catch (Exception ex) { - new WarningMessage("Failed to serialize player quest data!"); + Logger.warn("Failed to serialize player quest data!"); ex.printStackTrace(); } } @@ -263,7 +262,7 @@ public static Quest getQuest(UUID uuid, String questID) { UUID questUUID = UUID.fromString(questID); return getQuest(uuid, questUUID); } catch (Exception ex) { - new WarningMessage("Failed to convert quest ID from command into a valid UUID format!"); + Logger.warn("Failed to convert quest ID from command into a valid UUID format!"); return null; } } @@ -324,7 +323,7 @@ public static void updatePlayerQuestCooldowns(UUID uuid, PlayerQuestCooldowns pl try { setDatabaseValue(uuid, "PlayerQuestCooldowns", ObjectSerializer.toString(playerQuestCooldowns)); } catch (Exception ex) { - new WarningMessage("Failed to register player quest cooldowns!"); + Logger.warn("Failed to register player quest cooldowns!"); ex.printStackTrace(); } } @@ -347,7 +346,7 @@ public void run() { statement.executeUpdate(sql); statement.close(); } catch (Exception e) { - new WarningMessage("Failed to update database value."); + Logger.warn("Failed to update database value."); e.printStackTrace(); } } @@ -364,8 +363,8 @@ private static Object getDatabaseBlob(UUID uuid, String value) { if (bytes == null) return null; return new String(bytes); } catch (Exception e) { - new WarningMessage("Failed to get blob value from database!"); - new WarningMessage("UUID: " + uuid + " | Value: " + value); + Logger.warn("Failed to get blob value from database!"); + Logger.warn("UUID: " + uuid + " | Value: " + value); e.printStackTrace(); return null; } @@ -490,7 +489,7 @@ private static Boolean getDatabaseBoolean(UUID uuid, String value) { statement.close(); return reply; } catch (Exception e) { - new WarningMessage("Failed to get boolean value from database!"); + Logger.warn("Failed to get boolean value from database!"); e.printStackTrace(); return null; } @@ -505,7 +504,7 @@ private static String getDatabaseString(UUID uuid, String value) { statement.close(); return reply; } catch (Exception e) { - new WarningMessage("Failed to get string value from database!"); + Logger.warn("Failed to get string value from database!"); e.printStackTrace(); return null; } @@ -520,7 +519,7 @@ private static Double getDatabaseDouble(UUID uuid, String value) { statement.close(); return reply; } catch (Exception e) { - new WarningMessage("Failed to get double value from database!"); + Logger.warn("Failed to get double value from database!"); e.printStackTrace(); return null; } @@ -535,7 +534,7 @@ private static Integer getDatabaseInteger(UUID uuid, String value) { statement.close(); return reply; } catch (Exception e) { - new WarningMessage("Failed to get integer value from database!"); + Logger.warn("Failed to get integer value from database!"); e.printStackTrace(); return null; } @@ -566,13 +565,13 @@ public static Connection getConnection() throws Exception { public static void initializeDatabaseConnection() { new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + "/data").mkdirs(); try { - new InfoMessage("Opened database successfully"); + Logger.info("Opened database successfully"); GenerateDatabase.generate(); for (Player player : Bukkit.getOnlinePlayers()) new PlayerData(player.getUniqueId()); } catch (Exception e) { - new WarningMessage(e.getClass().getName() + ": " + e.getMessage()); - new WarningMessage("Failed to establish a connection to the SQLite database. Player data will not be saved! Is your MySQL configuration valid and is your MySQL server running?"); + Logger.warn(e.getClass().getName() + ": " + e.getMessage()); + Logger.warn("Failed to establish a connection to the SQLite database. Player data will not be saved! Is your MySQL configuration valid and is your MySQL server running?"); e.printStackTrace(); } @@ -584,7 +583,7 @@ public static void closeConnection() { if (connection == null) return; connection.close(); } catch (Exception ex) { - new WarningMessage("Could not correctly close database connection."); + Logger.warn("Could not correctly close database connection."); } } @@ -609,11 +608,11 @@ private void readExistingData(Statement statement, UUID uuid, ResultSet resultSe if (quest instanceof CustomQuest) ((CustomQuest) quest).applyTemporaryPermissions(Bukkit.getPlayer(uuid)); } catch (Exception ex) { - new WarningMessage("Failed to serialize quest data for player " + Bukkit.getPlayer(uuid) + " ! This player's quest data will be wiped to prevent future errors."); + Logger.warn("Failed to serialize quest data for player " + Bukkit.getPlayer(uuid) + " ! This player's quest data will be wiped to prevent future errors."); try { resetQuests(uuid); } catch (Exception ex2) { - new WarningMessage("Failed to reset quest data! Ironic."); + Logger.warn("Failed to reset quest data! Ironic."); ex2.printStackTrace(); } } @@ -624,11 +623,11 @@ private void readExistingData(Statement statement, UUID uuid, ResultSet resultSe playerQuestCooldowns = (PlayerQuestCooldowns) ObjectSerializer.fromString(new String(resultSet.getBytes("PlayerQuestCooldowns"), StandardCharsets.UTF_8)); playerQuestCooldowns.startCooldowns(uuid); } catch (Exception exception) { - new WarningMessage("Failed to get player quest cooldowns! ! This player's quest cooldowns will be wiped to prevent future errors."); + Logger.warn("Failed to get player quest cooldowns! ! This player's quest cooldowns will be wiped to prevent future errors."); try { resetPlayerQuestCooldowns(uuid); } catch (Exception ex2) { - new WarningMessage("Failed to reset quest cooldowns! Ironic."); + Logger.warn("Failed to reset quest cooldowns! Ironic."); ex2.printStackTrace(); } } @@ -646,7 +645,7 @@ private void readExistingData(Statement statement, UUID uuid, ResultSet resultSe setDismissEMStatusScreenMessage(Bukkit.getPlayer(uuid), false); } - new InfoMessage("User " + uuid + " data successfully read!"); + Logger.info("User " + uuid + " data successfully read!"); } private void writeNewData(Statement statement, UUID uuid) throws Exception { @@ -697,7 +696,7 @@ private void writeNewData(Statement statement, UUID uuid) throws Exception { "0);"; statement.executeUpdate(sql); statement.close(); - new InfoMessage("No player entry detected, generating new entry!"); + Logger.info("No player entry detected, generating new entry!"); } public static class PlayerDataEvents implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/database/PortOldData.java b/src/main/java/com/magmaguy/elitemobs/playerdata/database/PortOldData.java index 8dab6971f..6218efae6 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/database/PortOldData.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/database/PortOldData.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.playerdata.database; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -128,7 +128,7 @@ public PortOldData() { PlayerData.getConnection().commit(); PlayerData.getConnection().close(); } catch (Exception e) { - new WarningMessage("Warning: Failed to write values from old config files to new database system. Tell the dev!"); + Logger.warn("Warning: Failed to write values from old config files to new database system. Tell the dev!"); System.err.println(e.getClass().getName() + ": " + e.getMessage()); errored = true; } @@ -151,7 +151,7 @@ private void deleteConfig(File file) { try { if (file.exists() && file.isFile()) { file.delete(); - new WarningMessage("Deleted data file " + file.getName() + " - was no longer in use, moved to SQLite"); + Logger.warn("Deleted data file " + file.getName() + " - was no longer in use, moved to SQLite"); } } catch (Exception ex) { diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java index efbdc0ef5..de32c0cb9 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; import com.magmaguy.elitemobs.config.menus.premade.PlayerStatusMenuConfig; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.SpigotMessage; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -57,11 +57,11 @@ protected static TextComponent[] bossTrackingPage(Player player) { textComponents.add(SpigotMessage.commandHoverMessage( customBossEntity.getCustomBossBossBar().bossBarMessage(player, customBossEntity.getCustomBossesConfigFields().getLocationMessage()) + "\n", PlayerStatusMenuConfig.getOnBossTrackHover(), - "/elitemobs trackcustomboss " + customBossEntity.getEliteUUID())); + "/elitemobs track boss " + customBossEntity.getEliteUUID())); counter++; } catch (Exception ex) { - new WarningMessage("Failed to correctly get elements for boss tracking page!"); + Logger.warn("Failed to correctly get elements for boss tracking page!"); ex.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/GearPage.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/GearPage.java index 9f3345927..ff2bad8b1 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/GearPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/GearPage.java @@ -4,7 +4,6 @@ import com.magmaguy.elitemobs.config.menus.premade.PlayerStatusMenuConfig; import com.magmaguy.elitemobs.items.ShareItem; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -194,17 +193,15 @@ private static ChatColor unicodeColorizer(Material material) { case TURTLE_HELMET: return ChatColor.GREEN; default: - if (!VersionChecker.serverVersionOlderThan(16, 0)) { - if (material.equals(Material.NETHERITE_HELMET) || - material.equals(Material.NETHERITE_CHESTPLATE) || - material.equals(Material.NETHERITE_LEGGINGS) || - material.equals(Material.NETHERITE_BOOTS) || - material.equals(Material.NETHERITE_SWORD) || - material.equals(Material.NETHERITE_AXE) || - material.equals(Material.NETHERITE_HOE) || - material.equals(Material.NETHERITE_PICKAXE)) - return ChatColor.BLACK; - } + if (material.equals(Material.NETHERITE_HELMET) || + material.equals(Material.NETHERITE_CHESTPLATE) || + material.equals(Material.NETHERITE_LEGGINGS) || + material.equals(Material.NETHERITE_BOOTS) || + material.equals(Material.NETHERITE_SWORD) || + material.equals(Material.NETHERITE_AXE) || + material.equals(Material.NETHERITE_HOE) || + material.equals(Material.NETHERITE_PICKAXE)) + return ChatColor.BLACK; return ChatColor.DARK_GRAY; } } diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/PlayerStatusScreen.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/PlayerStatusScreen.java index c8091c975..0ac3dd8c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/PlayerStatusScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/PlayerStatusScreen.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.playerdata.statusscreen; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.menus.premade.PlayerStatusMenuConfig; import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.thirdparty.geyser.GeyserDetector; import com.magmaguy.elitemobs.utils.BookMaker; +import com.magmaguy.magmacore.util.ChatColorConverter; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/StatsPage.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/StatsPage.java index 26d02da1c..d375db0d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/StatsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/StatsPage.java @@ -63,7 +63,7 @@ protected static void statsPage(Player targetPlayer, Player requestingPlayer) { EconomyHandler.checkCurrency(targetPlayer.getUniqueId()) + "")); inventory.setItem(PlayerStatusMenuConfig.getStatsGuildTierSlot(), replaceItemNamePlaceholder(PlayerStatusMenuConfig.getStatsGuildTierItem().clone(), "$tier", - AdventurersGuildConfig.getShortenedRankName(GuildRank.getGuildPrestigeRank(targetPlayer), GuildRank.getActiveGuildRank(targetPlayer)) + "")); + AdventurersGuildConfig.getShortenedRankName(GuildRank.getGuildPrestigeRank(targetPlayer), GuildRank.getActiveGuildRank(targetPlayer)))); inventory.setItem(PlayerStatusMenuConfig.getStatsEliteKillsSlot(), replaceItemNamePlaceholder(PlayerStatusMenuConfig.getStatsEliteKillsItem().clone(), "$kills", PlayerData.getKills(targetPlayer.getUniqueId()) + "")); diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java index cf1fdfb81..65d12c34a 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.playerdata.statusscreen; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.commands.DungeonCommands; import com.magmaguy.elitemobs.config.menus.premade.PlayerStatusMenuConfig; import com.magmaguy.elitemobs.dungeons.CombatContent; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -50,6 +50,7 @@ protected static TextComponent[] teleportsPage() { if (!emPackage.isInstalled() || !(emPackage instanceof CombatContent) || emPackage.getDungeonPackagerConfigFields().isEnchantmentChallenge()) continue; + if (!emPackage.getDungeonPackagerConfigFields().isListedInTeleports()) continue; TextComponent message = new TextComponent(PlayerStatusScreen.convertLightColorsToBlack(emPackage.getDungeonPackagerConfigFields().getName() + "\n")); String hoverMessage = ChatColorConverter.convert(PlayerStatusMenuConfig.getOnTeleportHover() + "\n" + @@ -69,11 +70,12 @@ protected static TextComponent[] teleportsPage() { textComponent[0] = configTextComponent; return textComponent; } else { - TextComponent[] textComponent = new TextComponent[(int) Math.floor(counter / 9D) + 1]; - int internalCounter = 0; + double elementsPerPage = 5D; + TextComponent[] textComponent = new TextComponent[(int) Math.floor(counter + 2 / elementsPerPage) + 1]; + int internalCounter = 2; textComponent[0] = configTextComponent; for (TextComponent text : textComponents) { - int currentPage = (int) Math.floor(internalCounter / 9D); + int currentPage = (int) Math.floor(internalCounter / elementsPerPage); if (textComponent[currentPage] == null) textComponent[currentPage] = new TextComponent(); textComponent[currentPage].addExtra(text); @@ -91,6 +93,8 @@ protected static void teleportsPage(Player targetPlayer, Player requestingPlayer if (!emPackage.isInstalled() || !(emPackage instanceof CombatContent) || emPackage.getDungeonPackagerConfigFields().isEnchantmentChallenge()) continue; + if (!emPackage.getDungeonPackagerConfigFields().isListedInTeleports()) continue; + TeleportsPageEvents.orderedDungeons.add(emPackage); inventory.setItem(counter, ItemStackGenerator.generateItemStack(Material.PAPER, emPackage.getDungeonPackagerConfigFields().getName() , Collections.singletonList(emPackage.getDungeonPackagerConfigFields().getPlayerInfo() diff --git a/src/main/java/com/magmaguy/elitemobs/powers/BulletHell.java b/src/main/java/com/magmaguy/elitemobs/powers/BulletHell.java index 81741cd20..26d0e1bcd 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/BulletHell.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/BulletHell.java @@ -86,7 +86,7 @@ public void run() { return; } - eliteEntity.getLivingEntity().getWorld().spawnParticle(Particle.DRIP_WATER, eliteEntity.getLivingEntity().getLocation(), 10, 1, 1, 1); + eliteEntity.getLivingEntity().getWorld().spawnParticle(Particle.DRIPPING_WATER, eliteEntity.getLivingEntity().getLocation(), 10, 1, 1, 1); for (Entity nearbyEntity : eliteEntity.getLivingEntity().getNearbyEntities(20, 20, 20)) if (nearbyEntity instanceof Player && diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ChannelHealing.java b/src/main/java/com/magmaguy/elitemobs/powers/ChannelHealing.java index 01a43dfe1..45fe68731 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ChannelHealing.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ChannelHealing.java @@ -68,7 +68,7 @@ public void run() { if (timer % 10 == 0 && timer > 0) { double healAmount = healer.getLevel() / 2d; damagedEntity.heal(healAmount); - damagedEntity.getLocation().getWorld().spawnParticle(Particle.TOTEM, damagedEntity.getLocation().add(new Vector(0, 1, 0)), 20, 0.1, 0.1, 0.1); + damagedEntity.getLocation().getWorld().spawnParticle(Particle.TOTEM_OF_UNDYING, damagedEntity.getLocation().add(new Vector(0, 1, 0)), 20, 0.1, 0.1, 0.1); } Vector toDamaged = damagedEntity.getLocation().add(new Vector(0, 1, 0)) @@ -78,7 +78,7 @@ public void run() { Location rayLocation = healer.getLocation().add(new Vector(0, 1, 0)).add(toDamaged); for (int i = 0; i < 55; i++) { - rayLocation.getWorld().spawnParticle(Particle.TOTEM, rayLocation, 1, toDamaged.getX(), toDamaged.getY(), toDamaged.getZ(), .2D); + rayLocation.getWorld().spawnParticle(Particle.TOTEM_OF_UNDYING, rayLocation, 1, toDamaged.getX(), toDamaged.getY(), toDamaged.getZ(), .2D); rayLocation.add(toDamaged); if (rayLocation.distance(damagedEntity.getLocation()) < 2) break; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/DeathSlice.java b/src/main/java/com/magmaguy/elitemobs/powers/DeathSlice.java index aa6728ba4..119a42430 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/DeathSlice.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/DeathSlice.java @@ -71,7 +71,7 @@ private static ArrayList raytracedLocationList(Location originalLocati private static void doWarningParticle(Location location) { if (ThreadLocalRandom.current().nextDouble() < 0.3) - location.getWorld().spawnParticle(Particle.SMOKE_LARGE, location, 1, 0.05, 0.05, 0.05, 0.05); + location.getWorld().spawnParticle(Particle.LARGE_SMOKE, location, 1, 0.05, 0.05, 0.05, 0.05); } private static void doDamagePhase(Location location, EliteEntity eliteEntity) { diff --git a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonDiscoFireballs.java b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonDiscoFireballs.java index 9de8e4e36..68136c38c 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonDiscoFireballs.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonDiscoFireballs.java @@ -157,7 +157,7 @@ private void generateVisualParticles(EliteEntity eliteEntity, Fireball fireball) for (int i = 0; i < 200; i++) { particleLocation.add(downwardsVector.clone().multiply(0.3)); if (!particleLocation.getBlock().isPassable()) break; - fireball.getWorld().spawnParticle(Particle.SMOKE_NORMAL, particleLocation, 1, 1, 0, 0, 0); + fireball.getWorld().spawnParticle(Particle.SMOKE, particleLocation, 1, 1, 0, 0, 0); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonEndermiteBombardment.java b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonEndermiteBombardment.java index ea0a7e40c..dd4ca1352 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonEndermiteBombardment.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonEndermiteBombardment.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.powers.meta.Bombardment; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; @@ -40,7 +40,7 @@ public void taskBehavior(EliteEntity eliteEntity) { eliteEntity.addReinforcement(customBossEntity2); } catch (Exception ex) { - new WarningMessage("Failed to spawn binder of world's reinforcement endermite!"); + Logger.warn("Failed to spawn binder of world's reinforcement endermite!"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonPotionBombardment.java b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonPotionBombardment.java index 2a5d1f5fc..e378e2674 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonPotionBombardment.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonPotionBombardment.java @@ -28,8 +28,8 @@ public void taskBehavior(EliteEntity eliteEntity) { ItemStack itemStack = new ItemStack(Material.SPLASH_POTION); PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta(); if (ThreadLocalRandom.current().nextBoolean()) - potionMeta.addCustomEffect(new PotionEffect(PotionEffectType.HARM, 0, 1), true); - else potionMeta.addCustomEffect(new PotionEffect(PotionEffectType.SLOW, 0, 1), true); + potionMeta.addCustomEffect(new PotionEffect(PotionEffectType.STRENGTH, 0, 1), true); + else potionMeta.addCustomEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 1), true); itemStack.setItemMeta(potionMeta); @@ -39,7 +39,7 @@ public void taskBehavior(EliteEntity eliteEntity) { new Vector(ThreadLocalRandom.current().nextInt(-1, 1), 1, ThreadLocalRandom.current().nextInt(-1, 1))) - , EntityType.SPLASH_POTION); + , EntityType.POTION); thrownPotion.setItem(itemStack); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java index edbb40c06..2275bd811 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java @@ -102,7 +102,7 @@ private void doTornadoParticles() { .rotateAroundY(ThreadLocalRandom.current().nextDouble(2 * Math.PI))); randomParticleLocation.setDirection(randomParticleLocation.toVector().rotateAroundY(0.5 * Math.PI)); if (ThreadLocalRandom.current().nextDouble() < 0.7) - tornadoEye.getWorld().spawnParticle(Particle.SMOKE_LARGE, randomParticleLocation, 1, 0, 0, 0, 0.05); + tornadoEye.getWorld().spawnParticle(Particle.LARGE_SMOKE, randomParticleLocation, 1, 0, 0, 0, 0.05); else tornadoEye.getWorld().spawnParticle(Particle.SOUL_FIRE_FLAME, randomParticleLocation, 1, 0, 0, 0, 0.05); } @@ -120,7 +120,7 @@ private void doTerrainDestruction(EliteEntity eliteEntity) { if (block.getLocation().getY() != -1) blockList.add(block); } - Explosion.generateFakeExplosion(blockList, eliteEntity.getLivingEntity(), (PowersConfigFields)getPowersConfigFields(), tornadoEye.clone()); + Explosion.generateFakeExplosion(blockList, eliteEntity.getLivingEntity(), (PowersConfigFields) getPowersConfigFields(), tornadoEye.clone()); } private void doEntityDisplacement(LivingEntity sourceEntity) { diff --git a/src/main/java/com/magmaguy/elitemobs/powers/Firestorm.java b/src/main/java/com/magmaguy/elitemobs/powers/Firestorm.java index d5cff6958..2e7783937 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/Firestorm.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/Firestorm.java @@ -62,7 +62,7 @@ private static void doFlamePyrePhase1(Location location, EliteEntity eliteEntity @Override public void run() { counter++; - spawnPhase1Particle(location, Particle.SMOKE_NORMAL); + spawnPhase1Particle(location, Particle.SMOKE); if (counter < 20 * 2) return; cancel(); doFlamePyrePhase2(location, eliteEntity); @@ -93,7 +93,7 @@ public void run() { counter++; spawnPhase1Particle(location, Particle.FLAME); doDamage(location, eliteEntity, 0.5, 50, 0.5); - spawnPhase2Particle(location, Particle.SMOKE_NORMAL); + spawnPhase2Particle(location, Particle.SMOKE); if (counter < 20 * 2) return; cancel(); doFlamePyrePhase3(location, eliteEntity); @@ -130,7 +130,7 @@ public void run() { counter++; spawnPhase2Particle(location, Particle.FLAME); doDamage(location, eliteEntity, 3, 50, 3); - spawnPhase3Particle(location, Particle.SMOKE_NORMAL); + spawnPhase3Particle(location, Particle.SMOKE); if (counter < 20 * 2) return; cancel(); doFlamePyrePhase4(location, eliteEntity); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/FireworksBarrage.java b/src/main/java/com/magmaguy/elitemobs/powers/FireworksBarrage.java index 8e9b1ea64..43daabd1a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/FireworksBarrage.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/FireworksBarrage.java @@ -46,7 +46,7 @@ public void run() { } for (int i = 0; i < 2; i++) { - Firework firework = (Firework) eliteEntity.getLivingEntity().getWorld().spawnEntity(eliteEntity.getLivingEntity().getLocation(), EntityType.FIREWORK); + Firework firework = (Firework) eliteEntity.getLivingEntity().getWorld().spawnEntity(eliteEntity.getLivingEntity().getLocation(), EntityType.FIREWORK_ROCKET); FireworkMeta fireworkMeta = firework.getFireworkMeta(); fireworkMeta.setPower(10); fireworkMeta.addEffect(FireworkEffect.builder().withColor(Color.RED, Color.WHITE, Color.BLUE).flicker(true).build()); @@ -60,7 +60,7 @@ public void run() { if (nearbyEntity instanceof Player) if (((Player) nearbyEntity).getGameMode().equals(GameMode.ADVENTURE) || ((Player) nearbyEntity).getGameMode().equals(GameMode.SURVIVAL)) { - Firework firework = (Firework) eliteEntity.getLivingEntity().getWorld().spawnEntity(eliteEntity.getLivingEntity().getLocation(), EntityType.FIREWORK); + Firework firework = (Firework) eliteEntity.getLivingEntity().getWorld().spawnEntity(eliteEntity.getLivingEntity().getLocation(), EntityType.FIREWORK_ROCKET); FireworkMeta fireworkMeta = firework.getFireworkMeta(); fireworkMeta.setPower(10); fireworkMeta.addEffect(FireworkEffect.builder().withColor(Color.RED, Color.WHITE, Color.BLUE).flicker(true).build()); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/FlamePyre.java b/src/main/java/com/magmaguy/elitemobs/powers/FlamePyre.java index 1ed836060..f086a02e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/FlamePyre.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/FlamePyre.java @@ -50,7 +50,7 @@ public void run() { cancel(); return; } - spawnPhase1Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.SMOKE_NORMAL); + spawnPhase1Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.SMOKE); if (counter < 20 * 2) return; cancel(); doFlamePyrePhase2(eliteEntity); @@ -85,7 +85,7 @@ public void run() { counter++; spawnPhase1Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.FLAME); doDamage(eliteEntity, 0.5, 50, 0.5); - spawnPhase2Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.SMOKE_NORMAL); + spawnPhase2Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.SMOKE); if (counter < 20 * 2) return; cancel(); doFlamePyrePhase3(eliteEntity); @@ -128,7 +128,7 @@ public void run() { counter++; spawnPhase2Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.FLAME); doDamage(eliteEntity, 3, 50, 3); - spawnPhase3Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.SMOKE_NORMAL); + spawnPhase3Particle(eliteEntity.getLivingEntity().getLocation().clone(), Particle.SMOKE); if (counter < 20 * 2) return; cancel(); doFlamePyrePhase4(eliteEntity); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/Flamethrower.java b/src/main/java/com/magmaguy/elitemobs/powers/Flamethrower.java index 23bb888bb..585550117 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/Flamethrower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/Flamethrower.java @@ -64,7 +64,7 @@ public void run() { return; } - doParticleEffect(eliteEntity, fixedPlayerLocation, Particle.SMOKE_NORMAL); + doParticleEffect(eliteEntity, fixedPlayerLocation, Particle.SMOKE); counter++; if (counter < 20 * 2) return; @@ -147,7 +147,7 @@ public void run() { return; } timer++; - doParticleEffect(eliteEntity, fixedPlayerLocation, Particle.SMOKE_NORMAL); + doParticleEffect(eliteEntity, fixedPlayerLocation, Particle.SMOKE); if (timer < 20) return; cancel(); eliteEntity.getLivingEntity().setAI(true); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/FrostCone.java b/src/main/java/com/magmaguy/elitemobs/powers/FrostCone.java index 5a0c7d0da..f7970bb4d 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/FrostCone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/FrostCone.java @@ -78,7 +78,7 @@ private static void doSmokeEffect(EliteEntity eliteEntity, Location location) { for (int i = 0; i < 100; i++) { Vector shotVector = getShotVector(eliteEntity, location); eliteEntity.getLivingEntity().getWorld().spawnParticle( - Particle.SMOKE_NORMAL, + Particle.SMOKE, eliteEntity.getLivingEntity().getLocation().clone().add(new Vector(0, 1, 0)), 0, shotVector.getX(), @@ -132,7 +132,7 @@ public void playerHitByFrostConeSnowball(PlayerDamagedByEliteMobEvent event) { frostconePlayer.put(event.getPlayer(), 1); else frostconePlayer.put(event.getPlayer(), frostconePlayer.get(event.getPlayer()) + 1); - event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 7, frostconePlayer.get(event.getPlayer()))); + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 20 * 7, frostconePlayer.get(event.getPlayer()))); new BukkitRunnable() { final int amount = frostconePlayer.get(event.getPlayer()); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java b/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java index dd6287795..1cad9a8f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java @@ -6,7 +6,7 @@ import com.magmaguy.elitemobs.config.powers.PowersConfig; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.BossPower; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Item; @@ -54,7 +54,7 @@ public void run() { counter++; if (MobCombatSettingsConfig.isEnableWarningVisualEffects()) - eliteEntity.getLivingEntity().getWorld().spawnParticle(Particle.SMOKE_NORMAL, eliteEntity.getLivingEntity().getLocation(), counter, 1, 1, 1, 0); + eliteEntity.getLivingEntity().getWorld().spawnParticle(Particle.SMOKE, eliteEntity.getLivingEntity().getLocation(), counter, 1, 1, 1, 0); if (counter < 20 * 1.5) return; cancel(); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java b/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java index 2b054aa85..fbdbc838a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java @@ -5,7 +5,7 @@ import com.magmaguy.elitemobs.config.powers.PowersConfig; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.BossPower; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Item; @@ -75,7 +75,7 @@ private void doSmokeEffect(EliteEntity eliteEntity, Vector shotVector) { for (int i = 0; i < 200; i++) { Vector visualShotVector = getShotVector(shotVector); eliteEntity.getLivingEntity().getWorld().spawnParticle( - Particle.SMOKE_NORMAL, + Particle.SMOKE, eliteEntity.getLivingEntity().getLocation().clone().add(new Vector(0, 0.5, 0)), 0, visualShotVector.getX(), diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GroundPound.java b/src/main/java/com/magmaguy/elitemobs/powers/GroundPound.java index 25fa504a1..b6037fe74 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GroundPound.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GroundPound.java @@ -104,7 +104,7 @@ public void run() { entity.setVelocity(new Vector(0, 1.5, 0)); } if (entity instanceof LivingEntity) - ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 3, 2)); + ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 20 * 3, 2)); } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityArrow.java b/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityArrow.java index 24fb0eb87..07775fe93 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityArrow.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityArrow.java @@ -16,7 +16,7 @@ public InvulnerabilityArrow() { super(PowersConfig.getPower("invulnerability_arrow.yml")); } - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void invulnerabilityArrow(EliteMobDamagedByPlayerEvent event) { if (!event.getEliteMobEntity().hasPower(this)) return; if (!event.getEntityDamageByEntityEvent().getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE)) return; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFallDamage.java b/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFallDamage.java index f8aa4c0d2..78ee1acc6 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFallDamage.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFallDamage.java @@ -16,7 +16,7 @@ public InvulnerabilityFallDamage() { super(PowersConfig.getPower("invulnerability_fall_damage.yml")); } - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void invulnerabilityFallDamage(EliteMobDamagedEvent event) { if (!event.getEliteEntity().hasPower(this)) return; if (!event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.FALL)) return; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFireworks.java b/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFireworks.java index 779cb524e..68345f4d7 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFireworks.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/InvulnerabilityFireworks.java @@ -14,7 +14,7 @@ public InvulnerabilityFireworks() { super(PowersConfig.getPower("invulnerability_fireworks.yml")); } - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onEliteDamaged(EntityDamageByEntityEvent event) { if (!(event.getDamager() instanceof Firework)) return; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity()); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/MeteorShower.java b/src/main/java/com/magmaguy/elitemobs/powers/MeteorShower.java index f7cc03a68..5e17c1eb3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/MeteorShower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/MeteorShower.java @@ -62,7 +62,7 @@ public static void doCloudEffect(Location location) { int randY = ThreadLocalRandom.current().nextInt(2); int randZ = ThreadLocalRandom.current().nextInt(30) - 15; Location newLocation = location.clone().add(new Vector(randX, randY, randZ)); - location.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, newLocation, 1, 0, 0, 0, 0); + location.getWorld().spawnParticle(Particle.EXPLOSION, newLocation, 1, 0, 0, 0, 0); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java b/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java index 222a4a9ea..6ca9a72a3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java @@ -5,7 +5,7 @@ import com.magmaguy.elitemobs.events.BossCustomAttackDamage; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.CombatEnterScanPower; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Color; import org.bukkit.GameMode; import org.bukkit.Location; @@ -110,7 +110,7 @@ else if (yAbs > xAbs && yAbs > zAbs) y *= -1; else if (zAbs > yAbs && zAbs > xAbs) z *= -1; - else new WarningMessage("MagmaGuy is bad at math!"); + else Logger.warn("MagmaGuy is bad at math!"); laserVector.setX(x); laserVector.setY(y); laserVector.setZ(z); @@ -146,13 +146,13 @@ private Vector dragTarget(Vector originalVector, Location sourceLocation, Locati } private void doWarningParticle(Location location) { - location.getWorld().spawnParticle(Particle.REDSTONE, location.getX(), location.getY(), location.getZ(), + location.getWorld().spawnParticle(Particle.DUST, location.getX(), location.getY(), location.getZ(), 5, 0.2, 0.2, 0.2, 1, new Particle.DustOptions(Color.BLACK, 1)); } private void doDamageParticles(EliteEntity eliteEntity, Location location) { - location.getWorld().spawnParticle(Particle.REDSTONE, location.getX(), location.getY(), location.getZ(), + location.getWorld().spawnParticle(Particle.DUST, location.getX(), location.getY(), location.getZ(), 5, 0.2, 0.2, 0.2, 1, new Particle.DustOptions(Color.fromRGB( ThreadLocalRandom.current().nextInt(0, 100), diff --git a/src/main/java/com/magmaguy/elitemobs/powers/PlasmaBlaster.java b/src/main/java/com/magmaguy/elitemobs/powers/PlasmaBlaster.java index 996495f6f..de4b19d1b 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/PlasmaBlaster.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/PlasmaBlaster.java @@ -78,7 +78,7 @@ private void doDamage(Player player, EliteEntity sourceEntity) { private void doDamageFireworks(Location endLocation) { for (int i = 0; i < 200; i++) { - endLocation.getWorld().spawnParticle(Particle.REDSTONE, endLocation.getX(), endLocation.getY(), endLocation.getZ(), + endLocation.getWorld().spawnParticle(Particle.DUST, endLocation.getX(), endLocation.getY(), endLocation.getZ(), 1, 3, 3, 3, 1, new Particle.DustOptions(Color.fromRGB( ThreadLocalRandom.current().nextInt(122, 255), @@ -89,7 +89,7 @@ private void doDamageFireworks(Location endLocation) { } private void doVisualEffect(Location location, int counter) { - location.getWorld().spawnParticle(Particle.REDSTONE, location.getX(), location.getY(), location.getZ(), + location.getWorld().spawnParticle(Particle.DUST, location.getX(), location.getY(), location.getZ(), 10, 0.1 * counter / 12d, 0.1 * counter / 12d, 0.1 * counter / 12d, 1, new Particle.DustOptions(Color.fromRGB( ThreadLocalRandom.current().nextInt(0, 100), ThreadLocalRandom.current().nextInt(122, 255), diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ShieldWall.java b/src/main/java/com/magmaguy/elitemobs/powers/ShieldWall.java index 022f38b2b..07a235deb 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ShieldWall.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ShieldWall.java @@ -9,7 +9,7 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.ElitePower; import com.magmaguy.elitemobs.powers.meta.MinorPower; -import com.magmaguy.elitemobs.utils.VisualArmorStand; +import com.magmaguy.elitemobs.utils.VisualDisplay; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -189,7 +189,7 @@ private Location getRealLocation(Direction direction, Location livingEntityLocat private List armorStandCreator(Direction direction, EliteEntity eliteEntity) { List armorStands = new ArrayList<>(); for (int i = -1; i < 2; i++) { - ArmorStand armorStand = VisualArmorStand.VisualArmorStand(getRealLocation(direction, eliteEntity.getLivingEntity().getLocation(), i), "Barrier"); + ArmorStand armorStand = VisualDisplay.generateTemporaryArmorStand(getRealLocation(direction, eliteEntity.getLivingEntity().getLocation(), i), "Barrier"); armorStands.add(armorStand); armorStand.getEquipment().setItemInMainHand(new ItemStack(Material.SHIELD)); armorStand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/SkeletonPillar.java b/src/main/java/com/magmaguy/elitemobs/powers/SkeletonPillar.java index 3c1a19c63..6961ce965 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/SkeletonPillar.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/SkeletonPillar.java @@ -78,12 +78,12 @@ public void run() { private void pillarEffect(Location location, int timer, int offset) { location.add(locationMover(location, timer, offset)); - location.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, location, 15, 0.1, 5, 0.1, 0.05); + location.getWorld().spawnParticle(Particle.EXPLOSION, location, 15, 0.1, 5, 0.1, 0.05); pillarDamage(location); } private void pillarWarningEffect(Location location) { - location.getWorld().spawnParticle(Particle.SMOKE_LARGE, location, 5, 0.1, 5, 0.1, 0.05); + location.getWorld().spawnParticle(Particle.LARGE_SMOKE, location, 5, 0.1, 5, 0.1, 0.05); } private void pillarDamage(Location location) { diff --git a/src/main/java/com/magmaguy/elitemobs/powers/SpiritWalk.java b/src/main/java/com/magmaguy/elitemobs/powers/SpiritWalk.java index a5e0e4bb7..f8b084362 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/SpiritWalk.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/SpiritWalk.java @@ -171,7 +171,7 @@ private int getHitsCounter() { return hitCounter; } - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onBossMobGotHit(EliteMobDamagedEvent event) { SpiritWalk spiritWalk = (SpiritWalk) event.getEliteEntity().getPower(this); if (spiritWalk == null) return; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/SummonTheReturned.java b/src/main/java/com/magmaguy/elitemobs/powers/SummonTheReturned.java index 6737de3eb..7e8071037 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/SummonTheReturned.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/SummonTheReturned.java @@ -6,7 +6,7 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.powers.meta.BossPower; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.event.EventHandler; @@ -70,7 +70,7 @@ private void doSummon(EliteEntity eliteEntity) { try { eliteEntity.getLivingEntity().setVelocity(new Vector(x, 0.5, z)); } catch (Exception ex) { - new WarningMessage("Attempted to complete Summon the Returned power but a reinforcement mob wasn't detected! Did the boss move to an area that prevents spawning?"); + Logger.warn("Attempted to complete Summon the Returned power but a reinforcement mob wasn't detected! Did the boss move to an area that prevents spawning?"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java b/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java index 60c8be7aa..94fd0b006 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.powers; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteMobDamagedEvent; import com.magmaguy.elitemobs.api.EliteMobDeathEvent; @@ -11,6 +10,7 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.MinorPower; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; @@ -71,7 +71,7 @@ public void onTarget(EliteMobTargetPlayerEvent event) { * * @param event */ - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onDamaged(EliteMobDamagedEvent event) { if (!event.getEliteEntity().hasPower(this)) return; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/Taze.java b/src/main/java/com/magmaguy/elitemobs/powers/Taze.java index 5d9c506bb..1f28ca291 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/Taze.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/Taze.java @@ -31,7 +31,7 @@ public void taze(Player player, Location entityLocation, int counter) { if (counter > 2) return; player.setVelocity(player.getLocation().subtract(entityLocation.toVector()).toVector().normalize()); player.sendTitle("", "Shocked!", 1, 30, 1); - player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30, 5)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 30, 5)); new BukkitRunnable() { @Override public void run() { diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ZombieBloat.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieBloat.java index cae99bd51..c4ace553c 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieBloat.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieBloat.java @@ -56,7 +56,7 @@ public void run() { if (MobCombatSettingsConfig.isEnableWarningVisualEffects()) - eventZombie.getWorld().spawnParticle(Particle.TOTEM, new Location(eventZombie.getWorld(), + eventZombie.getWorld().spawnParticle(Particle.TOTEM_OF_UNDYING, new Location(eventZombie.getWorld(), eventZombie.getLocation().getX(), eventZombie.getLocation().getY() + eventZombie.getHeight(), eventZombie.getLocation().getZ()), 20, timer / 24, timer / 9d, timer / 24d, 0.1); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ZombieFriends.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieFriends.java index ebcfa493f..710bc54cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieFriends.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieFriends.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.powers; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent; import com.magmaguy.elitemobs.config.powers.PowersConfig; @@ -8,6 +7,7 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.powers.meta.MajorPower; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.scheduler.BukkitRunnable; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java index 00b68cef4..058503d28 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent; +import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.config.MobCombatSettingsConfig; import com.magmaguy.elitemobs.config.powers.PowersConfig; import com.magmaguy.elitemobs.entitytracker.EntityTracker; @@ -10,7 +11,7 @@ import com.magmaguy.elitemobs.powers.meta.MajorPower; import com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath; import com.magmaguy.elitemobs.powerstances.VisualItemInitializer; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -27,7 +28,7 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; -import static com.magmaguy.elitemobs.ChatColorConverter.convert; +import static com.magmaguy.magmacore.util.ChatColorConverter.convert; /** * Created by MagmaGuy on 18/05/2017. @@ -35,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - //todo: Shouldn't this be static? + private final ArrayList entityList = new ArrayList<>(); public ZombieNecronomicon() { super(PowersConfig.getPower("zombie_necronomicon.yml")); @@ -46,7 +47,8 @@ public void onPlayerDetect(EliteMobDamagedByPlayerEvent event) { ZombieNecronomicon zombieNecronomicon = (ZombieNecronomicon) event.getEliteMobEntity().getPower(this); if (zombieNecronomicon == null) return; if (zombieNecronomicon.isFiring()) return; - + zombieNecronomicon.entityList.removeIf(entity -> !entity.exists()); + if (zombieNecronomicon.entityList.size() > 9) return; zombieNecronomicon.setFiring(true); necronomiconVisualEffect(event.getEliteMobEntity(), zombieNecronomicon); spawnReinforcements(event.getEliteMobEntity(), event.getPlayer(), zombieNecronomicon); @@ -175,17 +177,15 @@ private void spawnReinforcements(EliteEntity eliteEntity, LivingEntity targetted new BukkitRunnable() { - final ArrayList entityList = new ArrayList<>(); - @Override public void run() { if (!eliteEntity.isValid() || !targetted.isValid() || !targetter.isValid() || targetted.getWorld() != targetter.getWorld() || targetted.getLocation().distance(targetter.getLocation()) > 30) { - for (Entity entity : entityList) + for (CustomBossEntity entity : entityList) if (entity.isValid()) - entity.remove(); + entity.remove(RemovalReason.REINFORCEMENT_CULL); if (eliteEntity.isValid()) targetter.setAI(true); @@ -196,7 +196,7 @@ public void run() { int randomizedNumber = ThreadLocalRandom.current().nextInt(5) + 1; - entityList.removeIf(currentEntity -> !currentEntity.isValid()); + entityList.removeIf(currentEntity -> !currentEntity.exists()); if (entityList.size() < 11) { @@ -209,7 +209,7 @@ public void run() { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity("necronomicon_zombie.yml"); if (customBossEntity == null) { - new WarningMessage("necronomicon_zombie.yml is not valid!"); + Logger.warn("necronomicon_zombie.yml is not valid!"); return; } customBossEntity.spawn(targetter.getLocation(), eliteEntity.getLevel(), false); @@ -227,13 +227,13 @@ public void run() { eliteEntity.addReinforcement(customBossEntity); - entityList.add(customBossEntity.getLivingEntity()); + entityList.add(customBossEntity); } else { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity("necronomicon_skeleton.yml"); if (customBossEntity == null) { - new WarningMessage("necronomicon_skeleton.yml is not valid!"); + Logger.warn("necronomicon_skeleton.yml is not valid!"); targetter.setAI(true); cancel(); return; @@ -251,7 +251,7 @@ public void run() { eliteEntity.addReinforcement(customBossEntity); - entityList.add(customBossEntity.getLivingEntity()); + entityList.add(customBossEntity); } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ZombieParents.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieParents.java index 9aef1c6a4..d1de3e264 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieParents.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieParents.java @@ -7,7 +7,7 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.powers.meta.MajorPower; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.scheduler.BukkitRunnable; @@ -96,14 +96,14 @@ public void onHit(EliteMobDamagedByPlayerEvent event) { try { reinforcementMom.spawn(event.getEntity().getLocation(), event.getEliteMobEntity().getLevel(), false); } catch (Exception ex) { - new WarningMessage("Failed to spawn Zombie Parents Mom reinforcement!"); + Logger.warn("Failed to spawn Zombie Parents Mom reinforcement!"); return; } CustomBossEntity reinforcementDad = CustomBossEntity.createCustomBossEntity("zombie_parents_dad.yml"); try { reinforcementDad.spawn(event.getEntity().getLocation(), event.getEliteMobEntity().getLevel(), false); } catch (Exception ex) { - new WarningMessage("Failed to spawn Zombie Parents Dad reinforcement!"); + Logger.warn("Failed to spawn Zombie Parents Dad reinforcement!"); return; } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/meta/CombatEnterScanPower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/CombatEnterScanPower.java index 52bbe2804..3dfdd99ab 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CombatEnterScanPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CombatEnterScanPower.java @@ -4,7 +4,6 @@ import com.magmaguy.elitemobs.api.EliteMobExitCombatEvent; import com.magmaguy.elitemobs.config.powers.PowersConfigFields; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; -import com.magmaguy.elitemobs.utils.DebugMessage; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.scheduler.BukkitTask; @@ -62,7 +61,6 @@ public void onCombatEnter(EliteMobEnterCombatEvent event) { @EventHandler public void onCombatExit(EliteMobExitCombatEvent event) { - new DebugMessage("Exiting combat for " + event.getEliteMobEntity().getName()); for (CombatEnterScanPower combatEnterScanPower : combatEnterScanPowers) { ElitePower elitePowerInstance = event.getEliteMobEntity().getPower(combatEnterScanPower); if (elitePowerInstance == null) diff --git a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java index 6dc9f9a18..dcd160317 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -9,14 +9,13 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; import com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig; import com.magmaguy.elitemobs.config.powers.PowersConfig; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.mobconstructor.CustomSpawn; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEscapeMechanism; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.powers.specialpowers.EnderCrystalLightningRod; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Location; import org.bukkit.NamespacedKey; import org.bukkit.entity.*; @@ -47,7 +46,7 @@ public CustomSummonPower(Object powerObject, CustomBossesConfigFields customBoss public static CustomBossEntity summonReinforcement(EliteEntity summoningEntity, Location spawnLocation, String reinforcementFilename, int duration) { CustomBossesConfigFields fields = CustomBossesConfig.getCustomBoss(reinforcementFilename); if (fields == null) { - new WarningMessage("Attempted to summon reinforcement " + reinforcementFilename + " which is not a valid reinforcement!"); + Logger.warn("Attempted to summon reinforcement " + reinforcementFilename + " which is not a valid reinforcement!"); return null; } CustomBossEntity customBossEntity = new CustomBossEntity(fields); @@ -62,7 +61,7 @@ public static CustomBossEntity summonReinforcement(EliteEntity summoningEntity, public static BukkitTask summonGlobalReinforcement(CustomBossReinforcement customBossReinforcement, CustomBossEntity summoningEntity) { if (customBossReinforcement.customSpawn == null || customBossReinforcement.customSpawn.isEmpty()) { - new WarningMessage("Reinforcement for boss " + summoningEntity.getCustomBossesConfigFields().getFilename() + " has an incorrectly configured global reinforcement for " + customBossReinforcement.bossFileName); + Logger.warn("Reinforcement for boss " + summoningEntity.getCustomBossesConfigFields().getFilename() + " has an incorrectly configured global reinforcement for " + customBossReinforcement.bossFileName); return null; } return new BukkitRunnable() { @@ -73,7 +72,7 @@ public void run() { for (int i = 0; i < customBossReinforcement.amount; i++) { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(customBossReinforcement.bossFileName); if (customBossEntity == null) { - new WarningMessage("Failed to spawn reinforcement because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?"); + Logger.warn("Failed to spawn reinforcement because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?"); return; } if (summoningEntity.isNormalizedCombat()) @@ -138,7 +137,7 @@ private void processNewFormat(Map map, String configFilename) { Double.parseDouble(locationString.split(",")[1]), Double.parseDouble(locationString.split(",")[2])); } catch (Exception ex) { - new WarningMessage("Failed to get location for string " + locationString + " in " + customBossesConfigFields.getFilename()); + Logger.warn("Failed to get location for string " + locationString + " in " + customBossesConfigFields.getFilename()); } break; case "lightningrod": @@ -158,19 +157,19 @@ private void processNewFormat(Map map, String configFilename) { break; case "customspawn": if (CustomSpawnConfig.getCustomEvent(parseString(entry.getKey(), entry.getValue(), customBossesConfigFields.getFilename())) == null) - new WarningMessage("Failed to determine Custom Spawn file for filename " + entry.getValue()); + Logger.warn("Failed to determine Custom Spawn file for filename " + entry.getValue()); else { customSpawn = parseString(entry.getKey(), entry.getValue(), customBossesConfigFields.getFilename()); } break; default: - new WarningMessage("Invalid boss reinforcement!"); - new WarningMessage("Problematic entry: " + entry.getValue()); + Logger.warn("Invalid boss reinforcement!"); + Logger.warn("Problematic entry: " + entry.getValue()); } } if (summonType == null) { - new WarningMessage("No summon type detected in " + customBossesConfigFields.getFilename() + " ! This reinforcement will not work."); + Logger.warn("No summon type detected in " + customBossesConfigFields.getFilename() + " ! This reinforcement will not work."); return; } @@ -196,14 +195,14 @@ private void processNewFormat(Map map, String configFilename) { break; default: customBossReinforcement = null; - new WarningMessage("Failed to determine summon type for reinforcement in " + customBossesConfigFields.getFilename() + " ! Contact the developer with this error!"); + Logger.warn("Failed to determine summon type for reinforcement in " + customBossesConfigFields.getFilename() + " ! Contact the developer with this error!"); } if (summonType != SummonType.ON_COMBAT_ENTER_PLACE_CRYSTAL) if (customBossReinforcement == null || customBossReinforcement.bossFileName == null || CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName) == null) { - new WarningMessage("Could not get filename for reinforcement in file " + configFilename); + Logger.warn("Could not get filename for reinforcement in file " + configFilename); return; } @@ -288,7 +287,7 @@ private void processOldFormats(String powerString, String configFilename) { summonType = SummonType.valueOf(getSubstringField(substring)); newMap.put("summonType", summonType.toString()); } catch (Exception ex) { - new WarningMessage("Failed to determine summon type from " + getSubstringField(substring)); + Logger.warn("Failed to determine summon type from " + getSubstringField(substring)); } break; case "filename": @@ -296,7 +295,7 @@ private void processOldFormats(String powerString, String configFilename) { filename = getSubstringField(substring); newMap.put("filename", filename); } catch (Exception ex) { - new WarningMessage("Failed to determine filename from " + getSubstringField(substring)); + Logger.warn("Failed to determine filename from " + getSubstringField(substring)); } break; case "chance": @@ -304,7 +303,7 @@ private void processOldFormats(String powerString, String configFilename) { chance = Double.parseDouble(getSubstringField(substring)); newMap.put("chance", chance); } catch (Exception ex) { - new WarningMessage("Failed to determine chance from " + getSubstringField(substring)); + Logger.warn("Failed to determine chance from " + getSubstringField(substring)); } break; case "location": @@ -316,7 +315,7 @@ private void processOldFormats(String powerString, String configFilename) { Double.parseDouble(locationString.split(",")[1]), Double.parseDouble(locationString.split(",")[2])); } catch (Exception ex) { - new WarningMessage("Failed to determine location from " + getSubstringField(substring)); + Logger.warn("Failed to determine location from " + getSubstringField(substring)); } break; case "lightningrod": @@ -324,7 +323,7 @@ private void processOldFormats(String powerString, String configFilename) { lightningRod = Boolean.parseBoolean(getSubstringField(substring)); newMap.put("lightningRod", lightningRod); } catch (Exception ex) { - new WarningMessage("Failed to determine lightningRod from " + getSubstringField(substring)); + Logger.warn("Failed to determine lightningRod from " + getSubstringField(substring)); } break; case "inheritaggro": @@ -332,7 +331,7 @@ private void processOldFormats(String powerString, String configFilename) { inheritAggro = Boolean.parseBoolean(getSubstringField(substring)); newMap.put("inheritAggro", inheritAggro); } catch (Exception ex) { - new WarningMessage("Failed to determine inheritAggro from " + getSubstringField(substring)); + Logger.warn("Failed to determine inheritAggro from " + getSubstringField(substring)); } break; case "amount": @@ -340,7 +339,7 @@ private void processOldFormats(String powerString, String configFilename) { amount = Integer.parseInt(getSubstringField(substring)); newMap.put("amount", amount); } catch (Exception ex) { - new WarningMessage("Failed to determine inheritAggro from " + getSubstringField(substring)); + Logger.warn("Failed to determine inheritAggro from " + getSubstringField(substring)); } break; case "inheritlevel": @@ -348,7 +347,7 @@ private void processOldFormats(String powerString, String configFilename) { inheritLevel = Boolean.parseBoolean(getSubstringField(substring)); newMap.put("inheritLevel", inheritLevel); } catch (Exception ex) { - new WarningMessage("Failed to determine inheritLevel from " + getSubstringField(substring)); + Logger.warn("Failed to determine inheritLevel from " + getSubstringField(substring)); } break; case "spawnnearby": @@ -356,27 +355,27 @@ private void processOldFormats(String powerString, String configFilename) { spawnNearby = Boolean.parseBoolean(getSubstringField(substring)); newMap.put("spawnNearby", spawnNearby); } catch (Exception ex) { - new WarningMessage("Failed to determine spawnNearby from " + getSubstringField(substring)); + Logger.warn("Failed to determine spawnNearby from " + getSubstringField(substring)); } break; case "customspawn": if (CustomSpawnConfig.getCustomEvent(getSubstringField(substring)) == null) - new WarningMessage("Failed to determine Custom Spawn file for filename " + substring); + Logger.warn("Failed to determine Custom Spawn file for filename " + substring); else { customSpawn = getSubstringField(substring); newMap.put("customSpawn", customSpawn); } break; default: - new WarningMessage("Invalid boss reinforcement string for line " + powerString + " !"); - new WarningMessage("Problematic entry: " + substring); + Logger.warn("Invalid boss reinforcement string for line " + powerString + " !"); + Logger.warn("Problematic entry: " + substring); } } replaceOldFormat(powerString, newMap); if (summonType == null) { - new WarningMessage("No summon type detected in " + powerString + " ! This reinforcement will not work."); + Logger.warn("No summon type detected in " + powerString + " ! This reinforcement will not work."); return; } @@ -402,7 +401,7 @@ private void processOldFormats(String powerString, String configFilename) { break; default: customBossReinforcement = null; - new WarningMessage("Failed to determine summon type for reinforcement " + powerString + " ! Contact the developer with this error!"); + Logger.warn("Failed to determine summon type for reinforcement " + powerString + " ! Contact the developer with this error!"); } if (customBossReinforcement == null) @@ -419,19 +418,27 @@ private void processOldFormats(String powerString, String configFilename) { if (customBossReinforcement == null || customBossReinforcement.bossFileName == null || CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName) == null) { - new WarningMessage("Could not get filename for reinforcement in file " + configFilename); + Logger.warn("Could not get filename for reinforcement in file " + configFilename); } } } private void replaceOldFormat(String entry, Map replacement) { - customBossesConfigFields.getPowers().remove(entry); + Iterator iterator = customBossesConfigFields.getPowers().iterator(); + while (iterator.hasNext()) { + Object power = iterator.next(); + if (power.equals(entry)) { + iterator.remove(); + break; + } + } customBossesConfigFields.getPowers().add(replacement); customBossesConfigFields.getFileConfiguration().set("powers", customBossesConfigFields.getPowers()); customBossesConfigFields.saveFile(); } + private String getSubstringField(String string) { if (string.split("=").length < 2) return ""; return string.split("=")[1]; @@ -446,7 +453,7 @@ private void parseOnce(String powerString) { private CustomBossReinforcement doOnce(String filename) { CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.ONCE, filename); if (CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName) == null) { - new WarningMessage("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); + Logger.warn("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); return null; } customBossReinforcements.add(customBossReinforcement); @@ -463,7 +470,7 @@ private CustomBossReinforcement doOnHit(String filename, double chance) { CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.ON_HIT, filename); customBossReinforcement.setSummonChance(chance); if (CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName) == null) { - new WarningMessage("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); + Logger.warn("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); return customBossReinforcement; } customBossReinforcements.add(customBossReinforcement); @@ -473,7 +480,7 @@ private CustomBossReinforcement doOnHit(String filename, double chance) { private CustomBossReinforcement doOnDeath(String filename) { CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.ON_DEATH, filename); if (CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName) == null) { - new WarningMessage("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); + Logger.warn("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); return null; } customBossReinforcements.add(customBossReinforcement); @@ -500,7 +507,7 @@ private CustomBossReinforcement doOnCombatEnter(String filename) { CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.ON_COMBAT_ENTER, filename); if (CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName) == null) { - new WarningMessage("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); + Logger.warn("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); return customBossReinforcement; } customBossReinforcements.add(customBossReinforcement); @@ -517,7 +524,7 @@ private void parseOnCombatEnterPlaceCrystal(String powerString) { } private CustomBossReinforcement doOnCombatEnterPlaceCrystal(Vector location, boolean lightningRod) { - CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.ON_COMBAT_ENTER, EntityType.ENDER_CRYSTAL, lightningRod); + CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.ON_COMBAT_ENTER, EntityType.END_CRYSTAL, lightningRod); customBossReinforcement.setSpawnLocationOffset(location); customBossReinforcements.add(customBossReinforcement); return customBossReinforcement; @@ -527,7 +534,7 @@ private CustomBossReinforcement doGlobalSummonReinforcement(String filename) { CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.GLOBAL, filename); CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName); if (customBossesConfigFields == null) { - new WarningMessage("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); + Logger.warn("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid! Filename: " + filename); return null; } customBossReinforcement.entityType = customBossesConfigFields.getEntityType(); @@ -612,7 +619,7 @@ private void summonReinforcement(EliteEntity eliteEntity, CustomBossReinforcemen if (CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName).isRegionalBoss()) { RegionalBossEntity regionalBossEntity = RegionalBossEntity.createTemporaryRegionalBossEntity(customBossReinforcement.bossFileName, spawnLocation); if (regionalBossEntity == null) { - new WarningMessage("Failed to spawn reinforcement for " + eliteEntity.getName() + " because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?"); + Logger.warn("Failed to spawn reinforcement for " + eliteEntity.getName() + " because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?"); return; } if (eliteEntity instanceof CustomBossEntity summoner && summoner.isNormalizedCombat()) @@ -627,7 +634,7 @@ private void summonReinforcement(EliteEntity eliteEntity, CustomBossReinforcemen } else { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(customBossReinforcement.bossFileName); if (customBossEntity == null) { - new WarningMessage("Failed to spawn reinforcement for " + eliteEntity.getName() + " because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?"); + Logger.warn("Failed to spawn reinforcement for " + eliteEntity.getName() + " because boss " + customBossReinforcement.bossFileName + " was invalid! Does the file exist? Is it configured correctly?"); return; } if (eliteEntity instanceof CustomBossEntity summoner && summoner.isNormalizedCombat()) @@ -655,18 +662,7 @@ else if (summoningEntity == null) finalSpawnLocation = null; else finalSpawnLocation = summoningEntity.getLocation().add(spawnLocationOffset); - if (summoningEntity instanceof CustomBossEntity && - ((CustomBossEntity) summoningEntity).getEmPackage() != null && - ((CustomBossEntity) summoningEntity).getEmPackage() instanceof SchematicPackage) - if (summoningEntity instanceof RegionalBossEntity) { - SchematicPackage schematicPackage = (SchematicPackage) ((CustomBossEntity) summoningEntity).getEmPackage(); - return summoningEntity.getSpawnLocation().add(spawnLocationOffset.rotateAroundY(schematicPackage.getDungeonPackagerConfigFields().getCalculatedRotation())); - } else { - SchematicPackage schematicPackage = (SchematicPackage) ((CustomBossEntity) summoningEntity).getEmPackage(); - return summoningEntity.getLocation().clone().add(spawnLocationOffset.rotateAroundY(schematicPackage.getDungeonPackagerConfigFields().getCalculatedRotation())); - } - - else return finalSpawnLocation; + return finalSpawnLocation; } public enum SummonType { diff --git a/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java index 6614f782c..c206505e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java @@ -7,7 +7,7 @@ import com.magmaguy.elitemobs.config.powers.PowersConfigFields; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.scripts.EliteScript; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.entity.LivingEntity; @@ -78,10 +78,10 @@ public static void addPower(EliteEntity eliteEntity, PowersConfigFields configFi eliteEntity.getElitePowers().add(elitePower); elitePower.applyPowers(eliteEntity.getLivingEntity()); } catch (Exception ex) { - new WarningMessage("Failed to assign power for config field " + configFields.getFilename()); + Logger.warn("Failed to assign power for config field " + configFields.getFilename()); } else - eliteEntity.getElitePowers().addAll(EliteScript.generateBossScripts(configFields.getEliteScriptBlueprints())); + eliteEntity.getElitePowers().addAll(EliteScript.generateBossScripts(configFields.getEliteScriptBlueprints(), eliteEntity)); } public static void initializePowers() { @@ -100,7 +100,7 @@ public static void initializePowers() { } catch (Exception ex) { //Not sure why stuff in the meta package is getting scanned, seems like the package scan isn't working as intended //todo: figure out why package scanning is getting more than what is in the packages here - //new WarningMessage("Failed to initialize power " + power.getName()); + //Logger.warn("Failed to initialize power " + power.getName()); } }); } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java index a7170f9a0..2634c1fa7 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java @@ -21,26 +21,30 @@ public class EliteScript extends ElitePower implements Cloneable { @Getter private final ScriptZone scriptZone; private final ScriptCooldowns scriptCooldowns; + private final ScriptConditions scriptConditions; @Getter protected Map eliteScriptMap; - private final ScriptConditions scriptConditions; - public EliteScript(EliteScriptBlueprint scriptBlueprint, Map eliteScriptMap) { + public EliteScript(EliteScriptBlueprint scriptBlueprint, Map eliteScriptMap, EliteEntity eliteEntity) { super(scriptBlueprint.getCustomConfigFields()); this.eliteScriptMap = eliteScriptMap; this.scriptEvents = new ScriptEvents(scriptBlueprint.getScriptEventsBlueprint()); this.scriptConditions = new ScriptConditions(scriptBlueprint.getScriptConditionsBlueprint(), this, false); this.scriptZone = new ScriptZone(scriptBlueprint.getScriptZoneBlueprint(), this); + if (scriptEvents.getScriptEventsBlueprint().isZoneListener()) { + scriptZone.setZoneListener(true); + scriptZone.startZoneListener(eliteEntity); + } this.scriptActions = new ScriptActions(scriptBlueprint.getScriptActionsBlueprint(), eliteScriptMap, this); this.scriptCooldowns = new ScriptCooldowns(scriptBlueprint.getScriptCooldownsBlueprint(), this); eliteScriptMap.put(scriptBlueprint.getScriptName(), this); } //Parse from boss config - public static List generateBossScripts(List blueprints) { + public static List generateBossScripts(List blueprints, EliteEntity eliteEntity) { //The map is declared here because it needs to be shared inside of all scripts in the same file so they can be referenced. HashMap powerMap = new HashMap(); - return blueprints.stream().map(eliteScriptBlueprint -> new EliteScript(eliteScriptBlueprint, powerMap)).collect(Collectors.toList()); + return blueprints.stream().map(eliteScriptBlueprint -> new EliteScript(eliteScriptBlueprint, powerMap, eliteEntity)).collect(Collectors.toList()); } /** @@ -66,6 +70,29 @@ public void check(Event event, EliteEntity eliteEntity, Player player) { doCooldownTicks(eliteEntity); } + /** + * Used by elite damaged by elite event + * + * @param event + * @param eliteEntity + * @param damager + */ + public void check(Event event, EliteEntity eliteEntity, LivingEntity damager) { + //If the script uses the cooldown system then it should respect if the boss is in a global or local cooldown state + //If the script does not define a local or global cooldown then it is considered to ignore cooldowns. This is an + //important bypass for a lot of behavior like teleporting at specific triggers regardless of state + if (getPowerCooldownTime() > 0 && getGlobalCooldownTime() > 0 && + scriptCooldowns != null && super.isInCooldown(eliteEntity)) return; + //Check if the event is relevant to the script + if (!scriptEvents.isTargetEvent(event.getClass())) return; + //Check if the event conditions are met + if (scriptConditions != null && !scriptConditions.meetsPreActionConditions(eliteEntity, damager)) return; + //Let's do some actions + scriptActions.runScripts(eliteEntity, damager, event); + //Cooldowns time + doCooldownTicks(eliteEntity); + } + /** * Used by scripts that call other scripts as the trigger * @@ -89,7 +116,8 @@ public void check(EliteEntity eliteEntity, LivingEntity directTarget, ScriptActi */ public void check(Location landingLocation, ScriptActionData previousScriptActionData) { //Check if the event conditions are met - if (scriptConditions != null && !scriptConditions.meetsPreActionConditions(previousScriptActionData.getEliteEntity(), null)) return; + if (scriptConditions != null && !scriptConditions.meetsPreActionConditions(previousScriptActionData.getEliteEntity(), null)) + return; //Let's do some actions scriptActions.runScripts(previousScriptActionData, landingLocation); //Cooldowns time diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java index 1b6cb7c4a..7fca4400f 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.powers.scripts; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.EliteDamageEvent; import com.magmaguy.elitemobs.api.PlayerDamagedByEliteMobEvent; @@ -9,12 +8,13 @@ import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; +import com.magmaguy.elitemobs.pathfinding.Navigation; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.powers.meta.CustomSummonPower; import com.magmaguy.elitemobs.powers.scripts.caching.ScriptActionBlueprint; import com.magmaguy.elitemobs.powers.scripts.enums.ActionType; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; @@ -22,6 +22,7 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Location; +import org.bukkit.attribute.Attribute; import org.bukkit.block.Block; import org.bukkit.boss.BossBar; import org.bukkit.entity.*; @@ -31,14 +32,13 @@ import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class ScriptAction { + @Getter + private static final HashSet invulnerablePlayers = new HashSet<>(); @Getter private final ScriptActionBlueprint blueprint; private final ScriptTargets scriptTargets; @@ -49,7 +49,6 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; - public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; this.scriptTargets = new ScriptTargets(blueprint.getScriptTargets(), eliteScript); @@ -61,6 +60,9 @@ public ScriptAction(ScriptActionBlueprint blueprint, Map el this.eliteScript = eliteScript; } + public static void shutdown() { + invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); + } /** * Base case, runs based on actions, not called by other scripts @@ -71,7 +73,7 @@ public ScriptAction(ScriptActionBlueprint blueprint, Map el */ public void runScript(EliteEntity eliteEntity, LivingEntity directTarget, Event event) { if (blueprint.getActionType() == null) { - new WarningMessage("Script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename() + " does not have a valid action! Every action must define a valid action for the script to work."); + Logger.warn("Script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename() + " does not have a valid action! Every action must define a valid action for the script to work."); return; } @@ -89,7 +91,7 @@ public void runScript(EliteEntity eliteEntity, LivingEntity directTarget, Event */ public void runScript(ScriptActionData previousScriptActionData) { if (blueprint.getActionType() == null) { - new WarningMessage("Script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename() + " does not have a valid action! Every action must define a valid action for the script to work."); + Logger.warn("Script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename() + " does not have a valid action! Every action must define a valid action for the script to work."); return; } @@ -123,6 +125,8 @@ private void scriptTask(ScriptActionData scriptActionData) { //This caches the tracking mostly for zones to start at the wait time. This matters if you are making zones //that go through a warning phase and then a damage phase. scriptTargets.cacheTargets(scriptActionData); + if (finalScriptTargets != null) + finalScriptTargets.cacheTargets(scriptActionData); if (blueprint.getWait() > 0) { //First wait for allotted amount of time new BukkitRunnable() { @@ -213,8 +217,10 @@ private void runActions(ScriptActionData scriptActionData) { case SPAWN_FALLING_BLOCK -> runSpawnFallingBlock(scriptActionData); case MODIFY_DAMAGE -> runModifyDamage(scriptActionData); case SUMMON_ENTITY -> runSummonEntity(scriptActionData); + case NAVIGATE -> runNavigate(scriptActionData); + case SCALE -> runScale(scriptActionData); default -> - new WarningMessage("Failed to determine action type " + blueprint.getActionType() + " in script " + blueprint.getScriptName() + " for file " + blueprint.getScriptFilename()); + Logger.warn("Failed to determine action type " + blueprint.getActionType() + " in script " + blueprint.getScriptName() + " for file " + blueprint.getScriptFilename()); } //Run script will have already run this if (!blueprint.getActionType().equals(ActionType.RUN_SCRIPT)) @@ -224,6 +230,8 @@ private void runActions(ScriptActionData scriptActionData) { protected Collection getTargets(ScriptActionData scriptActionData) { Collection livingTargets = scriptConditions.validateEntities(scriptActionData, scriptTargets.getTargetEntities(scriptActionData)); scriptTargets.setAnonymousTargets(livingTargets.stream().toList()); + if (blueprint.isDebug()) + livingTargets.forEach(livingTarget -> Logger.showLocation(livingTarget.getLocation())); return livingTargets; } @@ -231,6 +239,18 @@ protected Collection getTargets(ScriptActionData scriptActionData) protected Collection getLocationTargets(ScriptActionData scriptActionData) { Collection locationTargets = scriptConditions.validateLocations(scriptActionData, scriptTargets.getTargetLocations(scriptActionData)); scriptTargets.setAnonymousTargets(locationTargets.stream().toList()); + if (blueprint.isDebug()) + locationTargets.forEach(Logger::showLocation); + return locationTargets; + } + + //Gets a list of locations + protected Collection getFinalLocationTargets(ScriptActionData scriptActionData) { + Collection locationTargets = scriptConditions.validateLocations(scriptActionData, finalScriptTargets.getTargetLocations(scriptActionData)); + finalScriptTargets.setAnonymousTargets(locationTargets.stream().toList()); + if (blueprint.isDebug()) { + locationTargets.forEach(Logger::showLocation); + } return locationTargets; } @@ -238,10 +258,11 @@ protected Collection getLocationTargets(ScriptActionData scriptActionD private void runTeleport(ScriptActionData scriptActionData) { getTargets(scriptActionData).forEach(iteratedTarget -> { if (finalScriptTargets == null) { - new WarningMessage("Failed to get teleport destination for script " + blueprint.getScriptName() + " because there is no set FinalTarget!"); + Logger.warn("Failed to get teleport destination for script " + blueprint.getScriptName() + " because there is no set FinalTarget!"); return; } - List destinationLocations = new ArrayList<>(finalScriptTargets.getTargetLocations(scriptActionData)); +// List destinationLocations = new ArrayList<>(finalScriptTargets.getTargetLocations(scriptActionData)); + List destinationLocations = getFinalLocationTargets(scriptActionData).stream().toList(); if (destinationLocations.isEmpty()) return; MatchInstance.MatchInstanceEvents.teleportBypass = true; iteratedTarget.teleport(destinationLocations.get(0)); @@ -255,12 +276,12 @@ private void runMessage(ScriptActionData scriptActionData) { private void runTitleMessage(ScriptActionData scriptActionData) { if (blueprint.getTitle().isEmpty() && blueprint.getSubtitle().isEmpty()) { - new WarningMessage("TITLE_MESSAGE action does not have any titles or subtitles for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + Logger.warn("TITLE_MESSAGE action does not have any titles or subtitles for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); return; } getTargets(scriptActionData).forEach(iteratedTarget -> { if (!(iteratedTarget instanceof Player)) { - new WarningMessage("TITLE_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); + Logger.warn("TITLE_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); return; } ((Player) iteratedTarget).sendTitle(blueprint.getTitle(), blueprint.getSubtitle(), blueprint.getFadeIn(), blueprint.getDuration(), blueprint.getFadeOut()); @@ -269,12 +290,12 @@ private void runTitleMessage(ScriptActionData scriptActionData) { private void runActionBarMessage(ScriptActionData scriptActionData) { if (blueprint.getSValue().isEmpty()) { - new WarningMessage("ACTION_BAR_MESSAGE action does not have a sValue for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + Logger.warn("ACTION_BAR_MESSAGE action does not have a sValue for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); return; } getTargets(scriptActionData).forEach(iteratedTarget -> { if (!(iteratedTarget instanceof Player)) { - new WarningMessage("ACTION_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); + Logger.warn("ACTION_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); return; } ((Player) iteratedTarget).spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(blueprint.getSValue())); @@ -283,13 +304,13 @@ private void runActionBarMessage(ScriptActionData scriptActionData) { private void runBossBarMessage(ScriptActionData scriptActionData) { if (blueprint.getSValue().isEmpty()) { - new WarningMessage("BOSS_BAR_MESSAGE action does not have a valid sValue for script " + blueprint.getScriptFilename() + " in file " + blueprint.getScriptFilename()); + Logger.warn("BOSS_BAR_MESSAGE action does not have a valid sValue for script " + blueprint.getScriptFilename() + " in file " + blueprint.getScriptFilename()); return; } BossBar bossBar = Bukkit.createBossBar(blueprint.getSValue(), blueprint.getBarColor(), blueprint.getBarStyle()); getTargets(scriptActionData).forEach(iteratedTarget -> { if (!(iteratedTarget instanceof Player)) { - new WarningMessage("BOSS_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); + Logger.warn("BOSS_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); return; } bossBar.addPlayer((Player) iteratedTarget); @@ -300,13 +321,16 @@ private void runBossBarMessage(ScriptActionData scriptActionData) { //Applies a potion effect to the target living entity private void runPotionEffect(ScriptActionData scriptActionData) { - getTargets(scriptActionData).forEach(iteratedTarget -> iteratedTarget.addPotionEffect(new PotionEffect(blueprint.getPotionEffectType(), blueprint.getDuration(), blueprint.getAmplifier()))); + getTargets(scriptActionData).forEach(iteratedTarget -> { + if (!(iteratedTarget.isValid())) return; + iteratedTarget.addPotionEffect(new PotionEffect(blueprint.getPotionEffectType(), blueprint.getDuration(), blueprint.getAmplifier())); + }); } //Runs any scripts in the scripts field. Respects wait time and repeating tasks private void runAdditionalScripts(ScriptActionData scriptActionData) { if (blueprint.getActionType().equals(ActionType.RUN_SCRIPT) && blueprint.getScripts().isEmpty()) - new WarningMessage("Did not find any scripts for action RUN_SCRIPT in script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + Logger.warn("Did not find any scripts for action RUN_SCRIPT in script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); //This is a bit of a dirty hack but if there are no targets and an action called scripts then it is assumed that the script did not meet the conditions required to run and therefore additional scripts will also not run /* if (!blueprint.getActionType().equals(ActionType.RUN_SCRIPT) && @@ -320,7 +344,7 @@ private void runAdditionalScripts(ScriptActionData scriptActionData) { blueprint.getScripts().forEach(iteratedScriptName -> { EliteScript iteratedScript = eliteScriptMap.get(iteratedScriptName); if (iteratedScript == null) - new WarningMessage("Failed to get script " + iteratedScriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + Logger.warn("Failed to get script " + iteratedScriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); else { iteratedScript.check(scriptActionData.getEliteEntity(), scriptActionData.getDirectTarget(), scriptActionData); } @@ -329,7 +353,7 @@ private void runAdditionalScripts(ScriptActionData scriptActionData) { String scriptName = blueprint.getScripts().get(ThreadLocalRandom.current().nextInt(blueprint.getScripts().size())); EliteScript randomizedScript = eliteScriptMap.get(scriptName); if (randomizedScript == null) - new WarningMessage("Failed to get script " + scriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + Logger.warn("Failed to get script " + scriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); else randomizedScript.check(scriptActionData.getEliteEntity(), scriptActionData.getDirectTarget(), scriptActionData); } @@ -354,7 +378,6 @@ private void runSetOnFire(ScriptActionData scriptActionData) { //Applies the freeze visual effect from Minecraft. Requires a repeating task to keep reapplying private void runVisualFreeze(ScriptActionData scriptActionData) { - if (VersionChecker.serverVersionOlderThan(17, 0)) return; getTargets(scriptActionData).forEach(iteratedTarget -> iteratedTarget.setFreezeTicks((int) (iteratedTarget.getFreezeTicks() + blueprint.getAmount()))); } @@ -401,7 +424,14 @@ private void runStrikeLighting(ScriptActionData scriptActionData) { //Spawns a particle at the target location private void runSpawnParticle(ScriptActionData scriptActionData) { - getLocationTargets(scriptActionData).forEach(targetLocation -> scriptParticles.visualize(scriptActionData, targetLocation, eliteScript)); + boolean needsCentering = false; + switch (scriptActionData.getTargetType()) { + case ZONE_FULL, ZONE_BORDER, INHERIT_SCRIPT_ZONE_FULL, INHERIT_SCRIPT_ZONE_BORDER, LOCATION, LOCATIONS, + LANDING_LOCATION: + needsCentering = true; + } + boolean finalNeedsCentering = needsCentering; + getLocationTargets(scriptActionData).forEach(targetLocation -> scriptParticles.visualize(scriptActionData, !finalNeedsCentering ? targetLocation : targetLocation.clone().add(new Vector(.5, 0, .5)), eliteScript)); } //Sets mob AI @@ -471,7 +501,7 @@ private void runSpawnFireworks(ScriptActionData scriptActionData) { FireworkMeta fireworkMeta = firework.getFireworkMeta(); if (blueprint.getFireworkEffects().isEmpty()) { - new WarningMessage("Tried to spawn fireworks for script " + eliteScript.getFileName() + " but no color for the fireworks was set! This part of the script will not run."); + Logger.warn("Tried to spawn fireworks for script " + eliteScript.getFileName() + " but no color for the fireworks was set! This part of the script will not run."); return; } @@ -520,6 +550,12 @@ private void runSpawnFireworks(ScriptActionData scriptActionData) { private void runMakeInvulnerable(ScriptActionData scriptActionData) { getTargets(scriptActionData).forEach(targetEntity -> { targetEntity.setInvulnerable(blueprint.isInvulnerable()); + if (targetEntity instanceof Player player) { + if (blueprint.isInvulnerable()) + invulnerablePlayers.add(player); + else + invulnerablePlayers.remove(player); + } if (blueprint.getDuration() > 0) Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, () -> targetEntity.setInvulnerable(!blueprint.isInvulnerable()), blueprint.getDuration()); }); @@ -610,7 +646,6 @@ else if (blueprint.getVValue() != null) } private void runModifyDamage(ScriptActionData scriptActionData) { - if (scriptActionData.getEvent() instanceof EliteDamageEvent eliteDamageEvent) { eliteDamageEvent.setDamage(eliteDamageEvent.getDamage() * blueprint.getMultiplier()); } @@ -621,7 +656,7 @@ private void runSummonEntity(ScriptActionData scriptActionData) { try { entityType = EntityType.valueOf(blueprint.getSValue()); } catch (Exception ex) { - new WarningMessage("Failed to get entity type for the projectile in the script " + getBlueprint().getScriptName() + " in the file " + blueprint.getScriptFilename()); + Logger.warn("Failed to get entity type for the projectile in the script " + getBlueprint().getScriptName() + " in the file " + blueprint.getScriptFilename()); return; } @@ -664,4 +699,33 @@ public void run() { } }); } + + private void runNavigate(ScriptActionData scriptActionData) { + getTargets(scriptActionData).forEach(targetEntity -> { + EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(targetEntity); + if (!(eliteEntity instanceof CustomBossEntity customBossEntity)) return; + + if (finalScriptTargets == null) { + Logger.warn("Failed to get teleport destination for script " + blueprint.getScriptName() + " because there is no set FinalTarget!"); + return; + } + + List destinationLocations = new ArrayList<>(finalScriptTargets.getTargetLocations(scriptActionData)); + if (destinationLocations.isEmpty()) return; + Navigation.navigateTo(customBossEntity, (double) blueprint.getVelocity(), destinationLocations.get(0), blueprint.getBValue(), blueprint.getDuration()); + }); + } + + private void runScale(ScriptActionData scriptActionData) { + getTargets(scriptActionData).forEach(targetEntity -> { + targetEntity.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(blueprint.getScale()); + if (blueprint.getDuration() > 0) + new BukkitRunnable() { + @Override + public void run() { + targetEntity.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f); + } + }.runTaskLater(MetadataHandler.PLUGIN, blueprint.getDuration()); + }); + } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java index 6be88b0d1..461676ec9 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java @@ -13,6 +13,10 @@ import java.util.List; public class ScriptActionData { + @Getter + private final TargetType targetType; + @Getter + private final ScriptTargets scriptTargets; @Getter @Setter private Collection locations = null; @@ -26,10 +30,6 @@ public class ScriptActionData { @Setter private Location landingLocation = null; @Getter - private final TargetType targetType; - @Getter - private final ScriptTargets scriptTargets; - @Getter private ScriptZone scriptZone = null; @Getter @Setter @@ -71,6 +71,7 @@ public ScriptActionData(EliteEntity eliteEntity, LivingEntity directTarget, Scri this.event = event; } + //Used by actions that call scripts public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, ScriptActionData inheritedScriptActionData) { this.eliteEntity = inheritedScriptActionData.getEliteEntity(); this.directTarget = inheritedScriptActionData.getDirectTarget(); @@ -79,10 +80,20 @@ public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, Scri this.targetType = scriptTargets.getTargetBlueprint().getTargetType(); this.scriptZone = scriptZone; this.inheritedScriptActionData = inheritedScriptActionData; + this.landingLocation = inheritedScriptActionData.getLandingLocation(); + } + + //Used for the zone enter and leave, can't use direct targets + public ScriptActionData(EliteEntity eliteEntity, ScriptTargets scriptTargets, ScriptZone scriptZone) { + this.eliteEntity = eliteEntity; + this.scriptTargets = scriptTargets; + //This stores the cache shape + this.targetType = scriptTargets.getTargetBlueprint().getTargetType(); + this.scriptZone = scriptZone; } //For data with landing locations - public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, ScriptActionData inheritedScriptActionData,Location landingLocation) { + public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, ScriptActionData inheritedScriptActionData, Location landingLocation) { this.eliteEntity = inheritedScriptActionData.getEliteEntity(); this.directTarget = inheritedScriptActionData.getDirectTarget(); this.scriptTargets = scriptTargets; @@ -94,7 +105,7 @@ public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, Scr } //For data called by other scripts - public ScriptActionData(EliteEntity eliteEntity, LivingEntity directTarget, ScriptTargets scriptTargets, Collection previousEntityTargets, Collection previousLocationTargets) { + public ScriptActionData(EliteEntity eliteEntity, LivingEntity directTarget, ScriptTargets scriptTargets, Collection previousEntityTargets, Collection previousLocationTargets) { this.eliteEntity = eliteEntity; this.directTarget = directTarget; this.scriptTargets = scriptTargets; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java index 71093b934..18a6b3fc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java @@ -20,8 +20,8 @@ public class ScriptConditions { private final ScriptConditionsBlueprint conditionsBlueprint; + private final EliteScript eliteScript; private ScriptTargets scriptTargets = null; - private EliteScript eliteScript; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptEvents.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptEvents.java index 286ec2538..8aa319030 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptEvents.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptEvents.java @@ -1,9 +1,11 @@ package com.magmaguy.elitemobs.powers.scripts; import com.magmaguy.elitemobs.powers.scripts.caching.ScriptEventsBlueprint; +import lombok.Getter; public class ScriptEvents { + @Getter private final ScriptEventsBlueprint scriptEventsBlueprint; public ScriptEvents(ScriptEventsBlueprint eventsBlueprint) { diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java index c8510d40c..a2967870b 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java @@ -3,10 +3,11 @@ import com.magmaguy.elitemobs.api.*; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.ElitePower; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; @@ -20,6 +21,17 @@ public class ScriptListener implements Listener { public static HashMap fallingBlocks = new HashMap(); public static HashMap fallingEntities = new HashMap<>(); + public static void runEvent(FallingEntityDataPair fallingEntityDataPair, Location landingLocation) { + for (String string : fallingEntityDataPair.getScriptAction().getBlueprint().getLandingScripts()) { + EliteScript iteratedScript = fallingEntityDataPair.getScriptAction().getEliteScriptMap().get(string); + if (iteratedScript == null) { + Logger.warn("Elite script " + string + " does not exist for landing scripts!"); + return; + } + iteratedScript.check(landingLocation, fallingEntityDataPair.getScriptActionData()); + } + } + @EventHandler public void onEliteMobDamagedByPlayerEvent(EliteMobDamagedByPlayerEvent event) { if (event.isCancelled()) return; @@ -29,7 +41,7 @@ public void onEliteMobDamagedByPlayerEvent(EliteMobDamagedByPlayerEvent event) { @EventHandler public void onEliteMobDamagedByEliteMobEvent(EliteMobDamagedByEliteMobEvent event) { if (event.isCancelled()) return; - runEvent(event, event.getDamager()); + runEventGeneric(event, event.getDamagee(), event.getDamager().getLivingEntity()); } @EventHandler @@ -94,26 +106,31 @@ public void onEntityChangeBlockEvent(EntityChangeBlockEvent event) { fallingBlocks.remove(event.getEntity()); } + @EventHandler(priority = EventPriority.MONITOR) + public void onZoneEnterEvent(ScriptZoneEnterEvent event) { + runEventGeneric(event, event.getEliteEntity(), event.getEntity()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onZoneLeaveEvent(ScriptZoneLeaveEvent event) { + runEventGeneric(event, event.getEliteEntity(), event.getEntity()); + } + private void runEvent(Event event, EliteEntity eliteEntity) { for (ElitePower elitePower : eliteEntity.getElitePowers()) if (elitePower instanceof EliteScript eliteScript) eliteScript.check(event, eliteEntity, null); } - private void runEvent(Event event, EliteEntity eliteEntity, Player player) { + private void runEventGeneric(Event event, EliteEntity eliteEntity, LivingEntity directTarget) { for (ElitePower elitePower : eliteEntity.getElitePowers()) if (elitePower instanceof EliteScript eliteScript) - eliteScript.check(event, eliteEntity, player); + eliteScript.check(event, eliteEntity, directTarget); } - public static void runEvent(FallingEntityDataPair fallingEntityDataPair, Location landingLocation) { - for (String string : fallingEntityDataPair.getScriptAction().getBlueprint().getLandingScripts()) { - EliteScript iteratedScript = fallingEntityDataPair.getScriptAction().getEliteScriptMap().get(string); - if (iteratedScript == null) { - new WarningMessage("Elite script " + string + " does not exist for landing scripts!"); - return; - } - iteratedScript.check(landingLocation, fallingEntityDataPair.getScriptActionData()); - } + private void runEvent(Event event, EliteEntity eliteEntity, Player player) { + for (ElitePower elitePower : eliteEntity.getElitePowers()) + if (elitePower instanceof EliteScript eliteScript) + eliteScript.check(event, eliteEntity, player); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java index cbf846703..a8e35d721 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java @@ -36,15 +36,15 @@ private void visualize(ScriptActionData scriptActionData, Location location, Eli ScriptRelativeVector scriptRelativeVector = null; scriptRelativeVector = new ScriptRelativeVector(this.particleBlueprint.getRelativeVectorBlueprint(), eliteScript, location); - Vector movementVector = scriptRelativeVector.getVector(scriptActionData); - amount = 0; - x = movementVector.getX(); - y = movementVector.getY(); - z = movementVector.getZ(); + Vector movementVector = scriptRelativeVector.getVector(scriptActionData); + amount = 0; + x = movementVector.getX(); + y = movementVector.getY(); + z = movementVector.getZ(); } - if (particleBlueprint.getParticle().equals(Particle.REDSTONE)) + if (particleBlueprint.getParticle().equals(Particle.DUST)) location.getWorld().spawnParticle( particleBlueprint.getParticle(), location, @@ -78,8 +78,8 @@ else if (particleBlueprint.getParticle().equals(Particle.DUST_COLOR_TRANSITION)) particleBlueprint.getToGreen(), particleBlueprint.getToBlue()), 1)); - else if (particleBlueprint.getParticle().equals(Particle.SPELL_MOB) - //|| particleBlueprint.getParticle().equals(Particle.SPELL_MOB_AMBIENT) todo: 1.20.6 changed this name + else if (particleBlueprint.getParticle().equals(Particle.WITCH) + //|| particleBlueprint.getParticle().equals(Particle.WITCH_AMBIENT) todo: 1.20.6 changed this name ) { location.getWorld().spawnParticle( particleBlueprint.getParticle(), diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptRelativeVector.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptRelativeVector.java index 6f244fce1..1ea3e7e2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptRelativeVector.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptRelativeVector.java @@ -19,8 +19,7 @@ public ScriptRelativeVector(ScriptRelativeVectorBlueprint scriptRelativeVectorBl this.actionLocation = actionLocation; if (!scriptRelativeVectorBlueprint.getSourceTarget().getTargetType().equals(TargetType.ACTION_TARGET)) { sourceTarget = new ScriptTargets(scriptRelativeVectorBlueprint.getSourceTarget(), eliteScript); - } - else { + } else { sourceIsAction = true; } if (!scriptRelativeVectorBlueprint.getDestinationTarget().getTargetType().equals(TargetType.ACTION_TARGET)) @@ -34,8 +33,7 @@ public Vector getVector(ScriptActionData scriptActionData) { Location sourceLocation = null; if (sourceIsAction) { sourceLocation = actionLocation.clone(); - } - else if (sourceTarget != null && !sourceTarget.getTargetLocations(scriptActionData).isEmpty()) + } else if (sourceTarget != null && !sourceTarget.getTargetLocations(scriptActionData).isEmpty()) sourceLocation = sourceTarget.getTargetLocations(scriptActionData).iterator().next(); else return new Vector(0, 0, 0); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptTargets.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptTargets.java index 0ebcbf217..89510d7b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptTargets.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptTargets.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.scripts.caching.ScriptTargetsBlueprint; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -60,7 +60,7 @@ public Location processLocationFromString(EliteEntity eliteEntity, String locationString, ScriptActionData scriptActionData) { if (locationString == null) { - new WarningMessage("Failed to get location target in script " + targetBlueprint.getScriptName() + " in " + eliteScript.getFileName()); + Logger.warn("Failed to get location target in script " + targetBlueprint.getScriptName() + " in " + eliteScript.getFileName()); return null; } Location parsedLocation = ConfigurationLocation.serialize(locationString); @@ -74,7 +74,6 @@ public Location processLocationFromString(EliteEntity eliteEntity, } protected void cacheTargets(ScriptActionData scriptActionData) { - //Only cache if tracking if (getTargetBlueprint().isTrack()) { //Zones that animate independently can not be set to track, as this causes confusion. This is forced to make it easier on scripters. if (eliteScript.getScriptZone().isValid() && eliteScript.getScriptZone().getZoneBlueprint().getAnimationDuration() > 0) @@ -89,8 +88,9 @@ protected void cacheTargets(ScriptActionData scriptActionData) { if (eliteScript.getScriptZone().getZoneBlueprint().getAnimationDuration() > 0) animatedScriptZone = true; anonymousTargets = null; } - if (!animatedScriptZone) + if (!animatedScriptZone) { anonymousTargets = new ArrayList<>(getTargetLocations(scriptActionData)); + } if (!getTargetBlueprint().isTrack() && targetBlueprint.getScriptRelativeVectorBlueprint() != null) { scriptRelativeVector = new ScriptRelativeVector(targetBlueprint.getScriptRelativeVectorBlueprint(), eliteScript, null); scriptRelativeVector.cacheVector(scriptActionData); @@ -108,7 +108,7 @@ protected Collection getTargetEntities(ScriptActionData scriptActi Location eliteEntityLocation = scriptActionData.getEliteEntity().getLocation(); if (targetBlueprint == null) { - new WarningMessage("An action tried to run with an invalid target! Check which on it is by reading the startup logs and fix it! No target will be acquired for now."); + Logger.warn("An action tried to run with an invalid target! Check which on it is by reading the startup logs and fix it! No target will be acquired for now."); return new ArrayList<>(); } @@ -148,15 +148,15 @@ protected Collection getTargetEntities(ScriptActionData scriptActi try { return (List) scriptActionData.getInheritedScriptActionData().getScriptTargets().getAnonymousTargets(false, scriptActionData.getInheritedScriptActionData()); } catch (Exception Ex) { - new WarningMessage("Failed to get entity from INHERIT_SCRIPT_TARGET because the script inherits a location, not an entity"); + Logger.warn("Failed to get entity from INHERIT_SCRIPT_TARGET because the script inherits a location, not an entity"); } } else { - new WarningMessage("Failed to get INHERIT_SCRIPT_TARGET because the script is not called by another script!"); + Logger.warn("Failed to get INHERIT_SCRIPT_TARGET because the script is not called by another script!"); return new ArrayList<>(); } default: - new WarningMessage("Could not find default target for script in " + eliteScript.getFileName()); + Logger.warn("Could not find default target for script in " + eliteScript.getFileName()); return null; } } @@ -168,7 +168,7 @@ protected Collection getTargetEntities(ScriptActionData scriptActi * @return Validated location for the script behavior */ protected Collection getTargetLocations(ScriptActionData scriptActionData) { - if (anonymousTargets != null && !anonymousTargets.isEmpty() && anonymousTargets.get(0) instanceof Location) { + if (anonymousTargets != null && !anonymousTargets.isEmpty() && anonymousTargets.get(0) instanceof Location location) { return (List) anonymousTargets; } @@ -195,7 +195,7 @@ protected Collection getTargetLocations(ScriptActionData scriptActionD return scriptActionData.getInheritedScriptActionData().getScriptTargets().getAnonymousTargets( true, scriptActionData.getInheritedScriptActionData()); default: - new WarningMessage("Failed to get target type in script " + getTargetBlueprint().getScriptName() + " !"); + Logger.warn("Failed to get target type in script " + getTargetBlueprint().getScriptName() + " !"); } if (targetBlueprint.getCoverage() < 1) @@ -206,7 +206,7 @@ protected Collection getTargetLocations(ScriptActionData scriptActionD private Collection getLocationFromZone(ScriptActionData scriptActionData) { if (scriptActionData.getScriptZone() == null) { - new WarningMessage("Your script " + targetBlueprint.getScriptName() + " uses " + targetBlueprint.getTargetType().toString() + " but does not have a valid Zone defined!"); + Logger.warn("Your script " + targetBlueprint.getScriptName() + " uses " + targetBlueprint.getTargetType().toString() + " but does not have a valid Zone defined!"); return new ArrayList<>(); } return addOffsets(eliteScript.getScriptZone().getZoneLocations(scriptActionData, this), scriptActionData); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index b4c629237..e066f3348 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -1,18 +1,27 @@ package com.magmaguy.elitemobs.powers.scripts; +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.elitemobs.api.ScriptZoneEnterEvent; +import com.magmaguy.elitemobs.api.ScriptZoneLeaveEvent; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; +import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; +import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.powers.scripts.caching.ScriptTargetsBlueprint; import com.magmaguy.elitemobs.powers.scripts.caching.ScriptZoneBlueprint; import com.magmaguy.elitemobs.powers.scripts.enums.TargetType; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.elitemobs.utils.EventCaller; import com.magmaguy.elitemobs.utils.shapes.*; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; +import lombok.Setter; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; +import org.bukkit.scheduler.BukkitRunnable; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; @@ -26,6 +35,10 @@ public class ScriptZone { private ScriptTargets finalTargets = null; private ScriptTargets targets2 = null; private ScriptTargets finalTargets2 = null; + @Setter + private boolean zoneListener = false; + //Used to do zone enter and leave events + private Collection entitiesInZone; public ScriptZone(ScriptZoneBlueprint zoneBlueprint, EliteScript eliteScript) { this.zoneBlueprint = zoneBlueprint; @@ -38,9 +51,24 @@ public ScriptZone(ScriptZoneBlueprint zoneBlueprint, EliteScript eliteScript) { isValid = zoneBlueprint.getTarget() != null; } + //todo: urgent: at a scale this will cause problems because it does not unschedule the task when a custom boss gets unloaded. Should be cancelling correctly though + public void startZoneListener(EliteEntity eliteEntity) { + if (!zoneListener) return; + entitiesInZone = new HashSet<>(); + ScriptActionData scriptActionData = new ScriptActionData(eliteEntity, targets, this); + new ZoneListenerTask(eliteEntity, scriptActionData).runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + } + + public void ZoneEnterEvent(EliteEntity eliteEntity, LivingEntity livingEntity) { + new EventCaller(new ScriptZoneEnterEvent(eliteEntity, livingEntity)); + } + + public void ZoneLeaveEvent(EliteEntity eliteEntity, LivingEntity livingEntity) { + new EventCaller(new ScriptZoneLeaveEvent(eliteEntity, livingEntity)); + } + //Get living entities in zone - protected Collection - getZoneEntities(ScriptActionData scriptActionData, ScriptTargetsBlueprint blueprintFromRequestingTarget) { + protected Collection getZoneEntities(ScriptActionData scriptActionData, ScriptTargetsBlueprint blueprintFromRequestingTarget) { //Get the entities from those zones switch (blueprintFromRequestingTarget.getTargetType()) { case ZONE_FULL, ZONE_BORDER: @@ -48,7 +76,7 @@ public ScriptZone(ScriptZoneBlueprint zoneBlueprint, EliteScript eliteScript) { case INHERIT_SCRIPT_ZONE_FULL, INHERIT_SCRIPT_ZONE_BORDER: return getEntitiesInArea(generateShapes(scriptActionData.getInheritedScriptActionData(), false), blueprintFromRequestingTarget.getTargetType()); default: { - new WarningMessage("Couldn't parse target " + targets.getTargetBlueprint().getTargetType() + " in script "); + Logger.warn("Couldn't parse target " + targets.getTargetBlueprint().getTargetType() + " in script "); return new ArrayList<>(); } } @@ -58,10 +86,14 @@ public ScriptZone(ScriptZoneBlueprint zoneBlueprint, EliteScript eliteScript) { protected Collection getZoneLocations(ScriptActionData scriptActionData, ScriptTargets actionTarget) { //Get the locations from those zones return switch (actionTarget.getTargetBlueprint().getTargetType()) { - case ZONE_FULL -> consolidateLists(generateShapes(scriptActionData, false).stream().map(Shape::getLocations).collect(Collectors.toSet())); - case ZONE_BORDER -> consolidateLists(generateShapes(scriptActionData, false).stream().map(Shape::getEdgeLocations).collect(Collectors.toSet())); - case INHERIT_SCRIPT_ZONE_FULL -> consolidateLists(generateShapes(scriptActionData.getInheritedScriptActionData(), false).stream().map(Shape::getLocations).collect(Collectors.toSet())); - case INHERIT_SCRIPT_ZONE_BORDER -> consolidateLists(generateShapes(scriptActionData.getInheritedScriptActionData(), false).stream().map(Shape::getEdgeLocations).collect(Collectors.toSet())); + case ZONE_FULL -> + consolidateLists(generateShapes(scriptActionData, false).stream().map(Shape::getLocations).collect(Collectors.toSet())); + case ZONE_BORDER -> + consolidateLists(generateShapes(scriptActionData, false).stream().map(Shape::getEdgeLocations).collect(Collectors.toSet())); + case INHERIT_SCRIPT_ZONE_FULL -> + consolidateLists(generateShapes(scriptActionData.getInheritedScriptActionData(), false).stream().map(Shape::getLocations).collect(Collectors.toSet())); + case INHERIT_SCRIPT_ZONE_BORDER -> + consolidateLists(generateShapes(scriptActionData.getInheritedScriptActionData(), false).stream().map(Shape::getEdgeLocations).collect(Collectors.toSet())); default -> new ArrayList<>(); }; } @@ -80,7 +112,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for try { return scriptActionData.getShapesChachedByTarget(); } catch (Exception ex) { - new WarningMessage("Failed to get list of shapes!"); + Logger.warn("Failed to get list of shapes!"); return new ArrayList<>(); } } @@ -102,7 +134,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for break; case STATIC_RAY: if (targets2 == null) { - new WarningMessage("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); + Logger.warn("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); break; } for (Location location : targets2.getTargetLocations(scriptActionData)) @@ -111,7 +143,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for break; case ROTATING_RAY: if (targets2 == null) { - new WarningMessage("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); + Logger.warn("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); break; } for (Location target2Location : targets2.getTargetLocations(scriptActionData)) @@ -120,7 +152,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for break; case TRANSLATING_RAY: if (targets2 == null) { - new WarningMessage("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); + Logger.warn("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); break; } Location targetLocationEnd = null; @@ -151,7 +183,6 @@ private boolean rayLocationValidator(Location location1, Location location2) { return location1 != null && location2 != null && location1.getWorld().equals(location2.getWorld()); } - //Get entities in an area based on a filter private Collection getEntitiesInArea(List shapes, TargetType targetType) { //Get entities in the world @@ -210,4 +241,39 @@ private Collection filterByLiving(Location center) { return entities; } + private class ZoneListenerTask extends BukkitRunnable { + private final EliteEntity eliteEntity; + private final ScriptActionData scriptActionData; + + public ZoneListenerTask(EliteEntity eliteEntity, ScriptActionData scriptActionData) { + this.eliteEntity = eliteEntity; + this.scriptActionData = scriptActionData; + } + + @Override + public void run() { + if (eliteEntity.getLivingEntity() == null || !eliteEntity.getLivingEntity().isValid()) { + if (eliteEntity instanceof CustomBossEntity customBossEntity) { + if (customBossEntity.getHealth() <= 0) + cancel(); + if (customBossEntity instanceof InstancedBossEntity instancedBossEntity) + if (instancedBossEntity.isRemoved()) + //todo: check if this covers all cases + cancel(); + } else + //If it's not a custom entity there's no scenario where it should be able to survive an unload here + cancel(); + return; + } + Collection newEntities = getEntitiesInArea(generateShapes(scriptActionData, false), TargetType.ZONE_FULL); + newEntities.forEach(livingEntity -> { + if (!entitiesInZone.contains(livingEntity)) ZoneEnterEvent(eliteEntity, livingEntity); + }); + entitiesInZone.forEach(livingEntity -> { + if (!newEntities.contains(livingEntity)) ZoneLeaveEvent(eliteEntity, livingEntity); + }); + entitiesInZone = newEntities; + } + } + } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/EliteScriptBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/EliteScriptBlueprint.java index fc953100f..1045db483 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/EliteScriptBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/EliteScriptBlueprint.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.powers.scripts.caching; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.ConfigurationSection; @@ -97,7 +97,7 @@ private static void checkLegacyFormat(ConfigurationSection configurationSection, customConfigFields.getFileConfiguration().set("eliteScript", configurationSection.getValues(false)); customConfigFields.getFileConfiguration().save(customConfigFields.getFile()); } catch (Exception exception) { - new WarningMessage("Failed to update old script targets! Report this to the dev."); + Logger.warn("Failed to update old script targets! Report this to the dev."); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionBlueprint.java index 3bf87d486..cb784cc2c 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionBlueprint.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.powers.scripts.enums.ActionType; import com.magmaguy.elitemobs.powers.scripts.enums.WeatherType; import com.magmaguy.elitemobs.utils.PotionEffectTypeUtil; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Color; import org.bukkit.FireworkEffect; @@ -107,6 +107,12 @@ public class ScriptActionBlueprint { private float volume = 1f; @Getter private float pitch = 1f; + @Getter + private float velocity = 1f; + @Getter + private double scale = 1f; + @Getter + private boolean debug = false; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -139,15 +145,17 @@ protected void processKeyAndValue(String key, Object value) { try { potionEffectType = PotionEffectTypeUtil.getByKey(((String) value).toLowerCase(Locale.ROOT)); } catch (Exception ex) { - new WarningMessage("Invalid potion effect type " + value + " in file " + scriptFilename + " for script " + scriptName + " !"); + Logger.warn("Invalid potion effect type " + value + " in file " + scriptFilename + " for script " + scriptName + " !"); } } case "scripts" -> scripts = parseStringList(key, value, scriptName); case "landingscripts" -> landingScripts = parseStringList(key, value, scriptName); - case "conditions" -> conditionsBlueprint = new ScriptConditionsBlueprint((Map) value, scriptName, scriptFilename); + case "conditions" -> + conditionsBlueprint = new ScriptConditionsBlueprint((Map) value, scriptName, scriptFilename); case "times" -> times = parseInteger(key, value, scriptName); case "repeatevery" -> repeatEvery = parseInteger(key, value, scriptName); - case "particles" -> scriptParticlesBlueprint = new ScriptParticlesBlueprint((List>) value, scriptName, scriptFilename); + case "particles" -> + scriptParticlesBlueprint = new ScriptParticlesBlueprint((List>) value, scriptName, scriptFilename); case "multiplier" -> multiplier = parseDouble(key, value, scriptName); case "material" -> material = parseEnum(key, value, Material.class, scriptName); case "amount" -> amount = parseInteger(key, value, scriptName); @@ -162,8 +170,10 @@ protected void processKeyAndValue(String key, Object value) { case "fadeout" -> fadeOut = parseInteger(key, value, scriptName); case "flicker" -> flicker = parseBoolean(key, value, scriptName); case "withtrail" -> withTrail = parseBoolean(key, value, scriptName); - case "fireworkeffecttype" -> fireworkEffectType = parseEnum(key, value, FireworkEffect.Type.class, scriptName); - case "fireworkeffecttypes" -> fireworkEffectTypes = parseEnumList(key, value, FireworkEffect.Type.class, scriptName); + case "fireworkeffecttype" -> + fireworkEffectType = parseEnum(key, value, FireworkEffect.Type.class, scriptName); + case "fireworkeffecttypes" -> + fireworkEffectTypes = parseEnumList(key, value, FireworkEffect.Type.class, scriptName); case "fireworkeffects" -> fireworkEffects = parseEnumListList(key, value, FireworkColor.class, scriptName); case "power" -> power = parseInteger(key, value, scriptName); case "invulnerable" -> invulnerable = parseBoolean(key, value, scriptName); @@ -184,10 +194,14 @@ protected void processKeyAndValue(String key, Object value) { finalTarget = new ScriptTargetsBlueprint((Map) value, scriptName, scriptFilename); } case "onlyrunonescript" -> onlyRunOneScript = parseBoolean(key, value, scriptName); - case "relativevector" -> scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, scriptFilename, (Map) value); + case "relativevector" -> + scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, scriptFilename, (Map) value); case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); - default -> new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + case "velocity" -> velocity = parseFloat(key, value, scriptName); + case "scale" -> scale = parseFloat(key, value, scriptName); + case "debug" -> debug = parseBoolean(key, value, scriptName); + default -> Logger.warn("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionsBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionsBlueprint.java index a83a3f459..37b8478c8 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionsBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionsBlueprint.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.powers.scripts.caching; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.ConfigurationSection; @@ -15,7 +15,7 @@ public class ScriptActionsBlueprint { public ScriptActionsBlueprint(ConfigurationSection configurationSection, String scriptName, String filename) { List> values = configurationSection.getMapList("Actions"); if (values.isEmpty()) { - new WarningMessage("Script " + scriptName + " in file " + filename + " does not have any actions! You should probably fix this."); + Logger.warn("Script " + scriptName + " in file " + filename + " does not have any actions! You should probably fix this."); return; } values.forEach(entry -> scriptActionsBlueprintList.add(new ScriptActionBlueprint(entry, scriptName, filename))); diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptConditionsBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptConditionsBlueprint.java index b29e1664b..f60aaa65f 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptConditionsBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptConditionsBlueprint.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.powers.scripts.enums.ConditionType; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -64,15 +64,17 @@ private void processKeyAndValue(String key, Object value) { case "hastags" -> hasTags = MapListInterpreter.parseStringList(key, value, scriptName); case "doesnothavetags" -> doesNotHaveTags = MapListInterpreter.parseStringList(key, value, scriptName); case "isonfloor" -> isOnFloor = MapListInterpreter.parseBoolean(key, value, scriptName); - case "isstandingonmaterial" -> isStandingOnMaterial = MapListInterpreter.parseEnum(key, value, Material.class, scriptName); + case "isstandingonmaterial" -> + isStandingOnMaterial = MapListInterpreter.parseEnum(key, value, Material.class, scriptName); case "randomchance" -> randomChance = MapListInterpreter.parseDouble(key, value, scriptName); - case "conditiontype" -> conditionType = MapListInterpreter.parseEnum(key, value, ConditionType.class, scriptName); + case "conditiontype" -> + conditionType = MapListInterpreter.parseEnum(key, value, ConditionType.class, scriptName); case "target" -> { if (value instanceof MemorySection memorySection) value = memorySection.getValues(false); scriptTargets = new ScriptTargetsBlueprint((Map) value, scriptName, filename); } - default -> new WarningMessage("Failed to read key " + key + " for script " + scriptName); + default -> Logger.warn("Failed to read key " + key + " for script " + scriptName); } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptCooldownsBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptCooldownsBlueprint.java index 565e47a13..4c12d641c 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptCooldownsBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptCooldownsBlueprint.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.powers.scripts.caching; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.ConfigurationSection; @@ -25,7 +25,7 @@ public ScriptCooldownsBlueprint(ConfigurationSection configurationSection, Strin case "global" -> globalCooldown = MapListInterpreter.parseInteger(entry.getKey(), entry.getValue(), scriptName); default -> - new WarningMessage("Failed to parse cooldown entry for script name " + scriptName + " in config file " + filename); + Logger.warn("Failed to parse cooldown entry for script name " + scriptName + " in config file " + filename); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptEventsBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptEventsBlueprint.java index 037981b08..50d33811d 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptEventsBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptEventsBlueprint.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.powers.scripts.caching; import com.magmaguy.elitemobs.api.*; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.ConfigurationSection; @@ -12,6 +12,8 @@ public class ScriptEventsBlueprint { @Getter private final Set events = new HashSet<>(); + @Getter + private boolean zoneListener = false; public ScriptEventsBlueprint(ConfigurationSection configurationSection, String scriptName, String filename) { List values = configurationSection.getStringList("Events"); @@ -28,8 +30,16 @@ public ScriptEventsBlueprint(ConfigurationSection configurationSection, String s case "EliteMobTargetPlayerEvent" -> events.add(EliteMobTargetPlayerEvent.class); case "PlayerDamagedByEliteMobEvent" -> events.add(PlayerDamagedByEliteMobEvent.class); case "ElitePhaseSwitchEvent" -> events.add(ElitePhaseSwitchEvent.class); + case "ZoneEnterEvent" -> { + events.add(ScriptZoneEnterEvent.class); + zoneListener = true; + } + case "ZoneLeaveEvent" -> { + events.add(ScriptZoneLeaveEvent.class); + zoneListener = true; + } default -> - new WarningMessage("Failed to get valid script event from entry " + entry + " in " + scriptName + " for file " + filename + " !"); + Logger.warn("Failed to get valid script event from entry " + entry + " in " + scriptName + " for file " + filename + " !"); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptParticlesBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptParticlesBlueprint.java index 0d8d71927..5ed7d9066 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptParticlesBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptParticlesBlueprint.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.powers.scripts.caching; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Particle; @@ -28,6 +28,7 @@ public ScriptParticlesBlueprint() { public class ScriptParticleBlueprint { @Getter private final String scriptName; + private final String filename; @Getter private double x = 0.01; @Getter @@ -56,7 +57,6 @@ public class ScriptParticleBlueprint { private Boolean moveToTarget = null; @Getter private ScriptRelativeVectorBlueprint relativeVectorBlueprint = null; - private final String filename; public ScriptParticleBlueprint(Map entry, String scriptName, String filename) { this.filename = filename; @@ -86,8 +86,10 @@ private void processKeyAndValue(String key, Object value) { case "togreen" -> toGreen = parseInteger(key, value, scriptName); case "toblue" -> toBlue = parseInteger(key, value, scriptName); case "movetotarget" -> moveToTarget = parseBoolean(key, value, scriptName); - case "relativevector" -> relativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, filename, (Map) value); - default -> new WarningMessage("Key " + key + " in script " + scriptName + " in file " + filename + " for script particles is not a valid key!"); + case "relativevector" -> + relativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, filename, (Map) value); + default -> + Logger.warn("Key " + key + " in script " + scriptName + " in file " + filename + " for script particles is not a valid key!"); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptRelativeVectorBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptRelativeVectorBlueprint.java index 1356b61fe..a38bfcb70 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptRelativeVectorBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptRelativeVectorBlueprint.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.powers.scripts.caching; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.MemorySection; import org.bukkit.util.Vector; @@ -55,7 +55,7 @@ protected void processKeyAndValue(String key, Object value) { case "multiplier" -> multiplier = MapListInterpreter.parseDouble(key, value, scriptName); case "normalize" -> normalize = MapListInterpreter.parseBoolean(key, value, scriptName); case "offset" -> offset = MapListInterpreter.parseVector(key, value, scriptName); - default -> new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + default -> Logger.warn("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptTargetsBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptTargetsBlueprint.java index 2514cd2ff..455d24626 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptTargetsBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptTargetsBlueprint.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.powers.scripts.caching; import com.magmaguy.elitemobs.powers.scripts.enums.TargetType; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.configuration.MemorySection; @@ -44,7 +44,7 @@ public ScriptTargetsBlueprint(Map entry, String scriptName, String filenam this.filename = filename; processMapList(entry); if (!isZoneTarget() && coverage < 1.0) { - new WarningMessage("Coverage for script " + scriptName + " in file " + filename + " was less than 1.0 but the targetType is neither ZONE_FULL nor ZONE_BORDER! Coverage should only be used for ZONE_FULL or ZONE_BORDER"); + Logger.warn("Coverage for script " + scriptName + " in file " + filename + " was less than 1.0 but the targetType is neither ZONE_FULL nor ZONE_BORDER! Coverage should only be used for ZONE_FULL or ZONE_BORDER"); coverage = 1.0; } } @@ -81,7 +81,7 @@ protected void processKeyAndValue(String key, Object value) { else if (value instanceof LinkedHashMap) scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, filename, ((LinkedHashMap) value)); else - new WarningMessage("Failed to get valid format for relative offset in " + scriptName + " for file " + filename); + Logger.warn("Failed to get valid format for relative offset in " + scriptName + " for file " + filename); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptZoneBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptZoneBlueprint.java index ee0fcf261..642da8361 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptZoneBlueprint.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptZoneBlueprint.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.powers.scripts.enums.Filter; import com.magmaguy.elitemobs.powers.scripts.enums.ShapeType; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.MemorySection; @@ -110,7 +110,7 @@ protected void processKeyAndValue(String key, Object value) { case "yborder" -> yBorder = parseDouble(key, value, scriptName); case "zborder" -> zBorder = parseDouble(key, value, scriptName); default -> { - new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in file " + filename); + Logger.warn("Failed to read key " + key + " for script " + scriptName + " in file " + filename); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/powers/scripts/enums/ActionType.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/enums/ActionType.java index f936a3796..475a59a82 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/enums/ActionType.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/enums/ActionType.java @@ -32,7 +32,9 @@ public enum ActionType { PLAY_ANIMATION(true), SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), - SUMMON_ENTITY(false); + SUMMON_ENTITY(false), + NAVIGATE(false), + SCALE(false); @Getter private final boolean requiresLivingEntity; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/specialpowers/EnderCrystalLightningRod.java b/src/main/java/com/magmaguy/elitemobs/powers/specialpowers/EnderCrystalLightningRod.java index f7e7bb8ab..b90c2cc26 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/specialpowers/EnderCrystalLightningRod.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/specialpowers/EnderCrystalLightningRod.java @@ -45,7 +45,7 @@ public void run() { public static class EnderCrystalLightningRodEvents implements Listener { @EventHandler(ignoreCancelled = true) public void damageEvent(EntityDamageEvent event) { - if (!event.getEntity().getType().equals(EntityType.ENDER_CRYSTAL)) return; + if (!event.getEntity().getType().equals(EntityType.END_CRYSTAL)) return; if (!(event.getCause().equals(EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) || event.getCause().equals(EntityDamageEvent.DamageCause.FALLING_BLOCK) || event.getCause().equals(EntityDamageEvent.DamageCause.LIGHTNING))) return; diff --git a/src/main/java/com/magmaguy/elitemobs/powerstances/MajorPowerPowerStance.java b/src/main/java/com/magmaguy/elitemobs/powerstances/MajorPowerPowerStance.java index b553c50fe..64bf6a6ee 100644 --- a/src/main/java/com/magmaguy/elitemobs/powerstances/MajorPowerPowerStance.java +++ b/src/main/java/com/magmaguy/elitemobs/powerstances/MajorPowerPowerStance.java @@ -5,7 +5,6 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.ElitePower; import com.magmaguy.elitemobs.powers.meta.MajorPower; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Item; @@ -116,8 +115,7 @@ private Object addEffect(Material material) { Item item = eliteEntity.getLivingEntity().getWorld().dropItem(eliteEntity.getLivingEntity().getLocation(), new ItemStack(material)); item.setPickupDelay(Integer.MAX_VALUE); - if (!VersionChecker.serverVersionOlderThan(1, 11)) - item.setGravity(false); + item.setGravity(false); item.setInvulnerable(true); EntityTracker.registerVisualEffects(item); return item; diff --git a/src/main/java/com/magmaguy/elitemobs/powerstances/MinorPowerPowerStance.java b/src/main/java/com/magmaguy/elitemobs/powerstances/MinorPowerPowerStance.java index cc3e64290..d34c496cc 100644 --- a/src/main/java/com/magmaguy/elitemobs/powerstances/MinorPowerPowerStance.java +++ b/src/main/java/com/magmaguy/elitemobs/powerstances/MinorPowerPowerStance.java @@ -5,7 +5,6 @@ import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.ElitePower; import com.magmaguy.elitemobs.powers.meta.MinorPower; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Item; @@ -116,8 +115,7 @@ private Object addEffect(Material material) { Item item = eliteEntity.getLivingEntity().getWorld().dropItem(eliteEntity.getLivingEntity().getLocation(), new ItemStack(material)); item.setPickupDelay(Integer.MAX_VALUE); - if (!VersionChecker.serverVersionOlderThan(1, 11)) - item.setGravity(false); + item.setGravity(false); item.setInvulnerable(true); EntityTracker.registerVisualEffects(item); return item; diff --git a/src/main/java/com/magmaguy/elitemobs/powerstances/VisualEffectObfuscator.java b/src/main/java/com/magmaguy/elitemobs/powerstances/VisualEffectObfuscator.java index 53c9a2458..f8b304642 100644 --- a/src/main/java/com/magmaguy/elitemobs/powerstances/VisualEffectObfuscator.java +++ b/src/main/java/com/magmaguy/elitemobs/powerstances/VisualEffectObfuscator.java @@ -20,7 +20,7 @@ public void onTargetPlayer(EntityTargetLivingEntityEvent event) { eliteEntity.setVisualEffectObfuscated(false); } - @EventHandler (ignoreCancelled = true) + @EventHandler(ignoreCancelled = true) public void onDamageByPlayer(EntityDamageByEntityEvent event) { if (!(EntityFinder.getRealDamager(event) instanceof Player)) return; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity()); diff --git a/src/main/java/com/magmaguy/elitemobs/quests/CustomQuest.java b/src/main/java/com/magmaguy/elitemobs/quests/CustomQuest.java index 969ef9b0a..9550652fd 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/CustomQuest.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/CustomQuest.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.quests; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.QuestAcceptEvent; import com.magmaguy.elitemobs.api.QuestRewardEvent; @@ -11,7 +10,8 @@ import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns; import com.magmaguy.elitemobs.quests.rewards.QuestReward; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -71,7 +71,7 @@ public CustomQuestsConfigFields getCustomQuestsConfigFields() { if (customQuestsConfigFields == null) this.customQuestsConfigFields = CustomQuestsConfig.getCustomQuests().get(configurationFilename); if (customQuestsConfigFields == null) { - new WarningMessage("Detected that Custom Quest " + configurationFilename + " got removed even though player " + Logger.warn("Detected that Custom Quest " + configurationFilename + " got removed even though player " + Bukkit.getPlayer(getPlayerUUID()).getName() + " is still trying to complete it. This player's quest will now be wiped."); PlayerData.removeQuest(getPlayerUUID(), this); return null; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/DynamicQuest.java b/src/main/java/com/magmaguy/elitemobs/quests/DynamicQuest.java index 152a0ba74..825625903 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/DynamicQuest.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/DynamicQuest.java @@ -50,7 +50,7 @@ public void run() { public static void shutdown() { threeRandomDynamicObjectives.clear(); if (randomizerTask != null) - randomizerTask.cancel(); + randomizerTask.cancel(); } public static List generateQuests(Player player) { diff --git a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index 27698f350..2b350027d 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.quests; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.QuestAcceptEvent; import com.magmaguy.elitemobs.api.QuestCompleteEvent; @@ -14,8 +13,9 @@ import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.objectives.*; import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.SpigotMessage; import com.magmaguy.elitemobs.wormhole.Wormhole; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.SpigotMessage; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -80,8 +80,7 @@ public static void toggleTracking(Player player, String questID) { public static void toggleTracking(Player player, CustomQuest quest) { if (playerTrackingQuests.containsKey(player)) { playerTrackingQuests.get(player).stop(); - } - else { + } else { if (quest == null) { player.sendMessage("[EliteMobs] Failed to get a valid quest with that quest ID!"); return; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java index 011c013fd..b38f8a395 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.quests.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.commands.quests.QuestCommand; import com.magmaguy.elitemobs.config.QuestsConfig; import com.magmaguy.elitemobs.npcs.NPCEntity; import com.magmaguy.elitemobs.quests.CustomQuest; import com.magmaguy.elitemobs.quests.Quest; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -20,7 +20,10 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; import java.util.concurrent.atomic.AtomicInteger; public class QuestInventoryMenu { @@ -42,7 +45,7 @@ public static void generateInventoryQuestEntries(List quests, P public static void generateInventoryQuestDirectory(List quests, Player player, NPCEntity npcEntity) { String menuTitle = "Quests"; Inventory questInventory = Bukkit.createInventory(player, 27, menuTitle); - List questSlots = new ArrayList<>(Arrays.asList(13, 11, 15, 9, 17, 10, 16, 12, 14, 8)); + List questSlots = new ArrayList<>(new ArrayList<>(List.of(13, 11, 15, 9, 17, 10, 16, 12, 14, 8))); Material acceptMaterial = Material.GREEN_STAINED_GLASS_PANE; Material inProgressMaterial = Material.RED_STAINED_GLASS_PANE; Material completeMaterial = Material.ORANGE_STAINED_GLASS_PANE; @@ -70,9 +73,9 @@ public static void generateInventoryQuestEntry(Quest quest, Player player, NPCEn title = questText.getHeader().getText(); Inventory questInventory = Bukkit.createInventory(player, 27, title); int titleEntry = 4; - List loreEntries = new ArrayList<>(Arrays.asList(13, 14, 12, 15, 11, 16, 10, 17, 9)); - List objectivesEntries = new ArrayList<>(Arrays.asList(21, 20, 19, 18)); - List rewardEntries = new ArrayList<>(Arrays.asList(23, 24, 25)); + List loreEntries = new ArrayList<>(new ArrayList<>(List.of(13, 14, 12, 15, 11, 16, 10, 17, 9))); + List objectivesEntries = new ArrayList<>(new ArrayList<>(List.of(21, 20, 19, 18))); + List rewardEntries = new ArrayList<>(new ArrayList<>(List.of(23, 24, 25))); Material titleMaterial = Material.PAINTING; Material trackingMaterial = Material.TARGET; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java index ad70cc552..642964af8 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.quests.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.DefaultConfig; import com.magmaguy.elitemobs.config.menus.premade.CustomQuestMenuConfig; import com.magmaguy.elitemobs.config.menus.premade.DynamicQuestMenuConfig; @@ -17,7 +16,8 @@ import com.magmaguy.elitemobs.quests.objectives.Objective; import com.magmaguy.elitemobs.thirdparty.geyser.GeyserDetector; import com.magmaguy.elitemobs.utils.BookMaker; -import com.magmaguy.elitemobs.utils.SpigotMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.SpigotMessage; import lombok.Getter; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomFetchObjective.java b/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomFetchObjective.java index e99f7a4ea..71e74af09 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomFetchObjective.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomFetchObjective.java @@ -9,7 +9,7 @@ import com.magmaguy.elitemobs.playerdata.database.PlayerData; import com.magmaguy.elitemobs.quests.Quest; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -73,7 +73,7 @@ private void turnItemsIn(Player player) { return; } } - new WarningMessage("Player " + player.getName() + " managed to complete objective " + objectiveName + " without turning in the required amount of items! This isn't good, tell the developer!"); + Logger.warn("Player " + player.getName() + " managed to complete objective " + objectiveName + " without turning in the required amount of items! This isn't good, tell the developer!"); } /** diff --git a/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomObjectivesParser.java b/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomObjectivesParser.java index eadef889b..c97beb3a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomObjectivesParser.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/objectives/CustomObjectivesParser.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.quests.objectives; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.quests.CustomQuest; import com.magmaguy.elitemobs.utils.MapListInterpreter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import java.util.ArrayList; import java.util.List; @@ -57,7 +57,7 @@ private static Objective processObjectiveType(Map rawMap, Custom } } if (filename == null) { - new WarningMessage("Invalid filename for entry " + rawMap + " in Custom Quest " + customQuest.getCustomQuestsConfigFields().getFilename() + " . This objective will not be registered."); + Logger.warn("Invalid filename for entry " + rawMap + " in Custom Quest " + customQuest.getCustomQuestsConfigFields().getFilename() + " . This objective will not be registered."); return null; } try { @@ -70,8 +70,8 @@ else if (objectiveType.equals(ObjectiveType.DIALOG)) else if (objectiveType.equals(ObjectiveType.ARENA)) return new ArenaObjective(name, filename); } catch (Exception ex) { - new WarningMessage("Failed to register objective type for quest " + customQuest.getCustomQuestsConfigFields().getFilename() + " ! This quest will be skipped"); - new WarningMessage("Invalid entry: " + rawMap); + Logger.warn("Failed to register objective type for quest " + customQuest.getCustomQuestsConfigFields().getFilename() + " ! This quest will be skipped"); + Logger.warn("Invalid entry: " + rawMap); ex.printStackTrace(); } diff --git a/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java b/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java index f13ca3ca8..17a23b443 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.quests.objectives; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.api.QuestObjectivesCompletedEvent; import com.magmaguy.elitemobs.config.QuestsConfig; import com.magmaguy.elitemobs.config.npcs.NPCsConfig; @@ -10,6 +9,8 @@ import com.magmaguy.elitemobs.quests.rewards.QuestReward; import com.magmaguy.elitemobs.utils.EventCaller; import com.magmaguy.elitemobs.utils.SimpleScoreboard; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -25,6 +26,8 @@ public class QuestObjectives implements Serializable { + @Getter + private final UUID uuid = UUID.randomUUID(); @Getter @Setter protected QuestReward questReward; @@ -40,8 +43,6 @@ public class QuestObjectives implements Serializable { private boolean turnedIn = false; @Setter private boolean forceOver = false; - @Getter - private final UUID uuid = UUID.randomUUID(); /** * Used for dynamic quests @@ -81,11 +82,16 @@ public boolean isOver() { //used by the force bypass if (forceOver) return true; boolean checkOver = true; - for (Objective objective : objectives) + for (Objective objective : objectives) { + if (objective == null) { + Logger.warn("Found a null objective for quest " + quest.getQuestName()); + continue; + } if (!objective.isObjectiveCompleted()) { checkOver = false; break; } + } return checkOver; } diff --git a/src/main/java/com/magmaguy/elitemobs/quests/playercooldowns/PlayerQuestCooldowns.java b/src/main/java/com/magmaguy/elitemobs/quests/playercooldowns/PlayerQuestCooldowns.java index 87013bec8..d52b2e98c 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/playercooldowns/PlayerQuestCooldowns.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/playercooldowns/PlayerQuestCooldowns.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfigFields; import com.magmaguy.elitemobs.playerdata.database.PlayerData; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionAttachment; @@ -76,7 +76,7 @@ public static void addCooldown(Player player, String permission, int delayInMinu PlayerQuestCooldowns playerQuestCooldowns = PlayerData.getPlayerQuestCooldowns(player.getUniqueId()); if (playerQuestCooldowns == null) { playerQuestCooldowns = new PlayerQuestCooldowns(); - new WarningMessage("For some reason the player cooldowns failed to read, warn the dev!", true); + Logger.warn("For some reason the player cooldowns failed to read, warn the dev!", true); } playerQuestCooldowns.questCooldowns.add(new QuestCooldown(delayInMinutes, permission, player.getUniqueId())); PlayerData.updatePlayerQuestCooldowns(player.getUniqueId(), playerQuestCooldowns); diff --git a/src/main/java/com/magmaguy/elitemobs/quests/rewards/RewardEntry.java b/src/main/java/com/magmaguy/elitemobs/quests/rewards/RewardEntry.java index 583223d69..a7dfb8e6e 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/rewards/RewardEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/rewards/RewardEntry.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.economy.EconomyHandler; import com.magmaguy.elitemobs.utils.ObjectSerializer; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -58,7 +58,7 @@ public void serializeReward() { try { this.itemStack = ObjectSerializer.itemStackArrayFromBase64(deserializedItemStack); } catch (Exception ex) { - new WarningMessage("Failed to serialize item stack"); + Logger.warn("Failed to serialize item stack"); ex.printStackTrace(); } } @@ -75,6 +75,6 @@ else if (command != null) else if (currencyAmount != 0) EconomyHandler.addCurrency(playerUUID, currencyAmount); else - new WarningMessage("Quest failed to dispatch reward! Report this to the dev!", true); + Logger.warn("Quest failed to dispatch reward! Report this to the dev!", true); } } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/CustomModelInterface.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/CustomModelInterface.java index 1c242e102..e2c1da363 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/CustomModelInterface.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/CustomModelInterface.java @@ -3,11 +3,17 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; public interface CustomModelInterface { - public void shoot(); - public void melee(); - public void playAnimationByName(String animationName); - public void setName(String nametagName, boolean visible); - public void setNameVisible(boolean visible); - public void addPassenger(CustomBossEntity passenger); - public void switchPhase(); + void shoot(); + + void melee(); + + void playAnimationByName(String animationName); + + void setName(String nametagName, boolean visible); + + void setNameVisible(boolean visible); + + void addPassenger(CustomBossEntity passenger); + + void switchPhase(); } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/freeminecraftmodels/CustomModelFMM.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/freeminecraftmodels/CustomModelFMM.java index 54190049d..173f46be5 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/freeminecraftmodels/CustomModelFMM.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/freeminecraftmodels/CustomModelFMM.java @@ -9,7 +9,7 @@ public class CustomModelFMM implements CustomModelInterface { @Getter - private DynamicEntity dynamicEntity; + private final DynamicEntity dynamicEntity; public CustomModelFMM(LivingEntity livingEntity, String modelName, String nametagName) { dynamicEntity = DynamicEntity.create(modelName, livingEntity); diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/modelengine/CustomModelMEG.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/modelengine/CustomModelMEG.java index 7cbc9d2ca..0fac1c220 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/modelengine/CustomModelMEG.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/custommodels/modelengine/CustomModelMEG.java @@ -2,8 +2,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModelInterface; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import com.ticxo.modelengine.api.ModelEngineAPI; import com.ticxo.modelengine.api.animation.state.ModelState; import com.ticxo.modelengine.api.generator.model.ModelBlueprint; @@ -26,11 +25,11 @@ public class CustomModelMEG implements CustomModelInterface { public CustomModelMEG(LivingEntity livingEntity, String modelName, String nametagName) { try { if (ModelEngineAPI.api.getModelRegistry().getBlueprint(modelName) == null) { - new InfoMessage("Model " + modelName + " was not found! Make sure you install the model correctly if you have it. This entry will be skipped!"); + Logger.info("Model " + modelName + " was not found! Make sure you install the model correctly if you have it. This entry will be skipped!"); return; } } catch (NoSuchMethodError ex) { - new WarningMessage("Model Engine API version is not supported. Currently Elitemobs can only support ModelEngine R3.0.0."); + Logger.warn("Model Engine API version is not supported. Currently Elitemobs can only support ModelEngine R3.0.0."); return; } @@ -39,14 +38,14 @@ public CustomModelMEG(LivingEntity livingEntity, String modelName, String nameta activeModel = ModelEngineAPI.createActiveModel(modelBlueprint); if (activeModel == null) { - new WarningMessage("Failed to load model from " + modelName + " ! Is the model name correct, and has the model been installed correctly?"); + Logger.warn("Failed to load model from " + modelName + " ! Is the model name correct, and has the model been installed correctly?"); return; } modeledEntity = ModelEngineAPI.createModeledEntity(livingEntity); if (modeledEntity == null) { - new WarningMessage("Failed to create model entity " + modelName + " ! This means the entity that was meant to get disguised has a problem!"); + Logger.warn("Failed to create model entity " + modelName + " ! This means the entity that was meant to get disguised has a problem!"); return; } @@ -58,7 +57,7 @@ public CustomModelMEG(LivingEntity livingEntity, String modelName, String nameta success = true; } catch (Exception exception) { modeledEntity.removeModel(modelName); - new WarningMessage("Failed to make model entity " + modelName + " ! Couldn't assign model or visibility status."); + Logger.warn("Failed to make model entity " + modelName + " ! Couldn't assign model or visibility status."); exception.printStackTrace(); } @@ -73,7 +72,7 @@ public static void reloadModels() { try { ModelEngineAPI.api.getGenerator().importModelsAsync(); } catch (Exception ex) { - new WarningMessage("Model Engine API version is not supported. Currently Elitemobs can only support ModelEngine R3.0.0."); + Logger.warn("Model Engine API version is not supported. Currently Elitemobs can only support ModelEngine R3.0.0."); } } @@ -81,11 +80,11 @@ public static boolean modelExists(String modelName) { if (modelName == null || modelName.isEmpty()) return false; try { if (ModelEngineAPI.api.getModelRegistry().getBlueprint(modelName) == null) { - new InfoMessage("Model " + modelName + " was not found! Make sure you install the model correctly if you have it. This entry will be skipped!"); + Logger.info("Model " + modelName + " was not found! Make sure you install the model correctly if you have it. This entry will be skipped!"); return false; } } catch (NoSuchMethodError ex) { - new WarningMessage("Model Engine API version is not supported. Currently Elitemobs can only support ModelEngine R3.0.0, documentation for other versions doesn't exist."); + Logger.warn("Model Engine API version is not supported. Currently Elitemobs can only support ModelEngine R3.0.0, documentation for other versions doesn't exist."); return false; } @@ -119,7 +118,7 @@ public void setName(String nametagName, boolean visible) { if (modeledEntity == null) return; Nameable nametag = getNameableBone(); if (nametag == null) { - new WarningMessage("Failed to get hitbox nametag for disguise!"); + Logger.warn("Failed to get hitbox nametag for disguise!"); return; } nametag.setCustomName(nametagName); @@ -141,7 +140,7 @@ private Nameable getNameableBone() { public void addPassenger(CustomBossEntity passenger) { if (passenger.getCustomBossesConfigFields().getCustomModelMountPointID() == null) { - new WarningMessage("Attempted to add " + passenger.getCustomBossesConfigFields().getFilename() + " as a mounted entity for a custom model but it does not have customModelMountPointID set! The boss can't guess where it needs to be mounted, and therefore this will not work."); + Logger.warn("Attempted to add " + passenger.getCustomBossesConfigFields().getFilename() + " as a mounted entity for a custom model but it does not have customModelMountPointID set! The boss can't guess where it needs to be mounted, and therefore this will not work."); return; } modeledEntity.getMountManager().addPassengerToSeat( diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/discordsrv/DiscordSRVAnnouncement.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/discordsrv/DiscordSRVAnnouncement.java index 1359a68b9..658bb71c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/discordsrv/DiscordSRVAnnouncement.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/discordsrv/DiscordSRVAnnouncement.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.thirdparty.discordsrv; import com.magmaguy.elitemobs.config.DiscordSRVConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import github.scarsz.discordsrv.DiscordSRV; import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel; import github.scarsz.discordsrv.util.DiscordUtil; @@ -38,10 +38,10 @@ public DiscordSRVAnnouncement(String announcement) { if (textChannel != null) textChannel.sendMessage(ChatColor.stripColor(announcement)).queue(); else - new WarningMessage("Channel room " + DiscordSRVConfig.getAnnouncementRoomName() + " is not valid!"); + Logger.warn("Channel room " + DiscordSRVConfig.getAnnouncementRoomName() + " is not valid!"); } catch (Exception ex) { - new WarningMessage("Failed to send announcement via DiscordsSRV! Is it configured correctly?"); + Logger.warn("Failed to send announcement via DiscordsSRV! Is it configured correctly?"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java index 352357916..9e030fd0e 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java @@ -1,9 +1,8 @@ package com.magmaguy.elitemobs.thirdparty.libsdisguises; import com.magmaguy.elitemobs.config.DefaultConfig; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import me.libraryaddict.disguise.DisguiseAPI; -import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.disguisetypes.*; import org.bukkit.Bukkit; import org.bukkit.entity.Entity; @@ -12,7 +11,7 @@ public class DisguiseEntity { public static void initialize() { - DisguiseConfig.setPlayerNameType(DisguiseConfig.PlayerNameType.ARMORSTANDS); +// DisguiseConfig.setPlayerNameType(DisguiseConfig.PlayerNameType.ARMORSTANDS); } /** @@ -32,7 +31,7 @@ public static void disguise(String disguiseName, Entity entity, String customDis try { customDisguise(disguiseName.replace("custom:", ""), entity, customDisguiseData, filename); } catch (Exception ex) { - new WarningMessage("Failed to assign custom disguise " + disguiseName + "! Did you configure the disguise correctly?"); + Logger.warn("Failed to assign custom disguise " + disguiseName + "! Did you configure the disguise correctly?"); } return; } @@ -49,7 +48,7 @@ public static void disguise(String disguiseName, Entity entity, String customDis try { disguiseType = DisguiseType.valueOf(disguiseName); } catch (Exception ex) { - new WarningMessage("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise."); + Logger.warn("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise."); return; } @@ -58,14 +57,14 @@ public static void disguise(String disguiseName, Entity entity, String customDis else if (disguiseType.isMisc()) miscEntityDisguise(disguiseType, entity); else - new WarningMessage("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise."); + Logger.warn("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise."); } private static void playerDisguise(String playerName, Entity entity) { PlayerDisguise playerDisguise = new PlayerDisguise(playerName); playerDisguise.setEntity(entity); playerDisguise.setName(entity.getCustomName()); - playerDisguise.setNameVisible(true); //libs really doesn't like dinamic name displays + playerDisguise.setNameVisible(true); //libs really doesn't like dynamic name displays //playerDisguise.setNameVisible(DefaultConfig.isAlwaysShowNametags() || entity.getType().equals(EntityType.VILLAGER)); playerDisguise.setDynamicName(true); playerDisguise.startDisguise(); @@ -108,8 +107,8 @@ private static void customDisguise(String customDisguise, Entity entity, String } disguise.startDisguise(); } catch (Exception ex) { - new WarningMessage("Failed to set custom disguise for " + filename + " !"); - new WarningMessage("Does the disguise exist? Is LibsDisguises up-to-date?"); + Logger.warn("Failed to set custom disguise for " + filename + " !"); + Logger.warn("Does the disguise exist? Is LibsDisguises up-to-date?"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobs.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobs.java index ad1656244..95638a510 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobs.java @@ -11,7 +11,7 @@ public class MythicMobs { public static Entity spawn(Location location, String name, int level) { MythicMob mythicMob = MythicBukkit.inst().getMobManager().getMythicMob(name).orElse(null); - if (mythicMob != null){ + if (mythicMob != null) { ActiveMob activeMob = mythicMob.spawn(BukkitAdapter.adapt(location), level); return activeMob.getEntity().getBukkitEntity(); } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobsInterface.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobsInterface.java index 528f3f775..c9e51aea9 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobsInterface.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/mythicmobs/MythicMobsInterface.java @@ -5,8 +5,8 @@ import org.bukkit.entity.Entity; public class MythicMobsInterface { - public static Entity spawn(Location location, String name, int level){ + public static Entity spawn(Location location, String name, int level) { if (!Bukkit.getPluginManager().isPluginEnabled("MythicMobs")) return null; - return MythicMobs.spawn(location,name,level); + return MythicMobs.spawn(location, name, level); } } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/paper/PaperMC.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/paper/PaperMC.java index a405581a8..650ed5161 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/paper/PaperMC.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/paper/PaperMC.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.thirdparty.paper; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class PaperMC { @@ -12,7 +12,7 @@ public static void initialize() { try { paperMC = Class.forName("com.destroystokyo.paper.VersionHistoryManager$VersionData") != null; } catch (ClassNotFoundException e) { - Bukkit.getLogger().info("Not paper"); + Logger.info("Not paper"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java index 6ce153d20..530501678 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java @@ -6,7 +6,7 @@ import com.magmaguy.elitemobs.economy.EconomyHandler; import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.playerdata.database.PlayerData; -import com.magmaguy.elitemobs.utils.Round; +import com.magmaguy.magmacore.util.Round; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -99,7 +99,7 @@ public String onPlaceholderRequest(Player player, String identifier) { databases for safety purposes. All of the queries should be in memory regardless. */ - if (!PlayerData.isInMemory(player.getUniqueId())|| PlayerData.getPlayerData(player.getUniqueId()) == null) + if (!PlayerData.isInMemory(player.getUniqueId()) || PlayerData.getPlayerData(player.getUniqueId()) == null) return "Uninitialized player data!"; switch (identifier) { diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldedit/WorldEditUtils.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldedit/WorldEditUtils.java deleted file mode 100644 index 07dd4b8a0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldedit/WorldEditUtils.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.magmaguy.elitemobs.thirdparty.worldedit; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; -import com.sk89q.worldedit.function.operation.Operation; -import com.sk89q.worldedit.function.operation.Operations; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.world.World; -import org.bukkit.Location; - -import java.io.File; -import java.io.FileInputStream; -import java.util.HashMap; - -public class WorldEditUtils { - private static final HashMap schematicPackageEdits = new HashMap<>(); - - private WorldEditUtils() { - } - - public static boolean place(String schematicName, int rotation, Location anchorLocation, SchematicPackage schematicPackage) { - Clipboard clipboard = load(schematicName); - if (clipboard == null) return false; - paste(clipboard, anchorLocation, schematicPackage, rotation); - return true; - } - - public static Clipboard load(String schematicName) { - File schematicFile = new File(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath() + File.separatorChar + "schematics" + File.separatorChar + schematicName); - if (!schematicFile.exists()) return null; - Clipboard clipboard; - ClipboardFormat format = ClipboardFormats.findByFile(schematicFile); - try (ClipboardReader reader = format.getReader(new FileInputStream(schematicFile))) { - clipboard = reader.read(); - } catch (Exception e) { - throw new RuntimeException(e); - } - return clipboard; - } - - public static void paste(Clipboard clipboard, Location location, SchematicPackage schematicPackage, int rotation) { - AffineTransform affineTransform = new AffineTransform(); - World world = BukkitAdapter.adapt(location.getWorld()); - try (EditSession editSession = WorldEdit.getInstance().newEditSession(world)) { - ClipboardHolder clipboardHolder = new ClipboardHolder(clipboard); - clipboardHolder.setTransform(clipboardHolder.getTransform().combine(affineTransform.rotateY(rotation))); - - Operation operation = clipboardHolder - .createPaste(editSession) - .to(BlockVector3.at(location.getX(), location.getY(), location.getZ())) - // configure here - .build(); - Operations.complete(operation); - schematicPackageEdits.put(schematicPackage, editSession); - } catch (WorldEditException e) { - throw new RuntimeException(e); - } - } - - public static void undo(SchematicPackage schematicPackage) { - EditSession editSession = schematicPackageEdits.get(schematicPackage); - if (editSession == null) return; - editSession.undo(editSession); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java index 55f51be84..2a7cee438 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,54 +1,38 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; -import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; -import com.magmaguy.elitemobs.utils.WarningMessage; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.math.BlockVector3; +import com.magmaguy.magmacore.util.Logger; import com.sk89q.worldguard.WorldGuard; -import com.sk89q.worldguard.domains.DefaultDomain; -import com.sk89q.worldguard.protection.flags.Flags; import com.sk89q.worldguard.protection.flags.IntegerFlag; import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.registry.FlagConflictException; import com.sk89q.worldguard.protection.flags.registry.FlagRegistry; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.regions.RegionContainer; import lombok.Getter; import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; - -import java.util.UUID; public class WorldGuardCompatibility { - @Getter - private static final StateFlag.State allow = StateFlag.State.ALLOW; - @Getter - private static final StateFlag.State deny = StateFlag.State.DENY; - @Getter - private static StateFlag ELITEMOBS_SPAWN_FLAG; - @Getter - private static StateFlag ELITEMOBS_ONLY_SPAWN_FLAG; - @Getter - private static StateFlag ELITEMOBS_ANTIEXPLOIT; - @Getter - private static StateFlag ELITEMOBS_DUNGEON; - @Getter - private static StateFlag ELITEMOBS_EVENTS; - @Getter - private static IntegerFlag ELITEMOBS_MINIMUM_LEVEL; - @Getter - private static IntegerFlag ELITEMOBS_MAXIMUM_LEVEL; - @Getter - private static StateFlag ELITEMOBS_EXPLOSION_REGEN; - @Getter - private static StateFlag ELITEMOBS_EXPLOSION_BLOCK_DAMAGE; + @Getter + private static final StateFlag.State allow = StateFlag.State.ALLOW; + @Getter + private static final StateFlag.State deny = StateFlag.State.DENY; + @Getter + private static StateFlag ELITEMOBS_SPAWN_FLAG; + @Getter + private static StateFlag ELITEMOBS_ONLY_SPAWN_FLAG; + @Getter + private static StateFlag ELITEMOBS_ANTIEXPLOIT; + @Getter + private static StateFlag ELITEMOBS_DUNGEON; + @Getter + private static StateFlag ELITEMOBS_EVENTS; + @Getter + private static IntegerFlag ELITEMOBS_MINIMUM_LEVEL; + @Getter + private static IntegerFlag ELITEMOBS_MAXIMUM_LEVEL; + @Getter + private static StateFlag ELITEMOBS_EXPLOSION_REGEN; + @Getter + private static StateFlag ELITEMOBS_EXPLOSION_BLOCK_DAMAGE; public static boolean initialize() { @@ -56,90 +40,90 @@ public static boolean initialize() { if (Bukkit.getPluginManager().getPlugin("WorldGuard") == null) return false; - Bukkit.getLogger().info("[EliteMobs] WorldGuard detected."); + Logger.info(" WorldGuard detected."); FlagRegistry registry = null; try { registry = WorldGuard.getInstance().getFlagRegistry(); } catch (Exception ex) { - new WarningMessage("Something went wrong while loading WorldGuard. Are you using the right WorldGuard version?"); + Logger.warn("Something went wrong while loading WorldGuard. Are you using the right WorldGuard version?"); return false; } - Bukkit.getLogger().info("[EliteMobs] Enabling flags:"); + Logger.info(" Enabling flags:"); try { ELITEMOBS_SPAWN_FLAG = new StateFlag("elitemob-spawning", true); registry.register(ELITEMOBS_SPAWN_FLAG); - Bukkit.getLogger().info("[EliteMobs] - elitemob-spawning"); + Logger.info(" - elitemob-spawning"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-spawning already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn(" Warning: flag elitemob-spawning already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_SPAWN_FLAG = (StateFlag) registry.get("elitemob-spawning"); } try { ELITEMOBS_ONLY_SPAWN_FLAG = new StateFlag("elitemob-only-spawning", false); registry.register(ELITEMOBS_ONLY_SPAWN_FLAG); - Bukkit.getLogger().info("[EliteMobs] - elitemob-only-spawning"); + Logger.info(" - elitemob-only-spawning"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-only-spawning already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn(" Warning: flag elitemob-only-spawning already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_ONLY_SPAWN_FLAG = (StateFlag) registry.get("elitemob-only-spawning"); } try { ELITEMOBS_ANTIEXPLOIT = new StateFlag("elitemobs-antiexploit", true); registry.register(ELITEMOBS_ANTIEXPLOIT); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-antiexploit"); + Logger.info(" - elitemobs-antiexploit"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-antiexploit already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn(" Warning: flag elitemob-antiexploit already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_ANTIEXPLOIT = (StateFlag) registry.get("elitemobs-antiexploit"); } try { ELITEMOBS_DUNGEON = new StateFlag("elitemobs-dungeon", false); registry.register(ELITEMOBS_DUNGEON); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-dungeon"); + Logger.info(" - elitemobs-dungeon"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-dungeon already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn(" Warning: flag elitemob-dungeon already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_DUNGEON = (StateFlag) registry.get("elitemobs-dungeon"); } try { ELITEMOBS_EVENTS = new StateFlag("elitemobs-events", true); registry.register(ELITEMOBS_EVENTS); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-events"); + Logger.info(" - elitemobs-events"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-events already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn("Warning: flag elitemob-events already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_EVENTS = (StateFlag) registry.get("elitemobs-events"); } try { ELITEMOBS_MINIMUM_LEVEL = new IntegerFlag("elitemobs-minimum-level"); registry.register(ELITEMOBS_MINIMUM_LEVEL); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-minimum-level"); + Logger.info(" - elitemobs-minimum-level"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-minimum-level already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn(" Warning: flag elitemob-minimum-level already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_MINIMUM_LEVEL = (IntegerFlag) registry.get("elitemobs-minimum-level"); } try { ELITEMOBS_MAXIMUM_LEVEL = new IntegerFlag("elitemobs-maximum-level"); registry.register(ELITEMOBS_MAXIMUM_LEVEL); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-maximum-level"); + Logger.info("- elitemobs-maximum-level"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-maximum-level already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn("Warning: flag elitemob-maximum-level already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_MAXIMUM_LEVEL = (IntegerFlag) registry.get("elitemobs-maximum-level"); } try { ELITEMOBS_EXPLOSION_REGEN = new StateFlag("elitemobs-explosion-regen", true); registry.register(ELITEMOBS_EXPLOSION_REGEN); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-explosion-regen"); + Logger.info(" - elitemobs-explosion-regen"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-explosion-regen already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn("Warning: flag elitemob-explosion-regen already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_EXPLOSION_REGEN = (StateFlag) registry.get("elitemobs-explosion-regen"); } try { ELITEMOBS_EXPLOSION_BLOCK_DAMAGE = new StateFlag("elitemobs-explosion-block-damage", true); registry.register(ELITEMOBS_EXPLOSION_BLOCK_DAMAGE); - Bukkit.getLogger().info("[EliteMobs] - elitemobs-explosion-block-damage"); + Logger.info(" - elitemobs-explosion-block-damage"); } catch (FlagConflictException | IllegalStateException e) { - Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemobs-explosion-block-damage already exists! This is normal if you've just now reloaded EliteMobs."); + Logger.warn(" Warning: flag elitemobs-explosion-block-damage already exists! This is normal if you've just now reloaded EliteMobs."); ELITEMOBS_EXPLOSION_REGEN = (StateFlag) registry.get("elitemobs-explosion-block-damage"); } @@ -147,197 +131,166 @@ public static boolean initialize() { } - public static void protectWorldMinidugeonArea(Location location, WorldDungeonPackage dungeonWorldPackage) { - try { - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld())); - ProtectedRegion global = regions.getRegion("__global__"); - - if (global == null) { - // But we want a __global__, so let's create one - global = new GlobalProtectedRegion("__global__"); - regions.addRegion(global); - } - - protectMinidungeonArea(global, dungeonWorldPackage); - DefaultDomain members = global.getMembers(); - members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); - global.setOwners(members); - } catch (Exception ex) { - new WarningMessage("Failed to protect minidungeon world area!"); - } - } - - public static void protectWorldMinidugeonArea(World world) { - try { - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(world)); - ProtectedRegion global = regions.getRegion("__global__"); - - if (global == null) { - // But we want a __global__, so let's create one - global = new GlobalProtectedRegion("__global__"); - regions.addRegion(global); - } - - protectMinidungeonArea(global); - DefaultDomain members = global.getMembers(); - members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); - global.setOwners(members); - } catch (Exception ex) { - new WarningMessage("Failed to protect minidungeon world area!"); - } - } - - public static void protectWorldMinidugeonArea(Location location) { - protectWorldMinidugeonArea(location.getWorld()); - } - - public static void protectMinidungeonArea(ProtectedRegion protectedRegion, EMPackage dungeonWorldPackage) { - //elitemobs events - protectedRegion.setFlag(ELITEMOBS_DUNGEON, allow); - protectedRegion.setFlag(ELITEMOBS_ANTIEXPLOIT, deny); - protectedRegion.setFlag(ELITEMOBS_EVENTS, deny); - //WG events - protectedRegion.setFlag(Flags.PASSTHROUGH, deny); - protectedRegion.setFlag(Flags.INTERACT, deny); - protectedRegion.setFlag(Flags.CREEPER_EXPLOSION, deny); - protectedRegion.setFlag(Flags.FIRE_SPREAD, deny); - protectedRegion.setFlag(Flags.LAVA_FIRE, deny); - protectedRegion.setFlag(Flags.LAVA_FLOW, deny); - protectedRegion.setFlag(Flags.SNOW_FALL, deny); - protectedRegion.setFlag(Flags.SNOW_MELT, deny); - protectedRegion.setFlag(Flags.ICE_FORM, deny); - protectedRegion.setFlag(Flags.ICE_MELT, deny); - protectedRegion.setFlag(Flags.LEAF_DECAY, deny); - protectedRegion.setFlag(Flags.GRASS_SPREAD, deny); - protectedRegion.setFlag(Flags.MYCELIUM_SPREAD, deny); - protectedRegion.setFlag(Flags.CROP_GROWTH, deny); - protectedRegion.setFlag(Flags.SOIL_DRY, deny); - //missing coral-fade - //missing ravager-grief - protectedRegion.setFlag(Flags.GHAST_FIREBALL, deny); - protectedRegion.setFlag(Flags.WITHER_DAMAGE, deny); - protectedRegion.setFlag(Flags.ENDER_BUILD, deny); - protectedRegion.setFlag(Flags.ITEM_FRAME_ROTATE, deny); - protectedRegion.setFlag(Flags.PLACE_VEHICLE, deny); - protectedRegion.setFlag(Flags.DESTROY_VEHICLE, deny); - protectedRegion.setFlag(Flags.PVP, deny); - protectedRegion.setFlag(Flags.OTHER_EXPLOSION, deny); - protectedRegion.setFlag(Flags.TRAMPLE_BLOCKS, deny); - protectedRegion.setFlag(Flags.VINE_GROWTH, deny); - protectedRegion.setFlag(Flags.MUSHROOMS, deny); - protectedRegion.setFlag(Flags.DAMAGE_ANIMALS, allow); - protectedRegion.setFlag(Flags.SLEEP, deny); - protectedRegion.setFlag(Flags.CHEST_ACCESS, allow); - protectedRegion.setFlag(Flags.ENTITY_ITEM_FRAME_DESTROY, deny); - protectedRegion.setFlag(Flags.ENTITY_PAINTING_DESTROY, deny); - protectedRegion.setFlag(Flags.MOB_SPAWNING, allow); - protectedRegion.setFlag(Flags.TNT, deny); - protectedRegion.setFlag(Flags.ENDERDRAGON_BLOCK_DAMAGE, deny); - protectedRegion.setFlag(Flags.LIGHTER, deny); - protectedRegion.setFlag(Flags.ENDERPEARL, deny); - //Bypass for redstone and doors - protectedRegion.setFlag(Flags.USE, allow); - protectedRegion.setFlag(Flags.GREET_MESSAGE, dungeonWorldPackage.getDungeonPackagerConfigFields().getRegionEnterMessage()); - protectedRegion.setFlag(Flags.FAREWELL_MESSAGE, dungeonWorldPackage.getDungeonPackagerConfigFields().getRegionLeaveMessage()); - } - - public static boolean protectMinidungeonArea(String regionName, Location location) { - try { - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld())); - ProtectedRegion protectedRegion = regions.getRegion(regionName); - if (protectedRegion == null) { - new WarningMessage("The region name picked did not exist!"); - return false; - } - protectMinidungeonArea(protectedRegion); - return true; - } catch (Exception ex) { - new WarningMessage("Failed to protect region " + regionName + " !"); - return false; - } - } - - public static void protectMinidungeonArea(ProtectedRegion protectedRegion) { - //elitemobs events - protectedRegion.setFlag(ELITEMOBS_DUNGEON, allow); - protectedRegion.setFlag(ELITEMOBS_ANTIEXPLOIT, deny); - protectedRegion.setFlag(ELITEMOBS_EVENTS, deny); - //WG events - protectedRegion.setFlag(Flags.PASSTHROUGH, deny); - protectedRegion.setFlag(Flags.INTERACT, deny); - protectedRegion.setFlag(Flags.CREEPER_EXPLOSION, deny); - protectedRegion.setFlag(Flags.FIRE_SPREAD, deny); - protectedRegion.setFlag(Flags.LAVA_FIRE, deny); - protectedRegion.setFlag(Flags.LAVA_FLOW, deny); - protectedRegion.setFlag(Flags.SNOW_FALL, deny); - protectedRegion.setFlag(Flags.SNOW_MELT, deny); - protectedRegion.setFlag(Flags.ICE_FORM, deny); - protectedRegion.setFlag(Flags.ICE_MELT, deny); - protectedRegion.setFlag(Flags.LEAF_DECAY, deny); - protectedRegion.setFlag(Flags.GRASS_SPREAD, deny); - protectedRegion.setFlag(Flags.MYCELIUM_SPREAD, deny); - protectedRegion.setFlag(Flags.CROP_GROWTH, deny); - protectedRegion.setFlag(Flags.SOIL_DRY, deny); - //missing coral-fade - //missing ravager-grief - //protectedRegion.setFlag(Flags.GHAST_FIREBALL, deny); - this completely stops fireballs from working - protectedRegion.setFlag(ELITEMOBS_EXPLOSION_BLOCK_DAMAGE, deny); - protectedRegion.setFlag(Flags.WITHER_DAMAGE, deny); - protectedRegion.setFlag(Flags.ENDER_BUILD, deny); - protectedRegion.setFlag(Flags.ITEM_FRAME_ROTATE, deny); - protectedRegion.setFlag(Flags.PLACE_VEHICLE, deny); - protectedRegion.setFlag(Flags.DESTROY_VEHICLE, deny); - protectedRegion.setFlag(Flags.PVP, deny); - protectedRegion.setFlag(Flags.OTHER_EXPLOSION, deny); - protectedRegion.setFlag(Flags.TRAMPLE_BLOCKS, deny); - protectedRegion.setFlag(Flags.VINE_GROWTH, deny); - protectedRegion.setFlag(Flags.MUSHROOMS, deny); - protectedRegion.setFlag(Flags.DAMAGE_ANIMALS, allow); - protectedRegion.setFlag(Flags.SLEEP, deny); - protectedRegion.setFlag(Flags.CHEST_ACCESS, allow); - protectedRegion.setFlag(Flags.ENTITY_ITEM_FRAME_DESTROY, deny); - protectedRegion.setFlag(Flags.ENTITY_PAINTING_DESTROY, deny); - protectedRegion.setFlag(Flags.MOB_SPAWNING, allow); - protectedRegion.setFlag(Flags.TNT, deny); - protectedRegion.setFlag(Flags.ENDERDRAGON_BLOCK_DAMAGE, deny); - protectedRegion.setFlag(Flags.LIGHTER, deny); - protectedRegion.setFlag(Flags.ENDERPEARL, deny); - //Bypass for redstone and doors - protectedRegion.setFlag(Flags.USE, allow); - } - - /** - * Automatically creates a worldguard region protected as an EliteMobs minidungeon using two x y z vectors for the - * locations of the diagonally opposed locations - * - * @param corner1 - * @param corner2 - */ - public static void defineMinidungeon(Location corner1, Location corner2, Location anchorLocation, String schematicName, SchematicPackage schematicPackage) { - try { - RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regionManager = regionContainer.get(BukkitAdapter.adapt(anchorLocation.getWorld())); - BlockVector3 min = BlockVector3.at(corner1.getBlockX(), corner1.getBlockY(), corner1.getBlockZ()); - BlockVector3 max = BlockVector3.at(corner2.getBlockX(), corner2.getBlockY(), corner2.getBlockZ()); - ProtectedRegion region = new ProtectedCuboidRegion(schematicName.replace(".schem", ""), min, max); - protectMinidungeonArea(region, schematicPackage); - regionManager.addRegion(region); - } catch (Exception ex) { - new WarningMessage("Failed to add Minidungeon WorldGuard zone!"); - } - } - - public static void removeMinidungeon(String schematicName, Location anchorLocation) { - try { - RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regionManager = regionContainer.get(BukkitAdapter.adapt(anchorLocation.getWorld())); - regionManager.removeRegion(schematicName.replace(".schem", "")); - } catch (Exception ex) { - new WarningMessage("Failed to remove Minidungeon WorldGuard zone!"); - } - } +// public static void protectWorldMinidugeonArea(Location location, WorldDungeonPackage dungeonWorldPackage) { +// try { +// RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); +// RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld())); +// ProtectedRegion global = regions.getRegion("__global__"); +// +// if (global == null) { +// // But we want a __global__, so let's create one +// global = new GlobalProtectedRegion("__global__"); +// regions.addRegion(global); +// } +// +// protectMinidungeonArea(global, dungeonWorldPackage); +// DefaultDomain members = global.getMembers(); +// members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); +// global.setOwners(members); +// } catch (Exception ex) { +// Logger.warn("Failed to protect minidungeon world area!"); +// } +// } +// +// public static void protectWorldMinidugeonArea(World world) { +// try { +// RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); +// RegionManager regions = container.get(BukkitAdapter.adapt(world)); +// ProtectedRegion global = regions.getRegion("__global__"); +// +// if (global == null) { +// // But we want a __global__, so let's create one +// global = new GlobalProtectedRegion("__global__"); +// regions.addRegion(global); +// } +// +// protectMinidungeonArea(global); +// DefaultDomain members = global.getMembers(); +// members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); +// global.setOwners(members); +// } catch (Exception ex) { +// Logger.warn("Failed to protect minidungeon world area!"); +// } +// } +// +// public static void protectWorldMinidugeonArea(Location location) { +// protectWorldMinidugeonArea(location.getWorld()); +// } +// +// public static void protectMinidungeonArea(ProtectedRegion protectedRegion, EMPackage dungeonWorldPackage) { +// //elitemobs events +// protectedRegion.setFlag(ELITEMOBS_DUNGEON, allow); +// protectedRegion.setFlag(ELITEMOBS_ANTIEXPLOIT, deny); +// protectedRegion.setFlag(ELITEMOBS_EVENTS, deny); +// //WG events +// protectedRegion.setFlag(Flags.PASSTHROUGH, deny); +// protectedRegion.setFlag(Flags.INTERACT, deny); +// protectedRegion.setFlag(Flags.CREEPER_EXPLOSION, deny); +// protectedRegion.setFlag(Flags.FIRE_SPREAD, deny); +// protectedRegion.setFlag(Flags.LAVA_FIRE, deny); +// protectedRegion.setFlag(Flags.LAVA_FLOW, deny); +// protectedRegion.setFlag(Flags.SNOW_FALL, deny); +// protectedRegion.setFlag(Flags.SNOW_MELT, deny); +// protectedRegion.setFlag(Flags.ICE_FORM, deny); +// protectedRegion.setFlag(Flags.ICE_MELT, deny); +// protectedRegion.setFlag(Flags.LEAF_DECAY, deny); +// protectedRegion.setFlag(Flags.GRASS_SPREAD, deny); +// protectedRegion.setFlag(Flags.MYCELIUM_SPREAD, deny); +// protectedRegion.setFlag(Flags.CROP_GROWTH, deny); +// protectedRegion.setFlag(Flags.SOIL_DRY, deny); +// //missing coral-fade +// //missing ravager-grief +// protectedRegion.setFlag(Flags.GHAST_FIREBALL, deny); +// protectedRegion.setFlag(Flags.WITHER_DAMAGE, deny); +// protectedRegion.setFlag(Flags.ENDER_BUILD, deny); +// protectedRegion.setFlag(Flags.ITEM_FRAME_ROTATE, deny); +// protectedRegion.setFlag(Flags.PLACE_VEHICLE, deny); +// protectedRegion.setFlag(Flags.DESTROY_VEHICLE, deny); +// protectedRegion.setFlag(Flags.PVP, deny); +// protectedRegion.setFlag(Flags.OTHER_EXPLOSION, deny); +// protectedRegion.setFlag(Flags.TRAMPLE_BLOCKS, deny); +// protectedRegion.setFlag(Flags.VINE_GROWTH, deny); +// protectedRegion.setFlag(Flags.MUSHROOMS, deny); +// protectedRegion.setFlag(Flags.DAMAGE_ANIMALS, allow); +// protectedRegion.setFlag(Flags.SLEEP, deny); +// protectedRegion.setFlag(Flags.CHEST_ACCESS, allow); +// protectedRegion.setFlag(Flags.ENTITY_ITEM_FRAME_DESTROY, deny); +// protectedRegion.setFlag(Flags.ENTITY_PAINTING_DESTROY, deny); +// protectedRegion.setFlag(Flags.MOB_SPAWNING, allow); +// protectedRegion.setFlag(Flags.TNT, deny); +// protectedRegion.setFlag(Flags.ENDERDRAGON_BLOCK_DAMAGE, deny); +// protectedRegion.setFlag(Flags.LIGHTER, deny); +// protectedRegion.setFlag(Flags.ENDERPEARL, deny); +// //Bypass for redstone and doors +// protectedRegion.setFlag(Flags.USE, allow); +// protectedRegion.setFlag(Flags.GREET_MESSAGE, dungeonWorldPackage.getDungeonPackagerConfigFields().getRegionEnterMessage()); +// protectedRegion.setFlag(Flags.FAREWELL_MESSAGE, dungeonWorldPackage.getDungeonPackagerConfigFields().getRegionLeaveMessage()); +// } +// +// public static boolean protectMinidungeonArea(String regionName, Location location) { +// try { +// RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); +// RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld())); +// ProtectedRegion protectedRegion = regions.getRegion(regionName); +// if (protectedRegion == null) { +// Logger.warn("The region name picked did not exist!"); +// return false; +// } +// protectMinidungeonArea(protectedRegion); +// return true; +// } catch (Exception ex) { +// Logger.warn("Failed to protect region " + regionName + " !"); +// return false; +// } +// } +// +// public static void protectMinidungeonArea(ProtectedRegion protectedRegion) { +// //elitemobs events +// protectedRegion.setFlag(ELITEMOBS_DUNGEON, allow); +// protectedRegion.setFlag(ELITEMOBS_ANTIEXPLOIT, deny); +// protectedRegion.setFlag(ELITEMOBS_EVENTS, deny); +// //WG events +// protectedRegion.setFlag(Flags.PASSTHROUGH, deny); +// protectedRegion.setFlag(Flags.INTERACT, deny); +// protectedRegion.setFlag(Flags.CREEPER_EXPLOSION, deny); +// protectedRegion.setFlag(Flags.FIRE_SPREAD, deny); +// protectedRegion.setFlag(Flags.LAVA_FIRE, deny); +// protectedRegion.setFlag(Flags.LAVA_FLOW, deny); +// protectedRegion.setFlag(Flags.SNOW_FALL, deny); +// protectedRegion.setFlag(Flags.SNOW_MELT, deny); +// protectedRegion.setFlag(Flags.ICE_FORM, deny); +// protectedRegion.setFlag(Flags.ICE_MELT, deny); +// protectedRegion.setFlag(Flags.LEAF_DECAY, deny); +// protectedRegion.setFlag(Flags.GRASS_SPREAD, deny); +// protectedRegion.setFlag(Flags.MYCELIUM_SPREAD, deny); +// protectedRegion.setFlag(Flags.CROP_GROWTH, deny); +// protectedRegion.setFlag(Flags.SOIL_DRY, deny); +// //missing coral-fade +// //missing ravager-grief +// //protectedRegion.setFlag(Flags.GHAST_FIREBALL, deny); - this completely stops fireballs from working +// protectedRegion.setFlag(ELITEMOBS_EXPLOSION_BLOCK_DAMAGE, deny); +// protectedRegion.setFlag(Flags.WITHER_DAMAGE, deny); +// protectedRegion.setFlag(Flags.ENDER_BUILD, deny); +// protectedRegion.setFlag(Flags.ITEM_FRAME_ROTATE, deny); +// protectedRegion.setFlag(Flags.PLACE_VEHICLE, deny); +// protectedRegion.setFlag(Flags.DESTROY_VEHICLE, deny); +// protectedRegion.setFlag(Flags.PVP, deny); +// protectedRegion.setFlag(Flags.OTHER_EXPLOSION, deny); +// protectedRegion.setFlag(Flags.TRAMPLE_BLOCKS, deny); +// protectedRegion.setFlag(Flags.VINE_GROWTH, deny); +// protectedRegion.setFlag(Flags.MUSHROOMS, deny); +// protectedRegion.setFlag(Flags.DAMAGE_ANIMALS, allow); +// protectedRegion.setFlag(Flags.SLEEP, deny); +// protectedRegion.setFlag(Flags.CHEST_ACCESS, allow); +// protectedRegion.setFlag(Flags.ENTITY_ITEM_FRAME_DESTROY, deny); +// protectedRegion.setFlag(Flags.ENTITY_PAINTING_DESTROY, deny); +// protectedRegion.setFlag(Flags.MOB_SPAWNING, allow); +// protectedRegion.setFlag(Flags.TNT, deny); +// protectedRegion.setFlag(Flags.ENDERDRAGON_BLOCK_DAMAGE, deny); +// protectedRegion.setFlag(Flags.LIGHTER, deny); +// protectedRegion.setFlag(Flags.ENDERPEARL, deny); +// //Bypass for redstone and doors +// protectedRegion.setFlag(Flags.USE, allow); +// } } diff --git a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardExplosionBlockDamageFlag.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardExplosionBlockDamageFlag.java index 089a6b703..1b2eade04 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardExplosionBlockDamageFlag.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardExplosionBlockDamageFlag.java @@ -8,9 +8,11 @@ public class WorldGuardExplosionBlockDamageFlag implements Listener { @EventHandler(priority = EventPriority.LOWEST) - public void WorldGuardExplosionBlockDamageFlag(EntityExplodeEvent event){ - if (WorldGuardFlagChecker.checkFlag(event.getLocation(), WorldGuardCompatibility.getELITEMOBS_EXPLOSION_BLOCK_DAMAGE())) return; - if (!EntityTracker.isProjectileEntity(event.getEntity()) && !EntityTracker.isEliteMob(event.getEntity())) return; + public void WorldGuardExplosionBlockDamageFlag(EntityExplodeEvent event) { + if (WorldGuardFlagChecker.checkFlag(event.getLocation(), WorldGuardCompatibility.getELITEMOBS_EXPLOSION_BLOCK_DAMAGE())) + return; + if (!EntityTracker.isProjectileEntity(event.getEntity()) && !EntityTracker.isEliteMob(event.getEntity())) + return; event.blockList().clear(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index 9c8e082ec..122ef2245 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,9 +1,10 @@ package com.magmaguy.elitemobs.treasurechest; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.google.common.collect.ArrayListMultimap; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.config.SoundsConfig; import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields; import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; @@ -11,9 +12,10 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.Round; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.WeightedProbability; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.Round; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -31,15 +33,21 @@ import java.time.Instant; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; public class TreasureChest implements PersistentObject { + @Getter private static final HashMap treasureChestHashMap = new HashMap<>(); + private static final ArrayListMultimap instancedTreasureChests = ArrayListMultimap.create(); @Getter private final CustomTreasureChestConfigFields customTreasureChestConfigFields; private final String locationString; private final String worldName; + private final HashSet blacklistedPlayersInstance = new HashSet<>(); @Getter private Location location; private long restockTime; @@ -61,26 +69,35 @@ public TreasureChest(CustomTreasureChestConfigFields customTreasureChestConfigFi if (customTreasureChestConfigFields.getChestMaterial() == null) return; - initializeChest(); - - new PersistentObjectHandler(this); + if (!customTreasureChestConfigFields.isInstanced()) { + initializeChest(); + new PersistentObjectHandler(this); + treasureChestHashMap.put(location, this); + } else + instancedTreasureChests.put(worldName, this); + } - treasureChestHashMap.put(location, this); + public static void initializeInstancedTreasureChests(String instanceWorldName, World instancedWorld) { + List chests = instancedTreasureChests.get(instanceWorldName); + chests.forEach(treasureChest -> { + treasureChest.location = ConfigurationLocation.serializeWithInstance(instancedWorld, treasureChest.locationString); + treasureChest.restockTime = 0; + new PersistentObjectHandler(treasureChest); + treasureChest.generateChest(); + treasureChestHashMap.put(treasureChest.location, treasureChest); + }); } public static void clearTreasureChests() { treasureChestHashMap.clear(); } - public static HashMap getTreasureChestHashMap() { - return treasureChestHashMap; - } - public static TreasureChest getTreasureChest(Location location) { return getTreasureChestHashMap().get(location); } private void initializeChest() { + if (customTreasureChestConfigFields.isInstanced()) return; if (location != null && location.getWorld() != null) { long time = (restockTime - Instant.now().getEpochSecond()) * 20L; if (time < 0) @@ -96,14 +113,14 @@ private void generateChest() { .getBlockAt(location).getType().equals(customTreasureChestConfigFields.getChestMaterial())) location.getWorld().getBlockAt(location).setType(customTreasureChestConfigFields.getChestMaterial()); } catch (Exception ex) { - new WarningMessage("Custom Treasure Chest " + customTreasureChestConfigFields.getFilename() + " has an invalid location and can not be placed."); + Logger.warn("Custom Treasure Chest " + customTreasureChestConfigFields.getFilename() + " has an invalid location and can not be placed."); return; } if (location.getBlock().getBlockData() instanceof Directional chest) { chest.setFacing(customTreasureChestConfigFields.getFacing()); location.getBlock().setBlockData(chest); } else { - new WarningMessage("Treasure chest " + customTreasureChestConfigFields.getFilename() + + Logger.warn("Treasure chest " + customTreasureChestConfigFields.getFilename() + " does not have a directional block for the Treasure Chest material " + customTreasureChestConfigFields.getChestMaterial() + " ! Chest materials are directional, is your chest a chest?"); } @@ -114,23 +131,29 @@ public void doInteraction(Player player) { if (customTreasureChestConfigFields.getDropStyle().equals(DropStyle.GROUP)) if (playerIsInCooldown(player)) { - groupTimerCooldownMessage(player, getPlayerCooldown(player)); + if (!customTreasureChestConfigFields.isInstanced()) + groupTimerCooldownMessage(player, getPlayerCooldown(player)); + return; + } else if (restockTime > Instant.now().getEpochSecond()) return; - } - else if (restockTime > Instant.now().getEpochSecond()) - return; if (ThreadLocalRandom.current().nextDouble() < customTreasureChestConfigFields.getMimicChance()) doMimic(); else doTreasure(player); + player.playSound(player.getLocation(), SoundsConfig.treasureChestOpenSound, 1, 1); + if (customTreasureChestConfigFields.getDropStyle().equals(DropStyle.GROUP)) { - customTreasureChestConfigFields.getRestockTimers().add(cooldownStringConstructor(player)); - new BukkitRunnable() { - @Override - public void run() { - customTreasureChestConfigFields.getRestockTimers().removeIf(restockTime -> restockTime.split(":")[0].equals(player.getUniqueId().toString())); - } - }.runTaskLater(MetadataHandler.PLUGIN, 20L * 60 * customTreasureChestConfigFields.getRestockTimer()); + if (customTreasureChestConfigFields.isInstanced()) { + blacklistedPlayersInstance.add(player.getUniqueId()); + } else if (customTreasureChestConfigFields.getRestockTimers() != null) { + customTreasureChestConfigFields.getRestockTimers().add(cooldownStringConstructor(player)); + new BukkitRunnable() { + @Override + public void run() { + customTreasureChestConfigFields.getRestockTimers().removeIf(restockTime -> restockTime.split(":")[0].equals(player.getUniqueId().toString())); + } + }.runTaskLater(MetadataHandler.PLUGIN, 20L * 60 * customTreasureChestConfigFields.getRestockTimer()); + } return; } @@ -139,7 +162,8 @@ public void run() { restockTime = cooldownTime(); customTreasureChestConfigFields.setRestockTime(location, restockTime); - Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, this::generateChest, 20L * 60 * customTreasureChestConfigFields.getRestockTimer()); + if (!customTreasureChestConfigFields.isInstanced()) + Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, this::generateChest, 20L * 60 * customTreasureChestConfigFields.getRestockTimer()); } @@ -176,6 +200,9 @@ private void groupTimerCooldownMessage(Player player, long targetTime) { } private boolean playerIsInCooldown(Player player) { + if (customTreasureChestConfigFields.isInstanced()) + return blacklistedPlayersInstance.contains(player.getUniqueId()); + if (customTreasureChestConfigFields.getRestockTimers() == null) return false; for (String string : customTreasureChestConfigFields.getRestockTimers()) if (string.split(":")[0].equals(player.getUniqueId().toString())) return true; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/BossBarUtil.java b/src/main/java/com/magmaguy/elitemobs/utils/BossBarUtil.java new file mode 100644 index 000000000..71f1f6182 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/utils/BossBarUtil.java @@ -0,0 +1,81 @@ +package com.magmaguy.elitemobs.utils; + +import com.google.common.collect.ArrayListMultimap; +import com.magmaguy.elitemobs.playerdata.PlayerItem; +import lombok.Getter; +import org.bukkit.Bukkit; +import org.bukkit.boss.BarColor; +import org.bukkit.boss.BarStyle; +import org.bukkit.boss.BossBar; +import org.bukkit.entity.Player; + +import java.util.HashSet; +import java.util.List; + +public class BossBarUtil { + public static HashSet bossBars = new HashSet<>(); + public static ArrayListMultimap brokenPlayerItem = ArrayListMultimap.create(); + + private BossBarUtil() { + } + + public static void shutdown() { + bossBars.forEach(BossBar::removeAll); + bossBars.clear(); + } + + public static void DisplayBrokenItemBossBar(PlayerItem.EquipmentSlot equipmentSlot, Player player, String title) { + List arrayList = brokenPlayerItem.get(player); + boolean alreadyExists = false; + for (PlayerBrokenItemBar playerBrokenItemBar : arrayList) { + if (playerBrokenItemBar.getEquipmentSlot().equals(equipmentSlot)) { + alreadyExists = true; + break; + } + } + if (!alreadyExists) { + brokenPlayerItem.put(player, new PlayerBrokenItemBar(equipmentSlot, player, title, BarColor.RED, BarStyle.SOLID)); + } + } + + public static void HideBrokenItemBossBar(PlayerItem.EquipmentSlot equipmentSlot, Player player) { + List arrayList = brokenPlayerItem.get(player); + PlayerBrokenItemBar storedPlayerBrokenItemBar = null; + + for (PlayerBrokenItemBar playerBrokenItemBar : arrayList) { + if (playerBrokenItemBar.getEquipmentSlot().equals(equipmentSlot)) { + storedPlayerBrokenItemBar = playerBrokenItemBar; + DestroyBossBar(playerBrokenItemBar.bossBar); + break; + } + } + + brokenPlayerItem.remove(player, storedPlayerBrokenItemBar); + } + + private static BossBar CreateBossBar(Player player, String title, BarColor barColor, BarStyle barStyle) { + BossBar bossBar = Bukkit.createBossBar(title, barColor, barStyle); + bossBar.addPlayer(player); + bossBars.add(bossBar); + return bossBar; + } + + private static void DestroyBossBar(BossBar bossBar) { + bossBar.removeAll(); + bossBars.remove(bossBar); + } + + private static class PlayerBrokenItemBar { + @Getter + private final PlayerItem.EquipmentSlot equipmentSlot; + @Getter + private final BossBar bossBar; + + private PlayerBrokenItemBar(PlayerItem.EquipmentSlot equipmentSlot, Player player, String title, BarColor barColor, BarStyle barStyle) { + this.equipmentSlot = equipmentSlot; + bossBar = CreateBossBar(player, title, barColor, barStyle); + } + } + + +} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java index 05ee22fe0..9e757f94f 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.utils; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -52,9 +53,6 @@ public static Location serialize(String locationString, boolean silent) { if (world == null && !slicedString[0].equalsIgnoreCase("same_as_boss") && !notLoadedWorldNames.contains(slicedString[0]) && !silent) { -// if (!notLoadedWorldNames.isEmpty()) -// new WarningMessage("Some NPCs/bosses don't have their world installed! If you need help setting things up, you can go to " + DiscordLinks.mainLink + " !"); -// new InfoMessage("World " + slicedString[0] + " is not yet loaded! Entities that should spawn there have been queued."); notLoadedWorldNames.add(slicedString[0]); } x = Double.parseDouble(slicedString[1]); @@ -77,9 +75,9 @@ public static Location serialize(String locationString, boolean silent) { } catch (Exception ex) { if (locationString.equals("null")) return null; - new WarningMessage("Attempted to deserialize an invalid location!"); - new WarningMessage("Expected location format: worldname,x,y,z,pitch,yaw"); - new WarningMessage("Actual location format: " + locationString); + Logger.warn("Attempted to deserialize an invalid location!"); + Logger.warn("Expected location format: worldname,x,y,z,pitch,yaw"); + Logger.warn("Actual location format: " + locationString); return null; } return new Location(world, x, y, z, yaw, pitch); @@ -91,4 +89,48 @@ public static String worldName(String locationString) { return slicedString[0]; } + public static Location serializeWithInstance(World instancedWorld, String locationString) { + + if (locationString == null) + return null; + + double x = 0; + double y = 0; + double z = 0; + float yaw = 0; + float pitch = 0; + + try { + String locationOnlyString = locationString.split(":")[0]; + String[] slicedString = locationOnlyString.split(","); + + if (slicedString.length == 6 || slicedString.length == 4) { + x = Double.parseDouble(slicedString[1]); + y = Double.parseDouble(slicedString[2]); + z = Double.parseDouble(slicedString[3]); + if (slicedString.length > 4) { + yaw = Float.parseFloat(slicedString[4]); + pitch = Float.parseFloat(slicedString[5]); + } else { + yaw = 0; + pitch = 0; + } + } else if (slicedString.length == 5) { + x = Double.parseDouble(slicedString[0]); + y = Double.parseDouble(slicedString[1]); + z = Double.parseDouble(slicedString[2]); + yaw = Float.parseFloat(slicedString[3]); + pitch = Float.parseFloat(slicedString[4]); + } else throw new Exception(); + } catch (Exception ex) { + if (locationString.equals("null")) + return null; + Logger.warn("Attempted to deserialize an invalid location!"); + Logger.warn("Expected location format: worldname,x,y,z,pitch,yaw"); + Logger.warn("Actual location format: " + locationString); + return null; + } + return new Location(instancedWorld, x, y, z, yaw, pitch); + } + } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 2b338bd98..5af9ea6b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,18 +1,19 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; +import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Particle; -import org.bukkit.util.Vector; public class DebugBlockLocation { public DebugBlockLocation(Location location) { - if (!VersionChecker.serverVersionOlderThan(18, 0)) - //todo: restore barrier blocks here, block data was required for the snapshot version of this - location.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); - else - location.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); + location.getWorld().spawnParticle(Particle.BLOCK_MARKER, + location.getBlock().getX() + .5, + location.getBlock().getY() + .5, + location.getBlock().getZ() + .5, + 1, + Bukkit.createBlockData(Material.BARRIER)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugMessage.java deleted file mode 100644 index b9cfd0f24..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugMessage.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; - -public class DebugMessage { - private static boolean debugMode = false; - - public DebugMessage(Object message) { - if (debugMode) { - Bukkit.getLogger().warning("[EliteMobs] Debug message: " + message); - for (StackTraceElement element : Thread.currentThread().getStackTrace()) - Bukkit.getLogger().info(element.toString()); - } - } - - public static void toggleDebugMode(CommandSender commandSender) { - debugMode = !debugMode; - if (debugMode) - commandSender.sendMessage("[EliteMobs] Debug mode on!"); - else - commandSender.sendMessage("[EliteMobs] Debug mode off!"); - } - - public static boolean isDebugMode() { - return debugMode; - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DeepCopy.java b/src/main/java/com/magmaguy/elitemobs/utils/DeepCopy.java deleted file mode 100644 index b042bde2c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/DeepCopy.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import org.apache.commons.lang3.SerializationUtils; - -import java.io.Serializable; - -public class DeepCopy { - - /** - * Makes a deep copy of any Java object that is passed. - */ - public static Object copyObject(Serializable object) { - try { - return SerializationUtils.clone(object); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/Developer.java b/src/main/java/com/magmaguy/elitemobs/utils/Developer.java deleted file mode 100644 index cf2b43ac0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/Developer.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import org.bukkit.Bukkit; - -import java.util.logging.Level; - -public class Developer { - private Developer() { - } - - public static void message(String message) { - Bukkit.getLogger().log(Level.SEVERE, () -> "[EliteMobs] Developer message: " + message); - } - - public static void message(String message, boolean stacktrace) { - Bukkit.getLogger().log(Level.SEVERE, () -> "[EliteMobs] Developer message: " + message); - if (stacktrace) - for (StackTraceElement element : Thread.currentThread().getStackTrace()) - Bukkit.getLogger().info(element.toString()); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DialogArmorStand.java b/src/main/java/com/magmaguy/elitemobs/utils/DialogArmorStand.java index 284b2688c..a1a88c2e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DialogArmorStand.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DialogArmorStand.java @@ -3,19 +3,19 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.TextDisplay; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; public class DialogArmorStand { - public static ArmorStand createDialogArmorStand(Entity sourceEntity, String dialog, Vector offset) { + public static TextDisplay createDialogArmorStand(Entity sourceEntity, String dialog, Vector offset) { offset.add(getDisplacementVector(sourceEntity).subtract(new Vector(0, 1, 0))); Vector finalOffset = offset; - ArmorStand armorStand = VisualArmorStand.VisualArmorStand(sourceEntity.getLocation().clone().add(finalOffset), dialog); + TextDisplay armorStand = VisualDisplay.generateTemporaryTextDisplay(sourceEntity.getLocation().clone().add(finalOffset), dialog); //This part is necessary because armorstands are visible on their first tick to players new BukkitRunnable() { @@ -41,15 +41,15 @@ public void run() { private static Vector getDisplacementVector(Entity sourceEntity) { double height = 2.3; if (sourceEntity instanceof LivingEntity) - height = ((LivingEntity) sourceEntity).getEyeHeight() + 0.4; + height = ((LivingEntity) sourceEntity).getEyeHeight(); return new Vector(0, height, 0); } - public static ArmorStand createDialogArmorStand(LivingEntity sourceEntity, String dialog) { + public static TextDisplay createDialogArmorStand(LivingEntity sourceEntity, String dialog) { if (sourceEntity == null) return null; - ArmorStand armorStand = VisualArmorStand.VisualArmorStand(sourceEntity.getLocation().clone().add(getDisplacementVector(sourceEntity)), dialog); + TextDisplay armorStand = VisualDisplay.generateTemporaryTextDisplay(sourceEntity.getLocation().clone().add(getDisplacementVector(sourceEntity)), dialog); //This part is necessary because armorstands are visible on their first tick to players new BukkitRunnable() { int taskTimer = 0; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/InfoMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/InfoMessage.java deleted file mode 100644 index ae714f526..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/InfoMessage.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import org.bukkit.Bukkit; - -public class InfoMessage { - public InfoMessage(String message) { - Bukkit.getLogger().info("[EliteMobs] " + message); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java deleted file mode 100644 index 1f5955239..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import com.magmaguy.elitemobs.ChatColorConverter; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import java.util.List; - -public class ItemStackGenerator { - - public static ItemStack generateSkullItemStack(String owner, String name, List lore, int customModelID) { - ItemStack itemStack = generateSkullItemStack(owner, name, lore); - if (customModelID < 1) return itemStack; - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setCustomModelData(customModelID); - itemStack.setItemMeta(itemMeta); - return itemStack; - } - - public static ItemStack generateSkullItemStack(String owner, String name, List lore) { - ItemStack itemStack = new ItemStack(Material.PLAYER_HEAD); - SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta(); - skullMeta.setOwner(owner); - skullMeta.setDisplayName(name); - skullMeta.setLore(lore); - itemStack.setItemMeta(skullMeta); - return itemStack; - } - - public static ItemStack generateItemStack(ItemStack itemStack, String name, List lore) { - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setDisplayName(ChatColorConverter.convert(name)); - itemMeta.setLore(ChatColorConverter.convert(lore)); - itemStack.setItemMeta(itemMeta); - return itemStack; - } - - public static ItemStack generateItemStack(Material material, String name, List lore, int customModelID) { - ItemStack itemStack = generateItemStack(material, ChatColorConverter.convert(name)); - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setLore(ChatColorConverter.convert(lore)); - if (customModelID > 0) - itemMeta.setCustomModelData(customModelID); - itemStack.setItemMeta(itemMeta); - return itemStack; - } - - public static ItemStack generateItemStack(Material material, String name, List lore) { - ItemStack itemStack = generateItemStack(material, ChatColorConverter.convert(name)); - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setLore(ChatColorConverter.convert(lore)); - itemStack.setItemMeta(itemMeta); - return itemStack; - } - - public static ItemStack generateItemStack(Material material, String name) { - ItemStack itemStack = generateItemStack(material); - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setDisplayName(name); - itemStack.setItemMeta(itemMeta); - return itemStack; - } - - public static ItemStack generateItemStack(Material material) { - if (material == null) material = Material.AIR; - ItemStack itemStack = new ItemStack(material); - if (material.equals(Material.AIR)) return itemStack; - ItemMeta itemMeta = itemStack.getItemMeta(); - itemMeta.setDisplayName(""); - itemStack.setItemMeta(itemMeta); - return itemStack; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java index f98be82c8..f2e404f6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java @@ -1,6 +1,8 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; @@ -33,7 +35,7 @@ public static ItemStack deserialize(String identifier, FileConfiguration fileCon try { material = Material.valueOf(fileConfiguration.getString(identifier + "material")); } catch (Exception ex) { - new WarningMessage("Attempted to add material name " + fileConfiguration.getString("material") + " to a menu. This is not a valid material. Item will default to glass."); + Logger.warn("Attempted to add material name " + fileConfiguration.getString("material") + " to a menu. This is not a valid material. Item will default to glass."); material = Material.RED_STAINED_GLASS_PANE; } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/MapListInterpreter.java b/src/main/java/com/magmaguy/elitemobs/utils/MapListInterpreter.java index cd27c0534..d61895213 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/MapListInterpreter.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/MapListInterpreter.java @@ -1,6 +1,10 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.elitemobs.config.LegacyValueConverter; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import org.bukkit.Particle; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import java.util.ArrayList; @@ -9,7 +13,7 @@ public class MapListInterpreter { private static void parsingErrorMessage(String key, Object value, String scriptName) { - new WarningMessage("Failed to read value " + value + " for key " + key + " in script " + scriptName); + Logger.warn("Failed to read value " + value + " for key " + key + " in script " + scriptName); } public static String parseString(String key, Object value, String scriptName) { @@ -21,7 +25,7 @@ public static List parseStringList(String key, Object value, String scri try { return ChatColorConverter.convert((List) value); } catch (Exception ex) { - new WarningMessage("Failed to get string list for key " + key + " with value " + value + " in script " + scriptName); + Logger.warn("Failed to get string list for key " + key + " with value " + value + " in script " + scriptName); return new ArrayList<>(); } } @@ -49,7 +53,7 @@ else if (value instanceof String stringValue) { } return Integer.parseInt(stringValue); } else { - new WarningMessage("Failed to get integer value from " + value + " in script " + scriptName); + Logger.warn("Failed to get integer value from " + value + " in script " + scriptName); return null; } } catch (Exception ex) { @@ -90,6 +94,10 @@ else if (value instanceof String string) } public static > T parseEnum(String key, Object value, Class enumClass, String scriptName) { + if (enumClass.isAssignableFrom(Particle.class)) + value = LegacyValueConverter.parseParticle((String) value); + else if (enumClass.isAssignableFrom(PotionEffectType.class)) + value = LegacyValueConverter.parsePotionEffect((String) value); try { return Enum.valueOf(enumClass, (String) value); } catch (Exception ex) { @@ -104,7 +112,7 @@ public static > List parseEnumList(String key, Object value List parsedList = new ArrayList<>(); for (Object rawEnum : valueList) { if (!(rawEnum instanceof String)) { - new WarningMessage("Expected string, got something else!"); + Logger.warn("Expected string, got something else!"); parsingErrorMessage(key, value, scriptName); continue; } @@ -128,14 +136,14 @@ public static > List> parseEnumListList(String key, Ob if (value instanceof List valueList) { for (Object rawLastList : valueList) { if (!(rawLastList instanceof List)) { - new WarningMessage("Expected list of list, got something else!"); + Logger.warn("Expected list of list, got something else!"); parsingErrorMessage(key, value, scriptName); return parsedList; } List lastList = new ArrayList<>(); for (Object rawEnum : (List) rawLastList) { if (!(rawEnum instanceof String)) { - new WarningMessage("Expected string, got something else!"); + Logger.warn("Expected string, got something else!"); parsingErrorMessage(key, value, scriptName); continue; } @@ -145,7 +153,7 @@ public static > List> parseEnumListList(String key, Ob } } else { - new WarningMessage("Expected list, got something else!"); + Logger.warn("Expected list, got something else!"); parsingErrorMessage(key, value, scriptName); return parsedList; } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/PotionEffectTypeUtil.java b/src/main/java/com/magmaguy/elitemobs/utils/PotionEffectTypeUtil.java index da12ff373..f4f3a2185 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/PotionEffectTypeUtil.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/PotionEffectTypeUtil.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.utils; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.NamespacedKey; import org.bukkit.potion.PotionEffectType; @@ -23,7 +24,7 @@ private static PotionEffectType getByName(String name) { if (potionEffectType != null) return potionEffectType; else { - new WarningMessage("Failed to get potion effect type in script for key " + name + "!"); + Logger.warn("Failed to get potion effect type in script for key " + name + "!"); return null; } } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/Round.java b/src/main/java/com/magmaguy/elitemobs/utils/Round.java deleted file mode 100644 index 75d534cb9..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/Round.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -public class Round { - - private Round() { - } - - public static double twoDecimalPlaces(double value) { - return Math.round(value * 100.0) / 100.0; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java deleted file mode 100644 index 052244e87..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import com.magmaguy.elitemobs.ChatColorConverter; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; -import net.md_5.bungee.api.chat.hover.content.Text; - -public final class SpigotMessage { - public static TextComponent simpleMessage(String message) { - return new TextComponent(ChatColorConverter.convert(message)); - } - - public static TextComponent hoverMessage(String message, String hoverMessage) { - TextComponent textComponent = simpleMessage(message); - textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(hoverMessage))); - return textComponent; - } - - public static TextComponent commandHoverMessage(String message, String hoverMessage, String commandString) { - TextComponent textComponent = hoverMessage(message, ChatColorConverter.convert(hoverMessage)); - if (!commandString.isEmpty()) - textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, commandString)); - return textComponent; - } - - public static TextComponent hoverLinkMessage(String message, String hoverMessage, String link) { - TextComponent textComponent = hoverMessage(message, hoverMessage); - textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link)); - return textComponent; - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/StringColorAnimator.java b/src/main/java/com/magmaguy/elitemobs/utils/StringColorAnimator.java index 6b8278463..2966af660 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/StringColorAnimator.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/StringColorAnimator.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/VisualArmorStand.java b/src/main/java/com/magmaguy/elitemobs/utils/VisualArmorStand.java deleted file mode 100644 index e33d6df0d..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/VisualArmorStand.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.entitytracker.EntityTracker; -import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; -import org.bukkit.util.Consumer; - - -public class VisualArmorStand { - - public static ArmorStand VisualArmorStand(Location location, String customName) { - ArmorStand visualArmorStand = location.getWorld().spawn(location, ArmorStand.class, new Consumer() { - @Override - public void accept(ArmorStand armorStand) { - armorStand.setVisible(false); - armorStand.setMarker(true); - armorStand.setCustomName(ChatColorConverter.convert(customName)); - armorStand.setCustomNameVisible(true); - armorStand.setGravity(false); - armorStand.setRemoveWhenFarAway(true); - armorStand.setPersistent(false); - } - }); - EntityTracker.registerVisualEffects(visualArmorStand); - return visualArmorStand; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java new file mode 100644 index 000000000..4f935b9dd --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java @@ -0,0 +1,47 @@ +package com.magmaguy.elitemobs.utils; + +import com.magmaguy.elitemobs.entitytracker.EntityTracker; +import com.magmaguy.magmacore.util.ChatColorConverter; +import org.bukkit.Location; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Display; +import org.bukkit.entity.TextDisplay; +import org.bukkit.util.Consumer; + + +public class VisualDisplay { + + public static ArmorStand generateTemporaryArmorStand(Location location, String customName) { + ArmorStand visualArmorStand = location.getWorld().spawn(location, ArmorStand.class, new Consumer() { + @Override + public void accept(ArmorStand armorStand) { + armorStand.setVisible(false); + armorStand.setMarker(true); + armorStand.setCustomName(ChatColorConverter.convert(customName)); + armorStand.setCustomNameVisible(true); + armorStand.setGravity(false); + armorStand.setRemoveWhenFarAway(true); + armorStand.setPersistent(false); + } + }); + EntityTracker.registerVisualEffects(visualArmorStand); + return visualArmorStand; + } + + public static TextDisplay generateTemporaryTextDisplay(Location location, String customName) { + TextDisplay visualArmorStand = location.getWorld().spawn(location, TextDisplay.class, new Consumer() { + @Override + public void accept(TextDisplay textDisplay) { + textDisplay.setText(ChatColorConverter.convert(customName)); + textDisplay.setPersistent(false); + textDisplay.setInterpolationDelay(0); + textDisplay.setInterpolationDuration(0); + textDisplay.setBillboard(Display.Billboard.VERTICAL); + textDisplay.setShadowed(false); + } + }); + EntityTracker.registerVisualEffects(visualArmorStand); + return visualArmorStand; + } + +} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/WarningMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/WarningMessage.java deleted file mode 100644 index 360be4eb6..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/WarningMessage.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import com.magmaguy.elitemobs.MetadataHandler; -import org.bukkit.Bukkit; - -public class WarningMessage { - - public WarningMessage(String message) { - Bukkit.getLogger().warning("[EliteMobs] " + message); - } - - public WarningMessage(String message, boolean stackTrace) { - Bukkit.getLogger().warning("[EliteMobs] " + message); - if (stackTrace) { - Bukkit.getLogger().warning("[EliteMobs] Report the following to the developer at " + DiscordLinks.mainLink); - Bukkit.getLogger().info("EliteMobs version: " + MetadataHandler.PLUGIN.getDescription().getVersion() + " | Server version: " + Bukkit.getServer().getVersion()); - for (StackTraceElement element : Thread.currentThread().getStackTrace()) - Bukkit.getLogger().info(element.toString()); - } - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java b/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java index 3d44cd118..ba4b8db91 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.utils; import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import java.io.File; @@ -17,11 +18,11 @@ public static File cloneWorld(String worldName, String targetWorldName, String d File blueprintWorld = new File(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath() + File.separatorChar + "world_blueprints" + File.separatorChar + dungeonConfigurationFolderName + File.separatorChar + worldName); if (!blueprintWorld.exists()) { - new WarningMessage("Blueprint world " + worldName + " does not exist! Path: " + blueprintWorld.getAbsolutePath()); + Logger.warn("Blueprint world " + worldName + " does not exist! Path: " + blueprintWorld.getAbsolutePath()); return null; } if (!blueprintWorld.isDirectory()) { - new WarningMessage("Blueprint world " + worldName + " is not a directory!"); + Logger.warn("Blueprint world " + worldName + " is not a directory!"); return null; } @@ -51,14 +52,14 @@ private static void copy(File file, Path targetPath) { } else Files.copy(file.toPath(), targetPath, StandardCopyOption.REPLACE_EXISTING); } catch (Exception ex) { - new WarningMessage("Failed to copy file " + file.toString() + " to " + targetPath.toString()); + Logger.warn("Failed to copy file " + file.toString() + " to " + targetPath.toString()); ex.printStackTrace(); } } public static void recursivelyDelete(File file) { if (!file.exists()) { - new InfoMessage("Attempted to recursively file " + file.getAbsolutePath() + " which doesn't exist."); + Logger.info("Attempted to recursively file " + file.getAbsolutePath() + " which doesn't exist."); return; } if (file.isDirectory()) { @@ -69,7 +70,7 @@ public static void recursivelyDelete(File file) { } public static String getNewWorldName(String blueprintWorldName) { - ListworldNames = new ArrayList<>(); + List worldNames = new ArrayList<>(); Bukkit.getWorlds().forEach(world -> worldNames.add(world.getName())); for (File file : Bukkit.getWorldContainer().listFiles()) worldNames.add(file.getName()); int highestNumber = 0; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ZipFile.java b/src/main/java/com/magmaguy/elitemobs/utils/ZipFile.java deleted file mode 100644 index 3013a89d0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/utils/ZipFile.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.magmaguy.elitemobs.utils; - -import com.magmaguy.elitemobs.MetadataHandler; - -import java.io.*; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; - -public class ZipFile { - private ZipFile() { - } - - public static boolean zip(File directory, String targetZipPath) { - if (!directory.exists()) { - new WarningMessage("Failed to zip directory " + directory.getPath() + " because it does not exist!"); - return false; - } - - try { - ZipUtility.zip(directory, targetZipPath); - return true; - } catch (IOException e) { - e.printStackTrace(); - return false; - } - } - - public static File unzip(String zippedFileName) throws IOException { - String mainDirectory = MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath() + "/imports/"; - String fileZip = mainDirectory + zippedFileName; - File finalDirectory = new File(mainDirectory + zippedFileName.replace(".zip", "")); - byte[] buffer = new byte[1024]; - ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(fileZip)); - ZipEntry zipEntry = zipInputStream.getNextEntry(); - while (zipEntry != null) { - File newFile = newFile(finalDirectory, zipEntry); - if (zipEntry.isDirectory()) { - if (!newFile.isDirectory() && !newFile.mkdirs()) { - throw new IOException("Failed to create directory " + newFile); - } - } else { - // fix for Windows-created archives - File parent = newFile.getParentFile(); - if (!parent.isDirectory() && !parent.mkdirs()) { - throw new IOException("Failed to create directory " + parent); - } - - // write file content - FileOutputStream fileOutputStream = new FileOutputStream(newFile); - int len; - while ((len = zipInputStream.read(buffer)) > 0) { - fileOutputStream.write(buffer, 0, len); - } - fileOutputStream.close(); - } - zipEntry = zipInputStream.getNextEntry(); - } - zipInputStream.closeEntry(); - zipInputStream.close(); - return finalDirectory; - } - - private static File newFile(File destinationDir, ZipEntry zipEntry) throws IOException { - File destFile = new File(destinationDir, zipEntry.getName()); - - String destDirPath = destinationDir.getCanonicalPath(); - String destFilePath = destFile.getCanonicalPath(); - - if (!destFilePath.startsWith(destDirPath + File.separatorChar)) { - throw new IOException("Entry is outside of the target dir: " + zipEntry.getName()); - } - - return destFile; - } - - public static class ZipUtility { - /** - * A constants for buffer size used to read/write data - */ - private static final int BUFFER_SIZE = 4096; - - /** - * Compresses a list of files to a destination zip file - * - * @param file File to zip - * @param destZipFile The path of the destination zip file - * @throws FileNotFoundException - * @throws IOException - */ - public static void zip(File file, String destZipFile) throws FileNotFoundException, IOException { - ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(destZipFile)); - //This slight tweak avoids making the directory zipped be in the zipped file when what we are looking for is to - //zip the contents of the directory, outside of the directory itself - if (file.isDirectory()) { - for (File file1 : file.listFiles()) { - if (file1.isDirectory()) - zipDirectory(file1, file1.getName(), zos); - else - zipFile(file1, zos); - } - } else { - zipFile(file, zos); - } - zos.flush(); - zos.close(); - } - - /** - * Adds a directory to the current zip output stream - * - * @param folder the directory to be added - * @param parentFolder the path of parent directory - * @param zos the current zip output stream - * @throws FileNotFoundException - * @throws IOException - */ - private static void zipDirectory(File folder, String parentFolder, - ZipOutputStream zos) throws FileNotFoundException, IOException { - for (File file : folder.listFiles()) { - if (file.isDirectory()) { - zipDirectory(file, parentFolder + "/" + file.getName(), zos); - continue; - } - zos.putNextEntry(new ZipEntry(parentFolder + "/" + file.getName())); - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); - long bytesRead = 0; - byte[] bytesIn = new byte[BUFFER_SIZE]; - int read = 0; - while ((read = bis.read(bytesIn)) != -1) { - zos.write(bytesIn, 0, read); - bytesRead += read; - } - zos.closeEntry(); - } - } - - /** - * Adds a file to the current zip output stream - * - * @param file the file to be added - * @param zos the current zip output stream - * @throws FileNotFoundException - * @throws IOException - */ - private static void zipFile(File file, ZipOutputStream zos) - throws FileNotFoundException, IOException { - zos.putNextEntry(new ZipEntry(file.getName())); - BufferedInputStream bis = new BufferedInputStream(new FileInputStream( - file)); - long bytesRead = 0; - byte[] bytesIn = new byte[BUFFER_SIZE]; - int read = 0; - while ((read = bis.read(bytesIn)) != -1) { - zos.write(bytesIn, 0, read); - bytesRead += read; - } - zos.closeEntry(); - } - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java index 2f682e76d..f3a352a97 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java @@ -11,13 +11,13 @@ import java.util.stream.Collectors; public class Cuboid extends Shape { - private Location centerLocation = null; - private List locationVectors = null; - private List edgeVectors = null; private final double x; private final double y; private final double xBorder; private final double yBorder; + private Location centerLocation = null; + private List locationVectors = null; + private List edgeVectors = null; private double z; private double zBorder; @@ -44,8 +44,8 @@ public boolean contains(Location position) { @Override public boolean contains(LivingEntity livingEntity) { BoundingBox boundingBox = new BoundingBox( - x / 2D + centerLocation.getBlockX(), y / 2D + centerLocation.getBlockY(), z/ 2D + centerLocation.getBlockZ() , - -x / 2D + centerLocation.getBlockX(), centerLocation.getBlockY(), -z/ 2D + centerLocation.getBlockZ()); + Math.floor(x / 2D + centerLocation.getBlockX()), y / 2D + centerLocation.getBlockY(), Math.floor(z / 2D + centerLocation.getBlockZ()), + Math.floor(-x / 2D + centerLocation.getBlockX()), centerLocation.getBlockY(), Math.floor(-z / 2D + centerLocation.getBlockZ())); return livingEntity.getBoundingBox().overlaps(boundingBox); } @@ -77,7 +77,7 @@ public List getEdgeVectors() { edgeVectors = new ArrayList<>(); for (Vector vector : getLocationVectors()) if (vector.getY() <= yBorder && - (Math.abs(vector.getX()) >= xBorder / 2d || Math.abs(vector.getZ()) >= zBorder / 2d)) + (Math.abs(vector.getX()) >= Math.floor(xBorder / 2d) || Math.abs(vector.getZ()) >= Math.floor(zBorder / 2d))) edgeVectors.add(vector); return edgeVectors; } @@ -85,8 +85,8 @@ public List getEdgeVectors() { private List getLocationVectors() { if (locationVectors != null) return locationVectors; locationVectors = new ArrayList<>(); - double xHalf = x / 2d; - double zHalf = z / 2d; + double xHalf = Math.floor(x / 2d); + double zHalf = Math.floor(z / 2d); for (int localX = 0; localX < x; localX++) for (int localZ = 0; localZ < z; localZ++) for (int localY = 0; localY < y; localY++) diff --git a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cylinder.java b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cylinder.java index 057849eba..b684dc2ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cylinder.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cylinder.java @@ -14,11 +14,11 @@ public class Cylinder extends Shape { private final Vector center; private final double radius; - private double borderRadius = 1; private final double height; + private final List edgeVectors = null; + private double borderRadius = 1; private Location centerLocation = null; private List locationVectors = null; - private final List edgeVectors = null; public Cylinder(Location centerLocation, double radius, double height, double borderRadius) { this.centerLocation = centerLocation.clone(); diff --git a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Ray.java b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Ray.java index e516ea8c9..91d6d568e 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Ray.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Ray.java @@ -101,14 +101,14 @@ private class RayCuboid { private final double height; @Getter private final Location centerLocation; - @Getter - private Quaternion rotation; private final double maxX; private final double minX; private final double maxY; private final double minY; private final double maxZ; private final double minZ; + @Getter + private Quaternion rotation; public RayCuboid(double width, Location sourceLocation, Location destinationLocation) { this.width = width; diff --git a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index e59c8a85d..01c35ca90 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -1,12 +1,11 @@ package com.magmaguy.elitemobs.versionnotifier; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.SpigotMessage; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; @@ -23,9 +22,9 @@ public class VersionChecker { private static final List outdatedPackages = new ArrayList<>(); - private static boolean pluginIsUpToDate = true; @Getter - private static boolean SHA1Updated = false; + private static final boolean SHA1Updated = false; + private static boolean pluginIsUpToDate = true; private VersionChecker() { } @@ -70,11 +69,11 @@ public void run() { String publicVersion = ""; try { - Bukkit.getLogger().info("[EliteMobs] Latest public release is " + VersionChecker.readStringFromURL("https://api.spigotmc.org/legacy/update.php?resource=40090")); - Bukkit.getLogger().info("[EliteMobs] Your version is " + MetadataHandler.PLUGIN.getDescription().getVersion()); + Logger.info("Latest public release is " + VersionChecker.readStringFromURL("https://api.spigotmc.org/legacy/update.php?resource=40090")); + Logger.info("Your version is " + MetadataHandler.PLUGIN.getDescription().getVersion()); publicVersion = VersionChecker.readStringFromURL("https://api.spigotmc.org/legacy/update.php?resource=40090"); } catch (IOException e) { - Bukkit.getLogger().warning("[EliteMobs] Couldn't check latest version"); + Logger.warn("Couldn't check latest version"); return; } @@ -99,9 +98,9 @@ public void run() { } if (!snapshot) - Bukkit.getLogger().info("[EliteMobs] You are running the latest version!"); + Logger.info("You are running the latest version!"); else - new InfoMessage("You are running a snapshot version! You can check for updates in the #releases channel on the EliteMobs Discord!"); + Logger.info("You are running a snapshot version! You can check for updates in the #releases channel on the EliteMobs Discord!"); pluginIsUpToDate = true; } @@ -120,10 +119,10 @@ private static void checkDungeonVersions() { if (emPackage.getDungeonPackagerConfigFields().getDungeonVersion() < releaseVersion) { emPackage.setOutOfDate(true); outdatedPackages.add(emPackage); - new WarningMessage("Dungeon " + emPackage.getDungeonPackagerConfigFields().getName() + " is outdated! You should go download the updated version! Link: " + emPackage.getDungeonPackagerConfigFields().getDownloadLink()); + Logger.warn("Dungeon " + emPackage.getDungeonPackagerConfigFields().getName() + " is outdated! You should go download the updated version! Link: " + emPackage.getDungeonPackagerConfigFields().getDownloadLink()); } } catch (Exception exception) { - new WarningMessage("Failed to get version for EliteMobs package " + emPackage.getDungeonPackagerConfigFields().getFilename() + "! The URL " + "https://www.magmaguy.com/api/" + emPackage.getDungeonPackagerConfigFields().getFilename().replace(".yml", "") + " could not be reached!"); + Logger.warn("Failed to get version for EliteMobs package " + emPackage.getDungeonPackagerConfigFields().getFilename() + "! The URL " + "https://www.magmaguy.com/api/" + emPackage.getDungeonPackagerConfigFields().getFilename().replace(".yml", "") + " could not be reached!"); } } } @@ -142,7 +141,7 @@ private static String readStringFromURL(String url) throws IOException { private static void outOfDateHandler() { - new WarningMessage("[EliteMobs] A newer version of this plugin is available for download!"); + Logger.warn("[EliteMobs] A newer version of this plugin is available for download!"); pluginIsUpToDate = false; } @@ -163,10 +162,10 @@ public void onPlayerLogin(PlayerJoinEvent event) { public void run() { if (!event.getPlayer().isOnline()) return; if (!pluginIsUpToDate) - event.getPlayer().sendMessage(ChatColorConverter.convert("&a[EliteMobs] &cYour version of EliteMobs is outdated." + + event.getPlayer().sendMessage(ChatColorConverter.convert("&cYour version of EliteMobs is outdated." + " &aYou can download the latest version from &3&n&ohttps://www.spigotmc.org/resources/%E2%9A%94elitemobs%E2%9A%94.40090/")); if (!outdatedPackages.isEmpty()) { - event.getPlayer().sendMessage(ChatColorConverter.convert("&a[EliteMobs] &cThe following dungeons are outdated:")); + event.getPlayer().sendMessage(ChatColorConverter.convert("&cThe following dungeons are outdated:")); for (EMPackage emPackage : outdatedPackages) event.getPlayer().sendMessage(ChatColorConverter.convert( "&c- " + emPackage.getDungeonPackagerConfigFields().getName())); diff --git a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java deleted file mode 100644 index cebef64d0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.magmaguy.elitemobs.worlds; - -import com.magmaguy.elitemobs.config.AdventurersGuildConfig; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; -import org.bukkit.Bukkit; -import org.bukkit.WorldCreator; - -import java.io.File; -import java.util.Objects; -import java.util.logging.Filter; - -public class CustomWorldLoading { - - private CustomWorldLoading() { - } - - public static void startupWorldInitialization() { - File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); - File[] listOfFiles = folder.listFiles(); - - assert listOfFiles != null; - for (File listOfFile : listOfFiles) { - if (listOfFile.isDirectory() && listOfFile.getName().equals(AdventurersGuildConfig.getGuildWorldName())) { - new InfoMessage("[EliteMobs] World " + AdventurersGuildConfig.getGuildWorldName() + " found! Loading it in..."); - Filter filter = newFilter -> false; - Filter previousFilter = Bukkit.getLogger().getFilter(); - Bukkit.getLogger().setFilter(filter); - try { - WorldCreator worldCreator = new WorldCreator(AdventurersGuildConfig.getGuildWorldName()); - Objects.requireNonNull(Bukkit.createWorld(worldCreator)).setKeepSpawnInMemory(false); - new InfoMessage("[EliteMobs] World " + AdventurersGuildConfig.getGuildWorldName() + - " has been successfully loaded! It can be accessed through the '/ag' command, unless you changed that config option!"); - } catch (Exception ex) { - new WarningMessage("Failed to generate Adventurer's Guild World!"); - ex.printStackTrace(); - } - Bukkit.getLogger().setFilter(previousFilter); - break; - } - } - - } - - public static boolean adventurersGuildWorldExists() { - File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); - File[] listOfFiles = folder.listFiles(); - - assert listOfFiles != null; - for (File listOfFile : listOfFiles) - if (listOfFile.isDirectory() && - listOfFile.getName().equals(AdventurersGuildConfig.getGuildWorldName())) - return true; - return false; - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/VisualEffects.java b/src/main/java/com/magmaguy/elitemobs/wormhole/VisualEffects.java index 64e323301..f26f7b6fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/VisualEffects.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/VisualEffects.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.WormholesConfig; import com.magmaguy.elitemobs.config.wormholes.WormholeConfigFields; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.util.Vector; @@ -32,7 +32,7 @@ private void initializeVisualEffect() { generateIcosahedron(); break; default: - new WarningMessage("Missing com.magmaguy.elitemobs.wormhole style for " + wormholeConfigFields.getStyle()); + Logger.warn("Missing com.magmaguy.elitemobs.wormhole style for " + wormholeConfigFields.getStyle()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java index af790ddfe..fb0153733 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java @@ -1,7 +1,9 @@ package com.magmaguy.elitemobs.wormhole; +import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.wormholes.WormholeConfigFields; import lombok.Getter; +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -24,13 +26,18 @@ public class Wormhole { @Getter private final Color particleColor; + public static void addPlayerToCooldowns(Player player) { + playerCooldowns.add(player); + Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, () -> Wormhole.getPlayerCooldowns().remove(player), 20 * 5L); + } + @Getter private List> cachedRotations = new ArrayList<>(); public Wormhole(WormholeConfigFields wormholeConfigFields) { this.wormholeConfigFields = wormholeConfigFields; this.particleColor = Color.fromRGB(wormholeConfigFields.getParticleColor()); - if (!wormholeConfigFields.getStyle().equals(WormholeStyle.NONE)) { + if (wormholeConfigFields.getStyle() != null && !wormholeConfigFields.getStyle().equals(WormholeStyle.NONE)) { this.cachedRotations = new ArrayList<>(new VisualEffects(wormholeConfigFields).getCachedRotations()); } wormholeEntry1 = new WormholeEntry(this, getWormholeConfigFields().getLocation1(), 1); diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java index fde600e4c..3399255e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java @@ -1,16 +1,15 @@ package com.magmaguy.elitemobs.wormhole; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.WormholesConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.mobconstructor.PersistentObject; import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; import com.magmaguy.elitemobs.utils.ChunkLocationChecker; import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -56,7 +55,7 @@ public WormholeEntry(Wormhole wormhole, String locationString, int wormholeNumbe this.wormholeNumber = wormholeNumber; this.locationString = locationString; if (locationString == null) { - new WarningMessage("Wormhole " + wormhole.getWormholeConfigFields().getFilename() + " is missing a wormhole location! Fix this!"); + Logger.warn("Wormhole " + wormhole.getWormholeConfigFields().getFilename() + " is missing a wormhole location! Fix this!"); return; } setLocationFromConfiguration(); @@ -70,25 +69,24 @@ public WormholeEntry(Wormhole wormhole, String locationString, int wormholeNumbe private Location getDungeonLocation() { EMPackage emPackage = EMPackage.getEmPackages().get(locationString); if (emPackage == null) { - new WarningMessage("Dungeon " + locationString + " is not a valid dungeon packager name! Wormhole " + wormhole.getWormholeConfigFields().getFilename() + " will not lead anywhere."); + Logger.warn("Dungeon " + locationString + " is not a valid dungeon packager name! Wormhole " + wormhole.getWormholeConfigFields().getFilename() + " will not lead anywhere."); setPortalMissingMessage(WormholesConfig.getDefaultPortalMissingMessage()); return null; } if (!emPackage.isDownloaded() || !emPackage.isInstalled()) { - //new InfoMessage("Wormhole " + wormhole.getWormholeConfigFields().getFilename() + " will not lead anywhere because the dungeon " + locationString + " is not installed!"); + //Logger.info("Wormhole " + wormhole.getWormholeConfigFields().getFilename() + " will not lead anywhere because the dungeon " + locationString + " is not installed!"); setPortalMissingMessage(WormholesConfig.getDungeonNotInstalledMessage().replace("$dungeonID", emPackage.getDungeonPackagerConfigFields().getName())); this.opMessage = ChatColorConverter.convert("&8[EliteMobs - OP-only message] &fDownload links are available on &9https://magmaguy.itch.io/ &f" + "(free and premium) and &9https://www.patreon.com/magmaguy &f(premium). You can check the difference " + "between the two and get support here: " + DiscordLinks.mainLink); - - if (emPackage instanceof SchematicPackage) return null; } Location teleportLocation = emPackage.getDungeonPackagerConfigFields().getTeleportLocation(); if (teleportLocation == null) return null; - Vector offsetVector = teleportLocation.getDirection().clone().setY(0).normalize().multiply(1.5 * wormhole.getWormholeConfigFields().getSizeMultiplier()).setY(-1 * wormhole.getWormholeConfigFields().getSizeMultiplier()); +// Vector offsetVector = teleportLocation.getDirection().clone().setY(0).normalize().multiply(1.5 * wormhole.getWormholeConfigFields().getSizeMultiplier()).setY(-1 * wormhole.getWormholeConfigFields().getSizeMultiplier()); worldName = emPackage.getDungeonPackagerConfigFields().getWorldName(); - return teleportLocation.clone().subtract(offsetVector); +// return teleportLocation.clone().subtract(offsetVector); + return teleportLocation.clone(); } private void setLocationFromConfiguration() { diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java index b026770e8..26fb6bb92 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java @@ -1,12 +1,12 @@ package com.magmaguy.elitemobs.wormhole; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.config.WormholesConfig; import com.magmaguy.elitemobs.economy.EconomyHandler; import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns; import com.magmaguy.elitemobs.utils.ChunkLocationChecker; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Particle; @@ -111,7 +111,7 @@ private static void teleport(WormholeEntry wormholeEntry, Player player) { player.setVelocity(destination.getDirection().normalize()); player.setFlying(false); Wormhole.getPlayerCooldowns().add(player); - Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, () -> Wormhole.getPlayerCooldowns().remove(player), 20 * 10L); + Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, () -> Wormhole.getPlayerCooldowns().remove(player), 20 * 5L); }); } @@ -119,7 +119,7 @@ private static void teleport(WormholeEntry wormholeEntry, Player player) { private static void visualEffect(int counter, WormholeEntry wormholeEntry) { for (Vector vector : wormholeEntry.getWormhole().getCachedRotations().get(counter)) { Location particleLocation = wormholeEntry.getLocation().clone().add(vector); - wormholeEntry.getLocation().getWorld().spawnParticle(Particle.REDSTONE, particleLocation.getX(), particleLocation.getY(), particleLocation.getZ(), 1, 0, 0, 0, 1, new Particle.DustOptions(wormholeEntry.getWormhole().getParticleColor(), 1)); + wormholeEntry.getLocation().getWorld().spawnParticle(Particle.DUST, particleLocation.getX(), particleLocation.getY(), particleLocation.getZ(), 1, 0, 0, 0, 1, new Particle.DustOptions(wormholeEntry.getWormhole().getParticleColor(), 1)); } } } diff --git a/src/main/resources/AdventurersGuild.yml b/src/main/resources/AdventurersGuild.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/CombatTag.yml b/src/main/resources/CombatTag.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/ItemsCustomLootSettings.yml b/src/main/resources/ItemsCustomLootSettings.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/ItemsDropSettings.yml b/src/main/resources/ItemsDropSettings.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/ItemsProceduralSettings.yml b/src/main/resources/ItemsProceduralSettings.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/MobCombatSettings.yml b/src/main/resources/MobCombatSettings.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/ValidWorlds.yml b/src/main/resources/ValidWorlds.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/events.yml b/src/main/resources/events.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/playerGuildRank.yml b/src/main/resources/playerGuildRank.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/playerMoneyData.yml b/src/main/resources/playerMoneyData.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 1266d3b30..0e361e346 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 8.7.16 +version: 9.1.8 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -11,7 +11,6 @@ softdepend: - HolographicDisplays - DiscordSRV - LibsDisguises -- WorldEdit - ModelEngine - Geyser-Spigot - MythicMobs @@ -19,129 +18,221 @@ softdepend: - InfernalMobs - FreeMinecraftModels +commands: + elitemobs: + description: Main command + aliases: + - em + adventurersguild: + description: Main command + aliases: + - ag + permissions: elitemobs.*: description: Gives access to all elitemobs commands - children: - elitemobs.stats: true - elitemobs.checktier.others: true - elitemobs.versionnotification: true - elitemobs.currency.check.others: true - default: op - elitemobs.stats: - description: Allows players to run /elitemobs stats default: op - elitemobs.version: - description: Allows players to run /elitemobs version + elitemobs.adventurersguild.command: + description: Allows players to open the Adventurer's Guild menu + default: true + elitemobs.adventurersguild.teleport: + description: Allows players to teleport to the Adventurer's Guild + default: true + elitemobs.alt: + description: Allows players to switch menu styles default: true - elitemobs.shop.npc: - description: Allows players to interact with NPCs for dynamic shops + elitemobs.arena.start: + description: Allows players to start an arena default: true - elitemobs.shop.command: - description: Allows players to open the dynamic shop menu through commands + elitemobs.debug: + description: Gives access to the debug command + default: op + elitemobs.discord.link: + description: Gives the link to EliteMobs' discord server default: true - elitemobs.customshop.npc: - description: Allows players to interact with NPCs for dynamic shops + elitemobs.discord.message: + description: Allows sending debug messages to discord via DiscordSRV for testing purposes + default: op + elitemobs.dismiss: + description: Allows admins to dismiss the initial setup message + default: op + elitemobs.dungeon.tp: + description: Allows players to teleport to a dungeon default: true - elitemobs.customshop.command: - description: Allows players to open the dynamic shop menu through commands + elitemobs.command: + description: Allows players to use the main command of the plugin default: true - elitemobs.currency.pay: - description: Allows players to run /elitemobs pay [username] [amount] + elitemobs.enchant.command: + description: Allows players to use the enchant command default: true - elitemobs.currency.check: - description: Allows players to run /elitemobs wallet + elitemobs.event.start: + description: Allows admins to manually launch an event + default: op + elitemobs.fireball: + description: Allows admins to fire an elite fireball for terrain destruction testing purposes + default: op + elitemobs.help: + description: Allows players to run the help command default: true - elitemobs.currency.check.others: - description: Allows players to run /elitemobs check [username] + elitemobs.kill.command: + description: Allows admins to run the kill commands to kill elites default: op - elitemobs.events: - description: Allows players to launch all events + elitemobs.language: + description: Allows admins to set the translation used server-wide for EliteMobs + default: op + elitemobs.loot.command: + description: Opens the loot menu for EliteMobs group looting default: true - elitemobs.checktier.others: - description: Allows players to run /elitemobs checktier [player] + elitemobs.loot.debug: + description: Gives admins a set of gear of a specific level for testing purposes default: op - elitemobs.gettier: - description: Allows players to run /elitemobs gettier [tier] + elitemobs.loot.admin: + description: Lets admins give or obtain EliteMobs loot via command default: op - elitemobs.versionnotification: - description: Allows players to get notified about plugin updates + elitemobs.loot.stats: + description: Gives the elite stats of gear, for debugging purposes default: op - elitemobs.adventurersguild.teleport: - description: Allows players to teleport to the adventurer's guild hub using /ag + elitemobs.money.admin: + description: Allows admins to manually manipulate player elite currency + default: op + elitemobs.money.check.self: + description: Allows users to check their balance default: true - elitemobs.adventurersguild.command: - description: Allows players to rank menu using the /em adventurersguild command + elitemobs.money.check.others: + description: Allows users to check their balance + default: op + elitemobs.dungeon.package: + description: Allows admins to package EliteMobs content for distribution + default: op + elitemobs.money.pay: + description: Allows users to check their balance default: true - elitemobs.rank.command: - description: Allows players to open the rank menu through /em rank + elitemobs.place.admin: + description: Allows admins to run all commands related to placing and spawning npcs, bosses, treasure chests and more + default: op + elitemobs.quest.accept: + description: Allows users to accept a quest default: true - elitemobs.rank.npc: - description: Allows players to access the /em rank menu through NPCs + elitemobs.quest.bypass: + description: Allows users to accept a quest + default: op + elitemobs.quest.complete.force: + description: Allows admins to force complete all pending quests + default: op + elitemobs.quest.complete: + description: Allows players to complete quests + default: true + elitemobs.quest.leave: + description: Allows users to leave a quest default: true - elitemobs.quest.command: - description: Allows players to take on quests via command + elitemobs.quest.reset.all: + description: Allows admins to reset all quests for a specific player + default: op + elitemobs.quest.reset: + description: Allows admins to reset a quest for a specific player + default: op + elitemobs.quest.track: + description: Allows players to track the objectives of a quest default: true elitemobs.quest.npc: - description: Allows players to take on quests via EliteMobs NPC + description: Allows players to talk to quest npcs default: true - elitemobs.dungeontp: - description: Allows players to teleport to an elitemobs-set location + elitemobs.quit: + description: Allows players to quit instanced content default: true - elitemobs.spawntp: - description: Allows players to teleport to the default spawn location of the server. + elitemobs.rank.command: + description: Allows players to join open the rank menu of EliteMobs default: true - elitemobs.back.npc: - description: Allows players to interact with an npc to go back to a previous location. + elitemobs.rank.set: + description: Allows admins to set a specific EliteMobs rank for a specific player + default: op + elitemobs.reload: + description: Allows admins to reload EliteMobs + default: op + elitemobs.remove: + description: Allows admins to use the remove command + default: op + elitemobs.repair.command: + description: Allows users to use the repair command + default: true + elitemobs.respawn.force: + description: Allows admins to force respawn all regional bosses + default: op + elitemobs.scrap.command: + description: Allows players to use the scrap command default: true + elitemobs.setup: + description: Allows admins to use the setup commands + default: op elitemobs.shareitem: - description: Shares a held Elite Item on chat. + description: Allows players to use the share item command default: true - elitemobs.scrap.npc: - description: Allows players to scrap items at an npc + elitemobs.shop.custom: + description: Allows players to use custom shop command default: true - elitemobs.scrap.command: - description: Allows players to scrap items using a command + elitemobs.shop.custom.other: + description: Allows admins to open the custom shop for other people + default: op + elitemobs.shop.dynamic: + description: Allows players to use dynamic shop command default: true - elitemobs.smelt.command: - description: Allows players to smelt items using a command + elitemobs.shop.dynamic.other: + description: Allows admins to open the dynamic shop for other people + default: op + elitemobs.shop.sell.other: + description: Allows admins to open the sell shop for other people + default: op + elitemobs.teleport.spawn: + description: Allows players to use the spawn teleport command default: true - elitemobs.smelt.npc: - description: Allows players to smelt items using an npc + elitemobs.instance.start: + description: Allows players to use the start command in instances default: true - elitemobs.repair.command: - description: Allows players to use the repair command to open the menu for repairing elite items + elitemobs.stats: + description: Allows admins to get stats related to EliteMobs + default: op + elitemobs.boss.track: + description: Allows players to track trackable bosses default: true - elitemobs.repair.npc: - description: Allows players to interact with the NPC for repairing items + elitemobs.transitiveblocks: + description: Allows admins to run commands related to setting up transitive blocks + default: op + elitemobs.unbind.command: + description: Allows players to run the unbind command (which opens the menu to unbind with a scroll) default: true - elitemobs.refiner.command: - description: Allows players to use the refiner command to open the menu for upgrading Elite Scrap + elitemobs.unbind.force: + description: Allows admins to force unbind a held item via command + default: op + elitemobs.version: + description: Allows admins to check the plugin version of EliteMobs + default: op + elitemobs.rank.npc: + description: Allows players to talk to the rank npc default: true - elitemobs.refiner.npc: - description: Allows players to interact with the NPC for upgrading Elite Scrap + elitemobs.shop.dynamic.npc: + description: Allows players to talk to the dynamic shop npc default: true - elitemobs.enhancer.command: - description: Allows players to use the enhancer command to open the menu for upgrading Elite Items + elitemobs.shop.custom.npc: + description: Allows players to talk to the custom shop npc default: true - elitemobs.enhancer.npc: - description: Allows players to interact with the NPC for upgrading Elite Items + elitemobs.shop.sell.npc: + description: Allows players to talk to the sell shop npc default: true - elitemobs.unbind.command: - description: Allows players to use the unbind command to open the menu to unbind Elite Items + elitemobs.back.npc: + description: Allows players to talk to the back teleport npc + default: true + elitemobs.scrap.npc: + description: Allows players to talk to the scrap npc + default: true + elitemobs.repair.npc: + description: Allows players to talk to the repair npc default: true elitemobs.unbind.npc: - description: Allows players to interact with the unbinder NPC to unbind Elite Items - default: true - elitemobs.soulbind.bypass: - description: Allows users to bypass the soulbind restrictions. Only recommended for admins! - default: false - elitequest.*: - description: Used for quest-related permissions - default: not op + description: Allows players to talk to the unbind npc + default: true elitemobs.enchant.npc: - description: Allows players to interact with the enchanter NPC to enchant Elite Items + description: Allows players to talk to the enchant npc default: true - elitemobs.enchant.command: - description: Allows players to use the enchant command to enchant Elite Items - default: true \ No newline at end of file + elitemobs.protection.bypass: + description: Allows players to run the bypass command to toggle bypassing dungeon protections + default: op \ No newline at end of file diff --git a/src/main/resources/translation.yml b/src/main/resources/translation.yml deleted file mode 100644 index e69de29bb..000000000