From ef8b50b878e1aeb4c96387366c8e7fd9ecf7e588 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 18 Jun 2024 10:28:21 +0100 Subject: [PATCH 01/78] - Updated all entities, potion effects and enchantments to work with Minecraft 1.21 - Removed Super Mobs - Fixed bug where push action would be cancelled if applied on the same tick a player is damaged by the boss Signed-off-by: MagmaGuy --- build.gradle | 5 +- .../com/magmaguy/elitemobs/EliteMobs.java | 12 -- .../magmaguy/elitemobs/EventsRegistrer.java | 15 -- .../api/EliteMobDamagedByPlayerEvent.java | 4 +- .../api/PlayerDamagedByEliteMobEvent.java | 8 +- .../elitemobs/api/SuperMobDamageEvent.java | 72 ------- .../elitemobs/api/SuperMobDeathEvent.java | 58 ----- .../elitemobs/api/SuperMobRemoveEvent.java | 40 ---- .../elitemobs/api/SuperMobSpawnEvent.java | 61 ------ .../elitemobs/api/utils/EliteItemManager.java | 12 +- .../AlternativeDurabilityLoss.java | 2 +- .../EnderCrystalDamageProtectionBypass.java | 2 +- .../FindSuperMobs.java | 24 --- .../LightningImmunity.java | 2 +- .../LightningSpawnBypass.java | 2 +- .../PreventCreeperPassiveEntityDamage.java | 48 ----- .../antiexploit/PreventMountExploit.java | 2 +- .../combatsystem/combattag/CombatTag.java | 2 +- .../elitemobs/commands/AdminCommands.java | 27 --- .../elitemobs/commands/SpawnCommand.java | 12 -- .../commands/admin/GetTierCommand.java | 4 +- .../elitemobs/commands/admin/KillHandler.java | 33 --- .../commands/admin/StatsCommand.java | 7 - .../custombosses/premade/BalrogConfig.java | 8 +- .../custombosses/premade/EmberConfig.java | 2 +- .../custombosses/premade/IceFaeConfig.java | 2 +- .../premade/ImperialBeeGuardConfig.java | 2 +- .../KillerRabbitOfCaerbannogConfig.java | 8 +- .../custombosses/premade/KrakenConfig.java | 8 +- .../premade/LightningFaeConfig.java | 2 +- .../custombosses/premade/QueenBeeBoss.java | 8 +- .../custombosses/premade/RaugConfig.java | 2 +- .../premade/ChallengersBootsConfig.java | 2 +- .../premade/ChallengersChestplateConfig.java | 2 +- .../premade/ChallengersHelmetConfig.java | 2 +- .../premade/ChallengersLeggingsConfig.java | 2 +- .../premade/ChallengersSwordConfig.java | 2 +- .../premade/DepthsSeekerConfig.java | 2 +- .../premade/DwarvenGreedConfig.java | 2 +- .../EnchantedBookDurabilityConfig.java | 2 +- ...ntedBookProtectionEnvironmentalConfig.java | 2 +- .../premade/GoblinBallistaItem.java | 2 +- .../customitems/premade/GoblinBootsItem.java | 2 +- .../premade/GoblinChestplateItem.java | 2 +- .../premade/GoblinCleaverItem.java | 2 +- .../customitems/premade/GoblinHelmetItem.java | 2 +- .../premade/GoblinLeggingsItem.java | 2 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 2 +- .../premade/GruntsBootsConfig.java | 2 +- .../premade/GruntsChestplateConfig.java | 2 +- .../premade/GruntsHelmetConfig.java | 2 +- .../premade/GruntsLeggingsConfig.java | 2 +- .../premade/GruntsSwordConfig.java | 2 +- .../premade/InvictusBootsConfig.java | 2 +- .../premade/InvictusChestplateConfig.java | 2 +- .../premade/InvictusHelmetConfig.java | 2 +- .../premade/InvictusLeggingsConfig.java | 2 +- .../premade/InvictusPickaxeConfig.java | 2 +- .../premade/InvictusShovelConfig.java | 2 +- .../premade/InvictusSwordConfig.java | 2 +- .../premade/NovicesBootsConfig.java | 2 +- .../premade/NovicesChestplateConfig.java | 2 +- .../premade/NovicesHelmetConfig.java | 2 +- .../premade/NovicesLeggingsConfig.java | 2 +- .../premade/NovicesSwordConfig.java | 2 +- .../premade/RodOfTheDepthsConfig.java | 2 +- .../customitems/premade/TheFellerConfig.java | 2 +- .../customitems/premade/TheStingerConfig.java | 2 +- .../premade/VeteransBootsConfig.java | 2 +- .../premade/VeteransChestplateConfig.java | 2 +- .../premade/VeteransHelmetConfig.java | 2 +- .../premade/VeteransLeggingsConfig.java | 2 +- .../premade/VeteransSwordConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 2 +- .../mobproperties/MobPropertiesConfig.java | 5 - .../premade/SuperChickenConfig.java | 15 -- .../mobproperties/premade/SuperCowConfig.java | 15 -- .../premade/SuperMushroomCowConfig.java | 15 -- .../mobproperties/premade/SuperPigConfig.java | 15 -- .../premade/SuperSheepConfig.java | 15 -- .../powers/premade/ArrowRainConfig.java | 2 +- .../powers/premade/AttackBlindingConfig.java | 2 +- .../powers/premade/AttackConfusingConfig.java | 2 +- .../powers/premade/ZombieBloatConfig.java | 2 +- .../entitytracker/EntityTracker.java | 36 +--- .../elitemobs/items/EliteEnchantments.java | 16 +- .../elitemobs/items/EliteItemLore.java | 16 +- .../EarthquakeEnchantment.java | 2 +- .../FlamethrowerEnchantment.java | 6 +- .../MeteorShowerEnchantment.java | 2 +- .../PlasmaBootsEnchantment.java | 4 +- .../itemconstructor/EnchantmentGenerator.java | 36 ++-- .../itemconstructor/ItemQualityColorizer.java | 96 ++++----- .../potioneffects/PlayerPotionEffects.java | 10 +- .../mobconstructor/MergeHandler.java | 46 ---- .../mobconstructor/SuperMobConstructor.java | 40 ---- .../custombosses/CustomBossTrail.java | 2 +- .../mobdata/PluginMobProperties.java | 2 - .../mobdata/passivemobs/SuperChicken.java | 26 --- .../mobdata/passivemobs/SuperCow.java | 26 --- .../passivemobs/SuperMobProperties.java | 53 ----- .../mobdata/passivemobs/SuperMushroomCow.java | 26 --- .../mobdata/passivemobs/SuperPig.java | 26 --- .../mobdata/passivemobs/SuperSheep.java | 26 --- .../mobs/passive/ChickenHandler.java | 157 -------------- .../elitemobs/mobs/passive/CowHandler.java | 80 ------- .../elitemobs/mobs/passive/EggRunnable.java | 16 -- .../mobs/passive/MushroomCowHandler.java | 112 ---------- .../passive/PassiveEliteMobDeathHandler.java | 108 ---------- .../elitemobs/mobs/passive/PigHandler.java | 63 ------ .../elitemobs/mobs/passive/SheepHandler.java | 200 ------------------ .../elitemobs/playerdata/PlayerItem.java | 8 +- .../magmaguy/elitemobs/powers/BulletHell.java | 2 +- .../elitemobs/powers/ChannelHealing.java | 4 +- .../magmaguy/elitemobs/powers/DeathSlice.java | 2 +- .../powers/EnderDragonDiscoFireballs.java | 2 +- .../powers/EnderDragonPotionBombardment.java | 6 +- .../elitemobs/powers/EnderDragonTornado.java | 2 +- .../magmaguy/elitemobs/powers/Firestorm.java | 6 +- .../elitemobs/powers/FireworksBarrage.java | 4 +- .../magmaguy/elitemobs/powers/FlamePyre.java | 6 +- .../elitemobs/powers/Flamethrower.java | 4 +- .../magmaguy/elitemobs/powers/FrostCone.java | 4 +- .../elitemobs/powers/GoldExplosion.java | 2 +- .../elitemobs/powers/GoldShotgun.java | 2 +- .../elitemobs/powers/GroundPound.java | 2 +- .../elitemobs/powers/MeteorShower.java | 2 +- .../magmaguy/elitemobs/powers/PhotonRay.java | 4 +- .../elitemobs/powers/PlasmaBlaster.java | 4 +- .../elitemobs/powers/SkeletonPillar.java | 4 +- .../com/magmaguy/elitemobs/powers/Taze.java | 2 +- .../elitemobs/powers/ZombieBloat.java | 2 +- .../powers/meta/CustomSummonPower.java | 2 +- .../powers/scripts/ScriptAction.java | 31 +-- .../powers/scripts/ScriptParticles.java | 6 +- .../EnderCrystalLightningRod.java | 2 +- .../elitemobs/utils/DebugBlockLocation.java | 4 +- .../elitemobs/wormhole/WormholeTask.java | 2 +- src/main/resources/plugin.yml | 2 +- 142 files changed, 255 insertions(+), 1775 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperChickenConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperCowConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperMushroomCowConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperPigConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperSheepConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/MergeHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/SuperMobConstructor.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperChicken.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperCow.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMobProperties.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMushroomCow.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperPig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperSheep.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/ChickenHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/CowHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/EggRunnable.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/MushroomCowHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/PassiveEliteMobDeathHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/PigHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/SheepHandler.java diff --git a/build.gradle b/build.gradle index 000c6649d..f93122c7f 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '8.7.16-SNAPSHOT' +version '9.0.0-SNAPSHOT' repositories { maven { @@ -77,8 +77,7 @@ repositories { dependencies { //Spigot API - compileOnly "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT" - // The full CraftBukkit server with no shadowing. Requires mavenLocal. + compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" //BStats API implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 851495ecf..eb42590a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -43,8 +43,6 @@ 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.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.playerdata.database.PlayerData; @@ -68,7 +66,6 @@ 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; @@ -218,11 +215,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(); @@ -400,10 +392,6 @@ public void onDisable() { */ 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..75a115e83 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -29,12 +29,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; @@ -102,13 +100,6 @@ 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()) @@ -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()); @@ -232,9 +222,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,8 +265,6 @@ 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 EnderDragonUnstuck()); diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 1b4323c62..5f3b3b49e 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -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)) { 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; } 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/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/utils/EliteItemManager.java b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java index 1dca78eac..a72c2fd35 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; } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 0eaf6afa7..c0d03fbb8 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -30,7 +30,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; } 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/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/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index bd7a645b4..fb9391902 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -12,7 +12,7 @@ public class LightningImmunity implements Listener { @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) public void onLightningStrike(EntityDamageByEntityEvent event){ - if (!event.getDamager().getType().equals(EntityType.LIGHTNING)) return; + 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/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/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/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/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index 419fafcc7..c87210ed9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -233,17 +233,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde 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)), @@ -504,22 +493,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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") diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java index ef7ed08ba..d3a5658be 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -7,10 +7,8 @@ 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 org.bukkit.Bukkit; import org.bukkit.Location; @@ -145,12 +143,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); @@ -177,8 +169,4 @@ private static HashSet getPowers(String[] mobPowers, Command 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 27f12930b..9b2619d06 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -44,7 +44,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); @@ -72,7 +72,7 @@ public static void get(Player player, int tierLevel) { private static void addDurability(ItemStack itemStack){ ItemMeta itemMeta = itemStack.getItemMeta(); HashMap enchantmentIntegerHashMap = new HashMap<>(); - enchantmentIntegerHashMap.put(Enchantment.DURABILITY, 5); + enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); 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..e5e0c4bcd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java @@ -5,11 +5,9 @@ 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 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/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java index a8f0725b9..4f5f698ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -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/config/custombosses/premade/BalrogConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BalrogConfig.java index d65df6d93..6049a2675 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 @@ -16,10 +16,10 @@ public BalrogConfig() { "dynamic"); setPowers(Collections.singletonList("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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), Particle.FLAME.toString(), Particle.FLAME.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/IceFaeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/IceFaeConfig.java index 2b767ac61..be97a8262 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 @@ -17,6 +17,6 @@ public IceFaeConfig() { setDamageMultiplier(0.3); setPowers(Collections.singletonList("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..619e3e933 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 @@ -20,6 +20,6 @@ public ImperialBeeGuardConfig() { 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..66a9379c6 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 @@ -15,10 +15,10 @@ 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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.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..c5feefa37 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 @@ -15,10 +15,10 @@ 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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.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..6f7b618b4 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 @@ -17,6 +17,6 @@ public LightningFaeConfig() { setDamageMultiplier(0.3); setPowers(Collections.singletonList("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/QueenBeeBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/QueenBeeBoss.java index 488589cba..352f889a2 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 @@ -19,10 +19,10 @@ public QueenBeeBoss() { setEntityType(EntityType.BEE); setPowers(Collections.singletonList("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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.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/customitems/premade/ChallengersBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java index 124121082..ccfac6f38 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..36f4ced2f 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..c5af48d8d 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..3d82b0ca9 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..1db6f4ca5 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index 3dff27bdb..66387929c 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 @@ -13,7 +13,7 @@ public DepthsSeekerConfig() { 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")); + setEnchantments(Arrays.asList("LURE,3", "LUCK,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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..418e667b8 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 @@ -13,7 +13,7 @@ public DwarvenGreedConfig() { 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")); + setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/EnchantedBookDurabilityConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDurabilityConfig.java index 9fa012bb1..84434f406 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 @@ -14,7 +14,7 @@ public EnchantedBookDurabilityConfig(){ 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/EnchantedBookProtectionEnvironmentalConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionEnvironmentalConfig.java index e41651efc..577f5e94b 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 @@ -14,7 +14,7 @@ public EnchantedBookProtectionEnvironmentalConfig(){ 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/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 1733e17d1..5c7be6b92 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 @@ -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(Arrays.asList("ARROW_DAMAGE,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..f0ff0e047 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 @@ -17,7 +17,7 @@ public GoblinBootsItem() { 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")); + setEnchantments(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..70aaec84d 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 @@ -17,7 +17,7 @@ public GoblinChestplateItem() { 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(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..0538c35be 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 @@ -17,7 +17,7 @@ public GoblinCleaverItem() { 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(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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..1162ad080 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 @@ -17,7 +17,7 @@ public GoblinHelmetItem() { 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(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..897d3746b 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 @@ -17,7 +17,7 @@ public GoblinLeggingsItem() { 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(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..b526d6687 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 @@ -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(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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..24d535131 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 @@ -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(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,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..1fae1f440 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 @@ -17,7 +17,7 @@ public GoblinSlasherItem() { 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(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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..7fa585ec3 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..98fb62745 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..ac575075a 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..ee4d9ad47 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..b74955375 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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..5862f2613 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..260a1c496 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..7d3c68654 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..2d1efceec 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..8cc544edc 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("DIG_SPEED,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..ec619b4a5 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("DIG_SPEED,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..d2adb23c1 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/NovicesBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesBootsConfig.java index 98df7fabe..d0d4ebd14 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..de5dca260 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..189462464 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..5e891f5ca 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..4b042a516 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,5", "SWEEPING_EDGE,1", "UNBREAKING,5")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } 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..49e59d461 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 @@ -13,7 +13,7 @@ public RodOfTheDepthsConfig() { 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")); + setEnchantments(Arrays.asList("LURE,3", "LUCK,1", "UNBREAKING,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 14fbb4d6c..870774e8c 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 @@ -13,7 +13,7 @@ public TheFellerConfig() { 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")); + setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "SILK_TOUCH,1", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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..7564e67c5 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 @@ -14,7 +14,7 @@ public TheStingerConfig() { 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index 63b850031..fa3e7ae30 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..213a0facb 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..a702eeac8 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..f812d7d5b 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..436c6204e 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 93e85d278..ea50b9ea5 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); setPotionEffects(Arrays.asList("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..87c897770 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 @@ -13,7 +13,7 @@ public ZombieKingsAxeConfig() { 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", + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,5", "DIG_SPEED,5", "UNBREAKING,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")); setItemType(CustomItem.ItemType.UNIQUE); 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..8ef3f3b26 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -44,11 +44,6 @@ 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(), 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/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/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/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/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..28e002484 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -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); } 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..e79b2a59f 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), 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/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/itemconstructor/EnchantmentGenerator.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java index 30b0145cd..48f41b6c8 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java @@ -74,7 +74,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); validEnchantments.putAll(validateEnchantments("LOOT_BONUS_MOBS")); @@ -87,7 +87,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -96,7 +96,7 @@ public static HashMap generateEnchantments(double itemTier 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; @@ -106,7 +106,7 @@ public static HashMap generateEnchantments(double itemTier case STONE_PICKAXE: case WOODEN_PICKAXE: validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); //TODO: this doesn't take config into account @@ -122,7 +122,7 @@ public static HashMap generateEnchantments(double itemTier case STONE_SHOVEL: case WOODEN_SHOVEL: validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { @@ -139,7 +139,7 @@ public static HashMap generateEnchantments(double itemTier if (ItemSettingsConfig.isUseHoesAsWeapons()) validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { @@ -149,7 +149,7 @@ public static HashMap generateEnchantments(double itemTier } break; case SHIELD: - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -161,7 +161,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("DIG_SPEED")); @@ -173,9 +173,9 @@ 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")); @@ -190,8 +190,8 @@ public static HashMap generateEnchantments(double itemTier 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")); @@ -204,9 +204,9 @@ 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")); @@ -219,9 +219,9 @@ 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")); @@ -234,7 +234,7 @@ 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")); @@ -244,7 +244,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("DIG_SPEED")); 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/ItemQualityColorizer.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java index 305f27c9d..be472ba44 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java @@ -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/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/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/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/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 25340e4a3..4ea55665d 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -36,7 +36,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) { } 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/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/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index 56dec7027..0cf7a6a98 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -102,10 +102,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/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/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..270750255 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); } 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..c18505ede 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java @@ -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..52a7bd8e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java @@ -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/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..f1408759a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java @@ -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/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/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/meta/CustomSummonPower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java index 6dc9f9a18..5cf702d56 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -517,7 +517,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; 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 6c57385b0..1b6cb7c4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -429,19 +429,26 @@ private void runPlaySound(ScriptActionData scriptActionData) { } private void runPush(ScriptActionData scriptActionData) { - getTargets(scriptActionData).forEach(targetEntity -> { - if (blueprint.getScriptRelativeVectorBlueprint() != null) { - if (blueprint.getBValue() != null && blueprint.getBValue()) - targetEntity.setVelocity(targetEntity.getVelocity().add(new ScriptRelativeVector(blueprint.getScriptRelativeVectorBlueprint(), eliteScript, targetEntity.getLocation()).getVector(scriptActionData))); - else - targetEntity.setVelocity(new ScriptRelativeVector(blueprint.getScriptRelativeVectorBlueprint(), eliteScript, targetEntity.getLocation()).getVector(scriptActionData)); - } else if (blueprint.getVValue() != null) { - if (blueprint.getBValue() != null && blueprint.getBValue()) - targetEntity.setVelocity(targetEntity.getVelocity().add(blueprint.getVValue())); - else - targetEntity.setVelocity(blueprint.getVValue()); + //When players get hit that resets their velocity (by Minecraft) and since this runs before the damage is applied + //any velocity set here would be cancelled if used in a damage event. To bypass it we just run it a tick later. + new BukkitRunnable() { + @Override + public void run() { + getTargets(scriptActionData).forEach(targetEntity -> { + if (blueprint.getScriptRelativeVectorBlueprint() != null) { + if (blueprint.getBValue() != null && blueprint.getBValue()) + targetEntity.setVelocity(targetEntity.getVelocity().add(new ScriptRelativeVector(blueprint.getScriptRelativeVectorBlueprint(), eliteScript, targetEntity.getLocation()).getVector(scriptActionData))); + else + targetEntity.setVelocity(new ScriptRelativeVector(blueprint.getScriptRelativeVectorBlueprint(), eliteScript, targetEntity.getLocation()).getVector(scriptActionData)); + } else if (blueprint.getVValue() != null) { + if (blueprint.getBValue() != null && blueprint.getBValue()) + targetEntity.setVelocity(targetEntity.getVelocity().add(blueprint.getVValue())); + else + targetEntity.setVelocity(blueprint.getVValue()); + } + }); } - }); + }.runTaskLater(MetadataHandler.PLUGIN, 1); } private void runSummonReinforcement(ScriptActionData scriptActionData) { 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..23b26b065 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java @@ -44,7 +44,7 @@ private void visualize(ScriptActionData scriptActionData, Location location, Eli } - 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/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/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 2b338bd98..f63ce4e53 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -10,9 +10,9 @@ 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); + location.getWorld().spawnParticle(Particle.EXPLOSION, 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.EXPLOSION, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); } } diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java index b026770e8..26a4358a8 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java @@ -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/plugin.yml b/src/main/resources/plugin.yml index 1266d3b30..f3798c721 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.0.0 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From a1a6209f1eab6a40d3fa6660117ef2aa1deb81db Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Wed, 19 Jun 2024 14:05:52 +0100 Subject: [PATCH 02/78] - [New] 1.21 update! - [New] Added bossType field to custom bosses, to be used in the future for things like automatic boss bars - [New] Added Breach, Density and Wind Burst enchantments to EliteMobs - [New] Added Infested, Oozing, Raid Omen, Trial Omen, Weaving and Wind Charged potion effects to EliteMobs - [New] Added Bogged and Breeze entity types as valid elites and bosses - [New] All enchantments and potion effects now use the same names as in-game, instead of legacy API names - [New] Added compatibility layer that automatically converts legacy API names to the new equivalent, meaning it is not necessary to update the dungeons for them to keep working - [Removal] Removed Super Mobs - [Removal] Removed Schematic Dungeons, 100% of them will brought back as world-based dungeons. Use BetterStructures shrines as a replacement, they're much better. - [Removal] Removed all traces of WorldEdit as a requirement, since schematic dungeons are no longer a feature - [Removal] Removed the region leveling mode and the nightmare mode, they should either be improved or be their own plugin - [Removal] Removed all the code legacy code used to maintain multi-version support since this build will not be able to support anything before 1.21 - [Tweak] Default test boss no longer uses broadcast as a sample command and instead uses say - [Tweak] Fixed typo in stats page of the player em menu Signed-off-by: MagmaGuy --- build.gradle | 2 - .../elitemobs/ChatColorConverter.java | 2 +- .../com/magmaguy/elitemobs/EliteMobs.java | 13 -- .../magmaguy/elitemobs/EventsRegistrer.java | 19 +- .../api/EliteMobDamagedByPlayerEvent.java | 5 +- ...maticPackageRelativeBossLocationEvent.java | 56 ----- .../elitemobs/api/utils/EliteItemManager.java | 13 +- .../LightningImmunity.java | 4 +- .../PreventUpgradeDiamondToNetherite.java | 6 +- .../elitemobs/combatsystem/CombatSystem.java | 10 +- .../EliteMobDamagedByEliteMobHandler.java | 2 +- .../antiexploit/AmbientDamageExploit.java | 2 +- .../antiexploit/HoneyBlockJumpExploit.java | 2 - .../PreventLargeDarkroomExploit.java | 2 +- .../combatsystem/displays/PopupDisplay.java | 2 +- .../elitemobs/commands/AdminCommands.java | 24 -- .../commands/CustomBossCommandHandler.java | 24 -- .../elitemobs/commands/SpawnCommand.java | 27 ++- .../commands/TreasureChestCommands.java | 23 -- .../commands/admin/GetTierCommand.java | 3 +- .../admin/RelativeCoordinatesCommand.java | 6 - .../commands/admin/RemoveCommand.java | 12 +- .../elitemobs/commands/setup/SetupMenu.java | 6 +- .../elitemobs/config/ConfigurationEngine.java | 6 +- .../config/ConfigurationExporter.java | 8 +- .../elitemobs/config/CustomConfig.java | 6 +- .../elitemobs/config/DefaultConfig.java | 3 +- .../config/EconomySettingsConfig.java | 21 +- .../config/ItemUpgradeSystemConfig.java | 1 + .../config/LegacyValueConverter.java | 76 +++++++ .../elitemobs/config/ModelsConfig.java | 3 +- .../elitemobs/config/QuestsConfig.java | 17 +- .../config/ResourcePackDataConfig.java | 2 +- .../config/SpecialItemSystemsConfig.java | 10 +- .../elitemobs/config/ValidWorldsConfig.java | 15 -- .../CustomBossesConfigFields.java | 10 + .../premade/ImperialBeeGuardConfig.java | 5 +- .../custombosses/premade/QueenBeeBoss.java | 5 +- .../premade/TestCustomBossesConfig.java | 6 +- .../premade/TotemZombie1Boss.java | 13 +- .../premade/WeaponsGoblinBoss.java | 15 +- .../premade/WoodLeagueWave15Miniboss.java | 5 +- .../premade/WoodLeagueWave50Boss.java | 4 +- .../premade/WoodLeagueWave50BossP2.java | 4 +- .../premade/WoodLeagueWave50BossP3.java | 4 +- .../customevents/premade/QueenBeeEvent.java | 4 +- .../customitems/CustomItemsConfigFields.java | 43 ++++ .../premade/ChallengersBootsConfig.java | 2 +- .../premade/ChallengersChestplateConfig.java | 2 +- .../premade/ChallengersHelmetConfig.java | 2 +- .../premade/ChallengersLeggingsConfig.java | 2 +- .../premade/ChallengersSwordConfig.java | 2 +- .../premade/DwarvenGreedConfig.java | 2 +- .../EnchantedBookArrowDamageConfig.java | 20 +- .../EnchantedBookArrowKnockbackConfig.java | 2 +- .../EnchantedBookChannelingConfig.java | 2 +- .../premade/EnchantedBookDamageAllConfig.java | 2 +- .../EnchantedBookDamageArthropodsConfig.java | 2 +- .../EnchantedBookDamageUndeadConfig.java | 4 +- .../EnchantedBookDepthStriderConfig.java | 2 +- .../premade/EnchantedBookDigSpeedConfig.java | 4 +- .../EnchantedBookDurabilityConfig.java | 2 +- .../EnchantedBookEarthquakeConfig.java | 2 +- .../premade/EnchantedBookFlameConfig.java | 2 +- .../EnchantedBookFlamethrowerConfig.java | 2 +- .../EnchantedBookFrostWalkerConfig.java | 2 +- .../premade/EnchantedBookHunterConfig.java | 2 +- .../EnchantedBookIceBreakerConfig.java | 2 +- .../premade/EnchantedBookImpalingConfig.java | 2 +- .../premade/EnchantedBookKnockbackConfig.java | 2 +- .../premade/EnchantedBookLightningConfig.java | 2 +- .../EnchantedBookLootBonusBlocksConfig.java | 4 +- .../EnchantedBookLootBonusMobsConfig.java | 2 +- .../EnchantedBookLoudStrikesConfig.java | 2 +- .../premade/EnchantedBookLoyaltyConfig.java | 2 +- .../premade/EnchantedBookLuckConfig.java | 2 +- .../premade/EnchantedBookLureConfig.java | 2 +- .../premade/EnchantedBookMendingConfig.java | 2 +- .../EnchantedBookMeteorShowerConfig.java | 2 +- .../premade/EnchantedBookMultishotConfig.java | 2 +- .../premade/EnchantedBookOxygenConfig.java | 4 +- .../premade/EnchantedBookPiercingConfig.java | 2 +- .../EnchantedBookPlasmaBootsConfig.java | 2 +- ...ntedBookProtectionEnvironmentalConfig.java | 2 +- ...chantedBookProtectionExplosionsConfig.java | 4 +- .../EnchantedBookProtectionFallConfig.java | 4 +- .../EnchantedBookProtectionFireConfig.java | 4 +- ...chantedBookProtectionProjectileConfig.java | 4 +- .../EnchantedBookQuickChargeConfig.java | 2 +- .../premade/EnchantedBookRiptideConfig.java | 2 +- .../premade/EnchantedBookSilkTouchConfig.java | 2 +- .../premade/EnchantedBookSoulSpeedConfig.java | 2 +- .../EnchantedBookSweepingEdgeConfig.java | 2 +- .../premade/EnchantedBookThornsConfig.java | 2 +- .../EnchantedBookWaterWorkerConfig.java | 4 +- .../premade/GoblinBallistaItem.java | 2 +- .../customitems/premade/GoblinBootsItem.java | 6 +- .../premade/GoblinChestplateItem.java | 7 +- .../premade/GoblinCleaverItem.java | 7 +- .../customitems/premade/GoblinHelmetItem.java | 7 +- .../premade/GoblinLeggingsItem.java | 7 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 7 +- .../premade/GruntsBootsConfig.java | 2 +- .../premade/GruntsChestplateConfig.java | 2 +- .../premade/GruntsHelmetConfig.java | 2 +- .../premade/GruntsLeggingsConfig.java | 2 +- .../premade/GruntsSwordConfig.java | 2 +- .../premade/InvictusBootsConfig.java | 7 +- .../premade/InvictusChestplateConfig.java | 7 +- .../premade/InvictusHelmetConfig.java | 7 +- .../premade/InvictusLeggingsConfig.java | 7 +- .../premade/InvictusPickaxeConfig.java | 7 +- .../premade/InvictusShovelConfig.java | 7 +- .../premade/InvictusSwordConfig.java | 7 +- .../premade/NovicesSwordConfig.java | 2 +- .../customitems/premade/TheFellerConfig.java | 2 +- .../customitems/premade/TheStingerConfig.java | 2 +- .../premade/VeteransBootsConfig.java | 2 +- .../premade/VeteransChestplateConfig.java | 2 +- .../premade/VeteransHelmetConfig.java | 2 +- .../premade/VeteransLeggingsConfig.java | 2 +- .../premade/VeteransSwordConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 4 +- .../customquests/premade/TestQuestConfig.java | 2 +- .../premade/XmasQuest0Config.java | 2 +- .../DungeonPackagerConfigFields.java | 67 ------ ...inidungeon.java => AirShipMinidungeon.off} | 1 - .../premade/BeastsSanctuaryLair.java | 4 +- .../{CatacombsLair.java => CatacombsLair.off} | 1 - .../{ColosseumLair.java => ColosseumLair.off} | 1 - ...thedralLair.java => DarkCathedralLair.off} | 1 - .../premade/DiamondLeagueArena.java | 6 +- .../premade/EnchantmentChallenge1.java | 3 +- .../premade/EnchantmentChallenge10.java | 5 +- .../premade/EnchantmentChallenge11.java | 3 +- .../premade/EnchantmentChallenge12.java | 3 +- .../premade/EnchantmentChallenge13.java | 3 +- .../premade/EnchantmentChallenge14.java | 3 +- .../premade/EnchantmentChallenge15.java | 3 +- .../premade/EnchantmentChallenge16.java | 3 +- .../premade/EnchantmentChallenge17.java | 3 +- .../premade/EnchantmentChallenge18.java | 3 +- .../premade/EnchantmentChallenge19.java | 3 +- .../premade/EnchantmentChallenge2.java | 5 +- .../premade/EnchantmentChallenge20.java | 3 +- .../premade/EnchantmentChallenge3.java | 5 +- .../premade/EnchantmentChallenge4.java | 7 +- .../premade/EnchantmentChallenge5.java | 5 +- .../premade/EnchantmentChallenge6.java | 5 +- .../premade/EnchantmentChallenge7.java | 5 +- .../premade/EnchantmentChallenge8.java | 3 +- .../premade/EnchantmentChallenge9.java | 5 +- .../premade/IronLeagueArena.java | 4 +- .../premade/KnightCastleLair.java | 6 +- ...dungeon.java => PirateShipMinidungeon.off} | 1 - .../premade/{RuinsLair.java => RuinsLair.off} | 1 - .../premade/SteamworksLair.java | 4 +- .../premade/TheBridgeSanctum.java | 2 +- .../premade/TheCityDungeon.java | 2 +- .../premade/TheMinesDungeon.java | 2 +- .../premade/TheNetherWastes.java | 2 +- .../premade/ThePalaceSanctum.java | 2 +- .../premade/UnderGroveLair.java | 4 +- ...ngeon.java => VampireManorMinidungeon.off} | 1 - .../enchantments/EnchantmentsConfig.java | 8 +- .../EnchantmentsConfigFields.java | 2 +- ...kerConfig.java => AquaAffinityConfig.java} | 6 +- ...onfig.java => BaneOfArthropodsConfig.java} | 6 +- ...Config.java => BlastProtectionConfig.java} | 6 +- .../enchantments/premade/BreachConfig.java | 16 ++ .../enchantments/premade/DensityConfig.java | 16 ++ ...SpeedConfig.java => EfficiencyConfig.java} | 6 +- ...lConfig.java => FeatherFallingConfig.java} | 6 +- ...eConfig.java => FireProtectionConfig.java} | 6 +- ...{ArrowFireConfig.java => FlameConfig.java} | 6 +- ...usBlocksConfig.java => FortuneConfig.java} | 6 +- ...nfiniteConfig.java => InfinityConfig.java} | 6 +- ...onusMobsConfig.java => LootingConfig.java} | 6 +- ...uckConfig.java => LuckOfTheSeaConfig.java} | 6 +- ...rrowDamageConfig.java => PowerConfig.java} | 6 +- ...g.java => ProjectileProtectionConfig.java} | 6 +- ...entalConfig.java => ProtectionConfig.java} | 6 +- ...wKnockbackConfig.java => PunchConfig.java} | 6 +- .../enchantments/premade/RepairConfig.java | 2 +- ...ygenConfig.java => RespirationConfig.java} | 6 +- ...ageAllConfig.java => SharpnessConfig.java} | 6 +- ...mageUndeadConfig.java => SmiteConfig.java} | 6 +- ...ilityConfig.java => UnbreakingConfig.java} | 6 +- .../enchantments/premade/WindBurstConfig.java | 16 ++ .../config/menus/premade/ArenaMenuConfig.java | 9 +- .../menus/premade/CustomQuestMenuConfig.java | 2 +- .../menus/premade/PlayerStatusMenuConfig.java | 85 +++---- .../mobproperties/MobPropertiesConfig.java | 37 ++-- .../premade/EliteBoggedConfig.java | 17 ++ .../mobproperties/premade/EliteBreeze.java | 17 ++ .../premade/EliteSlimeConfig.java | 6 +- .../npcs/premade/BinderOfWorldsNPCConfig.java | 3 +- .../npcs/premade/BoneMonasteryTeleporter.java | 2 +- ...raftenminesLabSanctumTeleporterConfig.java | 2 +- .../npcs/premade/TheCaveTeleporter.java | 4 +- .../npcs/premade/TheCityTeleporter.java | 2 +- .../npcs/premade/TheClimbTeleporter.java | 2 +- .../npcs/premade/TheDeepMinesTeleporter.java | 4 +- .../npcs/premade/TheMinesTeleporter.java | 2 +- .../premade/TheNetherWastesTeleporter.java | 2 +- .../npcs/premade/ThePalaceTeleporter.java | 2 +- .../npcs/premade/TheQuarryTeleporter.java | 2 +- .../potioneffects/PotionEffectsConfig.java | 26 ++- ...astDiggingConfig.java => HasteConfig.java} | 6 +- .../potioneffects/premade/InfestedConfig.java | 13 ++ ...rmConfig.java => InstantDamageConfig.java} | 6 +- ...alConfig.java => InstantHealthConfig.java} | 6 +- .../{JumpConfig.java => JumpBoostConfig.java} | 6 +- ...ngConfig.java => MiningFatigueConfig.java} | 6 +- ...ConfusionConfig.java => NauseaConfig.java} | 6 +- .../potioneffects/premade/OozingConfig.java | 13 ++ .../potioneffects/premade/RaidOmenConfig.java | 13 ++ ...tanceConfig.java => ResistanceConfig.java} | 6 +- .../{SlowConfig.java => SlownessConfig.java} | 6 +- ...eDamageConfig.java => StrengthConfig.java} | 6 +- .../premade/TrialOmenConfig.java | 13 ++ .../potioneffects/premade/WeavingConfig.java | 13 ++ .../premade/WindChargedConfig.java | 13 ++ .../powers/premade/GoldShotgunConfig.java | 4 +- .../powers/premade/LightningBoltsConfig.java | 4 +- ...onfig.java => AGAirshipWormholeConfig.off} | 0 .../AGBeastsSanctuaryWormholeConfig.java | 2 +- ...fig.java => AGCatacombsWormholeConfig.off} | 0 ...fig.java => AGColosseumWormholeConfig.off} | 0 ...java => AGDarkCathedralWormholeConfig.off} | 0 .../AGKnightsCastleWormholeConfig.java | 2 +- ...eConfig.java => AGRuinsWormholeConfig.off} | 0 .../premade/AGUnderGroveWormholeConfig.java | 2 +- ....java => AGVampireManorWormholeConfig.off} | 0 .../elitemobs/dungeons/EMPackage.java | 4 +- .../dungeons/SchematicDungeonPackage.java | 208 ------------------ .../elitemobs/dungeons/SchematicPackage.java | 132 ----------- .../elitemobs/events/ActionEvent.java | 4 +- .../nightmaremodeworld/DaylightWatchdog.java | 35 --- .../gamemodes/zoneworld/EliteChunk.java | 45 ---- .../elitemobs/gamemodes/zoneworld/Grid.java | 62 ------ .../gamemodes/zoneworld/ZoneWarner.java | 49 ----- .../instanced/InstancePlayerManager.java | 3 +- .../instanced/arena/ArenaInstance.java | 7 +- .../instanced/dungeons/DungeonInstance.java | 4 +- .../elitemobs/items/EliteItemLore.java | 6 +- .../elitemobs/items/ItemLootShower.java | 3 +- .../magmaguy/elitemobs/items/ShareItem.java | 2 +- .../EarthquakeEnchantment.java | 2 +- .../CurrencyCustomLootEntry.java | 11 +- .../customloottable/CustomLootTable.java | 2 +- .../customloottable/EliteCustomLootEntry.java | 9 +- .../customloottable/SharedLootTable.java | 1 - .../itemconstructor/EnchantmentGenerator.java | 68 +++--- .../itemconstructor/ItemQualityColorizer.java | 4 +- .../potioneffects/ElitePotionEffect.java | 17 +- .../potioneffects/custom/Saturation.java | 2 +- .../menus/InstancedDungeonBrowser.java | 3 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 3 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 2 +- .../elitemobs/mobconstructor/BossType.java | 8 + .../elitemobs/mobconstructor/CustomSpawn.java | 9 +- .../elitemobs/mobconstructor/EliteEntity.java | 7 +- .../PersistentObjectHandler.java | 2 +- .../custombosses/BossMusic.java | 4 +- .../custombosses/CustomBossMegaConsumer.java | 4 +- .../custombosses/CustomBossTrail.java | 3 +- .../custombosses/RegionalBossEntity.java | 16 +- .../transitiveblocks/TransitiveBossBlock.java | 3 - .../mobdata/aggressivemobs/EliteBee.java | 4 - .../mobdata/aggressivemobs/EliteGoat.java | 4 - .../mobdata/aggressivemobs/EliteHoglin.java | 4 - .../mobdata/aggressivemobs/ElitePiglin.java | 4 - .../aggressivemobs/ElitePiglinBrute.java | 4 - .../mobdata/aggressivemobs/EliteWarden.java | 4 - .../mobdata/aggressivemobs/EliteZoglin.java | 4 - .../aggressivemobs/EliteZombifiedPiglin.java | 4 - .../NaturalMobSpawnEventHandler.java | 18 +- .../elitemobs/npcs/NPCDamageEvent.java | 2 +- .../elitemobs/pathfinding/Navigation.java | 24 +- .../playerdata/statusscreen/GearPage.java | 21 +- .../playerdata/statusscreen/StatsPage.java | 2 +- .../elitemobs/powers/EnderDragonTornado.java | 2 +- .../powers/InvulnerabilityArrow.java | 2 +- .../powers/InvulnerabilityFallDamage.java | 2 +- .../powers/InvulnerabilityFireworks.java | 2 +- .../magmaguy/elitemobs/powers/SpiritWalk.java | 2 +- .../com/magmaguy/elitemobs/powers/Taunt.java | 2 +- .../powers/meta/CustomSummonPower.java | 14 +- .../elitemobs/powers/scripts/EliteScript.java | 3 +- .../powers/scripts/ScriptAction.java | 2 - .../powers/scripts/ScriptActionData.java | 4 +- .../powers/scripts/ScriptConditions.java | 2 +- .../powers/scripts/ScriptParticles.java | 12 +- .../powers/scripts/ScriptRelativeVector.java | 6 +- .../elitemobs/powers/scripts/ScriptZone.java | 12 +- .../caching/ScriptActionBlueprint.java | 18 +- .../caching/ScriptConditionsBlueprint.java | 6 +- .../caching/ScriptParticlesBlueprint.java | 6 +- .../ScriptRelativeVectorBlueprint.java | 3 +- .../powerstances/MajorPowerPowerStance.java | 4 +- .../powerstances/MinorPowerPowerStance.java | 4 +- .../powerstances/VisualEffectObfuscator.java | 2 +- .../elitemobs/quests/DynamicQuest.java | 2 +- .../elitemobs/quests/QuestTracking.java | 3 +- .../custommodels/CustomModelInterface.java | 20 +- .../freeminecraftmodels/CustomModelFMM.java | 2 +- .../thirdparty/mythicmobs/MythicMobs.java | 2 +- .../mythicmobs/MythicMobsInterface.java | 4 +- .../placeholderapi/Placeholders.java | 2 +- .../thirdparty/worldedit/WorldEditUtils.java | 75 ------- .../worldguard/WorldGuardCompatibility.java | 78 ++----- .../WorldGuardExplosionBlockDamageFlag.java | 8 +- .../treasurechest/TreasureChest.java | 5 +- .../elitemobs/utils/DebugBlockLocation.java | 8 +- .../elitemobs/utils/WorldInstantiator.java | 2 +- .../elitemobs/utils/shapes/Cuboid.java | 4 +- .../versionnotifier/VersionChecker.java | 2 +- .../magmaguy/elitemobs/wormhole/Wormhole.java | 2 +- .../elitemobs/wormhole/WormholeEntry.java | 3 - src/main/resources/plugin.yml | 3 +- 324 files changed, 969 insertions(+), 1760 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TreasureChestCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{AirShipMinidungeon.java => AirShipMinidungeon.off} (99%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{CatacombsLair.java => CatacombsLair.off} (96%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{ColosseumLair.java => ColosseumLair.off} (97%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{DarkCathedralLair.java => DarkCathedralLair.off} (96%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{PirateShipMinidungeon.java => PirateShipMinidungeon.off} (98%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{RuinsLair.java => RuinsLair.off} (96%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{VampireManorMinidungeon.java => VampireManorMinidungeon.off} (99%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{WaterWorkerConfig.java => AquaAffinityConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DamageArthropodsConfig.java => BaneOfArthropodsConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionExplosionsConfig.java => BlastProtectionConfig.java} (64%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BreachConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DensityConfig.java rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DigSpeedConfig.java => EfficiencyConfig.java} (69%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionFallConfig.java => FeatherFallingConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionFireConfig.java => FireProtectionConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowFireConfig.java => FlameConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{LootBonusBlocksConfig.java => FortuneConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowInfiniteConfig.java => InfinityConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{LootBonusMobsConfig.java => LootingConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{LuckConfig.java => LuckOfTheSeaConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowDamageConfig.java => PowerConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionProjectileConfig.java => ProjectileProtectionConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionEnvironmentalConfig.java => ProtectionConfig.java} (63%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowKnockbackConfig.java => PunchConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{OxygenConfig.java => RespirationConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DamageAllConfig.java => SharpnessConfig.java} (69%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DamageUndeadConfig.java => SmiteConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DurabilityConfig.java => UnbreakingConfig.java} (69%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WindBurstConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBoggedConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{FastDiggingConfig.java => HasteConfig.java} (64%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InfestedConfig.java rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{HarmConfig.java => InstantDamageConfig.java} (64%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{HealConfig.java => InstantHealthConfig.java} (64%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{JumpConfig.java => JumpBoostConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{SlowDiggingConfig.java => MiningFatigueConfig.java} (64%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{ConfusionConfig.java => NauseaConfig.java} (65%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/OozingConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/RaidOmenConfig.java rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{DamageResistanceConfig.java => ResistanceConfig.java} (62%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{SlowConfig.java => SlownessConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{IncreaseDamageConfig.java => StrengthConfig.java} (63%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/TrialOmenConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WeavingConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WindChargedConfig.java rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGAirshipWormholeConfig.java => AGAirshipWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGCatacombsWormholeConfig.java => AGCatacombsWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGColosseumWormholeConfig.java => AGColosseumWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGDarkCathedralWormholeConfig.java => AGDarkCathedralWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGRuinsWormholeConfig.java => AGRuinsWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGVampireManorWormholeConfig.java => AGVampireManorWormholeConfig.off} (100%) delete mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/SchematicDungeonPackage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/SchematicPackage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/nightmaremodeworld/DaylightWatchdog.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/EliteChunk.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/Grid.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/ZoneWarner.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/thirdparty/worldedit/WorldEditUtils.java diff --git a/build.gradle b/build.gradle index f93122c7f..512568176 100644 --- a/build.gradle +++ b/build.gradle @@ -82,8 +82,6 @@ dependencies { implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //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 diff --git a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java index ef5b50091..1916f0a58 100644 --- a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java @@ -19,7 +19,7 @@ public static String convert(String string) { } public static List convert(List list) { - if (list == null)return new ArrayList<>(); + if (list == null) return new ArrayList<>(); List convertedList = new ArrayList<>(); for (Object value : list) convertedList.add(convert(value + "")); diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index eb42590a0..f435ce4fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -32,8 +32,6 @@ 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; @@ -79,8 +77,6 @@ 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; @@ -123,12 +119,6 @@ public static void worldScanner() { for (World world : Bukkit.getWorlds()) if (ValidWorldsConfig.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); - } } } @@ -341,8 +331,6 @@ public void onDisable() { 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..."); @@ -391,7 +379,6 @@ public void onDisable() { Repeating tasks that run as long as the server is on */ private void launchRunnables() { - if (!zoneBasedSpawningWorlds.isEmpty()) Grid.initializeGrid(); //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 75a115e83..28ece61c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -19,8 +19,6 @@ 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; @@ -105,9 +103,8 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDisenchantment()) register(new ItemDisenchantPrevention()); - if (!VersionChecker.serverVersionOlderThan(15, 2)) - if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) - register(new PreventUpgradeDiamondToNetherite()); + if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) + register(new PreventUpgradeDiamondToNetherite()); //Mob damage register(new EliteMobGenericDamagedHandler()); @@ -213,7 +210,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()); @@ -265,8 +261,7 @@ public static void registerEvents() { register(new LootMenu.LootMenuEvents()); //Minecraft behavior canceller - if (!VersionChecker.serverVersionOlderThan(16, 0)) - register(new PreventEliteBeeHiveEnter()); + register(new PreventEliteBeeHiveEnter()); register(new EnderDragonUnstuck()); if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities()) register(new VanillaReinforcementsCanceller()); @@ -286,9 +281,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()); @@ -367,10 +360,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/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 5f3b3b49e..2f8f5258b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -16,7 +16,6 @@ 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -139,7 +138,7 @@ private static double secondaryEnchantmentDamageIncrease(Player player, LivingEn 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.SMITE.getMaxLevel(); if (level < 1) return 0D; @@ -258,7 +257,7 @@ else if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE)) private void runAntiexploit(EliteEntity eliteEntity, EntityDamageByEntityEvent event, EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent) { 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/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 a72c2fd35..a6457ac7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java +++ b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java @@ -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/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index fb9391902..a3566e5c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; public class LightningImmunity implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onLightningStrike(EntityDamageByEntityEvent event){ + @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; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index 631dbe4b2..c25f8cdc5 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; 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/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/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index a53f51b46..0872c5094 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java @@ -64,7 +64,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); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index c87210ed9..43bce68e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -257,30 +257,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde 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)), diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java index 13f259eb9..eb0b29814 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java @@ -2,8 +2,6 @@ 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 org.bukkit.Location; @@ -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/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java index d3a5658be..9b4681e3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -32,7 +32,7 @@ public static void spawnEliteEntityTypeCommand(Player player, EntityType entityT EliteEntity eliteEntity = new EliteEntity(); eliteEntity.setLevel(level); - if (powers.isPresent()){ + if (powers.isPresent()) { HashSet mobPowers = getPowers(powers.get(), player); eliteEntity.applyPowers(mobPowers); } else { @@ -152,20 +152,19 @@ 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; } 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 9b2619d06..58e975378 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -57,7 +57,6 @@ public static void get(Player player, int tierLevel) { new EliteItemLore(bow, false); - player.getInventory().addItem(helmet); player.getInventory().addItem(chestplate); player.getInventory().addItem(leggings); @@ -69,7 +68,7 @@ public static void get(Player player, int tierLevel) { } - private static void addDurability(ItemStack itemStack){ + private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); HashMap enchantmentIntegerHashMap = new HashMap<>(); enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); 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..3ff071457 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -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/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java index cc533cde0..cb8d145b0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java @@ -2,11 +2,8 @@ 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; @@ -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/setup/SetupMenu.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java index d8aa49803..29e3b0689 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -7,7 +7,6 @@ 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; @@ -132,10 +131,7 @@ private static void dungeonButtonInteraction(Player player, SetupMenu setupMenu, return; } if (!emPackage.isInstalled()) - if (emPackage instanceof SchematicPackage) - emPackage.install(player, true); - else emPackage.install(player); - else if (emPackage instanceof SchematicPackage) emPackage.uninstall(player); + 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!"); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 82b145e0d..64093b316 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -5,7 +5,6 @@ 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 org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -80,7 +79,6 @@ public static void fileSaverOnlyDefaults(FileConfiguration fileConfiguration, Fi } private static void setComments(FileConfiguration fileConfiguration, String key, List comments) { - if (VersionChecker.serverVersionOlderThan(18, 2)) return; fileConfiguration.setComments(key, comments); } @@ -196,13 +194,13 @@ public static ItemStack setItemStack(File file, FileConfiguration fileConfigurat } 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."); } 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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java index 218dcd24b..22fbef2d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -54,14 +54,14 @@ public static void createResourcePack(CommandSender commandSender) { 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")); + 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")); + 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!"); + 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; @@ -175,7 +175,7 @@ private static void copyFile(File file, Path targetPath) { 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!"); + 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!"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java index 87f384a23..1848717fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java @@ -169,7 +169,7 @@ private void initialize(File file) { 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/"); + new WarningMessage("You can check the file validity by through YAML linters, such as the one at https://www.yamllint.com/"); ex.printStackTrace(); return; } @@ -184,8 +184,8 @@ private void initialize(File file) { //Store for use by the plugin addCustomConfigFields(file.getName(), instancedCustomConfigFields); } catch (Exception ex) { - new WarningMessage("Bad constructor for file " + file.getName()); - ex.printStackTrace(); + new WarningMessage("Bad constructor for file " + file.getName() + " ! You should probably delete that file."); +// ex.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index 61c212daf..bb73aa64f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -193,12 +193,11 @@ 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); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index a5a29b2bb..9aef67a34 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -205,17 +204,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."), diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java index 0aa4c0dad..53be17872 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java @@ -13,6 +13,7 @@ public class ItemUpgradeSystemConfig { private static double enchantedBookChance; @Getter private static double scrapChance; + private ItemUpgradeSystemConfig() { } 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..d71f4b62e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -0,0 +1,76 @@ +package com.magmaguy.elitemobs.config; + +import java.util.Locale; + +public class LegacyValueConverter { + private LegacyValueConverter() { + } + + public static String parseEnchantment(String materialName) { + switch (materialName.toUpperCase(Locale.ROOT)) { + case "POWER": + return "POWER"; + case "ARROW_FIRE": + return "FLAME"; + case "ARROW_INFINITE": + return "INFINITY"; + case "ARROW_KNOCKBACK": + return "PUNCH"; + case "BANE_OF_ARTHROPODS": + return "BANE_OF_ARTHROPODS"; + case "SMITE": + return "SMITE"; + case "EFFICIENCY": + return "EFFICIENCY"; + case "DURABILITY": + return "UNBREAKING"; + case "FORTUNE": + 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 "FEATHER_FALLING": + return "FEATHER_FALLING"; + case "FIRE_PROTECTION": + return "FIRE_PROTECTION"; + case "PROJECTILE_PROTECTION": + return "PROJECTILE_PROTECTION"; + case "AQUA_AFFINITY": + 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; + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java index dc58e0f94..01b60cec2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -6,7 +6,8 @@ import java.util.List; public class ModelsConfig { - private ModelsConfig(){} + private ModelsConfig() { + } public static String treasureChest; diff --git a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java index 68e14d13e..90a6d68a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -5,7 +5,6 @@ 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 lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -282,15 +281,13 @@ private static List setEntityTypes(FileConfiguration fileConfigurati 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); - } + 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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java index cdb862561..1a077e54a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java @@ -82,7 +82,7 @@ public static void toggleEliteMobsResourcePackStatus(boolean status) { } } - public static void toggleForceResourcePack(boolean status){ + public static void toggleForceResourcePack(boolean status) { fileConfiguration.set("forceResourcePack", status); forceResourcePack = status; } diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index cfdacdc37..2afad9dc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import lombok.Getter; import org.bukkit.configuration.file.FileConfiguration; @@ -108,11 +107,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"), diff --git a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java index 9d4cf42ca..e93f52dbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -14,10 +14,6 @@ public class ValidWorldsConfig { @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; @@ -37,17 +33,6 @@ public static void initializeConfig() { 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); } 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..898bc3ae7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -6,6 +6,7 @@ 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; @@ -214,6 +215,8 @@ public class CustomBossesConfigFields extends CustomConfigFields implements Cust private boolean neutral = false; @Getter private String onKillMessage; + @Getter + private BossType bossType = BossType.NORMAL; /** * Creates a new default pre-made Custom Boss. The boss is further customized through a builder pattern. @@ -382,6 +385,13 @@ 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) { + new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); + } } public boolean isCustomModelExists() { 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 619e3e933..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,12 +9,10 @@ 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); 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 352f889a2..d9ded5199 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,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; @@ -11,12 +10,10 @@ 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")); setUniqueLootList(Collections.singletonList("the_stinger.yml:1")); setTrails(Arrays.asList(Particle.LARGE_SMOKE.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..1a887fa97 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,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.Material; import org.bukkit.Particle; import org.bukkit.entity.EntityType; @@ -40,11 +39,10 @@ public TestCustomBossesConfig() { 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/TotemZombie1Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie1Boss.java index ea777cb8e..f23c6b3c0 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,13 +15,11 @@ public TotemZombie1Boss() { setPowers(Arrays.asList("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/WeaponsGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WeaponsGoblinBoss.java index e8e873678..4410a3ef6 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -18,14 +17,12 @@ 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")); setSpawnMessage("&cA Weapons Goblin has been sighted!"); 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..36f73b115 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -12,12 +11,10 @@ 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")); 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..19505489b 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -17,8 +16,7 @@ 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", "shield_wall.yml", 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..0c1b37520 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,8 +15,7 @@ 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", "flame_pyre.yml", 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..84cd323d2 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,8 +15,7 @@ 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", "lightning_bolts.yml", 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/CustomItemsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java index aac25d720..2ceac6f6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java @@ -2,7 +2,9 @@ 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.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -83,5 +85,46 @@ 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(",")) { + new WarningMessage("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(",")) { + new WarningMessage("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; } } 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 ccfac6f38..722f4e7e8 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 36f4ced2f..af578aa61 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 c5af48d8d..e09906e3b 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 3d82b0ca9..18192d44d 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 1db6f4ca5..a760313e7 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/DwarvenGreedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java index 418e667b8..cd672c0c7 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 @@ -13,7 +13,7 @@ public DwarvenGreedConfig() { 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", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("FORTUNE,4", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/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/EnchantedBookArrowKnockbackConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowKnockbackConfig.java index 9d8089859..c3bf2e7e3 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,7 +8,7 @@ import java.util.List; public class EnchantedBookArrowKnockbackConfig extends CustomItemsConfigFields { - public EnchantedBookArrowKnockbackConfig(){ + public EnchantedBookArrowKnockbackConfig() { super("enchanted_book_arrow_knockback", true, Material.BOOK, 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 84434f406..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,7 +8,7 @@ import java.util.List; public class EnchantedBookDurabilityConfig extends CustomItemsConfigFields { - public EnchantedBookDurabilityConfig(){ + public EnchantedBookDurabilityConfig() { super("enchanted_book_durability", true, Material.BOOK, 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..538c7bb27 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,7 +8,7 @@ import java.util.List; public class EnchantedBookFlameConfig extends CustomItemsConfigFields { - public EnchantedBookFlameConfig(){ + public EnchantedBookFlameConfig() { super("enchanted_book_arrow_fire", true, Material.BOOK, 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..a8e5d11f1 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,7 +8,7 @@ import java.util.List; public class EnchantedBookLuckConfig extends CustomItemsConfigFields { - public EnchantedBookLuckConfig(){ + public EnchantedBookLuckConfig() { super("enchanted_book_luck", true, Material.BOOK, 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 577f5e94b..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,7 +8,7 @@ import java.util.List; public class EnchantedBookProtectionEnvironmentalConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionEnvironmentalConfig(){ + public EnchantedBookProtectionEnvironmentalConfig() { super("enchanted_book_protection_environmental", true, Material.BOOK, 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/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 5c7be6b92..051a010f0 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 @@ -14,7 +14,7 @@ public GoblinBallistaItem() { Material.CROSSBOW, "&8Goblin Ballista", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "QUICK_CHARGE,3", "MULTISHOT,1")); + setEnchantments(Arrays.asList("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 f0ff0e047..824e68316 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,7 +2,6 @@ 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; @@ -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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setMaterial(Material.NETHERITE_BOOTS); + setEnchantments(Arrays.asList("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 70aaec84d..a6d88b11b 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 0538c35be..4634322c2 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 1162ad080..0fdb800ea 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 897d3746b..c3e741248 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 b526d6687..1f909e5d8 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 @@ -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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 24d535131..1a6fb6613 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,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 1fae1f440..7e3eef251 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 7fa585ec3..58bebb3fc 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,5", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 98fb62745..4b9e48791 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 ac575075a..9a9dd33b4 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 ee4d9ad47..7439c8751 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 b74955375..111c8de7a 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 5862f2613..8ea25d6f4 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_boots", true, Material.NETHERITE_BOOTS, "&4Invictus Boots", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 260a1c496..cd9caded1 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_chestplate", true, Material.NETHERITE_CHESTPLATE, "&4Invictus Chestplate", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 7d3c68654..12beeca3a 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_helmet", true, Material.NETHERITE_HELMET, "&4Invictus Helmet", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 2d1efceec..5d0f114e3 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_leggings", true, Material.NETHERITE_LEGGINGS, "&4Invictus Leggings", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 8cc544edc..7b43f3e85 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_pickaxe", true, Material.NETHERITE_PICKAXE, "&4Invictus Pickaxe", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 ec619b4a5..dab2b0359 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_shovel", true, Material.NETHERITE_SHOVEL, "&4Invictus Shovel", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 d2adb23c1..72e8632ca 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_sword", true, Material.NETHERITE_SWORD, "&4Invictus Sword", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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/NovicesSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java index 4b042a516..08395d999 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 870774e8c..956586568 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 @@ -13,7 +13,7 @@ public TheFellerConfig() { 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", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("FORTUNE,4", "SILK_TOUCH,1", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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 7564e67c5..8ddacaf59 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 @@ -14,7 +14,7 @@ public TheStingerConfig() { Material.GOLDEN_SWORD, "&eThe Stinger", Arrays.asList("&aFloat like a butterfly,", "&asting like a bee!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "UNBREAKING,1", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("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/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index fa3e7ae30..8860d84b7 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 213a0facb..9284f9720 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 a702eeac8..bdb6b7cf0 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 f812d7d5b..b9c51e254 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 436c6204e..bfbadbfcd 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index ea50b9ea5..9fb072f1c 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); setPotionEffects(Arrays.asList("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 87c897770..cfc38d25e 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 @@ -13,8 +13,8 @@ public ZombieKingsAxeConfig() { 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", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "WATER_WORKER,5", "FLAMETHROWER,1")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", + "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); setPotionEffects(Arrays.asList("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/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/XmasQuest0Config.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/XmasQuest0Config.java index b0fb4797f..b7ee0e5d4 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 @@ -10,7 +10,7 @@ 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")), + Map.of("Objective1", Map.of("objectiveType", "FETCH_ITEM", "filename", "xmas_lost_present.yml", "amount", 10, "itemName", "Lost Present")), Arrays.asList( "filename=xmas_treat.yml:amount=10:chance=.3", "filename=xmas_treat_v2.yml:amount=1:chance=.3", 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..d6bd939a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -2,8 +2,6 @@ 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 lombok.Getter; @@ -49,7 +47,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; @@ -305,11 +302,6 @@ public DungeonPackagerConfigFields(String fileName, 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); @@ -337,14 +329,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); @@ -390,29 +374,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 +390,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/AirShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off similarity index 99% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off index 62ee849a6..16cea48dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.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; 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..e9dd5f275 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,14 +4,14 @@ 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, "&2[lvl 130] &6The Beasts Sanctuary", - Arrays.asList("&6Confront the beasts!"), + List.of("&6Confront the beasts!"), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.LAIR, "em_beasts_sanctuary", 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 96% 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..be0c67159 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; 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 97% 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..1c259c713 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; 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.off similarity index 96% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off index 6ac37644d..4a620649a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.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; 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..256016c36 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, "&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", 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..81547090c 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge1() { super("enchantment_challenge_1_sanctum", false, "&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", 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..2fed2e58c 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, "&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", 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..f43af8bca 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge11() { super("enchantment_challenge_11_sanctum", false, "&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", 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..602b051e7 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge12() { super("enchantment_challenge_12_sanctum", false, "&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", 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..a7fe23b3a 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge13() { super("enchantment_challenge_13_sanctum", false, "&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", 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..b99263a7a 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge14() { super("enchantment_challenge_14_sanctum", false, "&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", 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..18ce21bbe 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge15() { super("enchantment_challenge_15_sanctum", false, "&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", 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..de617c2f4 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge16() { super("enchantment_challenge_16_sanctum", false, "&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", 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..f6454d65d 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge17() { super("enchantment_challenge_17_sanctum", false, "&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", 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..281594d1e 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge18() { super("enchantment_challenge_18_sanctum", false, "&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", 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..1eb473381 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge19() { super("enchantment_challenge_19_sanctum", false, "&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", 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..3ab15ee7a 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, "&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", 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..93db6c776 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge20() { super("enchantment_challenge_20_sanctum", false, "&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", 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..f1a315127 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, "&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", 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..468658c26 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, "&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", @@ -29,7 +28,7 @@ public EnchantmentChallenge4(){ "em_id_enchantment_challenge_4", 1); 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..7d651e30d 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, "&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", 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..9e9a723dd 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, "&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", 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..e314b3c84 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, "&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", 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..42a76e44b 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge8() { super("enchantment_challenge_8_sanctum", false, "&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", 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..30c2dc208 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, "&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", 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..5f3ae29c8 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, "&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", 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..2b2ed7af9 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,14 +4,14 @@ 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, "&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", @@ -25,6 +25,6 @@ public KnightCastleLair() { "&fAssault the castle!", "&fNow leaving the castle!", "the_knight_castle" - ); + ); } } 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.off similarity index 98% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off index 431fbd020..8b11cfa7d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.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; 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 96% 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..c7cd8aceb 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; 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..e8ffd7191 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,14 +4,14 @@ 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, "&2[lvl 140] &6The Steamworks", - Arrays.asList("&fA steampunk inspired lair!"), + List.of("&fA steampunk inspired lair!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_steamworks_lair", 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..519fa12dd 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheBridgeSanctum extends DungeonPackagerConfigFields { - public TheBridgeSanctum(){ + public TheBridgeSanctum() { super("the_bridge_sanctum", false, "&2[lvl 025] &3The Bridge Sanctum", 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..e38f58c8c 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheCityDungeon extends DungeonPackagerConfigFields { - public TheCityDungeon(){ + public TheCityDungeon() { super("the_city_dungeon", false, "&2[lvl 030] &3The City Dungeon", 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..4fffed566 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheMinesDungeon extends DungeonPackagerConfigFields { - public TheMinesDungeon(){ + public TheMinesDungeon() { super("the_mines_dungeon", false, "&2[lvl 020] &3The Mines Dungeon", 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..76f06d123 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheNetherWastes extends DungeonPackagerConfigFields { - public TheNetherWastes(){ + public TheNetherWastes() { super("the_nether_wastes_dungeon", false, "&2[lvl 050] &3The Nether Wastes Dungeon", 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..b115b2f63 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 @@ -9,7 +9,7 @@ import java.util.Map; public class ThePalaceSanctum extends DungeonPackagerConfigFields { - public ThePalaceSanctum(){ + public ThePalaceSanctum() { super("the_palace_sanctum", false, "&2[lvl 030] &3The Palace Sanctum", 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..2e4c88416 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,14 +4,14 @@ 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, "&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", 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 99% 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..008a99de9 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; 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..16bd68c60 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,7 @@ package com.magmaguy.elitemobs.config.enchantments; import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -20,10 +21,15 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { + EnchantmentsConfigFields test = enchantments.get(string); + if (test == null) { + new WarningMessage("Failed to find enchant file " + string); + new Exception().printStackTrace(); + } return enchantments.get(string); } 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/premade/ArenaMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ArenaMenuConfig.java index 47dce9098..90c0f330b 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 @@ -4,7 +4,6 @@ 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 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/CustomQuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java index 0e418cfe3..83d08f73b 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 @@ -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/PlayerStatusMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/PlayerStatusMenuConfig.java index 4a4aaaafe..bc487f6e2 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 @@ -5,7 +5,6 @@ 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 lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -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); @@ -406,30 +400,21 @@ public void processAdditionalFields() { ItemStackGenerator.generateItemStack(Material.DIAMOND_SWORD, "&4Damage: $damage", Arrays.asList("&fBase damage dealt to Elites.", - "&fBased on the level of your weapon!")),true); + "&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); + "&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", + Arrays.asList("&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); @@ -442,34 +427,22 @@ public void processAdditionalFields() { "&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", + 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); 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", @@ -478,7 +451,7 @@ public void processAdditionalFields() { Arrays.asList("&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", @@ -506,7 +479,7 @@ public void processAdditionalFields() { 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!", 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 8ef3f3b26..487606694 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -2,7 +2,6 @@ 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; @@ -47,7 +46,18 @@ public class MobPropertiesConfig { 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 EliteBreeze() + )); public static HashMap getMobProperties() { @@ -59,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/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/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java new file mode 100644 index 000000000..e89c9d654 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.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 EliteBreeze extends MobPropertiesConfigFields { + public EliteBreeze() { + super("elite_breeze", + EntityType.BOGGED, + 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/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/npcs/premade/BinderOfWorldsNPCConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BinderOfWorldsNPCConfig.java index d388d2838..774e587bd 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 @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class BinderOfWorldsNPCConfig extends NPCsConfigFields { public BinderOfWorldsNPCConfig() { @@ -15,7 +16,7 @@ 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( "The things I've seen...\\nYou wouldn't believe it.", 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/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/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/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/potioneffects/PotionEffectsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java index b517caa87..92191d0e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java @@ -14,34 +14,40 @@ public class PotionEffectsConfig { 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) { 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/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/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/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 9c9270745..49b1dd578 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -72,7 +72,7 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - new SchematicDungeonPackage(dungeonPackagerConfigFields); + new WarningMessage("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; } } else { @@ -88,7 +88,7 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldDungeonPackage(dungeonPackagerConfigFields); break; case SCHEMATIC: - new SchematicDungeonPackage(dungeonPackagerConfigFields); + new WarningMessage("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; } } 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/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 006f73e15..7df8ac857 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -8,7 +8,6 @@ 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 org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -153,8 +152,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/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/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/arena/ArenaInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java index aeddbb268..d05ed83d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -262,9 +262,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 + 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!"); } } } 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..bd09fa72a 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -74,7 +74,7 @@ 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); + }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -250,7 +250,7 @@ public void run() { }.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 + }.runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } private void setDifficulty(String difficultyName) { diff --git a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 28e002484..22c49b336 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -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..7513c9976 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -54,10 +54,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; } 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 e79b2a59f..7e3553b1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java @@ -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/customloottable/CurrencyCustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java index 1cdd85ce5..4816fed96 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java @@ -74,14 +74,17 @@ 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); + case "currencyamount" -> + currencyAmount = MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename); default -> new WarningMessage("Failed to read custom loot option " + key + " in " + configFilename); } } 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..a19a3766f 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java @@ -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..8423326d4 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java @@ -48,9 +48,12 @@ 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); } 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..506bc5baf 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java @@ -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 48f41b6c8..3af70a168 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,9 +71,9 @@ 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("SHARPNESS")); + validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("SMITE")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); @@ -83,7 +83,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case BOW: - validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); + validEnchantments.putAll(validateEnchantments("POWER")); validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); @@ -92,7 +92,7 @@ public static HashMap generateEnchantments(double itemTier 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")); @@ -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("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("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,13 +137,13 @@ 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("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")); } @@ -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("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: @@ -177,13 +177,13 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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: @@ -193,9 +193,9 @@ public static HashMap generateEnchantments(double itemTier 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; @@ -208,9 +208,9 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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; @@ -223,10 +223,10 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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")); @@ -241,7 +241,7 @@ public static HashMap generateEnchantments(double itemTier 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("UNBREAKING")); 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 be472ba44..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); } 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..a591776c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -2,6 +2,8 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfig; import com.magmaguy.elitemobs.utils.WarningMessage; +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -18,10 +20,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", stringObject[0].toLowerCase(Locale.ROOT))); + if (potionEffectType == null) { + new WarningMessage("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,8 +45,8 @@ 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) { 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/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index 3c4f8869f..fb0193d01 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -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..2fc5c4b40 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -213,7 +213,8 @@ private void handleBottomInventory(InventoryClickEvent event) { moveOneItemUp(ENCHANTED_BOOK_SLOT, event); else //Make sure enchant books themselves can't be enchanted - return; + { + } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && event.getView().getTopInventory().getItem(LUCKY_TICKET_SLOT) == null) { moveOneItemUp(LUCKY_TICKET_SLOT, event); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index 92cdcf069..9193dfbd8 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -173,7 +173,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); 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..98bde5175 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -0,0 +1,8 @@ +package com.magmaguy.elitemobs.mobconstructor; + +public enum BossType { + NORMAL, + MINIBOSS, + BOSS, + 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..54233739c 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -15,7 +15,6 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.*; @@ -241,7 +240,8 @@ 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 (Boolean.FALSE.equals(playerLocation.getWorld().getGameRuleValue(GameRule.DO_MOB_SPAWNING))) + continue; if (!customSpawnConfigFields.getValidWorlds().isEmpty()) if (!customSpawnConfigFields.getValidWorlds().contains(playerLocation.getWorld())) continue; @@ -275,10 +275,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..879e9c211 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -23,7 +23,6 @@ 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 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); @@ -283,11 +282,11 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR 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); } 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/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java index a31a596d6..caefe80e1 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java @@ -115,13 +115,13 @@ public void run() { cancel(); return; } - player.playSound(player.getLocation(), name, 1f, 1f); + 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); + player.playSound(player.getLocation(), name, 1f, 1f); songTask = new BukkitRunnable() { @Override public void run() { 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..9cfa6b5cd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java @@ -173,8 +173,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); 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 4ea55665d..a18650c41 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -5,7 +5,6 @@ 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 org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; @@ -49,7 +48,7 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - if (!VersionChecker.serverVersionOlderThan(18, 0) && particle.equals(Particle.BLOCK_MARKER)) + if (particle.equals(Particle.BLOCK_MARKER)) return; bukkitTasks.add(new BukkitRunnable() { @Override 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..f78da9a09 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; @@ -21,8 +20,6 @@ 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; @@ -310,21 +307,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/TransitiveBossBlock.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBossBlock.java index 193a30a5a..a8f11a3de 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,7 +2,6 @@ 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; @@ -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(); 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/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/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/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/mobspawning/NaturalMobSpawnEventHandler.java b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java index c3b1f21f1..3337129c3 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 || @@ -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/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index b6b8d4ae3..178143ea8 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -37,18 +37,18 @@ 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(); } @EventHandler(ignoreCancelled = true) 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/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/powers/EnderDragonTornado.java b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java index 270750255..2275bd811 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java @@ -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/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/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/Taunt.java b/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java index 60c8be7aa..0f440e84d 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java @@ -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/meta/CustomSummonPower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java index 5cf702d56..ba34e1394 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -9,7 +9,6 @@ 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; @@ -655,18 +654,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/scripts/EliteScript.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java index a7170f9a0..e93ffe173 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java @@ -89,7 +89,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..2de641a7a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -14,7 +14,6 @@ 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 lombok.Getter; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; @@ -354,7 +353,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()))); } 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..decfb2c18 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java @@ -82,7 +82,7 @@ public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, Scri } //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 +94,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..b6688cadb 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java @@ -21,7 +21,7 @@ public class ScriptConditions { private final ScriptConditionsBlueprint conditionsBlueprint; private ScriptTargets scriptTargets = null; - private EliteScript eliteScript; + private final EliteScript eliteScript; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; 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 23b26b065..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,11 +36,11 @@ 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(); } @@ -79,7 +79,7 @@ else if (particleBlueprint.getParticle().equals(Particle.DUST_COLOR_TRANSITION)) particleBlueprint.getToBlue()), 1)); else if (particleBlueprint.getParticle().equals(Particle.WITCH) - //|| particleBlueprint.getParticle().equals(Particle.WITCH_AMBIENT) todo: 1.20.6 changed this name + //|| 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/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index b4c629237..ded2378a3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -58,10 +58,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<>(); }; } 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..783949501 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 @@ -144,10 +144,12 @@ protected void processKeyAndValue(String key, Object value) { } 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 +164,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 +188,12 @@ 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); + default -> + new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } 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..9efc277c1 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 @@ -64,9 +64,11 @@ 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); 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..a0a15f694 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 @@ -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 -> + new WarningMessage("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..f8c1b3884 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 @@ -55,7 +55,8 @@ 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 -> + new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } } 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/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..5206a6d1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -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/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/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/placeholderapi/Placeholders.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java index 6ce153d20..09784d6f8 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java @@ -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..62b0b0f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,11 +1,9 @@ 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.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.domains.DefaultDomain; import com.sk89q.worldguard.protection.flags.Flags; @@ -15,7 +13,6 @@ 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; @@ -27,28 +24,28 @@ 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() { @@ -309,35 +306,4 @@ public static void protectMinidungeonArea(ProtectedRegion protectedRegion) { 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!"); - } - } - } 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..ccdc6a0f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -116,9 +116,8 @@ public void doInteraction(Player player) { if (playerIsInCooldown(player)) { 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); diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index f63ce4e53..739884148 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.util.Vector; @@ -8,11 +7,8 @@ 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, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); - else - location.getWorld().spawnParticle(Particle.EXPLOSION, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); + //todo: restore barrier blocks here, block data was required for the snapshot version of this + location.getWorld().spawnParticle(Particle.BLOCK_MARKER, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); } } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java b/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java index 3d44cd118..3ac0c0705 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java @@ -69,7 +69,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/shapes/Cuboid.java b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java index 2f682e76d..e8530e76e 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java @@ -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()); + x / 2D + centerLocation.getBlockX(), y / 2D + centerLocation.getBlockY(), z / 2D + centerLocation.getBlockZ(), + -x / 2D + centerLocation.getBlockX(), centerLocation.getBlockY(), -z / 2D + centerLocation.getBlockZ()); return livingEntity.getBoundingBox().overlaps(boundingBox); } diff --git a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index e59c8a85d..6c779e0b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -25,7 +25,7 @@ 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 VersionChecker() { } diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java index af790ddfe..7a71d00db 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java @@ -30,7 +30,7 @@ public class Wormhole { 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..bb4444467 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java @@ -3,7 +3,6 @@ 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; @@ -79,8 +78,6 @@ private Location getDungeonLocation() { 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; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f3798c721..8d46b9225 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0 +version: 9.0.0-SNAPSHOT-1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -11,7 +11,6 @@ softdepend: - HolographicDisplays - DiscordSRV - LibsDisguises -- WorldEdit - ModelEngine - Geyser-Spigot - MythicMobs From 55e8100abb187d1e674cfae0460c86c4b281a445 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 20 Jun 2024 16:01:32 +0100 Subject: [PATCH 03/78] EliteMobs 9.0.0-SNAPSHOT-2 - [New] Added Sounds.yml - [New] Quests, rank ups and opening treasure chests now have custom sounds in the resource pack - [New] Debug items now come with higher durability - [New] Dungeons all now install by default when imported, no longer requiring admins to run /em setup to install them - [New] Added compatibility layer to allow old transitive blocks to be interpreted correctly by their new minecraft values - [Fix] Fixed bug related to debug particles - [Removal] Removed dungeonLocationType from the dungeon packager, it was a legacy value - [Tweak] Minor refactors Signed-off-by: MagmaGuy --- .../com/magmaguy/elitemobs/EliteMobs.java | 4 + .../magmaguy/elitemobs/EventsRegistrer.java | 2 + .../GuildRankMenuHandler.java | 3 + .../elitemobs/api/QuestAcceptEvent.java | 9 +- .../elitemobs/api/QuestCompleteEvent.java | 3 + .../elitemobs/api/QuestLeaveEvent.java | 3 + .../elitemobs/api/QuestProgressionEvent.java | 2 + .../AlternativeDurabilityLoss.java | 3 +- .../elitemobs/commands/AdminCommands.java | 32 +- .../elitemobs/commands/ArenaCommands.java | 1 + .../elitemobs/commands/SetupHandler.java | 51 --- .../commands/admin/GetTierCommand.java | 6 +- .../elitemobs/commands/setup/SetupMenu.java | 135 +++---- .../elitemobs/config/AntiExploitConfig.java | 24 +- .../config/LegacyValueConverter.java | 6 + .../elitemobs/config/SoundsConfig.java | 14 +- .../CustomQuestsConfigFields.java | 6 - .../DungeonPackagerConfigFields.java | 128 +------ .../premade/AirShipMinidungeon.off | 2 +- .../premade/BeastsSanctuaryLair.java | 5 +- .../premade/BinderOfWorldsSanctum.java | 5 +- .../premade/BoneMonasteryDungeon.java | 5 +- .../dungeonpackager/premade/CatacombsLair.off | 2 +- .../dungeonpackager/premade/ColosseumLair.off | 2 +- .../premade/CraftenminesLabSanctum.java | 5 +- .../premade/DarkCathedralLair.off | 2 +- .../premade/DarkSpireMinidungeon.java | 5 +- .../premade/DiamondLeagueArena.java | 5 +- .../premade/EnchantmentChallenge1.java | 5 +- .../premade/EnchantmentChallenge10.java | 5 +- .../premade/EnchantmentChallenge11.java | 5 +- .../premade/EnchantmentChallenge12.java | 5 +- .../premade/EnchantmentChallenge13.java | 5 +- .../premade/EnchantmentChallenge14.java | 5 +- .../premade/EnchantmentChallenge15.java | 5 +- .../premade/EnchantmentChallenge16.java | 5 +- .../premade/EnchantmentChallenge17.java | 5 +- .../premade/EnchantmentChallenge18.java | 5 +- .../premade/EnchantmentChallenge19.java | 5 +- .../premade/EnchantmentChallenge2.java | 5 +- .../premade/EnchantmentChallenge20.java | 5 +- .../premade/EnchantmentChallenge3.java | 5 +- .../premade/EnchantmentChallenge4.java | 5 +- .../premade/EnchantmentChallenge5.java | 5 +- .../premade/EnchantmentChallenge6.java | 5 +- .../premade/EnchantmentChallenge7.java | 5 +- .../premade/EnchantmentChallenge8.java | 5 +- .../premade/EnchantmentChallenge9.java | 5 +- .../premade/FireworksLair.java | 5 +- .../premade/FrostPalaceSanctum.java | 5 +- .../premade/HallosseumLair.java | 5 +- .../premade/InvasionMinidungeon.java | 5 +- .../premade/IronLeagueArena.java | 5 +- .../premade/KnightCastleLair.java | 6 +- .../premade/NorthPoleMinidungeon.java | 5 +- .../premade/OasisAdventure.java | 5 +- .../premade/OasisPyramidSanctum.java | 5 +- .../premade/PirateShipMinidungeon.off | 2 +- .../premade/PrimisAdventure.java | 5 +- .../premade/PrimisBloodTempleSanctum.java | 5 +- .../premade/PrimisGladiusInvasionDungeon.java | 5 +- .../dungeonpackager/premade/RuinsLair.off | 2 +- .../premade/SewersMinidungeon.java | 5 +- .../ShadowOfTheBinderOfWorldsLair.java | 5 +- .../premade/SteamworksLair.java | 5 +- .../premade/TheBridgeSanctum.java | 5 +- .../premade/TheCaveSanctum.java | 5 +- .../premade/TheCityDungeon.java | 5 +- .../premade/TheClimbDungeon.java | 5 +- .../premade/TheDeepMinesDungeon.java | 5 +- .../premade/TheMinesDungeon.java | 5 +- .../premade/TheNetherWastes.java | 5 +- .../premade/ThePalaceSanctum.java | 5 +- .../premade/TheQuarryDungeon.java | 5 +- .../premade/UnderGroveLair.java | 5 +- .../premade/VampireManorMinidungeon.off | 2 +- .../wormholes/WormholeConfigFields.java | 2 +- .../elitemobs/dungeons/DungeonProtector.java | 96 +++++ .../elitemobs/dungeons/EMPackage.java | 16 - .../elitemobs/dungeons/EliteMobsWorld.java | 43 +++ .../dungeons/WorldDungeonPackage.java | 8 +- .../elitemobs/dungeons/WorldPackage.java | 3 +- .../dungeons/utility/DungeonUtils.java | 14 +- .../elitemobs/events/ActionEvent.java | 4 +- .../instanced/dungeons/DungeonInstance.java | 7 +- .../transitiveblocks/TransitiveBlock.java | 3 +- .../worldguard/WorldGuardCompatibility.java | 335 +++++++++--------- .../treasurechest/TreasureChest.java | 3 + .../elitemobs/utils/DebugBlockLocation.java | 11 +- .../elitemobs/worlds/CustomWorldLoading.java | 3 + src/main/resources/plugin.yml | 2 +- 91 files changed, 617 insertions(+), 635 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java create mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f435ce4fe..deb362c9c 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -26,6 +26,7 @@ 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; @@ -113,6 +114,7 @@ public static void initializeConfigs() { //SoundsConfig.initializeConfig(); //ModelsConfig.initializeConfig(); DungeonsConfig.initializeConfig(); + SoundsConfig.initializeConfig(); } public static void worldScanner() { @@ -368,6 +370,8 @@ public void onDisable() { ProceduralShopMenu.shutdown(); + EliteMobsWorld.shutdown(); + //save cached data Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); PlayerData.closeConnection(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 28ece61c1..d691fb16a 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -16,6 +16,7 @@ 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; @@ -350,6 +351,7 @@ public static void registerEvents() { register(new WorldGuardDungeonFlag()); register(new WorldGuardExplosionBlockDamageFlag()); } + register(new DungeonProtector()); register(new EntityTransformHandler()); register(new EliteBlazeWaterDamagePrevention()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 9c7724ecd..913756e3a 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -4,6 +4,7 @@ import com.magmaguy.elitemobs.config.AdventurersGuildConfig; 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; @@ -61,6 +62,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 +96,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); } /** diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java index 3ed1bbf62..03317ad67 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java @@ -2,6 +2,7 @@ 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; @@ -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/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index c0d03fbb8..68669c69c 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -65,8 +65,9 @@ public static void doDurabilityLoss(Player player) { if (ItemSettingsConfig.isPreventEliteItemsFromBreaking()) { damageable.setDamage(maxDurability - 1); itemStack.setItemMeta(damageable); - } else + } else { itemStack.setAmount(0); + } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index 43bce68e8..fadb018cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -90,34 +90,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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); @@ -697,8 +669,8 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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()); + if (eliteEntity instanceof CustomBossEntity customBossEntity) { + customBossEntity.getBossTrace().postLog((Player) commandContext.getSender()); return; } })); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java index 9a1c4cd86..5179f8289 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; public class ArenaCommands { + private 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/SetupHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java index 190fb6ea4..0b5f635b7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java @@ -1,12 +1,7 @@ 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 { @@ -19,50 +14,4 @@ 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 58e975378..a6309b02e 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() { } @@ -70,9 +68,7 @@ public static void get(Player player, int tierLevel) { private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); - HashMap enchantmentIntegerHashMap = new HashMap<>(); - enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); - ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); + itemMeta.addEnchant(Enchantment.UNBREAKING, 5, true); itemStack.setItemMeta(itemMeta); } 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 29e3b0689..17cc70b34 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -7,8 +7,10 @@ import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.*; +import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.SpigotMessage; import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; @@ -27,20 +29,19 @@ 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<>(); + private final int previousIcon = 27; + Inventory inventory; + Player player; 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; HashMap minidungeonHashMap = new HashMap<>(); + boolean adventurersGuildIsDownloaded = false; @Getter private int currentPage = 1; - boolean adventurersGuildIsDownloaded = false; public SetupMenu(Player player) { this.inventory = Bukkit.createInventory(player, 54, "Setup menu"); @@ -66,53 +67,6 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup } } - private void redrawMenu(int page, Inventory inventory) { - currentPage = page; - setupMenus.remove(inventory); - this.inventory = inventory; - inventory.clear(); - //reserve resource pack status - customResourcePackStatus(); - //reserve adventurer's guild - adventurersGuildWorldStatus(); - //iterate through dungeons - dungeonStatuses(); - //Set icons - addNavigationElements(); - player.openInventory(inventory); - setupMenus.put(inventory, this); - } - - private void addNavigationElements() { - ItemStack infoButton = GetLootMenuConfig.infoItem; - List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:", - "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy", - "&62) &fPut content in the &2imports &ffolder of EliteMobs", - "&63) &fDo &2/em reload", - "&64) &fDo &2/em setup", - "&65) &fClick on &eyellow &ficons to install!", - "Click to get more info!")); - ItemMeta itemMeta = infoButton.getItemMeta(); - itemMeta.setLore(lore); - infoButton.setItemMeta(itemMeta); - inventory.setItem(infoIcon, infoButton); - - ItemStack previousButton = GetLootMenuConfig.previousLootItem; - ItemMeta previousButtonMeta = previousButton.getItemMeta(); - previousButtonMeta.setDisplayName("Previous page"); - previousButton.setItemMeta(previousButtonMeta); - if (currentPage > 1) - inventory.setItem(previousIcon, previousButton); - - ItemStack nextButton = GetLootMenuConfig.nextLootItem; - ItemMeta nextButtonMeta = nextButton.getItemMeta(); - nextButtonMeta.setDisplayName("Next page"); - nextButton.setItemMeta(nextButtonMeta); - int totalPages = (int) Math.ceil(emPackages.size() / 28d); - if (totalPages > 1 && currentPage < totalPages) - inventory.setItem(nextIcon, nextButton); - } - public static void forceResourcePack(Player player) { ResourcePackDataConfig.toggleForceResourcePack(true); player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); @@ -158,11 +112,6 @@ private static void adventurersGuildButtonInteraction(Player player, SetupMenu s 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()) @@ -197,6 +146,53 @@ private static void adventurersGuildButtonInteraction(Player player, SetupMenu s } } + private void redrawMenu(int page, Inventory inventory) { + currentPage = page; + setupMenus.remove(inventory); + this.inventory = inventory; + inventory.clear(); + //reserve resource pack status + customResourcePackStatus(); + //reserve adventurer's guild + adventurersGuildWorldStatus(); + //iterate through dungeons + dungeonStatuses(); + //Set icons + addNavigationElements(); + player.openInventory(inventory); + setupMenus.put(inventory, this); + } + + private void addNavigationElements() { + ItemStack infoButton = GetLootMenuConfig.infoItem; + List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:", + "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy", + "&62) &fPut content in the &2imports &ffolder of EliteMobs", + "&63) &fDo &2/em reload", + "&64) &fDo &2/em setup", + "&65) &fClick on &eyellow &ficons to install!", + "Click to get more info!")); + ItemMeta itemMeta = infoButton.getItemMeta(); + itemMeta.setLore(lore); + infoButton.setItemMeta(itemMeta); + inventory.setItem(infoIcon, infoButton); + + ItemStack previousButton = GetLootMenuConfig.previousLootItem; + ItemMeta previousButtonMeta = previousButton.getItemMeta(); + previousButtonMeta.setDisplayName("Previous page"); + previousButton.setItemMeta(previousButtonMeta); + if (currentPage > 1) + inventory.setItem(previousIcon, previousButton); + + ItemStack nextButton = GetLootMenuConfig.nextLootItem; + ItemMeta nextButtonMeta = nextButton.getItemMeta(); + nextButtonMeta.setDisplayName("Next page"); + nextButton.setItemMeta(nextButtonMeta); + int totalPages = (int) Math.ceil(emPackages.size() / 28d); + if (totalPages > 1 && currentPage < totalPages) + inventory.setItem(nextIcon, nextButton); + } + private void dungeonStatuses() { //Counter has to account for pages int dungeonCounter = 0; @@ -220,23 +216,8 @@ private void dungeonStatuses() { 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; - } + addWorldDungeon(emPackage, inventoryLocationCounter); + minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; inventoryLocationCounter++; diff --git a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java index e68549c59..6b0641834 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java @@ -7,6 +7,7 @@ import java.util.List; public class AntiExploitConfig { + 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 @@ -44,38 +45,32 @@ public static void initializeConfig() { 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); @@ -86,4 +81,5 @@ public static void initializeConfig() { 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 index d71f4b62e..42fb1f950 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -73,4 +73,10 @@ public static String parsePotionEffect(String potionEffectName) { 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/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index eb0e8a45d..92fd4f3c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java @@ -23,31 +23,31 @@ public static void initializeConfig() { 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); + file, fileConfiguration, "questAcceptSound", "elitemobs:quest.accept", false); ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } 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..7b52edd01 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java @@ -21,9 +21,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(); @@ -103,8 +100,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 +117,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); } 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 d6bd939a4..a78c176c3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -10,7 +10,6 @@ import org.bukkit.World; import org.bukkit.util.Vector; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -19,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; @@ -99,6 +96,9 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter @Setter private boolean enchantmentChallenge = false; + @Getter + @Setter + private boolean allowExplosions; public DungeonPackagerConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); @@ -136,7 +136,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; @@ -152,6 +153,7 @@ public DungeonPackagerConfigFields(String filename, this.regionEnterMessage = regionEnterMessage; this.regionLeaveMessage = regionLeaveMessage; this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; defaultDungeon = true; } @@ -173,7 +175,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; @@ -192,113 +195,7 @@ public DungeonPackagerConfigFields(String filename, this.rawDungeonObjectives = rawDungeonObjectives; this.dungeonConfigFolderName = dungeonConfigFolderName; this.contentLevel = contentLevel; - 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 - */ - 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); - 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; } @@ -306,12 +203,6 @@ public DungeonPackagerConfigFields(String fileName, 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); @@ -353,6 +244,7 @@ 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); processAdditionalFields(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off index 16cea48dd..a2c641bb9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off @@ -11,7 +11,7 @@ public class AirShipMinidungeon extends DungeonPackagerConfigFields { public AirShipMinidungeon() { super( "airship_minidungeon", - false, + true, "&2[lvl 045-055] &6The Airship", Arrays.asList("&fAn awesome airship full of undead pirates!", "&6Credits: MagmaGuy, 69OzCanOfBepis", 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 e9dd5f275..0837e31e2 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 @@ -9,7 +9,7 @@ public class BeastsSanctuaryLair extends DungeonPackagerConfigFields { public BeastsSanctuaryLair() { super("beasts_sanctuary_lair", - false, + true, "&2[lvl 130] &6The Beasts Sanctuary", List.of("&6Confront the beasts!"), DiscordLinks.premiumMinidungeons, @@ -24,6 +24,7 @@ public BeastsSanctuaryLair() { "&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..f795aa65a 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 @@ -11,7 +11,7 @@ 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"), @@ -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..3f5de8c35 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 @@ -11,7 +11,7 @@ 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"), @@ -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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off index be0c67159..0b64e9905 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off @@ -10,7 +10,7 @@ import java.util.Collections; 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!", "&6Credits: Realm of Lotheridon"), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off index 1c259c713..8071ed2f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off @@ -10,7 +10,7 @@ import java.util.Arrays; 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", "&fmulti-phased battle, first mounted boss,", 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..36de8c98b 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 @@ -11,7 +11,7 @@ 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"), @@ -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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off index 4a620649a..88dd9a2ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off @@ -11,7 +11,7 @@ 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!", "&fA classic that all servers need!", 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..d1b0ccb68 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 @@ -9,7 +9,7 @@ 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!", "&fMade for those who want a real challenge!", @@ -26,6 +26,7 @@ public DarkSpireMinidungeon() { "&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 256016c36..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 @@ -9,7 +9,7 @@ public class DiamondLeagueArena extends DungeonPackagerConfigFields { public DiamondLeagueArena() { super("diamond_league_arena", - false, + true, "&5[lvl 100-150] &fThe Diamond League Arena", List.of("&fFace the Diamond League Arena!"), DiscordLinks.freeMinidungeons, @@ -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 81547090c..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge1 extends DungeonPackagerConfigFields { public EnchantmentChallenge1() { super("enchantment_challenge_1_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 01", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 2fed2e58c..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge10 extends DungeonPackagerConfigFields { public EnchantmentChallenge10() { super("enchantment_challenge_10_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 10", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 f43af8bca..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge11 extends DungeonPackagerConfigFields { public EnchantmentChallenge11() { super("enchantment_challenge_11_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 11", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 602b051e7..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge12 extends DungeonPackagerConfigFields { public EnchantmentChallenge12() { super("enchantment_challenge_12_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 12", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 a7fe23b3a..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge13 extends DungeonPackagerConfigFields { public EnchantmentChallenge13() { super("enchantment_challenge_13_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 13", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 b99263a7a..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge14 extends DungeonPackagerConfigFields { public EnchantmentChallenge14() { super("enchantment_challenge_14_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 14", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 18ce21bbe..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge15 extends DungeonPackagerConfigFields { public EnchantmentChallenge15() { super("enchantment_challenge_15_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 15", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 de617c2f4..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge16 extends DungeonPackagerConfigFields { public EnchantmentChallenge16() { super("enchantment_challenge_16_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 16", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 f6454d65d..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge17 extends DungeonPackagerConfigFields { public EnchantmentChallenge17() { super("enchantment_challenge_17_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 17", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 281594d1e..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge18 extends DungeonPackagerConfigFields { public EnchantmentChallenge18() { super("enchantment_challenge_18_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 18", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 1eb473381..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge19 extends DungeonPackagerConfigFields { public EnchantmentChallenge19() { super("enchantment_challenge_19_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 19", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 3ab15ee7a..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge2 extends DungeonPackagerConfigFields { public EnchantmentChallenge2() { super("enchantment_challenge_2_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 02", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 93db6c776..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge20 extends DungeonPackagerConfigFields { public EnchantmentChallenge20() { super("enchantment_challenge_20_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 20", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 f1a315127..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge3 extends DungeonPackagerConfigFields { public EnchantmentChallenge3() { super("enchantment_challenge_3_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 03", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 468658c26..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge4 extends DungeonPackagerConfigFields { public EnchantmentChallenge4() { super("enchantment_challenge_4_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 04", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,7 +26,8 @@ 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))); setEnchantmentChallenge(true); 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 7d651e30d..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge5 extends DungeonPackagerConfigFields { public EnchantmentChallenge5() { super("enchantment_challenge_5_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 05", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 9e9a723dd..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge6 extends DungeonPackagerConfigFields { public EnchantmentChallenge6() { super("enchantment_challenge_6_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 06", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 e314b3c84..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge7 extends DungeonPackagerConfigFields { public EnchantmentChallenge7() { super("enchantment_challenge_7_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 07", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 42a76e44b..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge8 extends DungeonPackagerConfigFields { public EnchantmentChallenge8() { super("enchantment_challenge_8_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 08", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 30c2dc208..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge9 extends DungeonPackagerConfigFields { public EnchantmentChallenge9() { super("enchantment_challenge_9_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 09", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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..94c9ec00d 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public FireworksLair() { "&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..ea29d5208 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 @@ -11,7 +11,7 @@ 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", "the queen of ice!", @@ -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..c905a352a 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public HallosseumLair() { "&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..f53ef5ff5 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public InvasionMinidungeon() { "&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 5f3ae29c8..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 @@ -9,7 +9,7 @@ public class IronLeagueArena extends DungeonPackagerConfigFields { public IronLeagueArena() { super("iron_league_arena", - false, + true, "&2[lvl 050-100] &fThe Iron League Arena", List.of("&fFace the Iron League Arena!"), DiscordLinks.freeMinidungeons, @@ -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 2b2ed7af9..015ea0546 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 @@ -9,7 +9,7 @@ public class KnightCastleLair extends DungeonPackagerConfigFields { public KnightCastleLair() { super("knights_castle_lair", - false, + true, "&2[lvl 095] &fThe Knight's Castle", List.of("&fChallenge the knights of the castle!"), DiscordLinks.freeMinidungeons, @@ -24,7 +24,7 @@ public KnightCastleLair() { "&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..247d7b656 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public NorthPoleMinidungeon() { "&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..1ebc4c2cb 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 @@ -9,7 +9,7 @@ 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"), @@ -25,7 +25,8 @@ public OasisAdventure() { "&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..455c4719c 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 @@ -11,7 +11,7 @@ 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"), @@ -28,7 +28,8 @@ 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))); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off index 8b11cfa7d..3de4f94ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off @@ -10,7 +10,7 @@ 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", "&fbosses made for players starting to get good,", 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..27f328016 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 @@ -9,7 +9,7 @@ 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"), @@ -25,7 +25,8 @@ public PrimisAdventure() { "&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..3aefee028 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 @@ -11,7 +11,7 @@ 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"), @@ -28,7 +28,8 @@ 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))); } 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..a46d4cf31 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 @@ -11,7 +11,7 @@ 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"), DiscordLinks.premiumMinidungeons, @@ -27,7 +27,8 @@ 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), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off index c7cd8aceb..9fa5eccb3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off @@ -10,7 +10,7 @@ import java.util.List; 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", "&fNorse mythology, be prepared for a smiting!", 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..af70c536b 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 @@ -9,7 +9,7 @@ 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"), @@ -26,6 +26,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..312147208 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public ShadowOfTheBinderOfWorldsLair() { "&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 e8ffd7191..bc0d59940 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 @@ -9,7 +9,7 @@ public class SteamworksLair extends DungeonPackagerConfigFields { public SteamworksLair() { super("steamworks_lair", - false, + true, "&2[lvl 140] &6The Steamworks", List.of("&fA steampunk inspired lair!"), DiscordLinks.freeMinidungeons, @@ -24,6 +24,7 @@ public SteamworksLair() { "&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 519fa12dd..e82a38921 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 @@ -11,7 +11,7 @@ public class TheBridgeSanctum extends DungeonPackagerConfigFields { 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"), @@ -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..c0e5d7873 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 @@ -11,7 +11,7 @@ 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"), @@ -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 e38f58c8c..b135a5a4f 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 @@ -11,7 +11,7 @@ public class TheCityDungeon extends DungeonPackagerConfigFields { 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"), @@ -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..dafbc9154 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 @@ -11,7 +11,7 @@ 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"), @@ -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..96cd82d74 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 @@ -11,7 +11,7 @@ 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"), @@ -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 4fffed566..1c8a64927 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 @@ -11,7 +11,7 @@ public class TheMinesDungeon extends DungeonPackagerConfigFields { 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_"), @@ -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/TheNetherWastes.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherWastes.java index 76f06d123..f0714a345 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 @@ -11,7 +11,7 @@ public class TheNetherWastes extends DungeonPackagerConfigFields { 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_"), @@ -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 b115b2f63..0ef8587f6 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 @@ -11,7 +11,7 @@ public class ThePalaceSanctum extends DungeonPackagerConfigFields { 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"), @@ -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..4b08260a5 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 @@ -11,7 +11,7 @@ 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"), @@ -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 2e4c88416..64eff941b 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 @@ -9,7 +9,7 @@ public class UnderGroveLair extends DungeonPackagerConfigFields { public UnderGroveLair() { super("under_grove_lair", - false, + true, "&2[lvl 170] &6The Under Grove", List.of("&6Stop the dryad's ritual!"), DiscordLinks.premiumMinidungeons, @@ -24,6 +24,7 @@ public UnderGroveLair() { "&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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off index 008a99de9..4663fa25b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off @@ -9,7 +9,7 @@ import java.util.Arrays; public class VampireManorMinidungeon extends DungeonPackagerConfigFields { public VampireManorMinidungeon() { super("vampire_manor", - false, + true, "&2[lvl 170] &cThe Vampire Manor", Arrays.asList("&fPrepare to spill blood!", "&6Credits: MagmaGuy, 69OzCanOfBepis"), 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..f10215e03 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java @@ -28,7 +28,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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java new file mode 100644 index 000000000..c6098d3e0 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -0,0 +1,96 @@ +package com.magmaguy.elitemobs.dungeons; + +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.EntityExplodeEvent; + +public class DungeonProtector implements Listener { + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockDamage(BlockDamageEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockBreak(BlockBreakEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) 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; + 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; + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBonemeal(BlockFertilizeEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidFlow(BlockFromToEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) 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; + 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); + } + + +} diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 49b1dd578..28da1c75f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -75,22 +75,6 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WarningMessage("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; } - } 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 WarningMessage("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; - } } } 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..c746bd6f2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -0,0 +1,43 @@ +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<>(); + 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/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/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 8b8df85eb..9a117376a 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -3,7 +3,6 @@ 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.wormhole.Wormhole; import lombok.Getter; @@ -66,7 +65,7 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); - WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); +// 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.")); 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..cf47ac349 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -1,5 +1,7 @@ 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; @@ -37,14 +39,14 @@ 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) { + public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { @@ -67,6 +69,9 @@ public static World loadWorld(String worldName, World.Environment environment) { if (world != null) world.setKeepSpawnInMemory(false); world.setDifficulty(Difficulty.HARD); Bukkit.getLogger().setFilter(previousFilter); + + EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + return world; } catch (Exception exception) { Bukkit.getLogger().setFilter(previousFilter); @@ -90,6 +95,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/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 7df8ac857..9b1fba505 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -55,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: 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 bd09fa72a..a201a3df6 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,7 +14,6 @@ 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 lombok.Getter; import org.bukkit.Bukkit; @@ -136,13 +135,13 @@ 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); +// 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()); 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..046654fc2 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,5 +1,6 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; @@ -35,7 +36,7 @@ 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); 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 62b0b0f7e..f1c4aeca3 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,26 +1,13 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.utils.WarningMessage; -import com.sk89q.worldedit.bukkit.BukkitAdapter; 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.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 { @@ -144,166 +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); - } +// 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); +// } } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index ccdc6a0f0..a3baa5901 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -4,6 +4,7 @@ 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; @@ -122,6 +123,8 @@ public void doInteraction(Player player) { 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() { diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 739884148..1f21941eb 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,14 +1,19 @@ package com.magmaguy.elitemobs.utils; +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) { - //todo: restore barrier blocks here, block data was required for the snapshot version of this - location.getWorld().spawnParticle(Particle.BLOCK_MARKER, 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.LIGHT)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java index cebef64d0..b0ace1e1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java +++ b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java @@ -1,6 +1,8 @@ package com.magmaguy.elitemobs.worlds; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.WarningMessage; import org.bukkit.Bukkit; @@ -31,6 +33,7 @@ public static void startupWorldInitialization() { 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!"); + EliteMobsWorld.create(worldCreator.createWorld().getUID(), DungeonPackagerConfig.getDungeonPackages().get("adventurers_guild.yml")); } catch (Exception ex) { new WarningMessage("Failed to generate Adventurer's Guild World!"); ex.printStackTrace(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8d46b9225..20d85e1ac 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0-SNAPSHOT-1 +version: 9.0.0-SNAPSHOT-2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 696bfc8e2a73ff71514ae45083136361e08de011 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sat, 22 Jun 2024 18:05:58 +0100 Subject: [PATCH 04/78] EliteMobs 9.0.0-SNAPSHOT-3 - [New] Outdated dungeons are now highlighted in orange in the em setup menu - [New] Items will no longer be dropped when they have no durability left, instead they will simply be deactivated and players will be warned that the items won't work until they are repaired again - [New] Damage indicators and dialogue now use text displays instead of armor stands - [Fix] Changed debug block look to barrier instead of light bulb - [Fix] Fixed problem that all would allow vanilla mobs to spawn in dungeons - [Fix] Fixed problem that would allow elite events to happen in worlds - [Fix] Fixed issue where projectile-caused explosions would sometimes not regenerate correctly even though the configuration was set to regenerate them - [Removal] Removed default schematics folder Signed-off-by: MagmaGuy --- .../com/magmaguy/elitemobs/EliteMobs.java | 14 -- .../GuildRankMenuHandler.java | 4 +- .../elitemobs/api/PlayerTeleportEvent.java | 8 +- .../AlternativeDurabilityLoss.java | 37 +---- .../combatsystem/displays/PopupDisplay.java | 25 ++-- .../guild/AdventurersGuildCommand.java | 55 +------ .../elitemobs/commands/setup/SetupMenu.java | 136 ++---------------- .../config/AdventurersGuildConfig.java | 33 ----- .../config/ConfigurationImporter.java | 2 +- .../elitemobs/config/ItemSettingsConfig.java | 11 +- .../config/SchematicsFolderConfig.java | 26 ---- .../DungeonPackagerConfigFields.java | 34 +++++ .../premade/AdventurersGuildHub.java | 29 ++++ .../elitemobs/dungeons/DungeonProtector.java | 7 + .../elitemobs/dungeons/EMPackage.java | 5 + .../elitemobs/dungeons/WorldPackage.java | 1 + .../elitemobs/events/CustomEvent.java | 3 + .../elitemobs/explosionregen/Explosion.java | 5 +- .../instanced/InstanceDeathLocation.java | 16 +-- .../instanced/dungeons/DungeonInstance.java | 2 +- .../SoulbindEnchantment.java | 6 +- .../elitemobs/npcs/chatter/NPCChatBubble.java | 8 +- .../npcs/chatter/NPCProximitySensor.java | 6 +- .../elitemobs/playerdata/PlayerItem.java | 17 +++ .../magmaguy/elitemobs/powers/ShieldWall.java | 4 +- .../elitemobs/utils/DebugBlockLocation.java | 2 +- .../elitemobs/utils/DialogArmorStand.java | 12 +- .../elitemobs/utils/VisualArmorStand.java | 29 ---- .../elitemobs/utils/VisualDisplay.java | 47 ++++++ .../elitemobs/worlds/CustomWorldLoading.java | 60 -------- 30 files changed, 222 insertions(+), 422 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/SchematicsFolderConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AdventurersGuildHub.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/VisualArmorStand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index deb362c9c..f06a343d5 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; @@ -60,7 +59,6 @@ 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 org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; @@ -84,7 +82,6 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations DefaultConfig.initializeConfig(); - SchematicsFolderConfig.initializeConfigs(); ResourcePackDataConfig.initializeConfig(); ItemSettingsConfig.initializeConfig(); ProceduralItemGenerationSettingsConfig.initializeConfig(); @@ -230,17 +227,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(); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 913756e3a..51ae8477a 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -279,14 +279,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/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index e5a62b28f..f579167be 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,6 +1,5 @@ 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.playerdata.database.PlayerData; @@ -75,9 +74,12 @@ public void executeTeleport() { ((WorldPackage) emPackage).getWorld() == destination.getWorld()) return; - if (AdventurersGuildConfig.getGuildWorldLocation() != null && - Objects.equals(AdventurersGuildConfig.getGuildWorldLocation().getWorld(), originalLocation.getWorld())) + EMPackage adventurersGuildPackage = EMPackage.getContent("adventurers_guild_hub"); + if (adventurersGuildPackage == null || !adventurersGuildPackage.isInstalled() || + adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation() == null || + Objects.equals(adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation().getWorld(), originalLocation.getWorld())) return; + PlayerData.setBackTeleportLocation(player, originalLocation); } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 68669c69c..275500332 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; @@ -83,32 +78,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/combatsystem/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index 0872c5094..8b1a2cf6b 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java @@ -11,13 +11,14 @@ 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 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; @@ -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/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 17cc70b34..ea17b69f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,17 +1,11 @@ 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.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.EventCaller; import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -39,7 +33,6 @@ public class SetupMenu { 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)); HashMap minidungeonHashMap = new HashMap<>(); - boolean adventurersGuildIsDownloaded = false; @Getter private int currentPage = 1; @@ -94,58 +87,6 @@ else if (!emPackage.uninstall(player)) { } } - 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(); - 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 redrawMenu(int page, Inventory inventory) { currentPage = page; setupMenus.remove(inventory); @@ -153,8 +94,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 @@ -200,7 +139,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())))); @@ -212,11 +151,11 @@ 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); - addWorldDungeon(emPackage, inventoryLocationCounter); + addDungeonPackagerContent(emPackage, inventoryLocationCounter); minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; @@ -224,7 +163,7 @@ private void dungeonStatuses() { } } - private void addWorldDungeon(EMPackage emPackage, int counter) { + private void addDungeonPackagerContent(EMPackage emPackage, int counter) { String itemName = emPackage.getDungeonPackagerConfigFields().getName(); List lore = new ArrayList<>(); @@ -236,26 +175,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()) @@ -267,17 +189,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!"); @@ -301,7 +221,7 @@ private void customResourcePackStatus() { boolean resourceState = ResourcePackDataConfig.isEliteMobsResourcePackEnabled(); 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; @@ -311,29 +231,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) { @@ -347,11 +244,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..7aaf10e90 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,10 +1,7 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; import lombok.Getter; -import lombok.Setter; -import org.bukkit.Location; import org.bukkit.configuration.file.FileConfiguration; import java.io.File; @@ -24,15 +21,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; @@ -85,12 +73,6 @@ public class AdventurersGuildConfig { private AdventurersGuildConfig() { } - public static void toggleGuildInstall() { - guildWorldIsEnabled = !guildWorldIsEnabled; - fileConfiguration.set("guildHubIsEnabledv2", guildWorldIsEnabled); - save(); - } - public static void save() { ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } @@ -107,18 +89,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); @@ -444,9 +414,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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java index 0e9fa98c0..1642611ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java @@ -108,7 +108,7 @@ public static void initializeConfigs() { 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); + new WarningMessage("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); 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?"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java index 3a7d97f6b..57381df60 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java @@ -98,9 +98,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 @@ -310,12 +308,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."), 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/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index a78c176c3..fd96a24ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -199,6 +199,40 @@ public DungeonPackagerConfigFields(String filename, defaultDungeon = true; } + //For the adventurer's guild hub + public DungeonPackagerConfigFields(String filename, + boolean isEnabled, + String name, + List customInfo, + String downloadLink, + String worldName, + World.Environment environment, + Boolean protect, + String teleportLocationString, + int dungeonVersion, + String playerInfo, + String regionEnterMessage, + String regionLeaveMessage, + String dungeonConfigFolderName, + boolean allowExplosions) { + super(filename, isEnabled); + this.contentType = ContentType.HUB; + this.name = name; + this.customInfo = customInfo; + this.downloadLink = downloadLink; + this.worldName = worldName; + this.environment = environment; + this.protect = protect; + this.teleportLocationString = teleportLocationString; + this.dungeonVersion = dungeonVersion; + this.playerInfo = playerInfo; + this.regionEnterMessage = regionEnterMessage; + this.regionLeaveMessage = regionLeaveMessage; + this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; + defaultDungeon = true; + } + @Override public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, false, true); 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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index c6098d3e0..d059fb8cf 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -4,6 +4,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.*; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityExplodeEvent; public class DungeonProtector implements Listener { @@ -92,5 +93,11 @@ public void preventLeafDecay(LeavesDecayEvent event){ 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); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 28da1c75f..f0d748779 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -37,6 +37,11 @@ public class EMPackage { protected List treasureChestList = new ArrayList<>(); protected List npcEntities = new ArrayList<>(); + public boolean isOutOfDate() { + if (!isInstalled) return false; + return outOfDate; + } + public EMPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; emPackages.put(dungeonPackagerConfigFields.getFilename(), this); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 9a117376a..1fe07038f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -85,4 +85,5 @@ public boolean uninstall(Player player) { world = null; return true; } + } diff --git a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java index 8ed92029a..30c762418 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java @@ -6,6 +6,7 @@ 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; @@ -58,6 +59,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())); } diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index abf08c100..4625ad1f1 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,9 @@ 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/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index 529bfcc05..eb9658198 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -4,13 +4,13 @@ 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 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/dungeons/DungeonInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java index a201a3df6..45420aca4 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -200,7 +200,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."); +// announce("MagmaGuy's note: This is still a work in progress, please be patient! Hope you enjoyed your run."); new BukkitRunnable() { @Override 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..7b43e90fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java @@ -8,13 +8,13 @@ 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 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/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/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index 0cf7a6a98..d4f10cb6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -1,7 +1,9 @@ package com.magmaguy.elitemobs.playerdata; +import com.magmaguy.elitemobs.ChatColorConverter; 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; @@ -13,6 +15,7 @@ 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; @@ -53,6 +56,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 +74,12 @@ private boolean fullUpdate(ItemStack itemStack) { if (itemStack == null) return fillNullItem(); + if (isOnLastDamage(itemStack)) { + player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace( + "$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + return fillNullItem(); + } + // //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; 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/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 1f21941eb..5af9ea6b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -13,7 +13,7 @@ public DebugBlockLocation(Location location) { location.getBlock().getY() + .5, location.getBlock().getZ() + .5, 1, - Bukkit.createBlockData(Material.LIGHT)); + Bukkit.createBlockData(Material.BARRIER)); } } 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/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..0f139d7d2 --- /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.ChatColorConverter; +import com.magmaguy.elitemobs.entitytracker.EntityTracker; +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/worlds/CustomWorldLoading.java b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java deleted file mode 100644 index b0ace1e1c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.magmaguy.elitemobs.worlds; - -import com.magmaguy.elitemobs.config.AdventurersGuildConfig; -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; -import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; -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!"); - EliteMobsWorld.create(worldCreator.createWorld().getUID(), DungeonPackagerConfig.getDungeonPackages().get("adventurers_guild.yml")); - } 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; - } - -} From aec2b52b8cbd48fd61882fd7a73d859f08baecc2 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 27 Jun 2024 16:49:48 +0100 Subject: [PATCH 05/78] EliteMobs 9.0.1 - [New] Added option to disable pvp in dungeons, defaulting to not allow pvp, to dungeons.yml - [New] Plugin will no longer try to load for unsupported Minecraft versions (versions older than Minecraft 1.21) - [Tweak] Changed several plugin defaults to be natively written for Minecraft 1.21 - [Fix] Fixed bug where reloading EliteMobs would remove the world protections for already loaded worlds - [Fix] Fixed error associated with trying to read potion effects - [Fix] Improved the compatibility layer to better take old enchantments and potion effects into account, reenabling effects on items generated before 9.0 - [Fix] Fixed error spam related to custom boss trails Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../com/magmaguy/elitemobs/EliteMobs.java | 6 ++ .../elitemobs/config/DungeonsConfig.java | 7 ++ .../config/LegacyValueConverter.java | 18 ++--- .../premade/DepthsSeekerConfig.java | 4 +- .../EnchantedBookArrowInfiniteConfig.java | 2 +- .../EnchantedBookArrowKnockbackConfig.java | 2 +- .../premade/EnchantedBookFlameConfig.java | 2 +- .../premade/EnchantedBookLuckConfig.java | 2 +- .../premade/GoblinCleaverItem.java | 2 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 2 +- .../premade/LuckyCharmsConfig.java | 2 +- .../premade/RodOfTheDepthsConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 2 +- .../enchantments/EnchantmentsConfig.java | 9 ++- .../elitemobs/dungeons/DungeonProtector.java | 68 +++++++++++-------- .../elitemobs/dungeons/WorldPackage.java | 1 + .../dungeons/utility/DungeonUtils.java | 5 ++ .../itemconstructor/EnchantmentGenerator.java | 10 +-- .../potioneffects/ElitePotionEffect.java | 3 +- .../custombosses/CustomBossTrail.java | 8 ++- src/main/resources/plugin.yml | 2 +- 25 files changed, 105 insertions(+), 62 deletions(-) diff --git a/build.gradle b/build.gradle index 512568176..76a2bbd37 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.0-SNAPSHOT' +version '9.0.1-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f06a343d5..d6ff23ffe 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -134,6 +134,12 @@ public void onEnable() { MetadataHandler.PLUGIN = this; Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion()); + if (VersionChecker.serverVersionOlderThan(21,0)){ + new WarningMessage("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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index 6f7c979a6..d0105bdd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -26,6 +26,8 @@ public class DungeonsConfig { private static String instancedDungeonCompleteMessage; @Getter private static String instancedDungeonClosingInstanceMessage; + @Getter + private static boolean friendlyFireInDungeons; private DungeonsConfig() { } @@ -72,6 +74,11 @@ public static void initializeConfig() { file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); + friendlyFireInDungeons = ConfigurationEngine.setBoolean( + List.of("Sets if PvP will be allowed in dungeons"), + fileConfiguration, "friendlyFireInDungeons", false + ); + 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 index 42fb1f950..c03efc4ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -8,7 +8,7 @@ private LegacyValueConverter() { public static String parseEnchantment(String materialName) { switch (materialName.toUpperCase(Locale.ROOT)) { - case "POWER": + case "ARROW_DAMAGE": return "POWER"; case "ARROW_FIRE": return "FLAME"; @@ -16,15 +16,15 @@ public static String parseEnchantment(String materialName) { return "INFINITY"; case "ARROW_KNOCKBACK": return "PUNCH"; - case "BANE_OF_ARTHROPODS": + case "DAMAGE_ARTHROPODS": return "BANE_OF_ARTHROPODS"; - case "SMITE": + case "DAMAGE_UNDEAD": return "SMITE"; - case "EFFICIENCY": + case "DIG_SPEED": return "EFFICIENCY"; case "DURABILITY": return "UNBREAKING"; - case "FORTUNE": + case "LOOT_BONUS_BLOCKS": return "FORTUNE"; case "LOOT_BONUS_MOBS": return "LOOTING"; @@ -36,13 +36,13 @@ public static String parseEnchantment(String materialName) { return "PROTECTION"; case "BLAST_PROTECTION": return "BLAST_PROTECTION"; - case "FEATHER_FALLING": + case "PROTECTION_FALL": return "FEATHER_FALLING"; - case "FIRE_PROTECTION": + case "PROTECTION_FIRE": return "FIRE_PROTECTION"; - case "PROJECTILE_PROTECTION": + case "PROTECTION_PROJECTILE": return "PROJECTILE_PROTECTION"; - case "AQUA_AFFINITY": + case "WATER_WORKER": return "AQUA_AFFINITY"; default: return materialName; 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 66387929c..f4135e948 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 @@ -13,8 +13,8 @@ public DepthsSeekerConfig() { 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", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK,0,self,continuous")); + setEnchantments(Arrays.asList("LURE,3", "LUCK_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); + setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK_OF_THE_SEA,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } } 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 c3bf2e7e3..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 @@ -14,7 +14,7 @@ public EnchantedBookArrowKnockbackConfig() { 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/EnchantedBookFlameConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlameConfig.java index 538c7bb27..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 @@ -14,7 +14,7 @@ public EnchantedBookFlameConfig() { 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/EnchantedBookLuckConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLuckConfig.java index a8e5d11f1..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 @@ -14,7 +14,7 @@ public EnchantedBookLuckConfig() { 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/GoblinCleaverItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinCleaverItem.java index 4634322c2..8d25f4031 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 @@ -14,7 +14,7 @@ public GoblinCleaverItem() { Material.NETHERITE_AXE, "&8Goblin Cleaver", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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/GoblinPokerItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java index 1f909e5d8..18f8f4c42 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 @@ -14,7 +14,7 @@ public GoblinPokerItem() { Material.TRIDENT, "&8Goblin Poker", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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 1a6fb6613..ab49b074a 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(Arrays.asList("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 7e3eef251..b56592181 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 @@ -14,7 +14,7 @@ public GoblinSlasherItem() { Material.NETHERITE_SWORD, "&8Goblin Slasher", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 3cbcfa73c..4f251360b 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 @@ -14,7 +14,7 @@ public LuckyCharmsConfig() { "&bLucky Charms", Arrays.asList("&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")); + setPotionEffects(List.of("LUCK_OF_THE_SEA,0,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 49e59d461..213325b25 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 @@ -13,7 +13,7 @@ public RodOfTheDepthsConfig() { 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", "UNBREAKING,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LURE,3", "LUCK_OF_THE_SEA,1", "UNBREAKING,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 9fb072f1c..95736297d 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOTING,5")); setPotionEffects(Arrays.asList("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 cfc38d25e..d8fd9b37c 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 @@ -14,7 +14,7 @@ public ZombieKingsAxeConfig() { "&4Zombie King's Axe", Arrays.asList("The axe of the one Zombies", "call their king.", "The bloodlust is palpable.")); setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); + "FIRE_ASPECT,4", "LOOTING,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); setPotionEffects(Arrays.asList("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/enchantments/EnchantmentsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java index 16bd68c60..26fa661df 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,7 @@ package com.magmaguy.elitemobs.config.enchantments; import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -21,12 +22,14 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { - EnchantmentsConfigFields test = enchantments.get(string); + String newString = LegacyValueConverter.parseEnchantment(string.replace(".yml", "")) + ".yml"; + newString = newString.toLowerCase(Locale.ROOT); + EnchantmentsConfigFields test = enchantments.get(newString); if (test == null) { - new WarningMessage("Failed to find enchant file " + string); + new WarningMessage("Failed to find enchant file " + newString); new Exception().printStackTrace(); } - return enchantments.get(string); + return enchantments.get(newString); } public static EnchantmentsConfigFields getEnchantment(Enchantment enchantment) { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index d059fb8cf..8a6e469be 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,103 +1,117 @@ package com.magmaguy.elitemobs.dungeons; +import com.magmaguy.elitemobs.config.DungeonsConfig; +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.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; public class DungeonProtector implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventPlayerBlockDamage(BlockDamageEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockDamage(BlockDamageEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventPlayerBlockBreak(BlockBreakEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockBreak(BlockBreakEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockBurnDamage(BlockBurnEvent event){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockPlace(BlockCanBuildEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setBuildable(false); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockExplosionEvent(BlockExplodeEvent event){ + @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){ + @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){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockFadeEvent(BlockFadeEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBonemeal(BlockFertilizeEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBonemeal(BlockFertilizeEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventLiquidFlow(BlockFromToEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidFlow(BlockFromToEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockFire(BlockIgniteEvent event){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockPlace(BlockPlaceEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventLeafDecay(LeavesDecayEvent event){ + @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){ + 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); + } + + } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 1fe07038f..0f964427e 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -41,6 +41,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; } 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 cf47ac349..02d206bbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -47,6 +47,11 @@ public static World loadWorld(WorldPackage worldPackage) { } public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { + if (Bukkit.getWorld(worldName) != null) { + EliteMobsWorld.create(Bukkit.getWorld(worldName).getUID(), dungeonPackagerConfigFields); + return Bukkit.getWorld(worldName); + } + File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { 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 3af70a168..725ce0426 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java @@ -77,16 +77,16 @@ public static HashMap generateEnchantments(double itemTier 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("POWER")); - validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); - validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); - validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); + 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")); @@ -237,7 +237,7 @@ public static HashMap generateEnchantments(double itemTier 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: 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 a591776c2..e3da5dddb 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -1,5 +1,6 @@ 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 org.bukkit.NamespacedKey; @@ -20,7 +21,7 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", stringObject[0].toLowerCase(Locale.ROOT))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0].toLowerCase(Locale.ROOT)))); if (potionEffectType == null) { new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; 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 a18650c41..65404b752 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -48,7 +48,13 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - if (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/resources/plugin.yml b/src/main/resources/plugin.yml index 20d85e1ac..8f39796ff 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0-SNAPSHOT-2 +version: 9.0.1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 8d25c8e4d8862c417dd7e95b2067027336f573d2 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 2 Jul 2024 13:19:53 +0100 Subject: [PATCH 06/78] EliteMobs 9.0.2 - [New] Added the NAVIGATE script action, which makes a mob navigate to the given block, with a maximum navigation time, an optional teleport failsafe and a velocity option - [New] Added ZoneEnterEvent and ZoneLeaveEvent for elite scripts. This allows scripters to trigger actions based on entities entering and leaving zones set in scripts. The DIRECT_TARGET of ZoneEnterEvent and ZoneLeaveEvent is the entity that entered or left, and due to how the internal logic works only absolute points (specific coordinates) and points relative to the boss can be used for scanning entering and leaving. - [New] No durability left messages for elite items now appear in the boss bar instead of spamming chat - [New] Treasure Chests can now be added to dungeon instances by using "instanced: true" in their configuration files and adding the locations the same way it is done with regional bosses - [New] Added minimum event cooldown for timed events, defaulted to 4 minutes, to prevent multiple events to happen all at once when players join worlds with queued events - [New] Added warning for items using INSTANT_DAMAGE/HARM potion effects due to the tendency of making players/admins not understand why they're healing undead mobs. We will be redoing all default/officially distributed loot that uses these potion effects, which shouldn't be more than a few cases. - [New] Added listedInTeleports option for dungeon packager that can prevent certain dungeons from being listed in the teleports page of the EM menu - [New] Added fireDamageMultiplier, poisonDamageMultiplier, witherDamageMultiplier to dungeons.yml which modify how much damage those damage sources deal inside of EliteMobs dungeon worlds to better balance combat - [New] Added safeguard in case a script gives players god mode (never recommended to do this) to remove god mode when they log off or the server shuts down - [Fix] Fixed issue where players would get permanently slowed down due to a Minecraft bug - [Fix] Fixed Zombie Necronomicon power now accounting for zombies potentially turnining into drowned - [Fix] Fixed maven repo readme - [Fix] Updated sonatype access to be token-based to reenable publishing the API - [Fix] Fixed an issue that caused EliteMobDamagedByEliteMobEvent scripts not to work correctly - [Fix] Fixed issue that caused quests to show the wrong level for the bosses in kill quests - [Fix] Fixed bug where teleports page could contain currently not installed content Signed-off-by: MagmaGuy --- README.md | 6 +- build.gradle | 12 +-- .../com/magmaguy/elitemobs/EliteMobs.java | 6 ++ .../magmaguy/elitemobs/EventsRegistrer.java | 4 + .../elitemobs/api/ScriptZoneEnterEvent.java | 29 +++++++ .../elitemobs/api/ScriptZoneLeaveEvent.java | 29 +++++++ .../EnvironmentalDungeonDamage.java | 20 +++++ .../FixPlayerSpeedOnRespawn.java | 14 ++++ .../PlayerQuitCleanup.java | 14 ++++ .../elitemobs/config/DungeonsConfig.java | 22 ++++- .../elitemobs/config/EventsConfig.java | 7 +- .../CustomBossesConfigFields.java | 2 +- .../customitems/CustomItemsConfigFields.java | 9 ++- .../CustomTreasureChestConfigFields.java | 6 ++ .../DungeonPackagerConfigFields.java | 4 + .../elitemobs/dungeons/WorldPackage.java | 2 +- .../magmaguy/elitemobs/events/TimedEvent.java | 3 + .../instanced/dungeons/DungeonInstance.java | 2 + .../potioneffects/ElitePotionEffect.java | 2 +- .../elitemobs/mobconstructor/CustomSpawn.java | 10 +-- .../custombosses/ElitePowerParser.java | 11 +-- .../custombosses/RegionalBossEntity.java | 1 + .../elitemobs/pathfinding/Navigation.java | 44 ++++++++++ .../elitemobs/playerdata/PlayerItem.java | 28 +++++-- .../statusscreen/TeleportsPage.java | 3 + .../elitemobs/powers/ZombieNecronomicon.java | 18 ++--- .../elitemobs/powers/meta/ElitePower.java | 2 +- .../elitemobs/powers/scripts/EliteScript.java | 33 +++++++- .../powers/scripts/ScriptAction.java | 40 +++++++-- .../powers/scripts/ScriptActionData.java | 9 +++ .../powers/scripts/ScriptEvents.java | 2 + .../powers/scripts/ScriptListener.java | 41 +++++++--- .../elitemobs/powers/scripts/ScriptZone.java | 57 ++++++++++++- .../caching/ScriptActionBlueprint.java | 3 + .../caching/ScriptEventsBlueprint.java | 10 +++ .../powers/scripts/enums/ActionType.java | 3 +- .../treasurechest/TreasureChest.java | 70 +++++++++++----- .../magmaguy/elitemobs/utils/BossBarUtil.java | 81 +++++++++++++++++++ .../utils/ConfigurationLocation.java | 47 ++++++++++- src/main/resources/plugin.yml | 2 +- 40 files changed, 613 insertions(+), 95 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java create mode 100644 src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java create mode 100644 src/main/java/com/magmaguy/elitemobs/utils/BossBarUtil.java 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 76a2bbd37..f27628f29 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.1-SNAPSHOT' +version '9.0.2-SNAPSHOT' repositories { maven { @@ -182,14 +182,16 @@ artifacts { archives javadocJar, sourcesJar } -ext.isReleaseVersion = !version.contains("SNAPSHOT") +//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 +// 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 = "https://s01.oss.sonatype.org/content/repositories/snapshots/"; credentials { username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index d6ff23ffe..8c3becb3a 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -42,8 +42,10 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; 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; @@ -55,6 +57,7 @@ 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.BossBarUtil; import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ServerTime; import com.magmaguy.elitemobs.utils.WarningMessage; @@ -363,6 +366,9 @@ public void onDisable() { ProceduralShopMenu.shutdown(); EliteMobsWorld.shutdown(); + Navigation.shutdown(); + BossBarUtil.shutdown(); + ScriptAction.shutdown(); //save cached data Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index d691fb16a..a2ac40314 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -107,6 +107,10 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) register(new PreventUpgradeDiamondToNetherite()); + register(new FixPlayerSpeedOnRespawn()); + register(new EnvironmentalDungeonDamage()); + register(new PlayerQuitCleanup()); + //Mob damage register(new EliteMobGenericDamagedHandler()); register(new EliteMobDamagedByEliteMobHandler()); 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/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/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java new file mode 100644 index 000000000..ea5f4de1b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java @@ -0,0 +1,14 @@ +package com.magmaguy.elitemobs.collateralminecraftchanges; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class FixPlayerSpeedOnRespawn implements Listener { + @EventHandler + public void onPlayerRespawn(PlayerRespawnEvent event) { + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0)); + } +} 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..cf7069ae3 --- /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/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index d0105bdd2..8ec9e8c08 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -28,6 +28,12 @@ public class DungeonsConfig { 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() { } @@ -73,11 +79,21 @@ public static void initializeConfig() { List.of("Sets the message that appears when an instanced dungeon closing"), file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); - friendlyFireInDungeons = ConfigurationEngine.setBoolean( List.of("Sets if PvP will be allowed in dungeons"), - fileConfiguration, "friendlyFireInDungeons", false - ); + 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); ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java index 8999ca60f..37d2b3339 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java @@ -12,6 +12,8 @@ public class EventsConfig { @Getter private static int actionEventMinimumCooldown; @Getter + private static int timedEventMinimumCooldown; + @Getter private static boolean actionEventsEnabled; @Getter private static boolean timedEventsEnabled; @@ -28,7 +30,10 @@ public static void initializeConfig() { 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"), 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 898bc3ae7..e3d98fa33 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -244,7 +244,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")) 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 2ceac6f6d..1a0184059 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java @@ -98,9 +98,7 @@ private void updatePostProcessor() { String[] split = enchantment.split(","); String result = LegacyValueConverter.parseEnchantment(split[0]); if (result.equals(split[0])) newEnchantments.add(enchantment); - else { - newEnchantments.add(result + "," + split[1]); - } + else newEnchantments.add(result + "," + split[1]); } enchantments = newEnchantments; @@ -126,5 +124,10 @@ private void updatePostProcessor() { } } potionEffects = newPotionEffects; + + potionEffects.forEach(potionEffect->{ + if (potionEffect.contains("INSTANT_DAMAGE")) + new WarningMessage("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/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index f74bf05c3..2f78f13f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java @@ -7,6 +7,7 @@ import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; +import lombok.Setter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -49,6 +50,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 +112,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) @@ -157,6 +162,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; 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 fd96a24ed..3db03e8fb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -99,6 +99,9 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter @Setter private boolean allowExplosions; + @Getter + @Setter + private boolean listedInTeleports = true; public DungeonPackagerConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); @@ -279,6 +282,7 @@ public void processConfigFields() { 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); processAdditionalFields(); } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 0f964427e..c8c3cf4fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -55,7 +55,7 @@ public void baseInitialization() { if (isDownloaded && isInstalled) { world = DungeonUtils.loadWorld(this); dungeonPackagerConfigFields.initializeWorld(); - } + } else isInstalled = false; } diff --git a/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java b/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java index 82172ae44..4a4771972 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java @@ -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; @@ -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/instanced/dungeons/DungeonInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java index 45420aca4..b85806480 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,6 +14,7 @@ import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; +import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.*; import lombok.Getter; import org.bukkit.Bukkit; @@ -72,6 +73,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, 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); } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); 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 e3da5dddb..aa65beda9 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -21,7 +21,7 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0].toLowerCase(Locale.ROOT)))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); if (potionEffectType == null) { new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java index 54233739c..a3ac05e2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -8,6 +8,7 @@ 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; @@ -115,7 +116,6 @@ public void run() { }.runTaskAsynchronously(MetadataHandler.PLUGIN); else spawn(); - } private void spawn() { @@ -129,7 +129,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; @@ -165,13 +165,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; @@ -240,6 +239,7 @@ public Location generateRandomSpawnLocation() { Location playerLocation = player.getLocation(); if (!ValidWorldsConfig.getValidWorlds().contains(playerLocation.getWorld().getName())) 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()) 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..b98882225 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java @@ -3,6 +3,7 @@ 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; @@ -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,7 +36,7 @@ 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) @@ -86,7 +87,7 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos if (powersConfigFields == null) { new WarningMessage("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()); @@ -96,11 +97,11 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos 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; 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 f78da9a09..cdc567e2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java @@ -48,6 +48,7 @@ public class RegionalBossEntity extends CustomBossEntity implements PersistentOb @Getter @Setter private List onRemoveTransitiveBlocks; + @Getter private boolean removed = false; private BukkitTask respawnTask = null; diff --git a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index 178143ea8..410287c9e 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 HashMap currentlyNavigating = new HashMap(); + public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; if (regionalBossEntity.getUnsyncedLivingEntity() != null && @@ -51,6 +60,41 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .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) public void makeReturningBossesInvulnerable(WanderBackToPointStartEvent event) { if (!event.isHardObjective()) return; diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index d4f10cb6d..f544a4fae 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -10,6 +10,7 @@ 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 org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -41,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 @@ -75,22 +78,31 @@ private boolean fullUpdate(ItemStack itemStack) { return fillNullItem(); if (isOnLastDamage(itemStack)) { - player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace( - "$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + 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; - if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { - if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { - player.getWorld().dropItem(player.getLocation(), itemStack); - itemStack.setAmount(0); - itemStack = new ItemStack(Material.AIR); + if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { + if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { + player.getWorld().dropItem(player.getLocation(), itemStack); + itemStack.setAmount(0); + itemStack = new ItemStack(Material.AIR); + } } - } //Neither offhand nor armor contribute to baseline damage outside of the enchants, so we reset the damage before anything this.eliteDamage = 0; 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..177653bc0 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -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" + @@ -91,6 +92,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/ZombieNecronomicon.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java index 00b68cef4..266003f8f 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; @@ -35,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - //todo: Shouldn't this be static? + private 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) { @@ -227,7 +227,7 @@ public void run() { eliteEntity.addReinforcement(customBossEntity); - entityList.add(customBossEntity.getLivingEntity()); + entityList.add(customBossEntity); } else { @@ -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/meta/ElitePower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java index 6614f782c..3cbe35933 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java @@ -81,7 +81,7 @@ public static void addPower(EliteEntity eliteEntity, PowersConfigFields configFi new WarningMessage("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() { 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 e93ffe173..750ba3320 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java @@ -25,22 +25,26 @@ public class EliteScript extends ElitePower implements Cloneable { 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 * 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 2de641a7a..969f57725 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -9,6 +9,7 @@ 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; @@ -30,14 +31,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; @@ -48,6 +48,10 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; + public static void shutdown(){ + invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); + } + public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; @@ -212,6 +216,7 @@ 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); default -> new WarningMessage("Failed to determine action type " + blueprint.getActionType() + " in script " + blueprint.getScriptName() + " for file " + blueprint.getScriptFilename()); } @@ -299,7 +304,10 @@ 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 @@ -518,6 +526,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()); }); @@ -662,4 +676,20 @@ 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) { + new WarningMessage("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()); + }); + } } \ 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 decfb2c18..994d92d98 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java @@ -81,6 +81,15 @@ public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, Scri this.inheritedScriptActionData = inheritedScriptActionData; } + //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) { this.eliteEntity = inheritedScriptActionData.getEliteEntity(); 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..b510405b3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java @@ -7,6 +7,7 @@ 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) { + new WarningMessage("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/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index ded2378a3..98c9c625e 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.EventCaller; import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.*; 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,49 @@ 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 BukkitRunnable() { + @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; + } + }.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: 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 783949501..cd0d776f4 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 @@ -107,6 +107,8 @@ public class ScriptActionBlueprint { private float volume = 1f; @Getter private float pitch = 1f; + @Getter + private float velocity = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -192,6 +194,7 @@ protected void processKeyAndValue(String key, Object value) { scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, scriptFilename, (Map) value); case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); + case "velocity" -> velocity = parseFloat(key, value, scriptName); default -> new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } 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..7a7a87ea6 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 @@ -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,6 +30,14 @@ 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 + " !"); } 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..16314c860 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,8 @@ public enum ActionType { PLAY_ANIMATION(true), SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), - SUMMON_ENTITY(false); + SUMMON_ENTITY(false), + NAVIGATE(false); @Getter private final boolean requiresLivingEntity; diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index a3baa5901..4f3c0d143 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.treasurechest; +import com.google.common.collect.ArrayListMultimap; import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; @@ -11,10 +12,7 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; 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.elitemobs.utils.*; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -32,15 +30,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; @@ -62,26 +66,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) @@ -115,7 +128,8 @@ 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; @@ -123,16 +137,20 @@ public void doInteraction(Player player) { if (ThreadLocalRandom.current().nextDouble() < customTreasureChestConfigFields.getMimicChance()) doMimic(); else doTreasure(player); - player.playSound(player.getLocation(), SoundsConfig.treasureChestOpenSound,1,1); + 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; } @@ -141,7 +159,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()); } @@ -178,6 +197,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; @@ -256,9 +278,13 @@ public enum DropStyle { public static class TreasureChestEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { + Developer.message("0"); if (event.getClickedBlock() == null) return; + Developer.message("1"); TreasureChest treasureChest = getTreasureChest(event.getClickedBlock().getLocation()); + Developer.message("2"); if (treasureChest == null) return; + Developer.message("3"); event.setCancelled(true); if (GuildRank.getMaxGuildRank(event.getPlayer()) < treasureChest.customTreasureChestConfigFields.getChestTier()) treasureChest.lowRankMessage(event.getPlayer()); 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..a6e454582 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java @@ -52,9 +52,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]); @@ -91,4 +88,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; + 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); + return null; + } + return new Location(instancedWorld, x, y, z, yaw, pitch); + } + } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8f39796ff..ae83b8987 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.1 +version: 9.0.2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From f9fdea3e6d9366b342b9ce8b56493436a4bc7219 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 7 Jul 2024 13:21:26 +0100 Subject: [PATCH 07/78] EliteMobs 9.0.3 - [New] The Nether Bell Sanctum - the last story mode sanctum is out! - [New] Withers can now be used as valid elites - [Fix] Updated the villager profession code to fit the new Spigot 1.21 API - [Fix] Fixed Breezes and Bogged not working correctly as elites - [Fix] Fixed Minecraft bug that caused speed potion effects to last forever under certain circumstances - [Tweak] Minor improvement to configuration generation Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../FixPlayerSpeedOnRespawn.java | 1 + .../elitemobs/config/ConfigurationEngine.java | 7 +++- .../premade/TheNetherBellSanctum.java | 38 +++++++++++++++++++ .../mobproperties/MobPropertiesConfig.java | 4 +- ...liteBreeze.java => EliteBreezeConfig.java} | 6 +-- .../premade/EliteWitherConfig.java | 18 +++++++++ .../config/npcs/NPCsConfigFields.java | 6 ++- .../npcs/premade/StoryDungeonsQuestGiver.java | 12 +++--- .../npcs/premade/TheNetherBellTeleporter.java | 26 +++++++++++++ .../LightningEnchantment.java | 4 +- .../elitemobs/mobconstructor/EliteEntity.java | 5 ++- .../mobdata/aggressivemobs/EliteBogged.java | 16 ++++++++ .../mobdata/aggressivemobs/EliteBreeze.java | 16 ++++++++ .../aggressivemobs/EliteMobProperties.java | 3 ++ .../mobdata/aggressivemobs/EliteWither.java | 17 +++++++++ .../treasurechest/TreasureChest.java | 9 ++--- src/main/resources/plugin.yml | 2 +- 18 files changed, 170 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java rename src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/{EliteBreeze.java => EliteBreezeConfig.java} (74%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherBellTeleporter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBogged.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBreeze.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWither.java diff --git a/build.gradle b/build.gradle index f27628f29..9cf1a7dd0 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.2-SNAPSHOT' +version '9.0.3-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java index ea5f4de1b..5b1defcd0 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java @@ -10,5 +10,6 @@ public class FixPlayerSpeedOnRespawn 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)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 64093b316..6e89a7855 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -83,7 +83,12 @@ private static void setComments(FileConfiguration fileConfiguration, String key, } public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - fileConfiguration.addDefault(key, defaultValue); + try { + fileConfiguration.addDefault(key, defaultValue); + } catch (Exception e) { + new WarningMessage("Attempted to write key " + key + " with value " + defaultValue + " to " + fileConfiguration.getName() + " and that contained an illegal argument!"); + e.printStackTrace(); + } return fileConfiguration.getBoolean(key); } 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..ed22a2e06 --- /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.Arrays; +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", + Arrays.asList("&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/mobproperties/MobPropertiesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java index 487606694..a2016203e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -56,8 +56,8 @@ public class MobPropertiesConfig { new EliteHoglinConfig(), new ElitePiglinBruteConfig(), new EliteBeeConfig(), - new EliteBreeze() - + new EliteBreezeConfig(), + new EliteWitherConfig() )); public static HashMap getMobProperties() { diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java similarity index 74% rename from src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java rename to src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java index e89c9d654..201efca76 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java @@ -5,10 +5,10 @@ import java.util.List; -public class EliteBreeze extends MobPropertiesConfigFields { - public EliteBreeze() { +public class EliteBreezeConfig extends MobPropertiesConfigFields { + public EliteBreezeConfig() { super("elite_breeze", - EntityType.BOGGED, + EntityType.BREEZE, true, "&2Lvl &2$level &2Elite &eBreeze", List.of("$player &cwas blown away by $entity!"), 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..eff26cef7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java @@ -0,0 +1,18 @@ +package com.magmaguy.elitemobs.config.mobproperties.premade; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; +import org.bukkit.entity.EntityType; + +import java.util.Arrays; + +public class EliteWitherConfig extends MobPropertiesConfigFields { + public EliteWitherConfig() { + super("elite_wither", + EntityType.WITHER, + true, + "&fLvl &2$level &7Elite &5Wither", + Arrays.asList("$player &cangered $entity&c!", + "$player &chas met $entity's &cfury!"), + 12); + } +} 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..2068c866a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java @@ -122,7 +122,11 @@ 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. + } 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)); 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/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/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/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index 879e9c211..12a20aa66 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -278,7 +278,6 @@ 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); @@ -290,6 +289,10 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR 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 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/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/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/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index 4f3c0d143..f34961cf0 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -12,7 +12,10 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.*; +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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -278,13 +281,9 @@ public enum DropStyle { public static class TreasureChestEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { - Developer.message("0"); if (event.getClickedBlock() == null) return; - Developer.message("1"); TreasureChest treasureChest = getTreasureChest(event.getClickedBlock().getLocation()); - Developer.message("2"); if (treasureChest == null) return; - Developer.message("3"); event.setCancelled(true); if (GuildRank.getMaxGuildRank(event.getPlayer()) < treasureChest.customTreasureChestConfigFields.getChestTier()) treasureChest.lowRankMessage(event.getPlayer()); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ae83b8987..541022761 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.2 +version: 9.0.3 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From c2a103cd08f8c27c8a3f63ae3016da40cca2db3d Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Wed, 17 Jul 2024 04:32:48 +0100 Subject: [PATCH 08/78] EliteMobs 9.0.4 - [New] The official EliteMobs resource packs is now automatically placed in the exports folder of EliteMobs to be used by my new plugin, ResourcePackManager, which can automatically merge and host resource packs! - [New] Added the scale setting to custom bosses, allowing them to be larger or smaller - [Fix] Fixed issue where the back teleported would not work correctly - [Removal] Removed /em generateresourcepack command, now replaced with the much better ResourcePackManager plugin that does it automatically Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../elitemobs/api/PlayerTeleportEvent.java | 21 +- .../elitemobs/commands/AdminCommands.java | 8 - .../config/ConfigurationExporter.java | 207 +++++------------- .../CustomBossesConfigFields.java | 4 + .../initialsetup/FirstTimeSetup.java | 6 +- .../custombosses/CustomBossMegaConsumer.java | 5 + src/main/resources/plugin.yml | 2 +- 8 files changed, 78 insertions(+), 177 deletions(-) diff --git a/build.gradle b/build.gradle index 9cf1a7dd0..c3ab731e3 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.3-SNAPSHOT' +version '9.0.4-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index f579167be..05177dd22 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,15 +1,12 @@ package com.magmaguy.elitemobs.api; -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(); @@ -67,20 +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; - - EMPackage adventurersGuildPackage = EMPackage.getContent("adventurers_guild_hub"); - if (adventurersGuildPackage == null || !adventurersGuildPackage.isInstalled() || - adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation() == null || - Objects.equals(adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation().getWorld(), originalLocation.getWorld())) - return; - - PlayerData.setBackTeleportLocation(player, originalLocation); } public static class PlayerTeleportEventExecutor implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index fadb018cb..003ce635a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -12,7 +12,6 @@ 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; @@ -692,13 +691,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde } })); - // /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") diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java index 22fbef2d0..2e9526b60 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 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) { + new WarningMessage("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) { + new WarningMessage("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 { + new WarningMessage("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/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index e3d98fa33..11f3afb7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -217,6 +217,8 @@ public class CustomBossesConfigFields extends CustomConfigFields implements Cust 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. @@ -392,6 +394,8 @@ public void processConfigFields() { } catch (Exception e) { new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); } + + this.scale = processDouble("scale", scale, 1, false); } public boolean isCustomModelExists() { diff --git a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java index 85f0346c6..4bea48f57 100644 --- a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java +++ b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java @@ -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/mobconstructor/custombosses/CustomBossMegaConsumer.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java index 9cfa6b5cd..d4163689f 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java @@ -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()); @@ -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/resources/plugin.yml b/src/main/resources/plugin.yml index 541022761..05e08f7c5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.3 +version: 9.0.4 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From d8d3843f452f9ded6b5f242e1ef6906061801275 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 25 Jul 2024 09:11:19 +0100 Subject: [PATCH 09/78] EliteMobs 9.0.5 - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Almost all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 63 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../elitemobs/ChatColorConverter.java | 29 - .../com/magmaguy/elitemobs/EliteMobs.java | 124 +-- .../magmaguy/elitemobs/EventsRegistrer.java | 2 +- .../magmaguy/elitemobs/MetadataHandler.java | 6 +- .../GuildRankMenuHandler.java | 2 +- .../announcements/AnnouncementPriority.java | 2 +- .../elitemobs/api/EliteDamageEvent.java | 3 +- .../elitemobs/api/PlayerPreTeleportEvent.java | 2 +- .../elitemobs/api/QuestAcceptEvent.java | 2 +- .../elitemobs/api/QuestRewardEvent.java | 2 +- .../api/instanced/MatchInstantiateEvent.java | 2 +- .../api/instanced/MatchJoinEvent.java | 2 +- .../AlternativeDurabilityLoss.java | 2 +- .../FixPlayerOnLoginOrRespawn.java | 28 + .../FixPlayerSpeedOnRespawn.java | 15 - .../PlayerDeathMessageByEliteMob.java | 2 +- .../PlayerQuitCleanup.java | 2 +- .../elitemobs/commands/AdminCommands.java | 896 ------------------ .../commands/AdventurersGuildCommand.java | 21 + .../elitemobs/commands/AltCommand.java | 24 + .../elitemobs/commands/ArenaCommand.java | 22 + .../elitemobs/commands/ArenaCommands.java | 4 +- .../elitemobs/commands/CommandHandler.java | 144 --- .../elitemobs/commands/CommandManager.java | 96 ++ .../commands/CurrencyCommandsHandler.java | 6 +- .../commands/CustomBossCommandHandler.java | 2 +- .../elitemobs/commands/DebugCommand.java | 25 + .../elitemobs/commands/DiscordCommand.java | 21 + .../commands/DiscordMessageCommand.java | 24 + .../elitemobs/commands/DismissCommand.java | 21 + .../commands/DungeonTeleportCommand.java | 23 + .../elitemobs/commands/EliteMobsCommand.java | 23 + .../elitemobs/commands/EnchantCommand.java | 24 + .../elitemobs/commands/EventCommand.java | 23 + .../elitemobs/commands/FireballCommand.java | 26 + .../elitemobs/commands/GuildRankCommands.java | 2 +- .../elitemobs/commands/HelpCommand.java | 29 + .../elitemobs/commands/KillCommand.java | 20 + .../elitemobs/commands/KillRadiusCommand.java | 24 + .../elitemobs/commands/KillTypeCommand.java | 26 + .../commands/KillTypeRadiusCommand.java | 29 + .../elitemobs/commands/LanguageCommand.java | 31 + .../elitemobs/commands/LootCommand.java | 21 + .../elitemobs/commands/LootDebugCommand.java | 26 + .../elitemobs/commands/LootGiveCommand.java | 27 + .../elitemobs/commands/LootMenuCommand.java | 23 + .../elitemobs/commands/LootRandomCommand.java | 27 + .../commands/LootSimulateCommand.java | 30 + .../commands/LootSimulateMultipleCommand.java | 32 + .../elitemobs/commands/LootStats.java | 37 + .../commands/MoneyAddAllCommand.java | 28 + .../elitemobs/commands/MoneyAddCommand.java | 29 + .../elitemobs/commands/MoneyCheckCommand.java | 27 + .../commands/MoneyCheckPlayerCommand.java | 24 + .../commands/MoneyRemoveCommand.java | 28 + .../elitemobs/commands/MoneySetCommand.java | 27 + .../elitemobs/commands/PackageCommand.java | 8 +- .../commands/PackageDungeonCommand.java | 22 + .../elitemobs/commands/PayCommand.java | 26 + .../elitemobs/commands/PlaceBossCommand.java | 25 + .../elitemobs/commands/PlaceNPCCommand.java | 26 + .../commands/PlaceTreasureChestCommand.java | 25 + .../commands/PlaceWormholeCommand.java | 41 + .../commands/QuestAcceptCommand.java | 25 + .../commands/QuestBypassCommand.java | 21 + .../commands/QuestCompleteCommand.java | 23 + .../elitemobs/commands/QuestLeaveCommand.java | 23 + .../commands/QuestResetAllCommand.java | 26 + .../elitemobs/commands/QuestResetCommand.java | 25 + .../elitemobs/commands/QuestTrackCommand.java | 25 + .../elitemobs/commands/QuitCommand.java | 23 + .../elitemobs/commands/RankCommand.java | 22 + .../elitemobs/commands/RankSetCommand.java | 26 + .../elitemobs/commands/ReloadCommand.java | 29 + .../elitemobs/commands/RemoveCommand.java | 21 + .../elitemobs/commands/RepairCommand.java | 26 + .../elitemobs/commands/RespawnAllCommand.java | 23 + .../elitemobs/commands/ScrapCommand.java | 26 + .../elitemobs/commands/SetupCommand.java | 22 + .../elitemobs/commands/SetupDoneCommand.java | 26 + .../elitemobs/commands/SetupHandler.java | 17 - .../commands/SetupToggleCommand.java | 29 + .../elitemobs/commands/ShareItemCommand.java | 22 + .../elitemobs/commands/ShopCustomCommand.java | 25 + .../commands/ShopCustomOtherCommand.java | 29 + .../commands/ShopDynamicCommand.java | 25 + .../commands/ShopProceduralOtherCommand.java | 29 + .../commands/ShopSellOtherCommand.java | 30 + .../commands/SpawnBossAtCommand.java | 40 + .../elitemobs/commands/SpawnBossCommand.java | 27 + .../commands/SpawnBossLevelAtCommand.java | 42 + .../commands/SpawnBossLevelCommand.java | 29 + .../elitemobs/commands/SpawnCommand.java | 16 +- .../elitemobs/commands/SpawnElite.java | 33 + .../commands/SpawnEliteAtCommand.java | 43 + .../commands/SpawnTeleportCommand.java | 24 + .../elitemobs/commands/StartCommand.java | 26 + .../elitemobs/commands/StatsCommand.java | 21 + .../elitemobs/commands/TrackBossCommand.java | 37 + .../TransitiveBlocksCancelCommand.java | 21 + .../TransitiveBlocksEditAreaCommand.java | 24 + .../commands/TransitiveBlocksEditCommand.java | 24 + .../TransitiveBlocksRegisterAreaCommand.java | 24 + .../TransitiveBlocksRegisterCommand.java | 24 + .../elitemobs/commands/UnbindCommand.java | 26 + .../commands/UnbindForceCommand.java | 27 + .../elitemobs/commands/UserCommands.java | 358 ------- .../elitemobs/commands/VersionCommand.java | 25 + .../admin/CheckTierOthersCommand.java | 35 - .../elitemobs/commands/admin/DebugScreen.java | 2 +- .../commands/admin/EventCommand.java | 2 +- .../commands/admin/GetTierCommand.java | 12 +- .../elitemobs/commands/admin/KillHandler.java | 2 +- .../elitemobs/commands/admin/LootCommand.java | 2 +- .../admin/RelativeCoordinatesCommand.java | 2 +- .../commands/admin/ReloadCommand.java | 13 - .../commands/admin/RemoveCommand.java | 2 +- .../commands/admin/SimLootCommand.java | 6 +- .../commands/admin/StatsCommand.java | 2 +- .../commands/admin/VersionCommand.java | 18 - .../commands/combat/CheckTierCommand.java | 27 - .../elitemobs/commands/setup/SetupMenu.java | 10 +- .../config/AdventurersGuildConfig.java | 187 ++-- .../elitemobs/config/AntiExploitConfig.java | 18 +- .../elitemobs/config/ArenasConfig.java | 15 +- .../elitemobs/config/CombatTagConfig.java | 17 +- .../elitemobs/config/ConfigurationEngine.java | 165 +--- .../config/ConfigurationExporter.java | 10 +- .../config/ConfigurationImporter.java | 40 +- .../elitemobs/config/CustomConfig.java | 193 ---- .../elitemobs/config/CustomConfigFields.java | 366 +------ .../config/CustomConfigFieldsInterface.java | 5 - .../elitemobs/config/DatabaseConfig.java | 15 +- .../elitemobs/config/DefaultConfig.java | 52 +- .../elitemobs/config/DiscordSRVConfig.java | 15 +- .../elitemobs/config/DungeonsConfig.java | 16 +- .../config/EconomySettingsConfig.java | 42 +- .../elitemobs/config/EventsConfig.java | 18 +- .../elitemobs/config/ItemSettingsConfig.java | 16 +- .../config/ItemUpgradeSystemConfig.java | 28 - .../config/LegacyValueConverter.java | 21 + .../config/MobCombatSettingsConfig.java | 18 +- .../elitemobs/config/ModelsConfig.java | 18 +- ...roceduralItemGenerationSettingsConfig.java | 44 +- .../elitemobs/config/QuestsConfig.java | 176 ++-- .../config/ResourcePackDataConfig.java | 48 +- .../elitemobs/config/SoundsConfig.java | 19 +- .../config/SpecialItemSystemsConfig.java | 39 +- .../elitemobs/config/UnusedNodeHandler.java | 31 - .../elitemobs/config/ValidWorldsConfig.java | 41 +- .../elitemobs/config/WormholesConfig.java | 16 +- .../customarenas/CustomArenasConfig.java | 2 +- .../CustomArenasConfigFields.java | 3 +- .../custombosses/CustomBossesConfig.java | 6 +- .../CustomBossesConfigFields.java | 33 +- .../customevents/CustomEventsConfig.java | 2 +- .../CustomEventsConfigFields.java | 7 +- .../config/customitems/CustomItemsConfig.java | 2 +- .../customitems/CustomItemsConfigFields.java | 13 +- .../premade/DepthsSeekerConfig.java | 2 +- .../premade/LuckyCharmsConfig.java | 2 +- .../customquests/CustomQuestsConfig.java | 2 +- .../CustomQuestsConfigFields.java | 20 +- .../customspawns/CustomSpawnConfig.java | 2 +- .../customspawns/CustomSpawnConfigFields.java | 3 +- .../CustomTreasureChestConfigFields.java | 9 +- .../CustomTreasureChestsConfig.java | 8 +- .../DungeonPackagerConfig.java | 2 +- .../DungeonPackagerConfigFields.java | 4 +- .../premade/OasisPyramidSanctum.java | 1 + .../premade/PrimisBloodTempleSanctum.java | 1 + .../premade/PrimisGladiusInvasionDungeon.java | 1 + .../enchantments/EnchantmentsConfig.java | 6 +- .../elitemobs/config/menus/MenusConfig.java | 2 +- .../config/menus/MenusConfigFields.java | 3 +- .../menus/premade/CustomQuestMenuConfig.java | 2 +- .../menus/premade/DynamicQuestMenuConfig.java | 2 +- .../MobPropertiesConfigFields.java | 2 +- .../elitemobs/config/npcs/NPCsConfig.java | 2 +- .../config/npcs/NPCsConfigFields.java | 11 +- .../elitemobs/config/powers/PowersConfig.java | 2 +- .../config/powers/PowersConfigFields.java | 4 +- .../translations/TranslationsConfig.java | 8 +- .../TranslationsConfigFields.java | 24 +- .../config/wormholes/WormholeConfig.java | 2 +- .../wormholes/WormholeConfigFields.java | 3 +- .../elitemobs/dungeons/EMPackage.java | 16 +- .../WorldInstancedDungeonPackage.java | 2 +- .../elitemobs/dungeons/WorldPackage.java | 6 +- .../dungeons/utility/DungeonUtils.java | 9 +- .../elitemobs/economy/VaultCompatibility.java | 9 +- .../elitemobs/events/ActionEvent.java | 4 +- .../elitemobs/events/CustomEvent.java | 9 +- .../elitemobs/events/MoonPhaseDetector.java | 4 +- .../magmaguy/elitemobs/events/TimedEvent.java | 8 +- .../elitemobs/explosionregen/Explosion.java | 3 +- .../initialsetup/FirstTimeSetup.java | 2 +- .../instanced/InstanceDeathLocation.java | 2 +- .../elitemobs/instanced/MatchInstance.java | 2 +- .../instanced/arena/ArenaInstance.java | 22 +- .../elitemobs/instanced/arena/ArenaWaves.java | 8 +- .../instanced/dungeons/DungeonInstance.java | 14 +- .../DungeonKillPercentageObjective.java | 6 +- .../dungeons/DungeonKillTargetObjective.java | 6 +- .../dungeons/EnchantmentDungeonInstance.java | 2 +- .../elitemobs/items/EliteItemLore.java | 6 +- .../elitemobs/items/ItemLootShower.java | 22 +- .../magmaguy/elitemobs/items/ItemTagger.java | 6 +- .../magmaguy/elitemobs/items/LootTables.java | 7 +- .../customenchantments/RepairEnchantment.java | 4 +- .../SoulbindEnchantment.java | 2 +- .../SummonMerchantEnchantment.java | 2 +- .../SummonWolfEnchantment.java | 6 +- .../items/customitems/CustomItem.java | 33 +- .../CurrencyCustomLootEntry.java | 4 +- .../customloottable/CustomLootEntry.java | 4 +- .../customloottable/CustomLootTable.java | 2 +- .../customloottable/EliteCustomLootEntry.java | 12 +- .../ItemStackCustomLootEntry.java | 4 +- .../customloottable/SharedLootTable.java | 2 +- .../itemconstructor/ItemConstructor.java | 2 +- .../itemconstructor/MaterialGenerator.java | 9 +- .../items/itemconstructor/NameGenerator.java | 15 +- .../potioneffects/ElitePotionEffect.java | 6 +- .../magmaguy/elitemobs/menus/ArenaMenu.java | 2 +- .../menus/InstancedDungeonBrowser.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 4 +- .../magmaguy/elitemobs/menus/LootMenu.java | 2 +- .../elitemobs/menus/ScrapperMenu.java | 2 +- .../magmaguy/elitemobs/menus/SellMenu.java | 2 +- .../elitemobs/menus/SharedShopElements.java | 2 +- .../elitemobs/mobconstructor/BossType.java | 1 + .../elitemobs/mobconstructor/CustomSpawn.java | 20 +- .../elitemobs/mobconstructor/EliteEntity.java | 6 +- .../custombosses/BossMusic.java | 6 +- .../custombosses/BossTrace.java | 60 -- .../custombosses/CustomBossBossBar.java | 11 +- .../custombosses/CustomBossDeath.java | 2 +- .../custombosses/CustomBossEntity.java | 44 +- .../CustomBossEscapeMechanism.java | 2 +- .../custombosses/CustomBossMegaConsumer.java | 40 +- .../custombosses/CustomBossMount.java | 8 +- .../custombosses/ElitePowerParser.java | 12 +- .../custombosses/InstancedBossEntity.java | 6 +- .../custombosses/PhaseBossEntity.java | 10 +- .../custombosses/RegionalBossEntity.java | 8 +- .../transitiveblocks/TransitiveBlock.java | 4 +- .../TransitiveBlockCommand.java | 4 +- .../transitiveblocks/TransitiveBossBlock.java | 6 +- .../NaturalMobSpawnEventHandler.java | 2 +- .../magmaguy/elitemobs/npcs/NPCEntity.java | 104 +- .../elitemobs/npcs/NPCInteractions.java | 6 +- .../ondeathcommands/OnDeathCommands.java | 4 +- .../elitemobs/pathfinding/Navigation.java | 4 +- .../elitemobs/playerdata/PlayerItem.java | 16 +- .../playerdata/database/GenerateDatabase.java | 9 +- .../playerdata/database/PlayerData.java | 51 +- .../playerdata/database/PortOldData.java | 6 +- .../statusscreen/BossTrackingPage.java | 6 +- .../statusscreen/PlayerStatusScreen.java | 2 +- .../statusscreen/TeleportsPage.java | 9 +- .../EnderDragonEndermiteBombardment.java | 4 +- .../magmaguy/elitemobs/powers/PhotonRay.java | 4 +- .../elitemobs/powers/SummonTheReturned.java | 4 +- .../com/magmaguy/elitemobs/powers/Taunt.java | 2 +- .../elitemobs/powers/ZombieFriends.java | 2 +- .../elitemobs/powers/ZombieNecronomicon.java | 10 +- .../elitemobs/powers/ZombieParents.java | 6 +- .../powers/meta/CombatEnterScanPower.java | 2 - .../powers/meta/CustomSummonPower.java | 66 +- .../elitemobs/powers/meta/ElitePower.java | 6 +- .../elitemobs/powers/scripts/EliteScript.java | 2 +- .../powers/scripts/ScriptAction.java | 60 +- .../powers/scripts/ScriptActionData.java | 8 +- .../powers/scripts/ScriptConditions.java | 2 +- .../powers/scripts/ScriptListener.java | 4 +- .../powers/scripts/ScriptTargets.java | 16 +- .../elitemobs/powers/scripts/ScriptZone.java | 12 +- .../scripts/caching/EliteScriptBlueprint.java | 4 +- .../caching/ScriptActionBlueprint.java | 10 +- .../caching/ScriptActionsBlueprint.java | 4 +- .../caching/ScriptConditionsBlueprint.java | 4 +- .../caching/ScriptCooldownsBlueprint.java | 4 +- .../caching/ScriptEventsBlueprint.java | 4 +- .../caching/ScriptParticlesBlueprint.java | 6 +- .../ScriptRelativeVectorBlueprint.java | 5 +- .../caching/ScriptTargetsBlueprint.java | 6 +- .../scripts/caching/ScriptZoneBlueprint.java | 4 +- .../powers/scripts/enums/ActionType.java | 3 +- .../elitemobs/quests/CustomQuest.java | 6 +- .../elitemobs/quests/QuestTracking.java | 2 +- .../quests/menus/QuestInventoryMenu.java | 2 +- .../elitemobs/quests/menus/QuestMenu.java | 2 +- .../objectives/CustomFetchObjective.java | 4 +- .../objectives/CustomObjectivesParser.java | 10 +- .../quests/objectives/QuestObjectives.java | 6 +- .../playercooldowns/PlayerQuestCooldowns.java | 4 +- .../elitemobs/quests/rewards/RewardEntry.java | 6 +- .../modelengine/CustomModelMEG.java | 23 +- .../discordsrv/DiscordSRVAnnouncement.java | 6 +- .../libsdisguises/DisguiseEntity.java | 12 +- .../elitemobs/thirdparty/paper/PaperMC.java | 4 +- .../worldguard/WorldGuardCompatibility.java | 52 +- .../treasurechest/TreasureChest.java | 8 +- .../utils/ConfigurationLocation.java | 13 +- .../elitemobs/utils/DebugMessage.java | 28 - .../magmaguy/elitemobs/utils/DeepCopy.java | 21 - .../magmaguy/elitemobs/utils/Developer.java | 21 - .../magmaguy/elitemobs/utils/InfoMessage.java | 9 - .../elitemobs/utils/ItemStackGenerator.java | 2 +- .../elitemobs/utils/ItemStackSerializer.java | 5 +- .../elitemobs/utils/MapListInterpreter.java | 24 +- .../elitemobs/utils/PotionEffectTypeUtil.java | 3 +- .../elitemobs/utils/SpigotMessage.java | 2 +- .../elitemobs/utils/StringColorAnimator.java | 2 +- .../elitemobs/utils/VisualDisplay.java | 2 +- .../elitemobs/utils/WarningMessage.java | 21 - .../elitemobs/utils/WorldInstantiator.java | 9 +- .../com/magmaguy/elitemobs/utils/ZipFile.java | 161 ---- .../elitemobs/utils/shapes/Cuboid.java | 6 +- .../elitemobs/utils/shapes/Cylinder.java | 4 +- .../magmaguy/elitemobs/utils/shapes/Ray.java | 4 +- .../versionnotifier/VersionChecker.java | 27 +- .../elitemobs/wormhole/VisualEffects.java | 4 +- .../elitemobs/wormhole/WormholeEntry.java | 15 +- .../elitemobs/wormhole/WormholeTask.java | 2 +- src/main/resources/AdventurersGuild.yml | 0 src/main/resources/CombatTag.yml | 0 .../resources/ItemsCustomLootSettings.yml | 0 src/main/resources/ItemsDropSettings.yml | 0 .../resources/ItemsProceduralSettings.yml | 0 src/main/resources/MobCombatSettings.yml | 0 src/main/resources/ValidWorlds.yml | 0 src/main/resources/events.yml | 0 src/main/resources/playerGuildRank.yml | 0 src/main/resources/playerMoneyData.yml | 0 src/main/resources/plugin.yml | 8 +- src/main/resources/translation.yml | 0 340 files changed, 3524 insertions(+), 4015 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootStats.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/UserCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/admin/CheckTierOthersCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/admin/ReloadCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/admin/VersionCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/combat/CheckTierCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/CustomConfigFieldsInterface.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossTrace.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/DebugMessage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/DeepCopy.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/Developer.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/InfoMessage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/WarningMessage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/ZipFile.java delete mode 100644 src/main/resources/AdventurersGuild.yml delete mode 100644 src/main/resources/CombatTag.yml delete mode 100644 src/main/resources/ItemsCustomLootSettings.yml delete mode 100644 src/main/resources/ItemsDropSettings.yml delete mode 100644 src/main/resources/ItemsProceduralSettings.yml delete mode 100644 src/main/resources/MobCombatSettings.yml delete mode 100644 src/main/resources/ValidWorlds.yml delete mode 100644 src/main/resources/events.yml delete mode 100644 src/main/resources/playerGuildRank.yml delete mode 100644 src/main/resources/playerMoneyData.yml delete mode 100644 src/main/resources/translation.yml diff --git a/build.gradle b/build.gradle index c3ab731e3..7e99f3d7f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ 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,6 +12,17 @@ plugins { compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + options.release = 21 +} + //Fixes issues with utf-8 in the translations files. Why? Don't know. processResources { def props = [version: version] @@ -23,7 +34,7 @@ processResources { } group 'com.magmaguy' -version '9.0.4-SNAPSHOT' +version '9.0.5' repositories { maven { @@ -42,13 +53,18 @@ repositories { mavenLocal() //Spigot API & CloudCommands - maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } +// 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 = 'http://magmaguy.com:50001/releases' + allowInsecureProtocol = true + } //Bstats API maven { url = 'https://repo.codemc.org/repository/maven-public' } @@ -72,7 +88,6 @@ repositories { artifact() } } - } dependencies { @@ -82,14 +97,6 @@ dependencies { implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' - //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' @@ -99,7 +106,7 @@ 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' @@ -113,8 +120,8 @@ dependencies { 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" @@ -125,6 +132,9 @@ dependencies { //Advanced AI goals implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.11.2-SNAPSHOT' + //Advanced AI goals + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' + // Mythic Mobs integration - currently only for arenas compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } @@ -143,9 +153,6 @@ 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) @@ -167,35 +174,19 @@ 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 = "https://s01.oss.sonatype.org/content/repositories/snapshots/"; + 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 1916f0a58..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 8c3becb3a..1f33f06be 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -5,7 +5,7 @@ */ import com.magmaguy.easyminecraftgoals.NMSManager; -import com.magmaguy.elitemobs.commands.CommandHandler; +import com.magmaguy.elitemobs.commands.CommandManager; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -58,11 +58,11 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.BossBarUtil; -import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ServerTime; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.versionnotifier.VersionChecker; 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; @@ -84,42 +84,40 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations - DefaultConfig.initializeConfig(); - ResourcePackDataConfig.initializeConfig(); - ItemSettingsConfig.initializeConfig(); - ProceduralItemGenerationSettingsConfig.initializeConfig(); + new DefaultConfig(); + new ResourcePackDataConfig(); + 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(); - SoundsConfig.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); } @@ -127,18 +125,16 @@ public static void worldScanner() { @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)){ - new WarningMessage("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."); + 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; } @@ -152,9 +148,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); } } @@ -173,14 +169,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; } @@ -188,7 +184,7 @@ public void onEnable() { EventsRegistrer.registerEvents(); //Launch the local data cache - DatabaseConfig.initializeConfig(); + new DatabaseConfig(); PlayerData.initializeDatabaseConnection(); ElitePlayerInventory.initialize(); @@ -253,7 +249,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(); } @@ -262,17 +258,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(); + new CommandManager(); - SpecialItemSystemsConfig.initializeConfig(); + new SpecialItemSystemsConfig(); /* Check for new plugin version or for dungeon updates @@ -284,11 +281,15 @@ public void onEnable() { @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) @@ -298,41 +299,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 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(); @@ -341,40 +323,24 @@ 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(); - EliteMobsWorld.shutdown(); Navigation.shutdown(); BossBarUtil.shutdown(); ScriptAction.shutdown(); - - //save cached data - Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); + Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); - Bukkit.getLogger().info("[EliteMobs] All done! Good night."); - + MagmaCore.shutdown(); + Logger.info("All done! Good night."); } /* diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index a2ac40314..e127f438e 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -107,7 +107,7 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) register(new PreventUpgradeDiamondToNetherite()); - register(new FixPlayerSpeedOnRespawn()); + register(new FixPlayerOnLoginOrRespawn()); register(new EnvironmentalDungeonDamage()); register(new PlayerQuitCleanup()); 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/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 51ae8477a..0a3986fe2 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.adventurersguild; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; @@ -8,6 +7,7 @@ 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; 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/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/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java index 03317ad67..3e3cce76c 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java @@ -1,11 +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; 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/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/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 275500332..24c42aa45 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -79,7 +79,7 @@ public void onPlayerDeath(PlayerDeathEvent event) { } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerShoot(EntityShootBowEvent event){ + public void onPlayerShoot(EntityShootBowEvent event) { if (!EliteItemManager.isEliteMobsItem(event.getBow())) return; if (isOnLastDamage(event.getBow())) event.setCancelled(true); } 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..fa6bf49a6 --- /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.PlayerLoginEvent; +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 onPlayerRespawn(PlayerLoginEvent 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/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java deleted file mode 100644 index 5b1defcd0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.collateralminecraftchanges; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class FixPlayerSpeedOnRespawn 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)); - } -} 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 index cf7069ae3..3a88714f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java @@ -7,7 +7,7 @@ public class PlayerQuitCleanup implements Listener { @EventHandler - public void onPlayerQuit(PlayerQuitEvent event){ + public void onPlayerQuit(PlayerQuitEvent event) { if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer())) event.getPlayer().setInvulnerable(false); } 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 003ce635a..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ /dev/null @@ -1,896 +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.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")))); - - 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 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 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 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) { - customBossEntity.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 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/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java new file mode 100644 index 000000000..1ec601fb5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class AdventurersGuildCommand extends AdvancedCommand { + public AdventurersGuildCommand() { + super(List.of("adventurersguild", "ag")); + 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() { + com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + } +} \ 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..01b258753 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -0,0 +1,24 @@ +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.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."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + PlayerData.setUseBookMenus(getCurrentPlayerSender(), !PlayerData.getUseBookMenus(getCurrentPlayerSender().getUniqueId())); + Logger.sendMessage(getCurrentCommandSender(), 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..030c1908c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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 "); + setDescription("When in instanced content, makes the player start the instance."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + ArenaCommands.openArenaMenu(getCurrentPlayerSender(), getStringArgument("arenaID")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java index 5179f8289..50d8010f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java @@ -4,7 +4,9 @@ import org.bukkit.entity.Player; public class ArenaCommands { - private ArenaCommands(){} + private 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 deleted file mode 100644 index 2a5faef8b..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -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. - */ - -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(); - } - - 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); - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java new file mode 100644 index 000000000..1acb36c11 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java @@ -0,0 +1,96 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; + +public class CommandManager extends com.magmaguy.magmacore.command.CommandManager { + public CommandManager() { + super(MetadataHandler.PLUGIN, "elitemobs"); + } + + @Override + public void registerCommands() { + //Admin commands + registerCommand(new SetupCommand()); + registerCommand(new SetupDoneCommand()); + registerCommand(new SetupToggleCommand()); + registerCommand(new SpawnBossCommand()); + registerCommand(new SpawnBossLevelCommand()); + registerCommand(new SpawnBossAtCommand()); + registerCommand(new SpawnBossLevelAtCommand()); + registerCommand(new PlaceBossCommand()); + registerCommand(new PlaceTreasureChestCommand()); + registerCommand(new PlaceNPCCommand()); + registerCommand(new RemoveCommand()); + registerCommand(new DebugCommand()); + registerCommand(new EventCommand()); + registerCommand(new StatsCommand()); + registerCommand(new LootMenuCommand()); + registerCommand(new LootGiveCommand()); + registerCommand(new LootRandomCommand()); + registerCommand(new LootSimulateMultipleCommand()); + registerCommand(new LootSimulateCommand()); + registerCommand(new VersionCommand()); + registerCommand(new ReloadCommand()); + registerCommand(new KillCommand()); + registerCommand(new KillRadiusCommand()); + registerCommand(new KillTypeCommand()); + registerCommand(new KillTypeRadiusCommand()); + registerCommand(new LootDebugCommand()); + registerCommand(new MoneyAddCommand()); + registerCommand(new MoneyAddAllCommand()); + registerCommand(new MoneySetCommand()); + registerCommand(new MoneyCheckPlayerCommand()); + registerCommand(new UnbindForceCommand()); + registerCommand(new FireballCommand()); + registerCommand(new RespawnAllCommand()); + registerCommand(new PackageDungeonCommand()); + registerCommand(new LanguageCommand()); + registerCommand(new PlaceWormholeCommand()); + registerCommand(new LootStats()); + registerCommand(new ShopProceduralOtherCommand()); + registerCommand(new ShopCustomOtherCommand()); + registerCommand(new ShopSellOtherCommand()); + registerCommand(new QuestBypassCommand()); + registerCommand(new QuestCompleteCommand()); + registerCommand(new QuestResetCommand()); + registerCommand(new QuestResetAllCommand()); + registerCommand(new TransitiveBlocksCancelCommand()); + registerCommand(new TransitiveBlocksRegisterCommand()); + registerCommand(new TransitiveBlocksEditCommand()); + registerCommand(new TransitiveBlocksRegisterAreaCommand()); + registerCommand(new TransitiveBlocksEditAreaCommand()); + registerCommand(new RankSetCommand()); + registerCommand(new SpawnElite()); + registerCommand(new SpawnEliteAtCommand()); + registerCommand(new DiscordMessageCommand()); + registerCommand(new DiscordCommand()); + + //User commands + registerCommand(new AdventurersGuildCommand()); + registerCommand(new ShareItemCommand()); + registerCommand(new ShopDynamicCommand()); + registerCommand(new ShopCustomCommand()); + registerCommand(new RepairCommand()); + registerCommand(new EnchantCommand()); + registerCommand(new ScrapCommand()); + registerCommand(new UnbindCommand()); + registerCommand(new MoneyCheckCommand()); + registerCommand(new QuestAcceptCommand()); + registerCommand(new QuestTrackCommand()); + registerCommand(new QuestLeaveCommand()); + registerCommand(new RankCommand()); + registerCommand(new LootCommand()); + registerCommand(new QuitCommand()); + registerCommand(new StartCommand()); + registerCommand(new ArenaCommand()); + registerCommand(new DismissCommand()); + registerCommand(new AltCommand()); + registerCommand(new SpawnTeleportCommand()); + registerCommand(new DungeonTeleportCommand()); + registerCommand(new TrackBossCommand()); + registerCommand(new PayCommand()); + + registerCommand(new EliteMobsCommand()); + registerCommand(new HelpCommand()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index 82373bb98..e6de39500 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 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 eb0b29814..71fbd2efb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; 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; 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..4eed4aad6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -0,0 +1,25 @@ +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.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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute() { + DebugScreen.open(getCurrentPlayerSender(), 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..4ea9e1ac4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Links to the EliteMobs discord."); + } + + @Override + public void execute() { + Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + } +} \ No newline at end of file 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..97c796060 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes"); + } + + @Override + public void execute() { + new DiscordSRVAnnouncement(getStringSequenceArgument("message")); + Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); + } +} \ No newline at end of file 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..0af89d79c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.magmacore.command.AdvancedCommand; +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"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + PlayerData.setDismissEMStatusScreenMessage(getCurrentPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(getCurrentPlayerSender().getUniqueId())); + } +} 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..c50bc0416 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.dungeontp"); + setDescription("Teleports players to Lairs, Minidungeons and Dungeons."); + setUsage("/em dungeontp "); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + DungeonCommands.teleport(getCurrentPlayerSender(), 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..a07eb3d2f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -0,0 +1,23 @@ +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.SenderType; + +import java.util.List; + +public class EliteMobsCommand extends AdvancedCommand { + public EliteMobsCommand() { + super(List.of("em", "elitemobs")); + setDescription("The main command for EliteMobs, opens the main menu."); + setUsage("/em"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + if (DefaultConfig.isEmLeadsToStatusMenu()) + new PlayerStatusScreen(getCurrentPlayerSender()); + } +} \ 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..c2766a35e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -0,0 +1,24 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + new ItemEnchantmentMenu(getCurrentPlayerSender()); + } +} 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..489fe0ef5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.events.TimedEvent; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Triggers a timed event to start at the next available time and place."); + } + + @Override + public void execute() { + com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(getCurrentCommandSender(), 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..c1a8cb366 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.entitytracker.EntityTracker; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Shoots a fireball, to test terrain protections and explosion regeneration."); + } + + @Override + public void execute() { + Fireball fireball = (Fireball) getCurrentPlayerSender().getWorld().spawnEntity(getCurrentPlayerSender().getLocation(), EntityType.FIREBALL); + fireball.setDirection(getCurrentPlayerSender().getLocation().getDirection().normalize()); + fireball.setShooter(getCurrentPlayerSender()); + 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..4cdca44e4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Lists all commands."); + } + + @Override + public void execute() { + Logger.sendMessage(getCurrentCommandSender(), "Commands:"); + CommandManager.getInstance().commands.forEach(command -> { + if (getCurrentCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.usage, command.description)); + } else { + Logger.sendSimpleMessage(getCurrentCommandSender(), command.usage); + Logger.sendSimpleMessage(getCurrentCommandSender(), command.description); + } + }); + } +} \ 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..a8b97ca43 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -0,0 +1,20 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class KillCommand extends AdvancedCommand { + public KillCommand() { + super(List.of("kill")); + setUsage("/em kill"); + setPermission("elitemobs.*"); + setDescription("Kills all elites."); + } + + @Override + public void execute() { + KillHandler.killAggressiveMobs(getCurrentCommandSender()); + } +} \ 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..ee0629fa8 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites in the specified radius."); + } + + @Override + public void execute() { + KillHandler.radiusKillAggressiveMobs(getCurrentPlayerSender(), 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..15d6e8ee7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites of the specified type."); + } + + @Override + public void execute() { + KillHandler.killEntityType(getCurrentPlayerSender(), EntityType.valueOf(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..0d412be6f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites of the specified type."); + } + + @Override + public void execute() { + KillHandler.radiusKillSpecificMobs(getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("type")), + 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..99c1ab744 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -0,0 +1,31 @@ +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.util.Logger; + +import java.util.List; + +public class LanguageCommand extends AdvancedCommand { + public LanguageCommand() { + super(List.of("language")); + addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); + setUsage("/em language "); + setPermission("elitemobs.*"); + setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + } + + @Override + public void execute() { + String language = getStringArgument("language"); + if (!TranslationsConfig.getTranslationConfigs().containsKey(language)) { + Logger.sendMessage(getCurrentCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(getCurrentCommandSender(), key)); + return; + } + DefaultConfig.setLanguage(getCurrentCommandSender(), language); + Logger.sendMessage(getCurrentCommandSender(), "&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..53b255fdc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.LootMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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() { + LootMenu.openMenu(getCurrentPlayerSender()); + } +} 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..82a55be01 --- /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.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em loot test "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + GetTierCommand.get(getCurrentPlayerSender(), 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..9159eaed2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -0,0 +1,27 @@ +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.SenderType; + +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Gives loot to a player."); + } + + @Override + public void execute() { + LootCommand.give(getCurrentCommandSender(), getStringArgument("playerName"), 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..2ff145bbc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.GetLootMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the loot menu."); + } + + @Override + public void execute() { + new GetLootMenu(getCurrentPlayerSender()); + } +} \ 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..5bff2f261 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -0,0 +1,27 @@ +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.SenderType; + +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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot random "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Gives loot to a player."); + } + + @Override + public void execute() { + SimLootCommand.forcePositiveLoot(getCurrentCommandSender(), getStringArgument("playerName"), 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..5986986de --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -0,0 +1,30 @@ +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.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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot simulate "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified level and player."); + } + + @Override + public void execute() { + SimLootCommand.run( + getCurrentPlayerSender(), + getIntegerArgument("level"), + 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..4f8988bc2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -0,0 +1,32 @@ +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.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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot simulate "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + SimLootCommand.runMultipleTimes( + getCurrentPlayerSender(), + getIntegerArgument("level"), + getIntegerArgument("times"), + 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..4dc8c73f9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -0,0 +1,37 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.api.utils.EliteItemManager; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Provides EliteMobs stats for the currently held item."); + } + + @Override + public void execute() { + Player player = getCurrentPlayerSender(); + 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..8d13578c1 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.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.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class MoneyAddAllCommand extends AdvancedCommand { + public MoneyAddAllCommand() { + super(List.of("money")); + addLiteral("add"); + addLiteral("all"); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money add all "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.addAllCommand( + getCurrentCommandSender(), + 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..08328ad15 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money add "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.addCommand( + getCurrentCommandSender(), + getStringArgument("player"), + 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..d2e35b5d6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -0,0 +1,27 @@ +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.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"); + setSenderType(SenderType.PLAYER); + setDescription("Checks the EliteMobs currency"); + } + + @Override + public void execute() { + if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) + new PlayerStatusScreen(getCurrentPlayerSender()); + else + CurrencyCommandsHandler.walletCommand(getCurrentPlayerSender()); + } +} 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..01f299276 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; + +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 check "); + setPermission("elitemobs.*"); + setDescription("Checks how much currency you have."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.checkCommand( + getCurrentCommandSender(), + getStringArgument("player")); + } +} \ No newline at end of file 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..e99856ac9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.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.SenderType; + +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Deducts the specified amount of currency from a player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.subtractCommand( + getStringArgument("player"), + 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..517ab97a5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; + +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.*"); + setDescription("Sets the specified amount of currency to a player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.setCommand( + getCurrentCommandSender(), + getStringArgument("player"), + 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..d9ba2bac9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; + +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.*"); + setDescription("Packages an EliteMobs dungeon for distribution."); + } + + @Override + public void execute() { + new PackageCommand(getCurrentCommandSender(), getStringArgument("dungeonName"), 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..98f778fed --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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 "); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + CurrencyCommandsHandler.payCommand( + getCurrentPlayerSender(), + getStringArgument("player"), + 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..a80c2017e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class PlaceBossCommand extends AdvancedCommand { + public PlaceBossCommand() { + super(List.of("place")); + addLiteral("boss"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + setUsage("/em addSpawn boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute() { + CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + } +} \ 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..d093d367a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -0,0 +1,26 @@ +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.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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Permanently adds an npc to the location the user is standing on."); + } + + @Override + public void execute() { + NPCCommands.set(getCurrentPlayerSender(), 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..ad8ee1d5a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Permanently adds a treasure chest to the location the user is standing on."); + } + + @Override + public void execute() { + CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + } +} \ 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..9ff0df62e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -0,0 +1,41 @@ +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.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 wormhole <1/2>"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + } + + @Override + public void execute() { + for (Wormhole wormhole : Wormhole.getWormholes()) { + if (wormhole.getWormholeConfigFields().getFilename().equals(getStringArgument("wormholeFilename"))) + switch (getStringArgument("wormholeOption")) { + case "1": + wormhole.getWormholeEntry1().updateLocation(getCurrentPlayerSender()); + return; + case "2": + wormhole.getWormholeEntry2().updateLocation(getCurrentPlayerSender()); + return; + default: + Logger.sendMessage(getCurrentCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + } + } + Logger.sendMessage(getCurrentCommandSender(), "Failed to set location for this wormhole."); + } +} \ No newline at end of file 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..9b10521ed --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.command"); + setSenderType(SenderType.PLAYER); + setDescription("Accepts a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute() { + QuestCommand.joinQuest(getStringArgument("questID"), getCurrentPlayerSender()); + } +} 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..413fbdbe6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class QuestBypassCommand extends AdvancedCommand { + public QuestBypassCommand() { + super(List.of("quest")); + addLiteral("bypass"); + setUsage("/em quest bypass"); + setPermission("elitemobs.*"); + setDescription("Bypasses permission restrictions for elite quests."); + } + + @Override + public void execute() { + QuestCommand.bypassQuestRequirements(getCurrentPlayerSender()); + } +} \ 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..bd98d8b1c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Forces all of your currently active elite quests to be completed. For debugging use only."); + } + + @Override + public void execute() { + QuestCommand.completeQuest(getCurrentPlayerSender()); + } +} \ 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..1ea94da6d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class QuestLeaveCommand extends AdvancedCommand { + public QuestLeaveCommand() { + super(List.of("quest")); + addLiteral("leave"); + setUsage("/em quest leave"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Leaves a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute() { + QuestCommand.leaveQuest(getCurrentPlayerSender(), 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..c000e8877 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -0,0 +1,26 @@ +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 java.util.ArrayList; +import java.util.List; + +public class QuestResetAllCommand extends AdvancedCommand { + public QuestResetAllCommand() { + super(List.of("quest")); + addLiteral("reset"); + addLiteral("all"); + addArgument("player", new ArrayList<>()); + addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); + setUsage("/em quest reset "); + setPermission("elitemobs.*"); + setDescription("Resets all quests for a specific player."); + } + + @Override + public void execute() { + QuestCommand.resetQuests(getCurrentCommandSender(), 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..e80d057fb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -0,0 +1,25 @@ +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 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.*"); + setDescription("Resets a specific quest for a specific player."); + } + + @Override + public void execute() { + QuestCommand.resetQuest(getCurrentCommandSender(), getStringArgument("player"), 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..06802a94f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.command"); + setSenderType(SenderType.PLAYER); + setDescription("Tracks a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute() { + QuestCommand.trackQuest(getStringArgument("questID"), getCurrentPlayerSender()); + } +} 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..d543f3016 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.instanced.MatchInstance; +import com.magmaguy.magmacore.command.AdvancedCommand; +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() { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(getCurrentPlayerSender()); + if (matchInstance != null) + matchInstance.removeAnyKind(getCurrentPlayerSender()); + } +} \ 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..cacf7c07d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + } +} \ 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..a1012bc61 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; + +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.*"); + setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified."); + } + + @Override + public void execute() { + GuildRankCommands.setGuildRank(getCurrentCommandSender(), + getStringArgument("player"), + getIntegerArgument("prestigeLevel"), + 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..46a469de3 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + 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() { + reload(getCurrentCommandSender()); + } +} \ 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..350acdf31 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content."); + } + + @Override + public void execute() { + com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(getCurrentPlayerSender()); + } +} \ 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..55f0209b5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -0,0 +1,26 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + RepairMenu repairMenu = new RepairMenu(); + repairMenu.constructRepairMenu(getCurrentPlayerSender()); + } + } +} 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..4536c0d31 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class RespawnAllCommand extends AdvancedCommand { + public RespawnAllCommand() { + super(List.of("respawn")); + addLiteral("all"); + setUsage("/em respawn all"); + setPermission("elitemobs.*"); + setDescription("Forces all regional bosses to respawn."); + } + + @Override + public void execute() { + 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..f1bd65d76 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -0,0 +1,26 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + ScrapperMenu scrapperMenu = new ScrapperMenu(); + scrapperMenu.constructScrapMenu(getCurrentPlayerSender()); + } + } +} 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..e23b0ce2e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.setup.SetupMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class SetupCommand extends AdvancedCommand { + public SetupCommand() { + super(List.of("setup")); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("The main command for setting up EliteMobs!"); + setUsage("/em setup"); + } + + @Override + public void execute() { + new SetupMenu(getCurrentPlayerSender()); + } +} 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..5091430a6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class SetupDoneCommand extends AdvancedCommand { + public SetupDoneCommand() { + super(List.of("setup")); + addLiteral("done"); + setUsage("/setup done"); + setPermission("elitemobs.*"); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute() { + DefaultConfig.toggleSetupDone(); + if (DefaultConfig.isSetupDone()) + Logger.sendMessage(getCurrentCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this."); + else + Logger.sendMessage(getCurrentCommandSender(), "&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 0b5f635b7..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.commands.setup.SetupMenu; -import com.magmaguy.elitemobs.dungeons.EMPackage; -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); - } -} 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..78e6e3b35 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.magmacore.command.AdvancedCommand; +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")); + setPermission("elitemobs.*"); + setDescription("Sets up EliteMobs content!"); + setUsage("/em setup toggle"); + addLiteral("toggle"); + addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); + } + + @Override + public void execute() { + String dungeon = getStringArgument("empackages"); + if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) + Logger.sendMessage(getCurrentCommandSender(), "Not a valid em package!"); + EMPackage emPackage = EMPackage.getEmPackages().get(dungeon); + if (emPackage.install()) + Logger.sendMessage(getCurrentCommandSender(), "Successfully installed 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..1189648ac --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.items.ShareItem; +import com.magmaguy.magmacore.command.AdvancedCommand; +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("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + } + + @Override + public void execute() { + ShareItem.showOnChat(getCurrentPlayerSender()); + } +} 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..3907223a9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -0,0 +1,25 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + CustomShopMenu.customShopInitializer(getCurrentPlayerSender()); + } +} 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..be44f5a22 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.CustomShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Opens the EliteMobs shop for custom items."); + } + + @Override + public void execute() { + try { + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(getCurrentCommandSender(), "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..b13ccf3f4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -0,0 +1,25 @@ +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.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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + ProceduralShopMenu.shopInitializer(getCurrentPlayerSender()); + } +} 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..67b331977 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.ProceduralShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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() { + try { + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(getCurrentCommandSender(), "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..d3847eed2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.SellMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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 custom "); + setPermission("elitemobs.*"); + setDescription("Opens the EliteMobs shop for custom items."); + } + + @Override + public void execute() { + SellMenu sellMenu = new SellMenu(); + try { + sellMenu.constructSellMenu(Bukkit.getPlayer(getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(getCurrentCommandSender(), "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..8e3d72342 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -0,0 +1,40 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; +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("/setup spawnAt boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + getStringArgument("filename"), + getStringArgument("worldName"), + new Vector( + getDoubleArgument("x"), + getDoubleArgument("y"), + 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..de21fe16b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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("/setup spawn boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + 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..0c21ed5f9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -0,0 +1,42 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; +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("/setup spawn bossAt "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + getStringArgument("filename"), + getStringArgument("worldName"), + new Vector( + getDoubleArgument("x"), + getDoubleArgument("y"), + getDoubleArgument("z")), + 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..986f72362 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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("/setup spawn boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + getStringArgument("filename"), + 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 9b4681e3e..322e88eeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -1,6 +1,5 @@ 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; @@ -10,6 +9,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; 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; @@ -27,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); + String[] powersArray = powers.get().split(" "); + HashSet mobPowers = getPowers(powersArray, player); eliteEntity.applyPowers(mobPowers); } else { eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity)); @@ -46,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, @@ -63,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); 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..4ad1e71c4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -0,0 +1,33 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + } + + @Override + public void execute() { + SpawnCommand.spawnEliteEntityTypeCommand( + getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("entityType")), + getIntegerArgument("level"), + Optional.of(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..fef05b732 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -0,0 +1,43 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.command.AdvancedCommand; +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 elite <...>"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + } + + @Override + public void execute() { + SpawnCommand.spawnEliteEntityTypeCommand( + getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("entityType")), + getStringArgument("world"), + new Vector( + getIntegerArgument("x"), + getIntegerArgument("y"), + getIntegerArgument("z")), + getIntegerArgument("level"), + Optional.of(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..4d3029a8b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -0,0 +1,24 @@ +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.SenderType; + +import java.util.List; + +public class SpawnTeleportCommand extends AdvancedCommand { + public SpawnTeleportCommand() { + super(List.of("spawntp")); + setPermission("elitemobs.spawntp"); + setUsage("/em spawntp"); + setDescription("Teleports players to the server spawn."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + if (DefaultConfig.getDefaultSpawnLocation() != null) + PlayerPreTeleportEvent.teleportPlayer(getCurrentPlayerSender(), 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..82447a712 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.instanced.MatchInstance; +import com.magmaguy.magmacore.command.AdvancedCommand; +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); + } + + @Override + public void execute() { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(getCurrentPlayerSender()); + if (matchInstance != null) { + matchInstance.countdownMatch(); + } else + Logger.sendMessage(getCurrentCommandSender(), "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..db0e4764f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Displays EliteMobs server stats."); + } + + @Override + public void execute() { + com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(getCurrentPlayerSender()); + } +} \ 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..cac58c1e4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -0,0 +1,37 @@ +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.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); + } + + @Override + public void execute() { + try { + for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) + if (customBossEntity.getEliteUUID().equals(UUID.fromString(getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(getCurrentPlayerSender()); + return; + } + Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + } catch (Exception ex) { + //happens when players try to track an entity that has despawned for any reason + Logger.sendMessage(getCurrentCommandSender(), 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..9c5f99c25 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class TransitiveBlocksCancelCommand extends AdvancedCommand { + public TransitiveBlocksCancelCommand() { + super(List.of("transitiveBlocks")); + addLiteral("cancel"); + setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender()); + } +} \ 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..8ae26b164 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Edits large transitive blocks areas for use by regional bosses."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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..936f496e2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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..a16414ca1 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Registers large transitive blocks areas for use by regional bosses."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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..66c304a25 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false); + } +} \ No newline at end of file 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..7c4e19c93 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -0,0 +1,26 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + UnbindMenu unbindMenu = new UnbindMenu(); + unbindMenu.constructUnbinderMenu(getCurrentPlayerSender()); + } + } +} 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..ca1237a23 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -0,0 +1,27 @@ +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.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.*"); + setDescription("Forcefully unbinds a held item."); + } + + @Override + public void execute() { + ItemStack itemStack = getCurrentPlayerSender().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..765e84ddb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Checks the server's plugin version."); + } + + @Override + public void execute() { + Logger.sendMessage( + getCurrentCommandSender(), + 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..7cb25431c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -1,6 +1,5 @@ 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; @@ -8,6 +7,7 @@ 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 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 a6309b02e..8cbeb76d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -55,14 +55,18 @@ 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)); } 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 e5e0c4bcd..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,10 +1,10 @@ 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.magmacore.util.ChatColorConverter; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; 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/RelativeCoordinatesCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java index 3ff071457..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,8 +1,8 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.dungeons.EMPackage; 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; 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 cb8d145b0..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,12 +1,12 @@ 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.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; 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 4f5f698ac..aff87c328 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -1,6 +1,5 @@ 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; @@ -8,6 +7,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.CommandSender; 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/setup/SetupMenu.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java index ea17b69f2..05bf15fc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.SpigotMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -60,10 +60,10 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup } } - public static void forceResourcePack(Player player) { - ResourcePackDataConfig.toggleForceResourcePack(true); - player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); - } +// 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 diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index 7aaf10e90..96882a5f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,15 +1,14 @@ 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.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 @@ -67,19 +66,96 @@ public class AdventurersGuildConfig { @Getter private static boolean disableCommonerRank; - private static File file; - private static FileConfiguration fileConfiguration; + public AdventurersGuildConfig() { + super("AdventurersGuild.yml"); + } + + public static String getRankName(int prestigeTier, int rankTier) { + return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]); + } - private AdventurersGuildConfig() { + 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"; + } } - public static void save() { - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, 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"; + } } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("AdventurersGuild.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @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); @@ -425,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 6b0641834..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,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 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; @@ -33,13 +32,12 @@ 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", @@ -77,9 +75,5 @@ public static void initializeConfig() { 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 6e89a7855..778e82472 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,102 +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.magmacore.util.ChatColorConverter; +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) { - fileConfiguration.setComments(key, comments); - } - - public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - try { - fileConfiguration.addDefault(key, defaultValue); - } catch (Exception e) { - new WarningMessage("Attempted to write key " + key + " with value " + defaultValue + " to " + fileConfiguration.getName() + " and that contained an illegal argument!"); - e.printStackTrace(); - } - 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); @@ -112,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) @@ -149,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()) @@ -194,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); } 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); } 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) @@ -215,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 2e9526b60..d0fbb9990 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.scheduler.BukkitRunnable; import java.io.*; @@ -27,7 +27,7 @@ public void run() { try { Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports")); } catch (Exception exception) { - new WarningMessage("Failed to create exports directory! Tell the dev!"); + Logger.warn("Failed to create exports directory! Tell the dev!"); exception.printStackTrace(); } } @@ -36,7 +36,7 @@ public void run() { 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) { - new WarningMessage("Failed to download official resource pack! Tell the dev!"); + Logger.warn("Failed to download official resource pack! Tell the dev!"); e.printStackTrace(); } } @@ -66,7 +66,7 @@ public static void downloadFile(String fileURL, String saveFilePath) throws IOEx // Opens input stream from the HTTP connection InputStream inputStream = httpConn.getInputStream(); - String saveFilePathWithName = saveFilePath + File.separatorChar+ fileName; + String saveFilePathWithName = saveFilePath + File.separatorChar + fileName; // Opens an output stream to save into file FileOutputStream outputStream = new FileOutputStream(saveFilePathWithName); @@ -81,7 +81,7 @@ public static void downloadFile(String fileURL, String saveFilePath) throws IOEx inputStream.close(); } else { - new WarningMessage("No file to download. Server replied HTTP code: " + responseCode); + Logger.warn("No file to download. Server replied HTTP code: " + responseCode); } httpConn.disconnect(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java index 1642611ba..2ec691a57 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java @@ -1,12 +1,11 @@ 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 com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.ZipFile; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -27,7 +26,7 @@ public static void initializeConfigs() { try { Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "imports")); } catch (Exception exception) { - new WarningMessage("Failed to create import directory! Tell the dev!"); + Logger.warn("Failed to create import directory! Tell the dev!"); exception.printStackTrace(); } return; @@ -37,7 +36,7 @@ public static void initializeConfigs() { 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!"); + Logger.warn("Failed to get imports folder! Report this to the dev!"); return; } @@ -47,10 +46,11 @@ public static void initializeConfigs() { for (File zippedFile : importsFile.listFiles()) { File unzippedFile; try { - if (zippedFile.getName().contains(".zip")) unzippedFile = ZipFile.unzip(zippedFile.getName()); + if (zippedFile.getName().contains(".zip")) + unzippedFile = ZipFile.unzip(zippedFile, new File(zippedFile.getAbsolutePath().replace(".zip", ""))); else unzippedFile = zippedFile; } catch (Exception e) { - new WarningMessage("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); + Logger.warn("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); e.printStackTrace(); continue; } @@ -105,18 +105,18 @@ public static void initializeConfigs() { if (CustomModel.customModelsEnabled()) { importedModels = true; } else - new WarningMessage("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); + Logger.warn("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); break; case "schematics": - new WarningMessage("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); + Logger.warn("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); 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?"); + Logger.warn("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!"); + Logger.warn("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); e.printStackTrace(); continue; } @@ -124,7 +124,7 @@ public static void initializeConfigs() { unzippedFile.delete(); zippedFile.delete(); } catch (Exception ex) { - new WarningMessage("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); + Logger.warn("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); ex.printStackTrace(); } } @@ -142,7 +142,7 @@ 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()); + Logger.info("Cleaning up " + file.getPath()); file.delete(); } @@ -151,16 +151,16 @@ private static void moveWorlds(File worldcontainerFile) { 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()); + Logger.info("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!"); + Logger.warn("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!"); + Logger.warn("Failed to move worlds for " + file.getName() + "! Tell the dev!"); exception.printStackTrace(); } } @@ -168,10 +168,10 @@ private static void moveWorlds(File worldcontainerFile) { private static void moveDirectory(File unzippedDirectory, Path targetPath, boolean force) { for (File file : unzippedDirectory.listFiles()) try { - new InfoMessage("Adding " + file.getCanonicalPath()); + Logger.info("Adding " + file.getCanonicalPath()); moveFile(file, targetPath, force); } catch (Exception exception) { - new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!"); + Logger.warn("Failed to move directories for " + file.getName() + "! Tell the dev!"); exception.printStackTrace(); } } @@ -191,7 +191,7 @@ private static void moveFile(File file, Path targetPath, boolean force) { 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!"); + Logger.warn("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 1848717fe..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 validity 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() + " ! You should probably delete that file."); -// 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 +128,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 +153,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( @@ -196,16 +201,7 @@ public static void initializeConfig() { 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); + 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); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - - 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 8ec9e8c08..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; @@ -35,12 +34,12 @@ public class DungeonsConfig { @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"), @@ -94,8 +93,5 @@ public static void initializeConfig() { 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); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index 9aef67a34..20a73bea6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,17 +1,17 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; +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 @@ -82,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; @@ -264,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 37d2b3339..2d72be5c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.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 EventsConfig { +public class EventsConfig extends ConfigurationFile { @Getter private static boolean announcementBroadcastWorldOnly; @Getter @@ -18,13 +17,12 @@ public class EventsConfig { @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); @@ -33,7 +31,7 @@ public static void initializeConfig() { fileConfiguration, "actionEventMinimumCooldownMinutes", 4); timedEventMinimumCooldown = ConfigurationEngine.setInt( List.of("Sets the minimum cooldown, in minutes, between timed events"), - fileConfiguration, "actionEventMinimumCooldownMinutes", 4); + 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"), @@ -43,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 57381df60..5c3e787db 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.List; -public class ItemSettingsConfig { +public class ItemSettingsConfig extends ConfigurationFile { @Getter private static String shopItemSource; @Getter @@ -120,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.", @@ -343,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 53be17872..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java +++ /dev/null @@ -1,28 +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 index c03efc4ed..e72f2a185 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -1,5 +1,7 @@ package com.magmaguy.elitemobs.config; +import org.bukkit.Particle; + import java.util.Locale; public class LegacyValueConverter { @@ -74,6 +76,25 @@ public static String parsePotionEffect(String 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(); + default: + return potionEffectName; + } + } + public static String parseDeserializedBlocks(String originalDeserializedBlock) { if (originalDeserializedBlock.endsWith("grass")) return originalDeserializedBlock.replace("grass", "grass_block[snowy=false]"); 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 01b60cec2..0114dfdaf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -1,24 +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..ecec2451e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -1,21 +1,18 @@ 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,14 +57,28 @@ public class ProceduralItemGenerationSettingsConfig { private static List verbs; @Getter private static List verbers; + @Getter + private static ProceduralItemGenerationSettingsConfig instance; + + public ProceduralItemGenerationSettingsConfig() { + super("ProceduralItemGenerationSettings.yml"); + instance = this; + } + + 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() { doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); @@ -1449,21 +1460,6 @@ public static void initializeConfig() { "Slapper" ), true); - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); - 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 90a6d68a1..fa5a2824c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -4,7 +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.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -15,7 +16,7 @@ import java.util.Arrays; import java.util.List; -public class QuestsConfig { +public class QuestsConfig extends ConfigurationFile { @Getter private static boolean requireQuestTurnIn; @@ -104,12 +105,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<>(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() + )); + + 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) { + 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."), @@ -251,87 +333,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() - )); - - 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 index 1a077e54a..01ba3e076 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; 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; @@ -17,7 +17,7 @@ import java.io.IOException; import java.net.URL; -public class ResourcePackDataConfig { +public class ResourcePackDataConfig extends ConfigurationFile { @Getter public static boolean eliteMobsResourcePackEnabled; @@ -31,23 +31,11 @@ public class ResourcePackDataConfig { public static String resourcePackLink; @Getter public static byte[] SHA1 = null; - private static File file; - private static FileConfiguration fileConfiguration; + public static ResourcePackDataConfig instance; - 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 ResourcePackDataConfig() { + super("resource_pack_config.yml"); + instance = this; } public static void updateSHA1() { @@ -59,21 +47,21 @@ public void run() { 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)"); + Logger.warn("[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."); + Logger.warn("[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); + instance.fileConfiguration.set("eliteMobsResourcePackEnabled", status); + ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); eliteMobsResourcePackEnabled = status; displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; if (status) { @@ -83,7 +71,7 @@ public static void toggleEliteMobsResourcePackStatus(boolean status) { } public static void toggleForceResourcePack(boolean status) { - fileConfiguration.set("forceResourcePack", status); + instance.fileConfiguration.set("forceResourcePack", status); forceResourcePack = status; } @@ -91,6 +79,18 @@ public static void sendResourcePack(Player player) { player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); } + @Override + public void initializeValues() { + 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; + } + public static class ResourcePackDataConfigEvents implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLogin(PlayerJoinEvent event) { diff --git a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index 92fd4f3c4..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,10 +13,12 @@ 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); @@ -48,8 +46,5 @@ public static void initializeConfig() { 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); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index 2afad9dc1..536569ffa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -1,15 +1,15 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.utils.WarningMessage; +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<>(); @@ -40,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."), @@ -152,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 e93f52dbd..fe1a8dc9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -1,28 +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 FileConfiguration fileConfiguration; - private static File file; + private static ValidWorldsConfig instance; - private ValidWorldsConfig() { + public ValidWorldsConfig() { + super("ValidWorlds.yml"); + instance = this; } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("ValidWorlds.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public static void addWorld(String worldName) { + if (instance.fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return; + + 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); + } + + @Override + public void initializeValues() { for (World world : Bukkit.getWorlds()) ConfigurationEngine.setBoolean(fileConfiguration, "Valid worlds." + world.getName(), true); @@ -32,19 +41,5 @@ public static void initializeConfig() { for (String key : validWorldsSection.getKeys(false)) if (validWorldsSection.getBoolean(key)) validWorlds.add(key); - - 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/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/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 11f3afb7e..b0e1f3584 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -1,16 +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; @@ -20,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<>(); @@ -273,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; } } @@ -285,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); } } @@ -295,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); } } @@ -305,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); @@ -339,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); @@ -392,7 +391,7 @@ public void processConfigFields() { try { this.bossType = BossType.valueOf(bossTypeString.toUpperCase(Locale.ROOT)); } catch (Exception e) { - new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); + Logger.warn("Boss type for boss " + filename + " is not a valid boss type!"); } this.scale = processDouble("scale", scale, 1, false); @@ -420,16 +419,16 @@ private HashMap processDamageModifiers(String path, HashMap(), true); 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 1a0184059..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,10 +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.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -12,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 @@ -92,7 +91,7 @@ private void updatePostProcessor() { List newEnchantments = new ArrayList<>(); for (String enchantment : enchantments) { if (!enchantment.contains(",")) { - new WarningMessage("Invalid format for enchantment in file " + filename + " for enchantment " + enchantment + " : missing ',' for valid level after the enchantment name"); + 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(","); @@ -105,7 +104,7 @@ private void updatePostProcessor() { List newPotionEffects = new ArrayList<>(); for (String potionEffect : potionEffects) { if (!potionEffect.contains(",")) { - new WarningMessage("Invalid format for potion effect in file " + filename + " for potion effect " + potionEffect + " : missing ',' for valid level after the potion effect name"); + 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(","); @@ -125,9 +124,9 @@ private void updatePostProcessor() { } potionEffects = newPotionEffects; - potionEffects.forEach(potionEffect->{ + potionEffects.forEach(potionEffect -> { if (potionEffect.contains("INSTANT_DAMAGE")) - new WarningMessage("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."); + 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/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index f4135e948..f56ab5db4 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 @@ -14,7 +14,7 @@ public DepthsSeekerConfig() { "&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_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK_OF_THE_SEA,0,self,continuous")); + setPotionEffects(Arrays.asList("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/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 4f251360b..3cbcfa73c 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 @@ -14,7 +14,7 @@ public LuckyCharmsConfig() { "&bLucky Charms", Arrays.asList("&aPart of a complete breakfast!", "&cNote: Absolutely not a part of", "&ca complete breakfast.")); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(List.of("LUCK_OF_THE_SEA,0,self,continuous")); + setPotionEffects(List.of("LUCK,0,self,continuous")); setDropWeight("1"); } } 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 7b52edd01..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<>(); @@ -23,9 +24,6 @@ public class CustomQuestsConfigFields extends CustomConfigFields implements Cust private int questLevel = 0; @Getter @Setter - protected Map> customObjectives = new HashMap(); - @Getter - @Setter private List customRewardsList = new ArrayList<>(); @Getter @Setter @@ -141,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); } @@ -156,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!"); } } @@ -184,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/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/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index 2f78f13f5..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,10 +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 lombok.Setter; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -123,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); } /** @@ -173,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 3db03e8fb..ec81efad7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; 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; @@ -246,7 +246,7 @@ public void processConfigFields() { 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; } 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 455c4719c..fcb138eb3 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 @@ -32,5 +32,6 @@ public OasisPyramidSanctum() { false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); + setListedInTeleports(false); } } 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 3aefee028..efb87a384 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 @@ -32,5 +32,6 @@ public PrimisBloodTempleSanctum() { 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 a46d4cf31..90d9e9f05 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 @@ -35,5 +35,6 @@ public PrimisGladiusInvasionDungeon() { Map.of("name", "mythic", "id", 2, "levelSync", 12) )); setMaxPlayerCount(5); + setListedInTeleports(false); } } 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 26fa661df..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,8 +1,8 @@ package com.magmaguy.elitemobs.config.enchantments; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.CustomConfig; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -26,7 +26,7 @@ public static EnchantmentsConfigFields getEnchantment(String string) { newString = newString.toLowerCase(Locale.ROOT); EnchantmentsConfigFields test = enchantments.get(newString); if (test == null) { - new WarningMessage("Failed to find enchant file " + newString); + Logger.warn("Failed to find enchant file " + newString); new Exception().printStackTrace(); } return enchantments.get(newString); 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/CustomQuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java index 83d08f73b..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; 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..5528b24af 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; 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/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 2068c866a..377527794 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 @@ -113,7 +112,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?"); } } @@ -152,7 +151,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?"); } } @@ -163,7 +162,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/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/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 f10215e03..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 diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index f0d748779..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; @@ -37,11 +37,6 @@ public class EMPackage { protected List treasureChestList = new ArrayList<>(); protected List npcEntities = new ArrayList<>(); - public boolean isOutOfDate() { - if (!isInstalled) return false; - return outOfDate; - } - public EMPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; emPackages.put(dungeonPackagerConfigFields.getFilename(), this); @@ -77,12 +72,17 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - new WarningMessage("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."); + 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 */ @@ -115,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/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index bdb189387..c208a1f1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -1,9 +1,9 @@ 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 org.bukkit.entity.Player; import java.io.File; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index c8c3cf4fa..8591340ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -1,10 +1,10 @@ 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.utils.WarningMessage; 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; @@ -28,7 +28,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; } 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 02d206bbe..9e63ac406 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,8 +5,7 @@ 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.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Difficulty; @@ -55,11 +54,11 @@ public static World loadWorld(String worldName, World.Environment environment, D 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!"); + Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); return null; } - new InfoMessage("Loading world " + worldName + " !"); + Logger.info("Loading world " + worldName + " !"); Filter filter = newFilter -> false; @@ -80,7 +79,7 @@ public static World loadWorld(String worldName, World.Environment environment, D return world; } catch (Exception exception) { Bukkit.getLogger().setFilter(previousFilter); - new WarningMessage("Failed to load world " + worldName + " !"); + Logger.warn("Failed to load world " + worldName + " !"); exception.printStackTrace(); } return null; 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/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 9b1fba505..43dd58b52 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -7,7 +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.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -90,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); diff --git a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java index 30c762418..b5873d709 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java @@ -11,8 +11,7 @@ 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; @@ -91,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); @@ -156,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 4a4771972..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; @@ -107,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; @@ -150,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; } diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index 4625ad1f1..848fe63e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java +++ b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java @@ -321,7 +321,8 @@ public static class ExplosionEvent implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void entityExplodeEvent(EntityExplodeEvent event) { Entity entity = event.getEntity(); - if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) entity = shooter; + if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) + entity = shooter; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity); if (eliteEntity != null) { generateExplosion(event); diff --git a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java index 4bea48f57..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; diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index eb9658198..696e75ff1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -1,10 +1,10 @@ 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.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java index 9b3cbb538..2437e284d 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; 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 d05ed83d0..467f217c5 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -1,6 +1,5 @@ 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; @@ -15,8 +14,9 @@ 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; @@ -113,14 +113,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 +135,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 +160,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; } } @@ -244,7 +244,7 @@ private void spawnBosses() { 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(); @@ -253,7 +253,7 @@ private void spawnBosses() { customBossEntity.setRandomLoot(false); customBossEntity.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), true); 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); @@ -263,9 +263,9 @@ private void spawnBosses() { 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!"); + 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) { - 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!"); + 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!"); } } } 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 b85806480..2c0007530 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -15,7 +15,11 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.*; +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.bukkit.Bukkit; import org.bukkit.Location; @@ -225,7 +229,7 @@ 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)); @@ -240,7 +244,7 @@ public void run() { dungeonInstances.remove(dungeonInstance); if (!Bukkit.unloadWorld(world, false)) { - new WarningMessage("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); + Logger.warn("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); return; } new BukkitRunnable() { @@ -266,7 +270,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; } @@ -274,7 +278,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 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/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 22c49b336..3e5d8eecb 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; @@ -12,7 +11,8 @@ 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 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; } diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index 7513c9976..e0d720677 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; @@ -11,7 +10,8 @@ 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.Logger; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -206,7 +206,7 @@ private Item generateCurrencyItem(Material material, Location location, double v 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); @@ -232,7 +232,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); } @@ -247,7 +247,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); } @@ -261,7 +261,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); } @@ -275,7 +275,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); } @@ -289,7 +289,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); } @@ -302,7 +302,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); } @@ -315,7 +315,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); } @@ -328,7 +328,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/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/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 7b43e90fc..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; @@ -9,6 +8,7 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.items.EliteItemLore; import com.magmaguy.elitemobs.utils.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; 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 4816fed96..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; @@ -85,7 +85,7 @@ public CurrencyCustomLootEntry(List entries, Map configMa 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); + 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 a19a3766f..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; 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 8423326d4..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; @@ -55,7 +55,7 @@ public EliteCustomLootEntry(List entries, Map configMap, 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); @@ -158,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++) @@ -219,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 506bc5baf..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; 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..e967da277 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; @@ -9,6 +8,7 @@ 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 org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; 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 aa65beda9..268cd32ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -2,7 +2,7 @@ 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; @@ -23,7 +23,7 @@ public ElitePotionEffect(String string) { int duration = 2 * 20; PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); if (potionEffectType == null) { - new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); + Logger.warn("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; } if (potionEffectType.equals(PotionEffectType.NIGHT_VISION)) @@ -51,7 +51,7 @@ public ElitePotionEffect(String string) { 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/menus/ArenaMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java index 2141e4441..ac94fb56b 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.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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index fb0193d01..f884985fc 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index 2fc5c4b40..d6f39502a 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.SpecialItemSystemsConfig; @@ -12,6 +11,7 @@ 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 net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -212,7 +212,7 @@ 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 + //Make sure enchant books themselves can't be enchanted { } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 612e92c2e..25202dc8d 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 73ef13cd0..42c4e12d7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -1,6 +1,5 @@ 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; @@ -11,6 +10,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java index 1f2b36ea6..1d20fa872 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -1,6 +1,5 @@ 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; @@ -11,6 +10,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; 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/mobconstructor/BossType.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java index 98bde5175..4009119dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -4,5 +4,6 @@ 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 a3ac05e2a..2fcb4547a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -14,8 +14,7 @@ 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.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); @@ -190,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 { @@ -201,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; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index 12a20aa66..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,7 +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.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -496,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/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java index caefe80e1..26ca95ece 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.EntityType; @@ -15,6 +15,7 @@ public class BossMusic { private final HashMap players = new HashMap<>(); + private final CustomBossEntity customBossEntity; @Getter private String name; @Getter @@ -24,7 +25,6 @@ public class BossMusic { @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) { @@ -55,7 +55,7 @@ private void parse(String rawString, int entryNumber) { } break; default: - new WarningMessage("Failed to get value for boss music!"); + Logger.warn("Failed to get value for boss music!"); } } } 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..0eebe530e 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 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; @@ -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..a86c13599 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 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..cb2556116 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; @@ -52,8 +55,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; @@ -171,14 +172,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 +186,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 +195,6 @@ public void spawn(Location spawnLocation, boolean silent) { } public void spawn(boolean silent) { - bossTrace.setSpawn(); if (livingEntity != null && livingEntity.isValid()) return; @@ -205,7 +203,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 +217,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 +231,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; } @@ -490,11 +488,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); if (livingEntity != null) persistentLocation = livingEntity.getLocation(); //Remove the living entity super.remove(removalReason); 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 d4163689f..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()); } } 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/ElitePowerParser.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java index b98882225..5e5a59a2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java @@ -9,7 +9,7 @@ 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; @@ -43,7 +43,7 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos 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 @@ -85,12 +85,12 @@ 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, customBossEntity); } } else - new WarningMessage("No valid power name in boss config " + customBossesConfigFields.getFilename()); + Logger.warn("No valid power name in boss config " + customBossesConfigFields.getFilename()); } } } @@ -110,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..7f0d184b1 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,13 +54,13 @@ 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); 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 cdc567e2e..937ac2233 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java @@ -14,7 +14,7 @@ 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; @@ -142,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() + " !"); } } } @@ -178,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); @@ -239,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); } 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 046654fc2..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,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -39,7 +39,7 @@ public static List serializeTransitiveBlocks(List deser 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 a8f11a3de..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 @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.api.EliteMobSpawnEvent; 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; @@ -53,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; } } @@ -69,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/mobspawning/NaturalMobSpawnEventHandler.java b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java index 3337129c3..a834e9ece 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java @@ -106,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() || diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java index e337528f9..372cc4f59 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,7 +17,8 @@ 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; @@ -41,8 +41,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 +73,6 @@ public NPCEntity(NPCsConfigFields npCsConfigFields, String locationString) { spawn(); persistentObjectHandler = new PersistentObjectHandler(this); } - /** * Spawns NPCs for dungeon instancing. */ @@ -78,16 +86,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 +116,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 +157,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 || @@ -192,7 +189,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(); } } @@ -315,18 +312,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 +351,6 @@ private String selectString(List strings) { return null; } - public static class NPCEntityEvents implements Listener { @EventHandler public void worldUnloadEvent(WorldUnloadEvent event) { @@ -378,4 +362,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..e1e2756cf 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; @@ -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/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 410287c9e..f9599c613 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -21,7 +21,7 @@ public class Navigation implements Listener { - private static HashMap currentlyNavigating = new HashMap(); + private static final HashMap currentlyNavigating = new HashMap(); public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; @@ -60,7 +60,7 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .register(); } - public static void shutdown(){ + public static void shutdown() { currentlyNavigating.values().forEach(BukkitTask::cancel); currentlyNavigating.clear(); } diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index f544a4fae..dfcd53f2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.playerdata; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.ItemSettingsConfig; @@ -11,6 +10,7 @@ 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; @@ -87,7 +87,7 @@ private boolean fullUpdate(ItemStack itemStack) { return fillNullItem(); } - if (displayingAsBroken){ + if (displayingAsBroken) { BossBarUtil.HideBrokenItemBossBar(equipmentSlot, player); displayingAsBroken = false; } @@ -96,13 +96,13 @@ private boolean fullUpdate(ItemStack itemStack) { // if (itemStack.isSimilar(this.itemStack)) // return false; - if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { - if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { - player.getWorld().dropItem(player.getLocation(), itemStack); - itemStack.setAmount(0); - itemStack = new ItemStack(Material.AIR); - } + if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { + if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { + player.getWorld().dropItem(player.getLocation(), itemStack); + itemStack.setAmount(0); + itemStack = new ItemStack(Material.AIR); } + } //Neither offhand nor armor contribute to baseline damage outside of the enchants, so we reset the damage before anything this.eliteDamage = 0; 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..b01cc634d 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; @@ -60,12 +59,12 @@ private static void addEntryIfEmpty(String columnName, ColumnValues columnValues if (resultSet.next()) { //Developer.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..5c6cabd04 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java @@ -5,7 +5,7 @@ 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.Logger; 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/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/TeleportsPage.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java index 177653bc0..c64a0655c 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 net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -70,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); 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/PhotonRay.java b/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java index f1408759a..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); 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 0f440e84d..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; 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 266003f8f..058503d28 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java @@ -11,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; @@ -28,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. @@ -36,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - private ArrayList entityList = new ArrayList<>(); + private final ArrayList entityList = new ArrayList<>(); public ZombieNecronomicon() { super(PowersConfig.getPower("zombie_necronomicon.yml")); @@ -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); @@ -233,7 +233,7 @@ public void run() { 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; 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 ba34e1394..90a4126bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -15,7 +15,7 @@ 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.*; @@ -46,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); @@ -61,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() { @@ -72,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()) @@ -137,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": @@ -157,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; } @@ -195,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; } @@ -287,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": @@ -295,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": @@ -303,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": @@ -315,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": @@ -323,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": @@ -331,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": @@ -339,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": @@ -347,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": @@ -355,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; } @@ -401,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) @@ -418,7 +418,7 @@ 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); } } @@ -445,7 +445,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); @@ -462,7 +462,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); @@ -472,7 +472,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); @@ -499,7 +499,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); @@ -526,7 +526,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(); @@ -611,7 +611,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()) @@ -626,7 +626,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()) 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 3cbe35933..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,7 +78,7 @@ 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)); @@ -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 750ba3320..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,9 +21,9 @@ 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, EliteEntity eliteEntity) { super(scriptBlueprint.getCustomConfigFields()); 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 969f57725..64bdee8e1 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; @@ -14,7 +13,8 @@ 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.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.*; @@ -48,11 +49,6 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; - public static void shutdown(){ - invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); - } - - public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; this.scriptTargets = new ScriptTargets(blueprint.getScriptTargets(), eliteScript); @@ -64,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 @@ -74,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; } @@ -92,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; } @@ -217,8 +216,9 @@ private void runActions(ScriptActionData 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)) @@ -242,7 +242,7 @@ 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)); @@ -259,12 +259,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()); @@ -273,12 +273,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())); @@ -287,13 +287,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); @@ -313,7 +313,7 @@ private void runPotionEffect(ScriptActionData scriptActionData) { //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) && @@ -327,7 +327,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); } @@ -336,7 +336,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); } @@ -477,7 +477,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; } @@ -622,7 +622,6 @@ else if (blueprint.getVValue() != null) } private void runModifyDamage(ScriptActionData scriptActionData) { - if (scriptActionData.getEvent() instanceof EliteDamageEvent eliteDamageEvent) { eliteDamageEvent.setDamage(eliteDamageEvent.getDamage() * blueprint.getMultiplier()); } @@ -633,7 +632,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; } @@ -683,7 +682,7 @@ private void runNavigate(ScriptActionData scriptActionData) { if (!(eliteEntity instanceof CustomBossEntity customBossEntity)) return; 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; } @@ -692,4 +691,17 @@ private void runNavigate(ScriptActionData scriptActionData) { 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 994d92d98..adc4cca3e 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 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 b6688cadb..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 ScriptTargets scriptTargets = null; private final EliteScript eliteScript; + private ScriptTargets scriptTargets = null; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; 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 b510405b3..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,7 +3,7 @@ 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; @@ -25,7 +25,7 @@ public static void runEvent(FallingEntityDataPair fallingEntityDataPair, Locatio 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!"); + Logger.warn("Elite script " + string + " does not exist for landing scripts!"); return; } iteratedScript.check(landingLocation, fallingEntityDataPair.getScriptActionData()); 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..4bde7b10e 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); @@ -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; } } @@ -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 98c9c625e..2fea67379 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -11,8 +11,8 @@ import com.magmaguy.elitemobs.powers.scripts.caching.ScriptZoneBlueprint; import com.magmaguy.elitemobs.powers.scripts.enums.TargetType; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.*; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -101,7 +101,7 @@ protected Collection getZoneEntities(ScriptActionData scriptAction 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<>(); } } @@ -137,7 +137,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<>(); } } @@ -159,7 +159,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)) @@ -168,7 +168,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)) @@ -177,7 +177,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; 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 cd0d776f4..4390f4ed8 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; @@ -109,6 +109,8 @@ public class ScriptActionBlueprint { private float pitch = 1f; @Getter private float velocity = 1f; + @Getter + private double scale = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -141,7 +143,7 @@ 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); @@ -195,8 +197,8 @@ protected void processKeyAndValue(String key, Object value) { case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); case "velocity" -> velocity = parseFloat(key, value, scriptName); - default -> - new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + case "scale" -> scale = parseFloat(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 9efc277c1..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; @@ -74,7 +74,7 @@ private void processKeyAndValue(String key, Object value) { 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 7a7a87ea6..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; @@ -39,7 +39,7 @@ public ScriptEventsBlueprint(ConfigurationSection configurationSection, String s 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 a0a15f694..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; @@ -89,7 +89,7 @@ private void processKeyAndValue(String key, Object value) { 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!"); + 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 f8c1b3884..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,8 +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 16314c860..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 @@ -33,7 +33,8 @@ public enum ActionType { SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), SUMMON_ENTITY(false), - NAVIGATE(false); + NAVIGATE(false), + SCALE(false); @Getter private final boolean requiresLivingEntity; 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/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index 5206a6d1c..de0bbcaa2 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; @@ -16,6 +15,7 @@ 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; 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..e91bb23ce 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 net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; 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..c09e4d2c2 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; @@ -18,6 +17,7 @@ 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 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..2019dc36f 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,7 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -25,6 +25,8 @@ public class QuestObjectives implements Serializable { + @Getter + private final UUID uuid = UUID.randomUUID(); @Getter @Setter protected QuestReward questReward; @@ -40,8 +42,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 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/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..de1970903 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java @@ -1,7 +1,7 @@ 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.*; @@ -32,7 +32,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 +49,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,7 +58,7 @@ 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) { @@ -108,8 +108,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/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/worldguard/WorldGuardCompatibility.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java index f1c4aeca3..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,6 +1,6 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.flags.IntegerFlag; import com.sk89q.worldguard.protection.flags.StateFlag; @@ -40,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"); } @@ -148,7 +148,7 @@ public static boolean initialize() { // members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); // global.setOwners(members); // } catch (Exception ex) { -// new WarningMessage("Failed to protect minidungeon world area!"); +// Logger.warn("Failed to protect minidungeon world area!"); // } // } // @@ -169,7 +169,7 @@ public static boolean initialize() { // members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); // global.setOwners(members); // } catch (Exception ex) { -// new WarningMessage("Failed to protect minidungeon world area!"); +// Logger.warn("Failed to protect minidungeon world area!"); // } // } // @@ -233,13 +233,13 @@ public static boolean initialize() { // 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!"); +// Logger.warn("The region name picked did not exist!"); // return false; // } // protectMinidungeonArea(protectedRegion); // return true; // } catch (Exception ex) { -// new WarningMessage("Failed to protect region " + regionName + " !"); +// Logger.warn("Failed to protect region " + regionName + " !"); // return false; // } // } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index f34961cf0..acf28eb97 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.treasurechest; import com.google.common.collect.ArrayListMultimap; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.config.DefaultConfig; @@ -14,8 +13,9 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -113,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?"); } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java index a6e454582..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; @@ -74,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); @@ -124,9 +125,9 @@ public static Location serializeWithInstance(World instancedWorld, String locati } 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(instancedWorld, x, y, z, yaw, pitch); 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/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 index 1f5955239..8e46e37a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java index f98be82c8..7f53a21b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; @@ -33,7 +34,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/SpigotMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java index 052244e87..080b80cfc 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.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; 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/VisualDisplay.java b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java index 0f139d7d2..4f935b9dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; 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; 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 3ac0c0705..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()) { 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 e8530e76e..edae9f180 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; 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 6c779e0b9..47c2564dd 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 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 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/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/WormholeEntry.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java index bb4444467..3399255e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java @@ -1,6 +1,5 @@ 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.entitytracker.EntityTracker; @@ -9,7 +8,8 @@ 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; @@ -55,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(); @@ -69,23 +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); } 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 26a4358a8..54403879d 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; 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 05e08f7c5..ccf8aaa7a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.4 +version: 9.0.5 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -18,6 +18,12 @@ softdepend: - InfernalMobs - FreeMinecraftModels +commands: + elitemobs: + description: Main command + aliases: + - em + permissions: elitemobs.*: description: Gives access to all elitemobs commands diff --git a/src/main/resources/translation.yml b/src/main/resources/translation.yml deleted file mode 100644 index e69de29bb..000000000 From d0c6e777185bb9e16aac0c50ac7ac9a9b348dced Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:30:54 +0200 Subject: [PATCH 10/78] Update DiscordCommand.java --- .../com/magmaguy/elitemobs/commands/DiscordCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java index 4ea9e1ac4..19bd0b56a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -9,8 +9,8 @@ public class DiscordCommand extends AdvancedCommand { public DiscordCommand() { super(List.of("discord")); - setUsage("/em discord "); - setPermission("elitemobs.*"); + setUsage("/em discord"); + setPermission("elitemobs.discord.link"); setDescription("Links to the EliteMobs discord."); } @@ -18,4 +18,4 @@ public DiscordCommand() { public void execute() { Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); } -} \ No newline at end of file +} From 31f642159399abe9b7b6fd40e8fa224db8b6ecac Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:36:32 +0200 Subject: [PATCH 11/78] Update DiscordMessageCommand.java --- .../magmaguy/elitemobs/commands/DiscordMessageCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java index 97c796060..5f6d4750f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -12,7 +12,7 @@ public DiscordMessageCommand() { super(List.of("discord")); addArgument("message", new ArrayList<>()); setUsage("/em discord "); - setPermission("elitemobs.*"); + setPermission("elitemobs.discord.message"); setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes"); } @@ -21,4 +21,4 @@ public void execute() { new DiscordSRVAnnouncement(getStringSequenceArgument("message")); Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); } -} \ No newline at end of file +} From 4742611bd97eb0df3cf069f7eba55b1072f874a1 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:58:57 +0200 Subject: [PATCH 12/78] Command updates --- .../elitemobs/commands/ArenaCommand.java | 3 +- .../elitemobs/commands/DebugCommand.java | 4 +- .../elitemobs/commands/EventCommand.java | 2 +- .../elitemobs/commands/FireballCommand.java | 2 +- .../elitemobs/commands/HelpCommand.java | 2 +- .../elitemobs/commands/KillCommand.java | 2 +- .../elitemobs/commands/KillRadiusCommand.java | 2 +- .../elitemobs/commands/KillTypeCommand.java | 4 +- .../commands/KillTypeRadiusCommand.java | 6 +- .../elitemobs/commands/LanguageCommand.java | 2 +- .../elitemobs/commands/LootCommand.java | 2 +- .../elitemobs/commands/LootDebugCommand.java | 6 +- .../elitemobs/commands/LootGiveCommand.java | 4 +- .../elitemobs/commands/LootMenuCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 4 +- .../commands/LootSimulateCommand.java | 2 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../elitemobs/commands/LootStats.java | 2 +- .../commands/MoneyAddAllCommand.java | 4 +- .../elitemobs/commands/MoneyAddCommand.java | 4 +- .../elitemobs/commands/MoneyCheckCommand.java | 4 +- .../commands/MoneyCheckPlayerCommand.java | 4 +- .../commands/MoneyRemoveCommand.java | 2 +- .../elitemobs/commands/MoneySetCommand.java | 4 +- .../commands/PackageDungeonCommand.java | 2 +- .../elitemobs/commands/PlaceBossCommand.java | 6 +- .../elitemobs/commands/PlaceNPCCommand.java | 2 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 4 +- .../commands/QuestBypassCommand.java | 2 +- .../commands/QuestCompleteCommand.java | 2 +- .../elitemobs/commands/QuestLeaveCommand.java | 2 +- .../commands/QuestResetAllCommand.java | 5 +- .../elitemobs/commands/QuestResetCommand.java | 2 +- .../elitemobs/commands/RankSetCommand.java | 2 +- .../elitemobs/commands/ReloadCommand.java | 2 +- .../elitemobs/commands/RemoveCommand.java | 2 +- src/main/resources/plugin.yml | 119 +++++++++++++++++- 38 files changed, 173 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index 030c1908c..af2d710d3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -11,7 +11,8 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setDescription("When in instanced content, makes the player start the instance."); + setPermission("elitemobs.event.start"); + setDescription("Open the Arena menu."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index 4eed4aad6..ce7c82e5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -13,9 +13,9 @@ public DebugCommand() { super(List.of("debug")); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em debug "); - setPermission("elitemobs.*"); + setPermission("elitemobs.debug"); setSenderType(SenderType.PLAYER); - setDescription("Toggles whether the setup message will show up."); + setDescription("Debug bosses or players."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java index 489fe0ef5..b04d02cbc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -11,7 +11,7 @@ public EventCommand() { super(List.of("event")); addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList()); setUsage("/em event "); - setPermission("elitemobs.*"); + setPermission("elitemobs.event.start"); setSenderType(SenderType.PLAYER); setDescription("Triggers a timed event to start at the next available time and place."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java index c1a8cb366..ff4ae49db 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -11,7 +11,7 @@ public class FireballCommand extends AdvancedCommand { public FireballCommand() { super(List.of("fireball")); setUsage("/em fireball"); - setPermission("elitemobs.*"); + setPermission("elitemobs.fireball"); setDescription("Shoots a fireball, to test terrain protections and explosion regeneration."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index 4cdca44e4..af4408e1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -10,7 +10,7 @@ public class HelpCommand extends AdvancedCommand { public HelpCommand() { super(List.of("help")); setUsage("/em help"); - setPermission("elitemobs.*"); + setPermission("elitemobs.help"); setDescription("Lists all commands."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index a8b97ca43..263e4b123 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -9,7 +9,7 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.*"); + setPermission("elitemobs.kill.kill"); setDescription("Kills all elites."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java index ee0629fa8..a408e4477 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -12,7 +12,7 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.*"); + setPermission("elitemobs.kill.radius"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java index 15d6e8ee7..e060bcb84 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -13,8 +13,8 @@ public KillTypeCommand() { super(List.of("kill")); addLiteral("type"); addArgument("type", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.*"); + setUsage("/em kill type "); + setPermission("elitemobs.kill.type"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java index 0d412be6f..90d86f7be 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -14,10 +14,10 @@ public KillTypeRadiusCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.*"); + setUsage("/em kill type "); + setPermission("elitemobs.kill.type.radius"); setSenderType(SenderType.PLAYER); - setDescription("Kills all elites of the specified type."); + setDescription("Kills all elites of the specified type within the specified radius."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java index 99c1ab744..0b6f9e2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -12,7 +12,7 @@ public LanguageCommand() { super(List.of("language")); addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); setUsage("/em language "); - setPermission("elitemobs.*"); + setPermission("elitemobs.language"); setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java index 53b255fdc..36c241e2f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -18,4 +18,4 @@ public LootCommand() { public void execute() { LootMenu.openMenu(getCurrentPlayerSender()); } -} +} \ 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 index 82a55be01..34478b53c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -13,10 +13,10 @@ public LootDebugCommand() { super(List.of("loot")); addLiteral("debug"); addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - setUsage("/em loot test "); - setPermission("elitemobs.*"); + setUsage("/em loot debug "); + setPermission("elitemobs.loot.debug"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 9159eaed2..9fccf132c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -15,9 +15,9 @@ public LootGiveCommand() { addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.give"); setSenderType(SenderType.PLAYER); - setDescription("Gives loot to a player."); + setDescription("Gives the specified loot to a specific player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java index 2ff145bbc..7c99be803 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -11,7 +11,7 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.menu"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 5bff2f261..0f8a0f0ee 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -15,9 +15,9 @@ public LootRandomCommand() { addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.random"); setSenderType(SenderType.PLAYER); - setDescription("Gives loot to a player."); + setDescription("Gives the player random loot of the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 5986986de..c166db304 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -15,7 +15,7 @@ public LootSimulateCommand() { addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.simulate"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index 4f8988bc2..730bb8db7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -16,7 +16,7 @@ public LootSimulateMultipleCommand() { addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.simulate.times"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java index 4dc8c73f9..ab6430518 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -13,7 +13,7 @@ public LootStats() { super(List.of("loot")); addLiteral("stats"); setUsage("/em loot stats"); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.stats"); setSenderType(SenderType.PLAYER); setDescription("Provides EliteMobs stats for the currently held item."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 8d13578c1..f5cc69e87 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -14,9 +14,9 @@ public MoneyAddAllCommand() { addLiteral("all"); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add all "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.add.all"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Gives every player on the server the specified amount of money."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 08328ad15..d83f008d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -14,9 +14,9 @@ public MoneyAddCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.add.player"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Gives the specified amount of money to the designated player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java index d2e35b5d6..33e655a4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -12,9 +12,9 @@ public MoneyCheckCommand() { super(List.of("money")); addLiteral("check"); setUsage("/em money check"); - setPermission("elitemobs.money.check"); + setPermission("elitemobs.money.check.self"); setSenderType(SenderType.PLAYER); - setDescription("Checks the EliteMobs currency"); + setDescription("Checks your EliteMobs currency."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 01f299276..e17d33f5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -11,8 +11,8 @@ public MoneyCheckPlayerCommand() { addLiteral("check"); addArgument("player", new ArrayList<>()); setUsage("/em check "); - setPermission("elitemobs.*"); - setDescription("Checks how much currency you have."); + setPermission("elitemobs.money.check.player"); + setDescription("Checks the currency of the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index e99856ac9..a05b654dc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -14,7 +14,7 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.remove"); setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java index 517ab97a5..d4a8db4c9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -13,8 +13,8 @@ public MoneySetCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money set "); - setPermission("elitemobs.*"); - setDescription("Sets the specified amount of currency to a player."); + setPermission("elitemobs.money.set"); + setDescription("Sets the specified amount of currency for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index d9ba2bac9..44bb71c85 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -11,7 +11,7 @@ public PackageDungeonCommand() { addArgument("dungeonName", new ArrayList<>()); addArgument("version", new ArrayList<>()); setUsage("/em package "); - setPermission("elitemobs.*"); + setPermission("elitemobs.package"); setDescription("Packages an EliteMobs dungeon for distribution."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index a80c2017e..00074c33c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -12,10 +12,10 @@ public PlaceBossCommand() { super(List.of("place")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/em addSpawn boss "); - setPermission("elitemobs.*"); + setUsage("/em place boss "); + setPermission("elitemobs.place.boss"); setSenderType(SenderType.PLAYER); - setDescription("Toggles whether the setup message will show up."); + setDescription("Add a spawn location for the specified boss at your current location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java index d093d367a..537d52c62 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -14,7 +14,7 @@ public PlaceNPCCommand() { addLiteral("npc"); addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet())); setUsage("/em place npc "); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.npc"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds an npc to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index ad8ee1d5a..e5bd38b37 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -13,7 +13,7 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.treasure"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds a treasure chest to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 9ff0df62e..2612668e1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -16,9 +16,9 @@ public PlaceWormholeCommand() { addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); setUsage("/em wormhole <1/2>"); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.wormhole"); setSenderType(SenderType.PLAYER); - setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + setDescription("Place a wormhole teleport at your current location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 413fbdbe6..63b0f4411 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -10,7 +10,7 @@ public QuestBypassCommand() { super(List.of("quest")); addLiteral("bypass"); setUsage("/em quest bypass"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.bypass"); setDescription("Bypasses permission restrictions for elite quests."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java index bd98d8b1c..c23f2557c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -11,7 +11,7 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.complete"); setSenderType(SenderType.PLAYER); setDescription("Forces all of your currently active elite quests to be completed. For debugging use only."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 1ea94da6d..933c12cc2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -11,7 +11,7 @@ public QuestLeaveCommand() { super(List.of("quest")); addLiteral("leave"); setUsage("/em quest leave"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.leave"); setSenderType(SenderType.PLAYER); setDescription("Leaves a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java index c000e8877..b87c868b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -13,9 +13,8 @@ public QuestResetAllCommand() { addLiteral("reset"); addLiteral("all"); addArgument("player", new ArrayList<>()); - addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); - setUsage("/em quest reset "); - setPermission("elitemobs.*"); + setUsage("/em quest reset all "); + setPermission("elitemobs.quest.reset.all"); setDescription("Resets all quests for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java index e80d057fb..890d5a680 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -14,7 +14,7 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.reset.quest"); setDescription("Resets a specific quest for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java index a1012bc61..b2c2c5c46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -12,7 +12,7 @@ public RankSetCommand() { addArgument("prestigeLevel", new ArrayList<>()); addArgument("guildLevel", new ArrayList<>()); setUsage("/em rank "); - setPermission("elitemobs.*"); + setPermission("elitemobs.rank.set"); setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java index 46a469de3..1cfdc72a5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -11,7 +11,7 @@ public class ReloadCommand extends AdvancedCommand { public ReloadCommand() { super(List.of("reload")); setUsage("/em reload"); - setPermission("elitemobs.*"); + setPermission("elitemobs.reload"); setDescription("Reloads EliteMobs."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java index 350acdf31..f8e33fcf4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -9,7 +9,7 @@ public class RemoveCommand extends AdvancedCommand { public RemoveCommand() { super(List.of("remove")); setUsage("/em remove"); - setPermission("elitemobs.*"); + setPermission("elitemobs.remove"); setSenderType(SenderType.PLAYER); setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content."); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ccf8aaa7a..d192b08f7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -149,4 +149,121 @@ permissions: 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 + default: true + elitemobs.arena.menu: + description: Allows players to open the Arena menu and join an Arena. + default: true + elitemobs.debug: + description: Allows players to have access to the player/bosses debug command. + default: true + elitemobs.discord.link: + description: Allows players to have access to the Discord link command. + default: true + elitemobs.discord.message: + description: Allows players to have access to the DiscordSRV message debug command. + default: op + elitemobs.event.start: + description: Allows players to start specific events. + default: op + elitemobs.fireball: + description: Allows players to shoot a fireball at the pointer's location. + default: op + elitemobs.help: + description: Allows players to see all available EliteMobs commands. + default: op + elitemobs.kill.kill: + description: Allows players to kill all elites. + default: op + elitemobs.kill.radius: + description: Allows players to kill all elites in the specified radius. + default: op + elitemobs.kill.type: + description: Allows players to kill all elites of the specified type. + default: op + elitemobs.kill.type.radius: + description: Allows players to kill all elites of the specified type within the given radius. + default: op + elitemobs.language: + description: Allows players to set the language that the server will use for EliteMobs. + default: op + elitemobs.loot.debug: + description: Allows players to equip themselves with a complete armor set, weapons set of the specified level, and food for testing purposes. + default: op + elitemobs.loot.give: + description: Allows players to give the specified loot to a specific player. + default: op + elitemobs.loot.menu: + description: Allows players to open the loot menu and select any loot they want. + default: op + elitemobs.loot.random: + description: Allows players to get random loot of the specified level. + default: op + elitemobs.loot.simulate: + description: Allows players to get simulated loot drops for the specified level and player. + default: op + elitemobs.loot.simulate.times: + description: Allows players to get simulated loot drops for a specified number of times for the given level and player. + default: op + elitemobs.loot.stats: + description: Allows players to see EliteMobs stats for the currently held item. + default: true + elitemobs.loot.stats: + description: Allows players to see EliteMobs stats for the currently held item. + default: op + elitemobs.money.add.all: + description: Allows players to give every player on the server the specified amount of money. + default: op + elitemobs.money.add.player: + description: Allows players to give the specified amount of money to the designated player. + default: op + elitemobs.money.check.self: + description: Allows players to check their EliteMobs currency. + default: true + elitemobs.money.check.player: + description: Allows players to check the currency of the specified player. + default: op + elitemobs.money.remove: + description: Allows players to deduct the specified amount of currency from a player. + default: op + elitemobs.money.set: + description: Allows players to set the specified amount of currency for the specified player. + default: op + elitemobs.package: + description: Allows players to package an EliteMobs dungeon for distribution. + default: op + elitemobs.place.boss: + description: Allows players to add a spawn location for the specified boss at their current location. + default: op + elitemobs.place.npc: + description: Allows players to permanently add an NPC to the location the user is standing on. + default: op + elitemobs.place.treasure: + description: Allows players to permanently add a treasure chest to the location the user is standing on. + default: op + elitemobs.place.wormhole: + description: Allows players to permanently add a wormhole teleport at their current location. + default: op + elitemobs.quest.bypass: + description: Allows players to bypass permission restrictions for elite quests. + default: op + elitemobs.quest.complete: + description: Allows players to force complete all of their currently active elite quests. For debugging use only. + default: op + elitemobs.quest.leave: + description: Allows players to leave a quest. Used via menu, can't be directly used. + default: op + elitemobs.quest.reset.all: + description: Allows players to reset all quests for a specific player. + default: op + elitemobs.quest.reset.quest: + description: Allows players to reset a specific quest for a specific player. + default: op + elitemobs.rank.set: + description: Allows players to manually set a player's guild rank to a the prestige level and guild level specified. + default: op + elitemobs.reload: + description: Allows players to reload EliteMobs. + default: op + elitemobs.remove: + description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. + default: op \ No newline at end of file From 6d513f631912bf512811d15db2eadc6087d61adb Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 26 Jul 2024 08:45:19 +0100 Subject: [PATCH 13/78] EliteMobs 9.0.5 - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Almost all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 6 +++--- .../commands/AdventurersGuildCommand.java | 5 +++-- .../elitemobs/commands/AltCommand.java | 7 ++++--- .../elitemobs/commands/ArenaCommand.java | 6 ++++-- .../elitemobs/commands/ArenaCommands.java | 14 -------------- .../elitemobs/commands/DebugCommand.java | 5 +++-- .../elitemobs/commands/DiscordCommand.java | 5 +++-- .../commands/DiscordMessageCommand.java | 7 ++++--- .../elitemobs/commands/DismissCommand.java | 5 +++-- .../commands/DungeonTeleportCommand.java | 5 +++-- .../elitemobs/commands/EliteMobsCommand.java | 9 +++++---- .../elitemobs/commands/EnchantCommand.java | 7 ++++--- .../elitemobs/commands/EventCommand.java | 5 +++-- .../elitemobs/commands/FireballCommand.java | 9 +++++---- .../elitemobs/commands/HelpCommand.java | 13 +++++++------ .../elitemobs/commands/KillCommand.java | 5 +++-- .../elitemobs/commands/KillRadiusCommand.java | 5 +++-- .../elitemobs/commands/KillTypeCommand.java | 7 +++---- .../commands/KillTypeRadiusCommand.java | 9 +++++---- .../elitemobs/commands/LanguageCommand.java | 13 +++++++------ .../elitemobs/commands/LootCommand.java | 5 +++-- .../elitemobs/commands/LootDebugCommand.java | 5 +++-- .../elitemobs/commands/LootGiveCommand.java | 7 +++---- .../elitemobs/commands/LootMenuCommand.java | 5 +++-- .../elitemobs/commands/LootRandomCommand.java | 7 +++---- .../commands/LootSimulateCommand.java | 9 +++++---- .../commands/LootSimulateMultipleCommand.java | 11 ++++++----- .../elitemobs/commands/LootStats.java | 5 +++-- .../commands/MoneyAddAllCommand.java | 9 ++++----- .../elitemobs/commands/MoneyAddCommand.java | 11 +++++------ .../elitemobs/commands/MoneyCheckCommand.java | 7 ++++--- .../commands/MoneyCheckPlayerCommand.java | 7 ++++--- .../commands/MoneyRemoveCommand.java | 9 ++++----- .../elitemobs/commands/MoneySetCommand.java | 9 +++++---- .../commands/PackageDungeonCommand.java | 7 +++++-- .../elitemobs/commands/PayCommand.java | 9 +++++---- .../elitemobs/commands/PlaceBossCommand.java | 5 +++-- .../elitemobs/commands/PlaceNPCCommand.java | 5 +++-- .../commands/PlaceTreasureChestCommand.java | 5 +++-- .../commands/PlaceWormholeCommand.java | 15 ++++++++------- .../commands/QuestAcceptCommand.java | 5 +++-- .../commands/QuestBypassCommand.java | 7 +++++-- .../commands/QuestCompleteCommand.java | 5 +++-- .../elitemobs/commands/QuestLeaveCommand.java | 5 +++-- .../commands/QuestResetAllCommand.java | 6 +++--- .../elitemobs/commands/QuestResetCommand.java | 7 +++++-- .../elitemobs/commands/QuestTrackCommand.java | 5 +++-- .../elitemobs/commands/QuitCommand.java | 7 ++++--- .../elitemobs/commands/RankCommand.java | 7 ++++--- .../elitemobs/commands/RankSetCommand.java | 11 ++++++----- .../elitemobs/commands/ReloadCommand.java | 5 +++-- .../elitemobs/commands/RemoveCommand.java | 5 +++-- .../elitemobs/commands/RepairCommand.java | 7 ++++--- .../elitemobs/commands/RespawnAllCommand.java | 3 ++- .../elitemobs/commands/ScrapCommand.java | 7 ++++--- .../elitemobs/commands/SetupCommand.java | 5 +++-- .../elitemobs/commands/SetupDoneCommand.java | 7 ++++--- .../commands/SetupToggleCommand.java | 9 +++++---- .../elitemobs/commands/ShareItemCommand.java | 5 +++-- .../elitemobs/commands/ShopCustomCommand.java | 7 ++++--- .../commands/ShopCustomOtherCommand.java | 7 ++++--- .../commands/ShopDynamicCommand.java | 7 ++++--- .../commands/ShopProceduralOtherCommand.java | 7 ++++--- .../commands/ShopSellOtherCommand.java | 7 ++++--- .../commands/SpawnBossAtCommand.java | 17 ++++++++--------- .../elitemobs/commands/SpawnBossCommand.java | 7 ++++--- .../commands/SpawnBossLevelAtCommand.java | 19 +++++++++---------- .../commands/SpawnBossLevelCommand.java | 9 +++++---- .../elitemobs/commands/SpawnElite.java | 11 ++++++----- .../commands/SpawnEliteAtCommand.java | 19 ++++++++++--------- .../commands/SpawnTeleportCommand.java | 5 +++-- .../elitemobs/commands/StartCommand.java | 7 ++++--- .../elitemobs/commands/StatsCommand.java | 5 +++-- .../elitemobs/commands/TrackBossCommand.java | 11 ++++++----- .../TransitiveBlocksCancelCommand.java | 7 +++++-- .../TransitiveBlocksEditAreaCommand.java | 12 ++++++++++-- .../commands/TransitiveBlocksEditCommand.java | 11 +++++++++-- .../TransitiveBlocksRegisterAreaCommand.java | 12 ++++++++++-- .../TransitiveBlocksRegisterCommand.java | 10 ++++++++-- .../elitemobs/commands/UnbindCommand.java | 7 ++++--- .../commands/UnbindForceCommand.java | 5 +++-- .../elitemobs/commands/VersionCommand.java | 5 +++-- 82 files changed, 357 insertions(+), 274 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java diff --git a/build.gradle b/build.gradle index 7e99f3d7f..1b0db9183 100644 --- a/build.gradle +++ b/build.gradle @@ -116,8 +116,8 @@ dependencies { 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' +// //reflections - used for config initialization +// implementation group: 'org.reflections', name: 'reflections', version: '0.10.2' //lombok compileOnly 'org.projectlombok:lombok:1.18.34' @@ -153,7 +153,7 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') - relocate('org.reflections', packagePath + '.reflections') +// relocate('org.reflections', packagePath + '.reflections') } archiveClassifier.set(null) archiveFileName.set(project.name + ".jar") diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 1ec601fb5..9c7dbbe5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public AdventurersGuildCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + 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 index 01b258753..b78d4e5bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public AltCommand() { } @Override - public void execute() { - PlayerData.setUseBookMenus(getCurrentPlayerSender(), !PlayerData.getUseBookMenus(getCurrentPlayerSender().getUniqueId())); - Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getSwitchEMStyleMessage()); + 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 index af2d710d3..c66063126 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -1,6 +1,8 @@ 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; @@ -17,7 +19,7 @@ public ArenaCommand() { } @Override - public void execute() { - ArenaCommands.openArenaMenu(getCurrentPlayerSender(), getStringArgument("arenaID")); + 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 50d8010f0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.menus.ArenaMenu; -import org.bukkit.entity.Player; - -public class ArenaCommands { - private 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/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index ce7c82e5e..34f06fa3b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -3,6 +3,7 @@ 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; @@ -19,7 +20,7 @@ public DebugCommand() { } @Override - public void execute() { - DebugScreen.open(getCurrentPlayerSender(), getStringArgument("filename")); + 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 index 19bd0b56a..b06eb76f3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public DiscordCommand() { } @Override - public void execute() { - Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + 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 index 5f6d4750f..64988902c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,8 +18,8 @@ public DiscordMessageCommand() { } @Override - public void execute() { - new DiscordSRVAnnouncement(getStringSequenceArgument("message")); - Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); + 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 index 0af89d79c..500607785 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public DismissCommand() { } @Override - public void execute() { - PlayerData.setDismissEMStatusScreenMessage(getCurrentPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(getCurrentPlayerSender().getUniqueId())); + public void execute(CommandData commandData) { + PlayerData.setDismissEMStatusScreenMessage(commandData.getPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(commandData.getPlayerSender().getUniqueId())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index c50bc0416..f0fb2b029 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,7 +18,7 @@ public DungeonTeleportCommand() { } @Override - public void execute() { - DungeonCommands.teleport(getCurrentPlayerSender(), getStringArgument("dungeonID")); + 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 index a07eb3d2f..82b5e1e2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -3,21 +3,22 @@ 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; +import java.util.ArrayList; public class EliteMobsCommand extends AdvancedCommand { public EliteMobsCommand() { - super(List.of("em", "elitemobs")); + super(new ArrayList<>()); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); setSenderType(SenderType.PLAYER); } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.isEmLeadsToStatusMenu()) - new PlayerStatusScreen(getCurrentPlayerSender()); + 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 index c2766a35e..1e7bfa81c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public EnchantCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - new ItemEnchantmentMenu(getCurrentPlayerSender()); + 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 index b04d02cbc..61a496b6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public EventCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(getCurrentCommandSender(), getStringArgument("filename")); + 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 index ff4ae49db..f15b47354 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,10 +17,10 @@ public FireballCommand() { } @Override - public void execute() { - Fireball fireball = (Fireball) getCurrentPlayerSender().getWorld().spawnEntity(getCurrentPlayerSender().getLocation(), EntityType.FIREBALL); - fireball.setDirection(getCurrentPlayerSender().getLocation().getDirection().normalize()); - fireball.setShooter(getCurrentPlayerSender()); + 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); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index af4408e1e..792b9e523 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.Player; @@ -15,14 +16,14 @@ public HelpCommand() { } @Override - public void execute() { - Logger.sendMessage(getCurrentCommandSender(), "Commands:"); + public void execute(CommandData commandData) { + Logger.sendMessage(commandData.getCommandSender(), "Commands:"); CommandManager.getInstance().commands.forEach(command -> { - if (getCurrentCommandSender() instanceof Player player) { - player.spigot().sendMessage(Logger.hoverMessage(command.usage, command.description)); + if (commandData.getCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.getUsage(), command.getDescription())); } else { - Logger.sendSimpleMessage(getCurrentCommandSender(), command.usage); - Logger.sendSimpleMessage(getCurrentCommandSender(), command.description); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getUsage()); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getDescription()); } }); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index 263e4b123..ca0f27243 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -14,7 +15,7 @@ public KillCommand() { } @Override - public void execute() { - KillHandler.killAggressiveMobs(getCurrentCommandSender()); + 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 index a408e4477..d4e84cd57 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,7 +19,7 @@ public KillRadiusCommand() { } @Override - public void execute() { - KillHandler.radiusKillAggressiveMobs(getCurrentPlayerSender(), getIntegerArgument("radius")); + 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 index e060bcb84..6cec36a67 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.entity.EntityType; import java.util.ArrayList; @@ -15,12 +15,11 @@ public KillTypeCommand() { addArgument("type", new ArrayList<>()); setUsage("/em kill type "); setPermission("elitemobs.kill.type"); - setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } @Override - public void execute() { - KillHandler.killEntityType(getCurrentPlayerSender(), EntityType.valueOf(getStringArgument("type"))); + 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 index 90d86f7be..a76c7b2d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -2,6 +2,7 @@ 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; @@ -21,9 +22,9 @@ public KillTypeRadiusCommand() { } @Override - public void execute() { - KillHandler.radiusKillSpecificMobs(getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("type")), - getIntegerArgument("range")); + 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 index 0b6f9e2b4..27574baf1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -3,6 +3,7 @@ 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.List; @@ -17,15 +18,15 @@ public LanguageCommand() { } @Override - public void execute() { - String language = getStringArgument("language"); + public void execute(CommandData commandData) { + String language = commandData.getStringArgument("language"); if (!TranslationsConfig.getTranslationConfigs().containsKey(language)) { - Logger.sendMessage(getCurrentCommandSender(), "Language not found. Valid languages:"); - TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(getCurrentCommandSender(), key)); + Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key)); return; } - DefaultConfig.setLanguage(getCurrentCommandSender(), language); - Logger.sendMessage(getCurrentCommandSender(), "&2Language set to " + language + + 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 index 36c241e2f..d1035a41f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public LootCommand() { } @Override - public void execute() { - LootMenu.openMenu(getCurrentPlayerSender()); + 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 index 34478b53c..f6217a661 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -3,6 +3,7 @@ import com.magmaguy.elitemobs.commands.admin.GetTierCommand; 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; @@ -20,7 +21,7 @@ public LootDebugCommand() { } @Override - public void execute() { - GetTierCommand.get(getCurrentPlayerSender(), getIntegerArgument("level")); + 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 index 9fccf132c..166ffeebb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -3,7 +3,7 @@ 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.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,11 @@ public LootGiveCommand() { addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); setPermission("elitemobs.loot.give"); - setSenderType(SenderType.PLAYER); setDescription("Gives the specified loot to a specific player."); } @Override - public void execute() { - LootCommand.give(getCurrentCommandSender(), getStringArgument("playerName"), getStringArgument("filename")); + 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 index 7c99be803..28b92ffa8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public LootMenuCommand() { } @Override - public void execute() { - new GetLootMenu(getCurrentPlayerSender()); + 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 index 0f8a0f0ee..04f6fcedb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -3,7 +3,7 @@ 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.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,11 @@ public LootRandomCommand() { addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); setPermission("elitemobs.loot.random"); - setSenderType(SenderType.PLAYER); setDescription("Gives the player random loot of the specified level."); } @Override - public void execute() { - SimLootCommand.forcePositiveLoot(getCurrentCommandSender(), getStringArgument("playerName"), getIntegerArgument("level")); + 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 index c166db304..752a7b82b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -3,6 +3,7 @@ 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; @@ -21,10 +22,10 @@ public LootSimulateCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SimLootCommand.run( - getCurrentPlayerSender(), - getIntegerArgument("level"), - getStringArgument("playerName")); + 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 index 730bb8db7..ca0236728 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -3,6 +3,7 @@ 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; @@ -22,11 +23,11 @@ public LootSimulateMultipleCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SimLootCommand.runMultipleTimes( - getCurrentPlayerSender(), - getIntegerArgument("level"), - getIntegerArgument("times"), - getStringArgument("playerName")); + 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 index ab6430518..9e81fb2f6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -2,6 +2,7 @@ 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; @@ -19,8 +20,8 @@ public LootStats() { } @Override - public void execute() { - Player player = getCurrentPlayerSender(); + public void execute(CommandData commandData) { + Player player = commandData.getPlayerSender(); ItemStack item = player.getInventory().getItemInMainHand(); double attackSpeed = EliteItemManager.getAttackSpeed(item); double damage = EliteItemManager.getBaseDamage(item); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index f5cc69e87..69a41cdd6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,14 +15,13 @@ public MoneyAddAllCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add all "); setPermission("elitemobs.money.add.all"); - setSenderType(SenderType.PLAYER); setDescription("Gives every player on the server the specified amount of money."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.addAllCommand( - getCurrentCommandSender(), - getDoubleArgument("amount")); + 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 index d83f008d0..62480a03a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,15 +15,14 @@ public MoneyAddCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); setPermission("elitemobs.money.add.player"); - setSenderType(SenderType.PLAYER); setDescription("Gives the specified amount of money to the designated player."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.addCommand( - getCurrentCommandSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index 33e655a4a..14cee4268 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,10 +19,10 @@ public MoneyCheckCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) - new PlayerStatusScreen(getCurrentPlayerSender()); + new PlayerStatusScreen(commandData.getPlayerSender()); else - CurrencyCommandsHandler.walletCommand(getCurrentPlayerSender()); + 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 index e17d33f5c..29a6736e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -1,6 +1,7 @@ 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; @@ -16,9 +17,9 @@ public MoneyCheckPlayerCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.checkCommand( - getCurrentCommandSender(), - getStringArgument("player")); + commandData.getCommandSender(), + commandData.getStringArgument("player")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index a05b654dc..a2d17c061 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,14 +15,13 @@ public MoneyRemoveCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); setPermission("elitemobs.money.remove"); - setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.subtractCommand( - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index d4a8db4c9..9de1d06e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,10 +19,10 @@ public MoneySetCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.setCommand( - getCurrentCommandSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + commandData.getCommandSender(), + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index 44bb71c85..1e867ea92 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -1,6 +1,7 @@ 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; @@ -16,7 +17,9 @@ public PackageDungeonCommand() { } @Override - public void execute() { - new PackageCommand(getCurrentCommandSender(), getStringArgument("dungeonName"), getStringArgument("version")); + 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 index 98f778fed..3a7961030 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,10 +18,10 @@ public PayCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.payCommand( - getCurrentPlayerSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index 00074c33c..21ca47b73 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public PlaceBossCommand() { } @Override - public void execute() { - CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + 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 index 537d52c62..c1f31c9cd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -3,6 +3,7 @@ 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; @@ -20,7 +21,7 @@ public PlaceNPCCommand() { } @Override - public void execute() { - NPCCommands.set(getCurrentPlayerSender(), getStringArgument("filename")); + 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 index e5bd38b37..2753aed75 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public PlaceTreasureChestCommand() { } @Override - public void execute() { - CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + 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/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 2612668e1..186e4dcf5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -3,6 +3,7 @@ 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; @@ -22,20 +23,20 @@ public PlaceWormholeCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(getStringArgument("wormholeFilename"))) - switch (getStringArgument("wormholeOption")) { + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("wormholeFilename"))) + switch (commandData.getStringArgument("wormholeOption")) { case "1": - wormhole.getWormholeEntry1().updateLocation(getCurrentPlayerSender()); + wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); return; case "2": - wormhole.getWormholeEntry2().updateLocation(getCurrentPlayerSender()); + wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender()); return; default: - Logger.sendMessage(getCurrentCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); } } - Logger.sendMessage(getCurrentCommandSender(), "Failed to set location for this 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/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index 9b10521ed..29a552ad2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public QuestAcceptCommand() { } @Override - public void execute() { - QuestCommand.joinQuest(getStringArgument("questID"), getCurrentPlayerSender()); + 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 index 63b0f4411..2854671a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -2,6 +2,8 @@ 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; @@ -11,11 +13,12 @@ public QuestBypassCommand() { addLiteral("bypass"); setUsage("/em quest bypass"); setPermission("elitemobs.quest.bypass"); + setSenderType(SenderType.PLAYER); setDescription("Bypasses permission restrictions for elite quests."); } @Override - public void execute() { - QuestCommand.bypassQuestRequirements(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + QuestCommand.bypassQuestRequirements(commandData.getPlayerSender()); } } \ 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 index c23f2557c..63831dcdc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public QuestCompleteCommand() { } @Override - public void execute() { - QuestCommand.completeQuest(getCurrentPlayerSender()); + 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/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 933c12cc2..306478b72 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public QuestLeaveCommand() { } @Override - public void execute() { - QuestCommand.leaveQuest(getCurrentPlayerSender(), getStringArgument("questID")); + 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 index b87c868b9..9f4915e63 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -1,8 +1,8 @@ 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 java.util.ArrayList; import java.util.List; @@ -19,7 +19,7 @@ public QuestResetAllCommand() { } @Override - public void execute() { - QuestCommand.resetQuests(getCurrentCommandSender(), getStringArgument("player")); + 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 index 890d5a680..46d9e5586 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -3,6 +3,8 @@ 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; @@ -16,10 +18,11 @@ public QuestResetCommand() { setUsage("/em quest reset "); setPermission("elitemobs.quest.reset.quest"); setDescription("Resets a specific quest for a specific player."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - QuestCommand.resetQuest(getCurrentCommandSender(), getStringArgument("player"), getStringArgument("questName")); + 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 index 06802a94f..8629cc3a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public QuestTrackCommand() { } @Override - public void execute() { - QuestCommand.trackQuest(getStringArgument("questID"), getCurrentPlayerSender()); + 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 index d543f3016..148b2b2bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,9 +16,9 @@ public QuitCommand() { } @Override - public void execute() { - MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender()); if (matchInstance != null) - matchInstance.removeAnyKind(getCurrentPlayerSender()); + 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 index cacf7c07d..39a4bdcbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,8 +16,8 @@ public RankCommand() { } @Override - public void execute() { - if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + 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 index b2c2c5c46..b4730d04b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,10 +18,10 @@ public RankSetCommand() { } @Override - public void execute() { - GuildRankCommands.setGuildRank(getCurrentCommandSender(), - getStringArgument("player"), - getIntegerArgument("prestigeLevel"), - getIntegerArgument("guildLevel")); + 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 index 1cfdc72a5..efc3774b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -2,6 +2,7 @@ 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; @@ -23,7 +24,7 @@ public static void reload(CommandSender commandSender) { } @Override - public void execute() { - reload(getCurrentCommandSender()); + 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 index f8e33fcf4..2110beb14 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public RemoveCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(getCurrentPlayerSender()); + 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 index 55f0209b5..2dca59643 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public RepairCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { RepairMenu repairMenu = new RepairMenu(); - repairMenu.constructRepairMenu(getCurrentPlayerSender()); + 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 index 4536c0d31..bd845d9df 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -15,7 +16,7 @@ public RespawnAllCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> { if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn(); }); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index f1bd65d76..ea92414cc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public ScrapCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { ScrapperMenu scrapperMenu = new ScrapperMenu(); - scrapperMenu.constructScrapMenu(getCurrentPlayerSender()); + 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 index e23b0ce2e..d31265acf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,7 +17,7 @@ public SetupCommand() { } @Override - public void execute() { - new SetupMenu(getCurrentPlayerSender()); + 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 index 5091430a6..c8186bdc7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,11 +17,11 @@ public SetupDoneCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { DefaultConfig.toggleSetupDone(); if (DefaultConfig.isSetupDone()) - Logger.sendMessage(getCurrentCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this."); + 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(getCurrentCommandSender(), "&aEliteMobs will once again send messages on login. You can do [/em setup done] again to revert this."); + 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/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 78e6e3b35..3d5ade5d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,12 +19,12 @@ public SetupToggleCommand() { } @Override - public void execute() { - String dungeon = getStringArgument("empackages"); + public void execute(CommandData commandData) { + String dungeon = commandData.getStringArgument("empackages"); if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) - Logger.sendMessage(getCurrentCommandSender(), "Not a valid em package!"); + Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!"); EMPackage emPackage = EMPackage.getEmPackages().get(dungeon); if (emPackage.install()) - Logger.sendMessage(getCurrentCommandSender(), "Successfully installed content!"); + Logger.sendMessage(commandData.getCommandSender(), "Successfully installed 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 index 1189648ac..415c820b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,7 +17,7 @@ public ShareItemCommand() { } @Override - public void execute() { - ShareItem.showOnChat(getCurrentPlayerSender()); + 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 index 3907223a9..587dcdc7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,8 +19,8 @@ public ShopCustomCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - CustomShopMenu.customShopInitializer(getCurrentPlayerSender()); + 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 index be44f5a22..4973844da 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,11 +20,11 @@ public ShopCustomOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { - CustomShopMenu.customShopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index b13ccf3f4..993484c24 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,8 +19,8 @@ public ShopDynamicCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - ProceduralShopMenu.shopInitializer(getCurrentPlayerSender()); + 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 index 67b331977..5984710df 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,11 +20,11 @@ public ShopProceduralOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { - ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index d3847eed2..237f811a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,12 +20,12 @@ public ShopSellOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SellMenu sellMenu = new SellMenu(); try { - sellMenu.constructSellMenu(Bukkit.getPlayer(getStringArgument("player"))); + sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index 8e3d72342..08ce864f7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -22,19 +22,18 @@ public SpawnBossAtCommand() { addArgument("z", new ArrayList<>()); setUsage("/setup spawnAt boss "); setPermission("elitemobs.*"); - setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getStringArgument("worldName"), + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), new Vector( - getDoubleArgument("x"), - getDoubleArgument("y"), - getDoubleArgument("z"))); + 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 index de21fe16b..e64ecad12 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,9 +20,9 @@ public SpawnBossCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename")); + 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 index 0c21ed5f9..f8629dd5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -23,20 +23,19 @@ public SpawnBossLevelAtCommand() { addArgument("level", new ArrayList<>()); setUsage("/setup spawn bossAt "); setPermission("elitemobs.*"); - setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getStringArgument("worldName"), + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), new Vector( - getDoubleArgument("x"), - getDoubleArgument("y"), - getDoubleArgument("z")), - getIntegerArgument("level")); + 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 index 986f72362..3eab1fadb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -2,6 +2,7 @@ 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; @@ -20,10 +21,10 @@ public SpawnBossLevelCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getIntegerArgument("level")); + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getIntegerArgument("level")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 4ad1e71c4..b93daf058 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -2,6 +2,7 @@ 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; @@ -23,11 +24,11 @@ public SpawnElite() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnEliteEntityTypeCommand( - getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("entityType")), - getIntegerArgument("level"), - Optional.of(getStringSequenceArgument("powers"))); + 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 index fef05b732..9d8478165 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -2,6 +2,7 @@ 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; @@ -28,16 +29,16 @@ public SpawnEliteAtCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnEliteEntityTypeCommand( - getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("entityType")), - getStringArgument("world"), + commandData.getPlayerSender(), + EntityType.valueOf(commandData.getStringArgument("entityType")), + commandData.getStringArgument("world"), new Vector( - getIntegerArgument("x"), - getIntegerArgument("y"), - getIntegerArgument("z")), - getIntegerArgument("level"), - Optional.of(getStringSequenceArgument("powers"))); + 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 index 4d3029a8b..514a88788 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public SpawnTeleportCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.getDefaultSpawnLocation() != null) - PlayerPreTeleportEvent.teleportPlayer(getCurrentPlayerSender(), DefaultConfig.getDefaultSpawnLocation()); + 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 index 82447a712..c99e1152a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,11 +17,11 @@ public StartCommand() { } @Override - public void execute() { - MatchInstance matchInstance = MatchInstance.getPlayerInstance(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(commandData.getPlayerSender()); if (matchInstance != null) { matchInstance.countdownMatch(); } else - Logger.sendMessage(getCurrentCommandSender(), "You are not queued for instanced content!"); + 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 index db0e4764f..27c1d144e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public StatsCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(getCurrentPlayerSender()); + 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 index cac58c1e4..832f2fecc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -3,6 +3,7 @@ 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; @@ -21,17 +22,17 @@ public TrackBossCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) - if (customBossEntity.getEliteUUID().equals(UUID.fromString(getStringArgument("id")))) { - customBossEntity.getCustomBossBossBar().addTrackingPlayer(getCurrentPlayerSender()); + if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandData.getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(commandData.getPlayerSender()); return; } - Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + 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(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + 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 index 9c5f99c25..1bd6ed1af 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -2,6 +2,8 @@ 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; @@ -12,10 +14,11 @@ public TransitiveBlocksCancelCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender()); + 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 index 8ae26b164..753b51b7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,16 @@ public TransitiveBlocksEditAreaCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Edits large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), true, true); + 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 index 936f496e2..24e386a4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,15 @@ public TransitiveBlocksEditCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), true); + 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 index a16414ca1..4a18e7785 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,16 @@ public TransitiveBlocksRegisterAreaCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Registers large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false, true); + 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 index 66c304a25..5bdb76b5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,14 @@ public TransitiveBlocksRegisterCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false); + 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/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index 7c4e19c93..d3b038b46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public UnbindCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { UnbindMenu unbindMenu = new UnbindMenu(); - unbindMenu.constructUnbinderMenu(getCurrentPlayerSender()); + 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 index ca1237a23..ad957e55b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -3,6 +3,7 @@ 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; @@ -19,8 +20,8 @@ public UnbindForceCommand() { } @Override - public void execute() { - ItemStack itemStack = getCurrentPlayerSender().getInventory().getItemInMainHand(); + public void execute(CommandData commandData) { + ItemStack itemStack = commandData.getPlayerSender().getInventory().getItemInMainHand(); if (ItemTagger.isEliteItem(itemStack)) SoulbindEnchantment.removeEnchantment(itemStack); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index 765e84ddb..cae741a0f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,9 +18,9 @@ public VersionCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { Logger.sendMessage( - getCurrentCommandSender(), + commandData.getCommandSender(), ChatColor.WHITE + " version " + ChatColor.GREEN + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion()); } } \ No newline at end of file From 3b8131e601f89eea455b6c3249f5ce66e1fdc437 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:05:49 +0200 Subject: [PATCH 14/78] Finished going through commands --- .../java/com/magmaguy/elitemobs/commands/RepairCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/RespawnAllCommand.java | 2 +- .../java/com/magmaguy/elitemobs/commands/ScrapCommand.java | 2 +- .../java/com/magmaguy/elitemobs/commands/SetupCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/SetupDoneCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/SetupToggleCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/ShareItemCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/ShopCustomCommand.java | 2 +- .../magmaguy/elitemobs/commands/ShopCustomOtherCommand.java | 4 ++-- .../com/magmaguy/elitemobs/commands/ShopDynamicCommand.java | 2 +- .../magmaguy/elitemobs/commands/ShopSellOtherCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/SpawnBossCommand.java | 4 ++-- .../elitemobs/commands/SpawnBossLevelAtCommand.java | 6 +++--- .../magmaguy/elitemobs/commands/SpawnBossLevelCommand.java | 6 +++--- .../java/com/magmaguy/elitemobs/commands/SpawnElite.java | 2 +- .../magmaguy/elitemobs/commands/SpawnEliteAtCommand.java | 6 +++--- .../elitemobs/commands/TransitiveBlocksCancelCommand.java | 2 +- .../elitemobs/commands/TransitiveBlocksEditAreaCommand.java | 4 ++-- .../elitemobs/commands/TransitiveBlocksEditCommand.java | 6 +++--- .../commands/TransitiveBlocksRegisterAreaCommand.java | 4 ++-- .../elitemobs/commands/TransitiveBlocksRegisterCommand.java | 6 +++--- .../java/com/magmaguy/elitemobs/commands/UnbindCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/UnbindForceCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/VersionCommand.java | 4 ++-- 25 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java index 2dca59643..a1d6adeab 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -14,7 +14,7 @@ public RepairCommand() { 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"); + setDescription("Opens the repair item menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index bd845d9df..0d344b743 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -11,7 +11,7 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.*"); + setPermission("elitemobs.respawn"); setDescription("Forces all regional bosses to respawn."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index ea92414cc..534216f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -14,7 +14,7 @@ public ScrapCommand() { 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"); + setDescription("Opens the scrap menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index d31265acf..a7a604090 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -10,7 +10,7 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.*"); + setPermission("elitemobs.setup.main"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index c8186bdc7..509091122 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -12,7 +12,7 @@ public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); setUsage("/setup done"); - setPermission("elitemobs.*"); + setPermission("elitemobs.setup.done"); setDescription("Toggles whether the setup message will show up."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 3d5ade5d0..cbfb4e4eb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -11,11 +11,11 @@ public class SetupToggleCommand extends AdvancedCommand { public SetupToggleCommand() { super(List.of("setup")); - setPermission("elitemobs.*"); - setDescription("Sets up EliteMobs content!"); - setUsage("/em setup toggle"); addLiteral("toggle"); addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); + setUsage("/em setup toggle "); + setPermission("elitemobs.setup.toggle"); + setDescription("Allows you to toggle the installation of specified EliteMobs content."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java index 415c820b5..46b26dea2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -13,7 +13,7 @@ public ShareItemCommand() { setUsage("/em shareItem"); setPermission("elitemobs.shareitem"); setSenderType(SenderType.PLAYER); - setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + setDescription("Shares the stats of the currently held EliteMobs item in chat."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java index 587dcdc7b..51d1ee9db 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -15,7 +15,7 @@ public ShopCustomCommand() { 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"); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 4973844da..2d5d0bd9b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -15,8 +15,8 @@ public ShopCustomOtherCommand() { addLiteral("custom"); addArgument("player", new ArrayList<>()); setUsage("/em shop custom "); - setPermission("elitemobs.*"); - setDescription("Opens the EliteMobs shop for custom items."); + setPermission("elitemobs.shop.custom.player"); + setDescription("Opens the EliteMobs shop for custom items for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java index 993484c24..b6e84d237 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -15,7 +15,7 @@ public ShopDynamicCommand() { setUsage("/em shop dynamic"); setPermission("elitemobs.shop.command"); setSenderType(SenderType.PLAYER); - setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub"); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java index 237f811a9..eed677e82 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -14,9 +14,9 @@ public ShopSellOtherCommand() { super(List.of("shop")); addLiteral("sell"); addArgument("player", new ArrayList<>()); - setUsage("/em shop custom "); - setPermission("elitemobs.*"); - setDescription("Opens the EliteMobs shop for custom items."); + setUsage("/em shop sell "); + setPermission("elitemobs.shop.sell.player"); + setDescription("Opens the EliteMobs shop sell menu for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java index 08ce864f7..b183dc2fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -20,9 +20,9 @@ public SpawnBossAtCommand() { addArgument("x", new ArrayList<>()); addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); - setUsage("/setup spawnAt boss "); - setPermission("elitemobs.*"); - setDescription("Spawns a custom boss at the location the user is looking at."); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.spawn.boss.at"); + setDescription("Spawns a custom boss at the specified location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index e64ecad12..2d0560276 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -13,8 +13,8 @@ public SpawnBossCommand() { super(List.of("spawn")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/setup spawn boss "); - setPermission("elitemobs.*"); + setUsage("/em spawn boss "); + setPermission("elitemobs.spawn.boss"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index f8629dd5d..8d6955a6e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -21,9 +21,9 @@ public SpawnBossLevelAtCommand() { addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); addArgument("level", new ArrayList<>()); - setUsage("/setup spawn bossAt "); - setPermission("elitemobs.*"); - setDescription("Spawns a custom boss at the location the user is looking at."); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.spawn.boss.at.level"); + setDescription("Spawns a custom boss at the specified location with the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3eab1fadb..3d06e9055 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -14,10 +14,10 @@ public SpawnBossLevelCommand() { 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("/setup spawn boss "); - setPermission("elitemobs.*"); + setUsage("/em spawn boss "); + setPermission("elitemobs.spawn.boss.level"); setSenderType(SenderType.PLAYER); - setDescription("Spawns a custom boss at the location the user is looking at."); + setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index b93daf058..8346397de 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -18,7 +18,7 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.*"); + setPermission("elitemobs.spawn.elite"); setSenderType(SenderType.PLAYER); setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java index 9d8478165..bcf53598e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -22,10 +22,10 @@ public SpawnEliteAtCommand() { addArgument("entityType", new ArrayList<>()); addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); - setUsage("/em spawn elite <...>"); - setPermission("elitemobs.*"); + setUsage("/em spawn eliteAt <...>"); + setPermission("elitemobs.spawn.elite.at"); setSenderType(SenderType.PLAYER); - setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + setDescription("Spawns an elite of the specified type and level, optionally with specified powers, at the chosen location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 1bd6ed1af..8673dfaeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -12,7 +12,7 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setPermission("elitemobs.transitiveblocks.cancel"); setDescription("Cancels transitive block registration."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java index 753b51b7b..2c4d4acd6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -14,8 +14,8 @@ public TransitiveBlocksEditAreaCommand() { addLiteral("editArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setUsage("/em transitiveBlocks editArea "); + setPermission("elitemobs.transitiveblocks.edit.area"); setDescription("Edits large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java index 24e386a4a..a7274abe6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -14,9 +14,9 @@ public TransitiveBlocksEditCommand() { addLiteral("edit"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); - setDescription("Cancels transitive block registration."); + setUsage("/em transitiveBlocks edit "); + setPermission("elitemobs.transitiveblocks.edit.edit"); + setDescription("Edits transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java index 4a18e7785..b869df481 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -14,8 +14,8 @@ public TransitiveBlocksRegisterAreaCommand() { addLiteral("registerArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setUsage("/em transitiveBlocks registerArea "); + setPermission("elitemobs.transitiveblocks.register.area"); setDescription("Registers large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java index 5bdb76b5c..4af68f83f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -14,9 +14,9 @@ public TransitiveBlocksRegisterCommand() { addLiteral("register"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); - setDescription("Cancels transitive block registration."); + setUsage("/em transitiveBlocks register "); + setPermission("elitemobs.transitiveblocks.register.register"); + setDescription("Registers transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index d3b038b46..742eb9385 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -14,7 +14,7 @@ public UnbindCommand() { 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"); + setDescription("Opens the unbind menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java index ad957e55b..f853fa85b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -15,7 +15,7 @@ public UnbindForceCommand() { addLiteral("force"); setUsage("/em unbind force"); setSenderType(SenderType.PLAYER); - setPermission("elitemobs.*"); + setPermission("elitemobs.unbind.force"); setDescription("Forcefully unbinds a held item."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index cae741a0f..3a7669ba6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -13,8 +13,8 @@ public class VersionCommand extends AdvancedCommand { public VersionCommand() { super(List.of("version")); setUsage("/em version"); - setPermission("elitemobs.*"); - setDescription("Checks the server's plugin version."); + setPermission("elitemobs.version"); + setDescription("Checks the server's EliteMobs plugin version."); } @Override From 7da1b0a243641bfa4b290dadc91626150b9369cf Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:06:18 +0200 Subject: [PATCH 15/78] Updated plugin.yml with the rest of permissions --- src/main/resources/plugin.yml | 59 ++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d192b08f7..7862ba231 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -266,4 +266,61 @@ permissions: default: op elitemobs.remove: description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. - default: op \ No newline at end of file + default: op + elitemobs.respawn: + description: Allows players to force respawn all regional bosses. + default: op + elitemobs.setup.main: + description: Allows players to have access to the main command for setting up EliteMobs. + default: op + elitemobs.setup.done: + description: Allows players to toggle whether the setup message will show up in the server chat. + default: op + elitemobs.setup.toggle: + description: Allows players to toggle the installation of specified EliteMobs content. + default: op + elitemobs.shop.custom: + description: Allows players to open the EliteMobs shop for custom items for the specified player. + default: op + elitemobs.shop.sell.player: + description: Allows players to open the EliteMobs shop for custom items for the specified player. + default: op + elitemobs.spawn.boss.at: + description: Allows players to spawn a custom boss at the specified location. + default: op + elitemobs.spawn.boss: + description: Allows players to spawn a custom boss at the location the player is looking at. + default: op + elitemobs.spawn.boss.at.level: + description: Allows players to spawn a custom boss at the specified location with the specified level. + default: op + elitemobs.spawn.boss.level: + description: Allows players to spawn a custom boss at the location the user is looking at with the specified level. + default: op + elitemobs.spawn.elite: + description: Allows players to spawn an elite of a specified type and level, optionally with specific powers, at the targeted location. + default: op + elitemobs.spawn.elite.at: + description: Allows players to spawn an elite of the specified type and level, optionally with specified powers, at the chosen location. + default: op + elitemobs.transitiveblocks.cancel: + description: Allows players to cancel transitive block registration. + default: op + elitemobs.transitiveblocks.edit.area: + description: Allows players to edit large transitive blocks areas for use by regional bosses. + default: op + elitemobs.transitiveblocks.edit.edit: + description: Allows players to edit transitive blocks for use by regional bosses. + default: op + elitemobs.transitiveblocks.register.area: + description: Allows players to register large transitive blocks areas for use by regional bosses. + default: op + elitemobs.transitiveblocks.register.register: + description: Allows players to register transitive blocks for use by regional bosses. + default: op + elitemobs.unbind.force: + description: Allows players to forcefully unbind a held item. + default: op + elitemobs.version: + description: Allows players to check the server's EliteMobs plugin version. + default: op From 5c10ef4ea8aa2a2636e0dbfde17a0b4ce015c49b Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:13:05 +0200 Subject: [PATCH 16/78] Updated SetupDoneCommand.java fixed help text for SetupDoneCommand --- .../java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index 509091122..7222579ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -11,7 +11,7 @@ public class SetupDoneCommand extends AdvancedCommand { public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); - setUsage("/setup done"); + setUsage("/em setup done"); setPermission("elitemobs.setup.done"); setDescription("Toggles whether the setup message will show up."); } From d3f4bfa59dbe441e89740badee8dcdd29d9499f2 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:49:26 +0200 Subject: [PATCH 17/78] Updated MoneyCheckPlayerCommand.java fixed setusage for MoneyCheckPlayer --- .../magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 29a6736e7..62bb4caff 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -11,7 +11,7 @@ public MoneyCheckPlayerCommand() { super(List.of("money")); addLiteral("check"); addArgument("player", new ArrayList<>()); - setUsage("/em check "); + setUsage("/em money check "); setPermission("elitemobs.money.check.player"); setDescription("Checks the currency of the specified player."); } @@ -22,4 +22,4 @@ public void execute(CommandData commandData) { commandData.getCommandSender(), commandData.getStringArgument("player")); } -} \ No newline at end of file +} From 31e24a9de2dbc6b542b636ddb8aa02a169f10789 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:44:43 +0200 Subject: [PATCH 18/78] Some minor edits to commands --- .../com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java | 2 +- src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 186e4dcf5..3b326e924 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -16,7 +16,7 @@ public PlaceWormholeCommand() { addLiteral("wormhole"); addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); - setUsage("/em wormhole <1/2>"); + setUsage("/em place wormhole <1/2>"); setPermission("elitemobs.place.wormhole"); setSenderType(SenderType.PLAYER); setDescription("Place a wormhole teleport at your current location."); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java index 39a4bdcbe..b85485726 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -11,7 +11,7 @@ public class RankCommand extends AdvancedCommand { public RankCommand() { super(List.of("rank")); setUsage("/em rank"); - setDescription("Opens the EliteMobs rank menu."); + setDescription("Opens the EliteMobs rank menu or teleports you to the Adventurer's Guild."); setSenderType(SenderType.PLAYER); } From 66e312bc360bf83d35f1e5a497d803a9d192a07d Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Mon, 29 Jul 2024 16:17:08 +0100 Subject: [PATCH 19/78] EliteMobs 9.1.0 SNAPSHOT: - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Nearly all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [New] All content imports are now handled by MagmaCore. This update now also allows content to be installed incorrectly - meaning packs from other plugins can be correctly imported in EliteMobs and moved to the right place, content for plugins not yet installed in the server will prepare the content ahead of time if the server installs those plugins in the future - [New] The pirate ship minidungeon has been readded to the plugin defaults as it has now been updated out of being a schematic dungeon - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [New] Resource pack option in the em setup menu has been tweaked to recommend the Resource Pack Manager plugin instead, this will be further tweaked after public release - [New] Importing content with models will now automatically and immediately host the content if FMM and RSPM are installed, meaning dungeons with models will now work after a single EliteMobs reload to install if from the imports - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Fix] Elite projectiles can no longer survive chunk unloads - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 62 +----- .../com/magmaguy/elitemobs/EliteMobs.java | 7 +- .../elitemobs/adventurersguild/GuildRank.java | 2 +- .../api/EliteMobDamagedByPlayerEvent.java | 2 +- .../FixPlayerOnLoginOrRespawn.java | 4 +- .../ItemEnchantmentPrevention.java | 2 +- .../PreventUpgradeDiamondToNetherite.java | 2 +- .../combatsystem/EliteProjectile.java | 2 + .../combatsystem/displays/PopupDisplay.java | 2 +- .../elitemobs/commands/CommandHandler.java | 102 +++++++++ .../elitemobs/commands/CommandManager.java | 96 --------- .../commands/CurrencyCommandsHandler.java | 2 +- .../elitemobs/commands/HelpCommand.java | 19 +- .../elitemobs/commands/LootDebugCommand.java | 3 +- .../elitemobs/commands/LootGiveCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 4 +- .../commands/LootSimulateCommand.java | 4 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../commands/MoneyAddAllCommand.java | 8 +- .../elitemobs/commands/MoneyAddCommand.java | 2 +- .../elitemobs/commands/PlaceBossCommand.java | 8 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 2 +- .../commands/QuestBypassCommand.java | 6 + .../commands/SetupToggleCommand.java | 9 +- .../elitemobs/commands/admin/DebugScreen.java | 2 +- .../elitemobs/commands/admin/NPCCommands.java | 2 +- .../commands/admin/StatsCommand.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 23 +- .../elitemobs/config/ConfigurationEngine.java | 2 +- .../config/ConfigurationImporter.java | 199 ------------------ .../config/LegacyValueConverter.java | 8 + ...roceduralItemGenerationSettingsConfig.java | 3 +- .../premade/TheLivingDeadConfig.java | 2 +- .../premade/PirateShipMinidungeon.java | 34 +++ .../premade/PirateShipMinidungeon.off | 66 ------ .../config/menus/premade/ArenaMenuConfig.java | 2 +- .../menus/premade/BuyOrSellMenuConfig.java | 2 +- .../menus/premade/CustomShopMenuConfig.java | 2 +- .../menus/premade/GetLootMenuConfig.java | 2 +- .../menus/premade/GuildRankMenuConfig.java | 2 +- .../premade/ItemEnchantmentMenuConfig.java | 2 +- .../menus/premade/PlayerStatusMenuConfig.java | 2 +- .../premade/ProceduralShopMenuConfig.java | 2 +- .../config/menus/premade/QuestMenuConfig.java | 2 +- .../menus/premade/RepairMenuConfig.java | 2 +- .../menus/premade/ScrapperMenuConfig.java | 2 +- .../config/menus/premade/SellMenuConfig.java | 2 +- .../menus/premade/UnbinderMenuConfig.java | 2 +- .../elitemobs/economy/EconomyHandler.java | 2 +- .../elitemobs/items/EliteItemLore.java | 2 +- .../elitemobs/items/ItemLootShower.java | 4 +- .../elitemobs/items/ItemWorthCalculator.java | 2 +- .../items/ScalableItemConstructor.java | 2 +- .../itemconstructor/ItemConstructor.java | 2 +- .../menus/InstancedDungeonBrowser.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 2 +- .../magmaguy/elitemobs/menus/LootMenu.java | 2 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 2 +- .../elitemobs/menus/ScrapperMenu.java | 2 +- .../magmaguy/elitemobs/menus/SellMenu.java | 4 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 2 +- .../custombosses/CustomBossBossBar.java | 2 +- .../custombosses/CustomBossDeath.java | 2 +- .../custombosses/CustomBossTrail.java | 2 +- .../statusscreen/BossTrackingPage.java | 4 +- .../statusscreen/TeleportsPage.java | 2 +- .../elitemobs/powers/GoldExplosion.java | 2 +- .../elitemobs/powers/GoldShotgun.java | 2 +- .../elitemobs/quests/QuestTracking.java | 2 +- .../quests/menus/QuestInventoryMenu.java | 2 +- .../elitemobs/quests/menus/QuestMenu.java | 2 +- .../placeholderapi/Placeholders.java | 2 +- .../treasurechest/TreasureChest.java | 2 +- .../elitemobs/utils/ItemStackGenerator.java | 76 ------- .../elitemobs/utils/ItemStackSerializer.java | 1 + .../com/magmaguy/elitemobs/utils/Round.java | 12 -- .../elitemobs/utils/SpigotMessage.java | 32 --- .../versionnotifier/VersionChecker.java | 2 +- src/main/resources/plugin.yml | 6 +- 80 files changed, 280 insertions(+), 630 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/Round.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java diff --git a/build.gradle b/build.gradle index 1b0db9183..d22f97548 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import org.apache.tools.ant.filters.ReplaceTokens - plugins { id 'java-library' id 'idea' @@ -14,16 +12,11 @@ compileTestJava.options.encoding = "UTF-8" java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(17) } } -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' - options.release = 21 -} - -//Fixes issues with utf-8 in the translations files. Why? Don't know. +//Fixes issues with utf-8 in the translations files. processResources { def props = [version: version] inputs.properties props @@ -34,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.0.5' +version '9.1.0' repositories { maven { @@ -53,13 +46,8 @@ 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 = 'http://magmaguy.com:50001/releases' @@ -77,10 +65,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/' @@ -93,8 +79,6 @@ repositories { dependencies { //Spigot API compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" - //BStats API - implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' //Vault @@ -112,31 +96,23 @@ dependencies { 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.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' + // Mythic Mobs integration - currently only for arenas + compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' - //Advanced AI goals + ///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.11.2-SNAPSHOT' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0' - //Advanced AI goals - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' - - // Mythic Mobs integration - currently only for arenas - compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } artifacts { // task 'build' runs generates uberjar @@ -153,30 +129,12 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') -// 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 -} - - -//ext.isReleaseVersion = !version.contains("SNAPSHOT") - publishing { repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 1f33f06be..502a143c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -5,7 +5,7 @@ */ import com.magmaguy.easyminecraftgoals.NMSManager; -import com.magmaguy.elitemobs.commands.CommandManager; +import com.magmaguy.elitemobs.commands.CommandHandler; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -222,7 +222,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 @@ -267,7 +268,7 @@ public void onEnable() { //Commands // new CommandHandler(); - new CommandManager(); + CommandHandler.registerCommands(); new SpecialItemSystemsConfig(); 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/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 2f8f5258b..8c0359157 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -15,7 +15,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.magmacore.util.Round; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java index fa6bf49a6..7293e3822 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java @@ -4,7 +4,7 @@ import org.bukkit.attribute.Attribute; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -19,7 +19,7 @@ public void onPlayerRespawn(PlayerRespawnEvent event) { } @EventHandler - public void onPlayerRespawn(PlayerLoginEvent event) { + 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()) 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/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index c25f8cdc5..3de63fa7d 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.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.Listener; 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/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index 8b1a2cf6b..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,8 +10,8 @@ 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.VisualDisplay; +import com.magmaguy.magmacore.util.Round; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java new file mode 100644 index 000000000..97d1734f0 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -0,0 +1,102 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.CommandManager; + +public class CommandHandler { + private static CommandManager emCommand; + private static CommandManager adventurersGuildCommand; + private CommandHandler() { + } + + 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 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()); + + //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 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/CommandManager.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java deleted file mode 100644 index 1acb36c11..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.MetadataHandler; - -public class CommandManager extends com.magmaguy.magmacore.command.CommandManager { - public CommandManager() { - super(MetadataHandler.PLUGIN, "elitemobs"); - } - - @Override - public void registerCommands() { - //Admin commands - registerCommand(new SetupCommand()); - registerCommand(new SetupDoneCommand()); - registerCommand(new SetupToggleCommand()); - registerCommand(new SpawnBossCommand()); - registerCommand(new SpawnBossLevelCommand()); - registerCommand(new SpawnBossAtCommand()); - registerCommand(new SpawnBossLevelAtCommand()); - registerCommand(new PlaceBossCommand()); - registerCommand(new PlaceTreasureChestCommand()); - registerCommand(new PlaceNPCCommand()); - registerCommand(new RemoveCommand()); - registerCommand(new DebugCommand()); - registerCommand(new EventCommand()); - registerCommand(new StatsCommand()); - registerCommand(new LootMenuCommand()); - registerCommand(new LootGiveCommand()); - registerCommand(new LootRandomCommand()); - registerCommand(new LootSimulateMultipleCommand()); - registerCommand(new LootSimulateCommand()); - registerCommand(new VersionCommand()); - registerCommand(new ReloadCommand()); - registerCommand(new KillCommand()); - registerCommand(new KillRadiusCommand()); - registerCommand(new KillTypeCommand()); - registerCommand(new KillTypeRadiusCommand()); - registerCommand(new LootDebugCommand()); - registerCommand(new MoneyAddCommand()); - registerCommand(new MoneyAddAllCommand()); - registerCommand(new MoneySetCommand()); - registerCommand(new MoneyCheckPlayerCommand()); - registerCommand(new UnbindForceCommand()); - registerCommand(new FireballCommand()); - registerCommand(new RespawnAllCommand()); - registerCommand(new PackageDungeonCommand()); - registerCommand(new LanguageCommand()); - registerCommand(new PlaceWormholeCommand()); - registerCommand(new LootStats()); - registerCommand(new ShopProceduralOtherCommand()); - registerCommand(new ShopCustomOtherCommand()); - registerCommand(new ShopSellOtherCommand()); - registerCommand(new QuestBypassCommand()); - registerCommand(new QuestCompleteCommand()); - registerCommand(new QuestResetCommand()); - registerCommand(new QuestResetAllCommand()); - registerCommand(new TransitiveBlocksCancelCommand()); - registerCommand(new TransitiveBlocksRegisterCommand()); - registerCommand(new TransitiveBlocksEditCommand()); - registerCommand(new TransitiveBlocksRegisterAreaCommand()); - registerCommand(new TransitiveBlocksEditAreaCommand()); - registerCommand(new RankSetCommand()); - registerCommand(new SpawnElite()); - registerCommand(new SpawnEliteAtCommand()); - registerCommand(new DiscordMessageCommand()); - registerCommand(new DiscordCommand()); - - //User commands - registerCommand(new AdventurersGuildCommand()); - registerCommand(new ShareItemCommand()); - registerCommand(new ShopDynamicCommand()); - registerCommand(new ShopCustomCommand()); - registerCommand(new RepairCommand()); - registerCommand(new EnchantCommand()); - registerCommand(new ScrapCommand()); - registerCommand(new UnbindCommand()); - registerCommand(new MoneyCheckCommand()); - registerCommand(new QuestAcceptCommand()); - registerCommand(new QuestTrackCommand()); - registerCommand(new QuestLeaveCommand()); - registerCommand(new RankCommand()); - registerCommand(new LootCommand()); - registerCommand(new QuitCommand()); - registerCommand(new StartCommand()); - registerCommand(new ArenaCommand()); - registerCommand(new DismissCommand()); - registerCommand(new AltCommand()); - registerCommand(new SpawnTeleportCommand()); - registerCommand(new DungeonTeleportCommand()); - registerCommand(new TrackBossCommand()); - registerCommand(new PayCommand()); - - registerCommand(new EliteMobsCommand()); - registerCommand(new HelpCommand()); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index e6de39500..e11cdfd9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java @@ -2,8 +2,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index 792b9e523..c2b49187d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,13 +19,15 @@ public HelpCommand() { @Override public void execute(CommandData commandData) { Logger.sendMessage(commandData.getCommandSender(), "Commands:"); - CommandManager.getInstance().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()); - } - }); + 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/LootDebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java index f6217a661..ada2a14e9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.elitemobs.commands.admin.GetTierCommand; -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; @@ -13,7 +12,7 @@ public class LootDebugCommand extends AdvancedCommand { public LootDebugCommand() { super(List.of("loot")); addLiteral("debug"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>()); setUsage("/em loot debug "); setPermission("elitemobs.loot.debug"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 166ffeebb..0014a9663 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -14,7 +14,7 @@ public LootGiveCommand() { addLiteral("give"); addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); - setUsage("/em loot give "); + setUsage("/em loot give "); setPermission("elitemobs.loot.give"); setDescription("Gives the specified loot to a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 04f6fcedb..7ae31801d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -12,8 +12,8 @@ public class LootRandomCommand extends AdvancedCommand { public LootRandomCommand() { super(List.of("loot")); addLiteral("random"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - addArgument("playerName", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot random "); setPermission("elitemobs.loot.random"); setDescription("Gives the player random loot of the specified level."); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 752a7b82b..5284dc1e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -13,8 +13,8 @@ public class LootSimulateCommand extends AdvancedCommand { public LootSimulateCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - addArgument("playerName", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot simulate "); setPermission("elitemobs.loot.simulate"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index ca0236728..cf7eba055 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -13,7 +13,7 @@ public class LootSimulateMultipleCommand extends AdvancedCommand { public LootSimulateMultipleCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>()); addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 69a41cdd6..d751e4547 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; import com.magmaguy.magmacore.command.CommandData; @@ -10,10 +9,9 @@ public class MoneyAddAllCommand extends AdvancedCommand { public MoneyAddAllCommand() { super(List.of("money")); - addLiteral("add"); - addLiteral("all"); - addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - setUsage("/em money add all "); + addLiteral("addAll"); + addArgument("amount", new ArrayList<>()); + setUsage("/em money addAll "); setPermission("elitemobs.money.add.all"); setDescription("Gives every player on the server the specified amount of money."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 62480a03a..31d4d871c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -11,7 +11,7 @@ public class MoneyAddCommand extends AdvancedCommand { public MoneyAddCommand() { super(List.of("money")); addLiteral("add"); - addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("player", new ArrayList<>()); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); setPermission("elitemobs.money.add.player"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index 21ca47b73..9e6093dec 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -1,18 +1,24 @@ 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"); - addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + 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.boss"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index 2753aed75..fb1b012ca 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -21,6 +21,6 @@ public PlaceTreasureChestCommand() { @Override public void execute(CommandData commandData) { - CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender()); + 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 index 3b326e924..261fa79d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -25,7 +25,7 @@ public PlaceWormholeCommand() { @Override public void execute(CommandData commandData) { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("wormholeFilename"))) + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename"))) switch (commandData.getStringArgument("wormholeOption")) { case "1": wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 2854671a1..83619bbae 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -1,9 +1,11 @@ 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; @@ -20,5 +22,9 @@ public QuestBypassCommand() { @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/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index cbfb4e4eb..f523de7d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -24,7 +24,12 @@ public void execute(CommandData commandData) { 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()) - Logger.sendMessage(commandData.getCommandSender(), "Successfully installed content!"); + 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/admin/DebugScreen.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java index 7cb25431c..e39885c30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -6,8 +6,8 @@ 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/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/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java index aff87c328..d3c5bd302 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -6,8 +6,8 @@ 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; 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 05bf15fc1..a2baef37f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.SpigotMessage; 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; @@ -50,14 +50,17 @@ 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) { diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 778e82472..c47c3692e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; 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; 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 2ec691a57..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.MetadataHandler; -import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; -import com.magmaguy.magmacore.util.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) { - Logger.warn("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) { - Logger.warn("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, new File(zippedFile.getAbsolutePath().replace(".zip", ""))); - else unzippedFile = zippedFile; - } catch (Exception e) { - Logger.warn("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 - Logger.warn("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); - break; - case "schematics": - Logger.warn("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); - break; - default: - Logger.warn("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) { - Logger.warn("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); - e.printStackTrace(); - continue; - } - try { - unzippedFile.delete(); - zippedFile.delete(); - } catch (Exception ex) { - Logger.warn("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); - Logger.info("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()) { - Logger.info("Overriding existing directory " + destinationFile.getPath()); - if (Bukkit.getWorld(file.getName()) != null) { - Bukkit.unloadWorld(file.getName(), false); - Logger.warn("Unloaded world " + file.getName() + " for safe replacement!"); - } - deleteDirectory(destinationFile); - } - FileUtils.moveDirectory(file, destinationFile); - } catch (Exception exception) { - Logger.warn("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 { - Logger.info("Adding " + file.getCanonicalPath()); - moveFile(file, targetPath, force); - } catch (Exception exception) { - Logger.warn("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) { - Logger.warn("Failed to move directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index e72f2a185..a05612a0f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -90,6 +90,14 @@ public static String parseParticle(String potionEffectName) { 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(); default: return potionEffectName; } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java index ecec2451e..33ba488b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -62,7 +62,6 @@ public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile { public ProceduralItemGenerationSettingsConfig() { super("ProceduralItemGenerationSettings.yml"); - instance = this; } private void addMaterial(Material material) { @@ -79,6 +78,8 @@ public void cacheMaterials() { @Override public void initializeValues() { + instance = this; + doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); 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..83547319e 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,7 +1,7 @@ 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; 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 new file mode 100644 index 000000000..f9aaa7e5e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.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.Arrays; + +public class PirateShipMinidungeon extends DungeonPackagerConfigFields { + public PirateShipMinidungeon() { + super("pirate_ship_minidungeon", + true, + "&2[lvl 010-020] &6The Pirate Ship", + Arrays.asList("&fA fun, challenging minidungeon full of", + "&fbosses made for players starting to get good,", + "&fat EliteMobs!", + "&6Credits: MagmaGuy & Realm of Lotheridon"), + DiscordLinks.freeMinidungeons, + DungeonSizeCategory.MINIDUNGEON, + "em_pirate_ship", + World.Environment.NORMAL, + true, + "em_the_pirate_ship,-85,63,243.5,-150,0", + 0, + "Difficulty: &6Medium\n" + + "$bossCount bosses, from level $lowestTier to $highestTier\n" + + "&6One of the best hunting grounds for" + + "&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!", + "the_pirate_ship", + false); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off deleted file mode 100644 index 3de4f94ff..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off +++ /dev/null @@ -1,66 +0,0 @@ -package com.magmaguy.elitemobs.config.dungeonpackager.premade; - -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.utils.DiscordLinks; -import org.bukkit.util.Vector; - -import java.util.Arrays; -import java.util.List; - -public class PirateShipMinidungeon extends DungeonPackagerConfigFields { - public PirateShipMinidungeon() { - super("pirate_ship_minidungeon", - true, - "&2[lvl 010-020] &6The Pirate Ship", - Arrays.asList("&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, - DungeonSizeCategory.MINIDUNGEON, - "em_pirate_ship.schem", - true, - new Vector(16, -6, -1), - new Vector(-20, 58, 90), - "-17,1,49,0,0", - 0, - "Difficulty: &6Medium\n" + - "$bossCount bosses, from level $lowestTier to $highestTier\n" + - "&6One of the best hunting grounds for" + - "&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"); - } -} 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 90c0f330b..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,7 +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.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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..92f8bade2 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,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.Material; import org.bukkit.inventory.ItemStack; 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..3c7146b40 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,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.Arrays; 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..d10bea9e4 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,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 lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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..d7f6d3e9b 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,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 lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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 bc487f6e2..078211799 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,7 +4,7 @@ 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.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; 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..fad0a5f59 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,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.Arrays; 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..c8db6f1e7 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,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.Material; import org.bukkit.inventory.ItemStack; 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..3add3eebb 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,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.Material; import org.bukkit.inventory.ItemStack; 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..5d5e59f92 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,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.Material; import org.bukkit.inventory.ItemStack; 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..cbcca2963 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,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.Material; import org.bukkit.inventory.ItemStack; 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..3746afa01 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,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 lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 3e5d8eecb..3edba4109 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -10,9 +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.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; diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index e0d720677..4fbd06cf8 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -8,10 +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.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; 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/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/itemconstructor/ItemConstructor.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java index e967da277..71a2cc1c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java @@ -7,8 +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/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index f884985fc..e9bdefa43 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -5,8 +5,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index d6f39502a..d9a77bd98 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -10,8 +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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 25202dc8d..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.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/RepairMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java index 933ee6a43..e160d12ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -6,7 +6,7 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 42c4e12d7..ee4246745 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -9,8 +9,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java index 1d20fa872..3e59aec15 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -8,9 +8,9 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index 9193dfbd8..b6b0c1099 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -8,7 +8,7 @@ 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; 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 0eebe530e..fe43e4b3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -3,9 +3,9 @@ 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.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; 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 a86c13599..d4654b4fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java @@ -4,8 +4,8 @@ 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/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 65404b752..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,7 +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.magmacore.util.ItemStackGenerator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; 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 5c6cabd04..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.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; 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 c64a0655c..65d12c34a 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -4,8 +4,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java b/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java index c18505ede..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; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java b/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java index 52a7bd8e5..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; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index de0bbcaa2..2b350027d 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -13,9 +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; 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 e91bb23ce..e1cee7b08 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java @@ -5,8 +5,8 @@ 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; 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 c09e4d2c2..642964af8 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java @@ -16,8 +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/thirdparty/placeholderapi/Placeholders.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java index 09784d6f8..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; diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index acf28eb97..122ef2245 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -12,10 +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.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; 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 8e46e37a6..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.magmacore.util.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 7f53a21b4..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,7 @@ package com.magmaguy.elitemobs.utils; 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; 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 080b80cfc..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.magmacore.util.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/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index 47c2564dd..01c35ca90 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.SpigotMessage; 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; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7862ba231..84686f0dd 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.5 +version: 9.1.0-SNAPSHOT author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -23,6 +23,10 @@ commands: description: Main command aliases: - em + adventurersguild: + description: Main command + aliases: + - ag permissions: elitemobs.*: From 1c5bf30e2bf2ad21c0d28942b26da6d7ba8c1af7 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 2 Aug 2024 12:49:20 +0100 Subject: [PATCH 20/78] EliteMobs 9.1.0: - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Nearly all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [New] All content imports are now handled by MagmaCore. This update now also allows content to be installed incorrectly - meaning packs from other plugins can be correctly imported in EliteMobs and moved to the right place, content for plugins not yet installed in the server will prepare the content ahead of time if the server installs those plugins in the future - [New] The pirate ship minidungeon has been readded to the plugin defaults as it has now been updated out of being a schematic dungeon - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [New] Resource pack option in the em setup menu has been tweaked to recommend the Resource Pack Manager plugin instead, this will be further tweaked after public release - [New] Importing content with models will now automatically and immediately host the content if FMM and RSPM are installed, meaning dungeons with models will now work after a single EliteMobs reload to install if from the imports - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Fix] Elite projectiles can no longer survive chunk unloads - [Removal] Removed trace system from custom bosses - [Removal] Removed the resource pack data config, now handled by ResourcePackManager Signed-off-by: MagmaGuy --- build.gradle | 4 +- .../com/magmaguy/elitemobs/EliteMobs.java | 1 - .../magmaguy/elitemobs/EventsRegistrer.java | 2 - .../GuildRankMenuHandler.java | 4 +- .../commands/AdventurersGuildCommand.java | 4 +- .../elitemobs/commands/CommandHandler.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 3 +- .../elitemobs/config/DefaultConfig.java | 4 +- .../config/LegacyValueConverter.java | 10 ++ .../config/ResourcePackDataConfig.java | 102 ------------------ .../premade/PirateShipMinidungeon.java | 2 +- .../magmaguy/elitemobs/menus/ArenaMenu.java | 4 +- .../elitemobs/menus/BuyOrSellMenu.java | 6 +- .../elitemobs/menus/CustomShopMenu.java | 6 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 4 +- .../elitemobs/menus/ProceduralShopMenu.java | 6 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 5 +- .../elitemobs/menus/ScrapperMenu.java | 5 +- .../magmaguy/elitemobs/menus/SellMenu.java | 3 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 5 +- .../custombosses/CustomBossBossBar.java | 2 +- .../powers/scripts/ScriptAction.java | 9 +- .../elitemobs/utils/shapes/Cuboid.java | 10 +- src/main/resources/plugin.yml | 2 +- 24 files changed, 57 insertions(+), 148 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java diff --git a/build.gradle b/build.gradle index d22f97548..4051736de 100644 --- a/build.gradle +++ b/build.gradle @@ -110,8 +110,8 @@ dependencies { 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.11.2-SNAPSHOT' - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.12.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.8' } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 502a143c2..a27940735 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -85,7 +85,6 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations new DefaultConfig(); - new ResourcePackDataConfig(); new ItemSettingsConfig(); new ProceduralItemGenerationSettingsConfig(); PotionEffectsConfig.initializeConfigs(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index e127f438e..4eb7bc8b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -88,8 +88,6 @@ public static void registerEvents() { register(new Navigation()); - register(new ResourcePackDataConfig.ResourcePackDataConfigEvents()); - register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener()); register(new VersionChecker.VersionCheckerEvents()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 0a3986fe2..fd00f7ca7 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.adventurersguild; 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; @@ -114,7 +114,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); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 9c7dbbe5d..1c6f75897 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -4,11 +4,11 @@ import com.magmaguy.magmacore.command.CommandData; import com.magmaguy.magmacore.command.SenderType; -import java.util.List; +import java.util.ArrayList; public class AdventurersGuildCommand extends AdvancedCommand { public AdventurersGuildCommand() { - super(List.of("adventurersguild", "ag")); + super(new ArrayList<>()); setUsage("/em adventurersguild"); setPermission("elitemobs.adventurersguild.command"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 97d1734f0..eea0afcea 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -69,7 +69,7 @@ public static void registerCommands() { emCommand.registerCommand(new DiscordCommand()); //User commands - emCommand.registerCommand(new AdventurersGuildCommand()); +// emCommand.registerCommand(new AdventurersGuildCommand()); emCommand.registerCommand(new ShareItemCommand()); emCommand.registerCommand(new ShopDynamicCommand()); emCommand.registerCommand(new ShopCustomCommand()); 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 a2baef37f..b3fee7974 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.magmacore.util.ChatColorConverter; @@ -221,7 +220,7 @@ 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.YELLOW_STAINED_GLASS_PANE; diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index 3cc651db0..6972a4ecf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -76,6 +76,8 @@ public class DefaultConfig extends ConfigurationFile { private static String bossAlreadyGoneMessage; @Getter private static boolean resetPlayerScaleOnLogin; + @Getter + private static boolean forceMenuUnicode; public DefaultConfig() { super("config.yml"); @@ -202,6 +204,6 @@ public void initializeValues() { 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); 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); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index a05612a0f..3a0b9fcdd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -98,6 +98,16 @@ public static String parseParticle(String potionEffectName) { 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; } 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 01ba3e076..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.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.Logger; -import lombok.Getter; -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -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 extends ConfigurationFile { - - @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; - public static ResourcePackDataConfig instance; - - public ResourcePackDataConfig() { - super("resource_pack_config.yml"); - instance = this; - } - - 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) { - Logger.warn("[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) { - Logger.warn("[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) { - instance.fileConfiguration.set("eliteMobsResourcePackEnabled", status); - ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); - eliteMobsResourcePackEnabled = status; - displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; - if (status) { - updateSHA1(); - Bukkit.getOnlinePlayers().forEach(ResourcePackDataConfig::sendResourcePack); - } - } - - public static void toggleForceResourcePack(boolean status) { - instance.fileConfiguration.set("forceResourcePack", status); - forceResourcePack = status; - } - - public static void sendResourcePack(Player player) { - player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); - } - - @Override - public void initializeValues() { - 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; - } - - 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/dungeonpackager/premade/PirateShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java index f9aaa7e5e..18a471e88 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 @@ -17,7 +17,7 @@ public PirateShipMinidungeon() { "&6Credits: MagmaGuy & Realm of Lotheridon"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, - "em_pirate_ship", + "em_the_pirate_ship", World.Environment.NORMAL, true, "em_the_pirate_ship,-85,63,243.5,-150,0", diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java index ac94fb56b..44544f352 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.menus; 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; @@ -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/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index d9a77bd98..67d3dfef0 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.menus; +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; @@ -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); 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 e160d12ec..e8b703fac 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -3,7 +3,6 @@ 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.magmacore.util.ItemStackGenerator; @@ -55,7 +54,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 +63,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); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index ee4246745..55c881ab7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -5,7 +5,6 @@ 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; @@ -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 3e59aec15..653e6e536 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -3,7 +3,6 @@ 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; @@ -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/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index b6b0c1099..16c47a94c 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -3,7 +3,6 @@ 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; @@ -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); 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 fe43e4b3e..51655d24e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -43,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); } 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 64bdee8e1..dea4169e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -407,7 +407,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 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 edae9f180..f3a352a97 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java @@ -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/resources/plugin.yml b/src/main/resources/plugin.yml index 84686f0dd..d53051303 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.0-SNAPSHOT +version: 9.1.0 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 1a2cc0554abd71bc971aa7deceae773e89a7b67f Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 4 Aug 2024 02:47:44 +0100 Subject: [PATCH 21/78] EliteMobs 9.1.1: - [New] Redid all permissions - [New] Readded /em adventurersguild as an alternative for /ag - [Fix] Fixed error related to repairing items - [Fix] Fixed quest turn in not working in book menus - [Tweak] Removed sticks being worn as helmets by the wood league arena bosses Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../PreventPathfindingExploit.java | 3 + .../commands/AdventurersGuildArgCommand.java | 22 ++ .../elitemobs/commands/AltCommand.java | 1 + .../elitemobs/commands/ArenaCommand.java | 2 +- .../elitemobs/commands/CommandHandler.java | 2 + .../elitemobs/commands/DismissCommand.java | 1 + .../commands/DungeonTeleportCommand.java | 2 +- .../elitemobs/commands/EliteMobsCommand.java | 1 + .../elitemobs/commands/KillCommand.java | 2 +- .../elitemobs/commands/KillRadiusCommand.java | 2 +- .../elitemobs/commands/KillTypeCommand.java | 2 +- .../commands/KillTypeRadiusCommand.java | 2 +- .../elitemobs/commands/LootGiveCommand.java | 2 +- .../elitemobs/commands/LootMenuCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 2 +- .../commands/LootSimulateCommand.java | 2 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../commands/MoneyAddAllCommand.java | 2 +- .../elitemobs/commands/MoneyAddCommand.java | 2 +- .../commands/MoneyCheckPlayerCommand.java | 2 +- .../commands/MoneyRemoveCommand.java | 2 +- .../elitemobs/commands/MoneySetCommand.java | 2 +- .../elitemobs/commands/PayCommand.java | 1 + .../elitemobs/commands/PlaceBossCommand.java | 2 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 2 +- .../commands/QuestAcceptCommand.java | 2 +- .../commands/QuestCompleteCommand.java | 2 +- .../commands/QuestCompleteQuestCommand.java | 26 ++ .../elitemobs/commands/QuestResetCommand.java | 2 +- .../elitemobs/commands/QuestTrackCommand.java | 2 +- .../elitemobs/commands/RespawnAllCommand.java | 2 +- .../elitemobs/commands/SetupCommand.java | 2 +- .../elitemobs/commands/SetupDoneCommand.java | 2 +- .../commands/SetupToggleCommand.java | 2 +- .../commands/ShopCustomOtherCommand.java | 2 +- .../commands/ShopDynamicCommand.java | 2 +- .../commands/ShopSellOtherCommand.java | 2 +- .../commands/SpawnBossAtCommand.java | 2 +- .../elitemobs/commands/SpawnBossCommand.java | 2 +- .../commands/SpawnBossLevelAtCommand.java | 2 +- .../commands/SpawnBossLevelCommand.java | 2 +- .../elitemobs/commands/SpawnElite.java | 2 +- .../commands/SpawnEliteAtCommand.java | 2 +- .../commands/SpawnTeleportCommand.java | 2 +- .../elitemobs/commands/StartCommand.java | 1 + .../elitemobs/commands/StatsCommand.java | 2 +- .../elitemobs/commands/TrackBossCommand.java | 1 + .../TransitiveBlocksCancelCommand.java | 2 +- .../TransitiveBlocksEditAreaCommand.java | 2 +- .../commands/TransitiveBlocksEditCommand.java | 2 +- .../TransitiveBlocksRegisterAreaCommand.java | 2 +- .../TransitiveBlocksRegisterCommand.java | 2 +- .../config/AdventurersGuildConfig.java | 2 +- .../premade/WoodLeagueWave10Boss.java | 4 +- .../WoodLeagueWave10Reinforcement.java | 4 +- .../premade/WoodLeagueWave11Melee.java | 4 +- .../premade/WoodLeagueWave11Ranged.java | 2 +- .../premade/WoodLeagueWave12Melee.java | 4 +- .../premade/WoodLeagueWave12Ranged.java | 2 +- .../premade/WoodLeagueWave13Melee.java | 4 +- .../premade/WoodLeagueWave13Ranged.java | 2 +- .../premade/WoodLeagueWave14Melee.java | 4 +- .../premade/WoodLeagueWave14Ranged.java | 2 +- .../premade/WoodLeagueWave15Miniboss.java | 4 +- .../premade/WoodLeagueWave16Melee.java | 4 +- .../premade/WoodLeagueWave16Ranged.java | 2 +- .../premade/WoodLeagueWave17Melee.java | 4 +- .../premade/WoodLeagueWave17Ranged.java | 2 +- .../premade/WoodLeagueWave18Melee.java | 2 +- .../premade/WoodLeagueWave19Ranged.java | 2 +- .../premade/WoodLeagueWave1Melee.java | 4 +- .../premade/WoodLeagueWave1Ranged.java | 2 +- .../premade/WoodLeagueWave2Melee.java | 4 +- .../premade/WoodLeagueWave2Ranged.java | 2 +- .../premade/WoodLeagueWave3Melee.java | 4 +- .../premade/WoodLeagueWave4Melee.java | 4 +- .../premade/WoodLeagueWave4Ranged.java | 2 +- .../premade/WoodLeagueWave5Miniboss.java | 4 +- .../premade/WoodLeagueWave6Melee.java | 4 +- .../premade/WoodLeagueWave6Ranged.java | 2 +- .../premade/WoodLeagueWave7Melee.java | 4 +- .../premade/WoodLeagueWave7Ranged.java | 2 +- .../premade/WoodLeagueWave8Melee.java | 4 +- .../premade/WoodLeagueWave9Ranged.java | 2 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 2 +- src/main/resources/plugin.yml | 358 ++++++------------ 88 files changed, 251 insertions(+), 354 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java diff --git a/build.gradle b/build.gradle index 4051736de..916d080a4 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.0' +version '9.1.1' repositories { maven { 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..6380c0f63 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,7 @@ import com.magmaguy.easyminecraftgoals.NMSManager; import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent; +import org.bukkit.entity.Mob; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -11,6 +12,8 @@ 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; event.getEliteMobEntity().incrementAntiExploit(5, "no path to player"); 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/AltCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java index b78d4e5bf..4a6f18b00 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -14,6 +14,7 @@ public AltCommand() { super(List.of("alt")); setUsage("/em alt"); setDescription("Changes the style of the /em menu."); + setPermission("elitemobs.alt"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index c66063126..9c97bb5ab 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -13,7 +13,7 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setPermission("elitemobs.event.start"); + setPermission("elitemobs.arena.start"); setDescription("Open the Arena menu."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index eea0afcea..5f907c5d4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -55,6 +55,7 @@ public static void registerCommands() { 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()); @@ -92,6 +93,7 @@ public static void registerCommands() { emCommand.registerCommand(new DungeonTeleportCommand()); emCommand.registerCommand(new TrackBossCommand()); emCommand.registerCommand(new PayCommand()); + emCommand.registerCommand(new AdventurersGuildArgCommand()); emCommand.registerCommand(new EliteMobsCommand()); emCommand.registerCommand(new HelpCommand()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java index 500607785..bb1b02fd4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -12,6 +12,7 @@ public DismissCommand() { super(List.of("dismiss")); setDescription("Dismisses /em menu message."); setUsage("/em dismiss"); + setPermission("elitemobs.dismiss"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index f0fb2b029..5c71e0f63 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -11,7 +11,7 @@ public class DungeonTeleportCommand extends AdvancedCommand { public DungeonTeleportCommand() { super(List.of("dungeontp")); addArgument("dungeonID", new ArrayList<>()); - setPermission("elitemobs.dungeontp"); + setPermission("elitemobs.dungeon.tp"); setDescription("Teleports players to Lairs, Minidungeons and Dungeons."); setUsage("/em dungeontp "); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java index 82b5e1e2a..c41a1a6b2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -13,6 +13,7 @@ public EliteMobsCommand() { super(new ArrayList<>()); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); + setPermission("elitemobs.command"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index ca0f27243..70c740edd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -10,7 +10,7 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.kill.kill"); + setPermission("elitemobs.kill.command"); setDescription("Kills all elites."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java index d4e84cd57..978c494a7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -13,7 +13,7 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.kill.radius"); + setPermission("elitemobs.kill.command"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java index 6cec36a67..03b0ffdc6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -14,7 +14,7 @@ public KillTypeCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); setUsage("/em kill type "); - setPermission("elitemobs.kill.type"); + setPermission("elitemobs.kill.command"); setDescription("Kills all elites of the specified type."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java index a76c7b2d9..33cd0d2e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -16,7 +16,7 @@ public KillTypeRadiusCommand() { addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); setUsage("/em kill type "); - setPermission("elitemobs.kill.type.radius"); + setPermission("elitemobs.kill.command"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type within the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 0014a9663..5938e9cfb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -15,7 +15,7 @@ public LootGiveCommand() { addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); - setPermission("elitemobs.loot.give"); + setPermission("elitemobs.loot.admin"); setDescription("Gives the specified loot to a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java index 28b92ffa8..9126a677b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -12,7 +12,7 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.loot.menu"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 7ae31801d..60c979976 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -15,7 +15,7 @@ public LootRandomCommand() { addArgument("level", new ArrayList<>()); addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot random "); - setPermission("elitemobs.loot.random"); + setPermission("elitemobs.loot.admin"); setDescription("Gives the player random loot of the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 5284dc1e6..9dbd97527 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -16,7 +16,7 @@ public LootSimulateCommand() { addArgument("level", new ArrayList<>()); addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.simulate"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index cf7eba055..a38e117cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -17,7 +17,7 @@ public LootSimulateMultipleCommand() { addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.simulate.times"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index d751e4547..176e7f042 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -12,7 +12,7 @@ public MoneyAddAllCommand() { addLiteral("addAll"); addArgument("amount", new ArrayList<>()); setUsage("/em money addAll "); - setPermission("elitemobs.money.add.all"); + setPermission("elitemobs.money.admin"); setDescription("Gives every player on the server the specified amount of money."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 31d4d871c..e7089faa2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -14,7 +14,7 @@ public MoneyAddCommand() { addArgument("player", new ArrayList<>()); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); - setPermission("elitemobs.money.add.player"); + setPermission("elitemobs.money.admin"); setDescription("Gives the specified amount of money to the designated player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 62bb4caff..a73f8def9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -12,7 +12,7 @@ public MoneyCheckPlayerCommand() { addLiteral("check"); addArgument("player", new ArrayList<>()); setUsage("/em money check "); - setPermission("elitemobs.money.check.player"); + setPermission("elitemobs.money.check.others"); setDescription("Checks the currency of the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index a2d17c061..3bb188cd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -14,7 +14,7 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.money.remove"); + setPermission("elitemobs.money.admin"); setDescription("Deducts the specified amount of currency from a player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java index 9de1d06e0..5a1c9802d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -14,7 +14,7 @@ public MoneySetCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money set "); - setPermission("elitemobs.money.set"); + setPermission("elitemobs.money.admin"); setDescription("Sets the specified amount of currency for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java index 3a7961030..fdd48e0a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -14,6 +14,7 @@ public PayCommand() { addArgument("amount", new ArrayList<>()); setDescription("Send money to a player, minus tax."); setUsage("/em pay "); + setPermission("elitemobs.money.pay"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index 9e6093dec..2a65ae715 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -20,7 +20,7 @@ public PlaceBossCommand() { regionalBosses.add(entry.getKey()); addArgument("filename", regionalBosses); setUsage("/em place boss "); - setPermission("elitemobs.place.boss"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Add a spawn location for the specified boss at your current location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index fb1b012ca..b47ae3621 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -14,7 +14,7 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.place.treasure"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds a treasure chest to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 261fa79d9..04cb8aa06 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -17,7 +17,7 @@ public PlaceWormholeCommand() { addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); setUsage("/em place wormhole <1/2>"); - setPermission("elitemobs.place.wormhole"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Place a wormhole teleport at your current location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index 29a552ad2..e5526ea69 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -14,7 +14,7 @@ public QuestAcceptCommand() { addLiteral("accept"); addArgument("questID", new ArrayList<>()); setUsage("/em quest accept "); - setPermission("elitemobs.quest.command"); + setPermission("elitemobs.quest.accept"); setSenderType(SenderType.PLAYER); setDescription("Accepts a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java index 63831dcdc..232fb266a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -12,7 +12,7 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.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."); } 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/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java index 46d9e5586..f57951bbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -16,7 +16,7 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.quest.reset.quest"); + setPermission("elitemobs.quest.reset"); setDescription("Resets a specific quest for a specific player."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java index 8629cc3a6..207a34243 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -14,7 +14,7 @@ public QuestTrackCommand() { addLiteral("track"); addArgument("questID", new ArrayList<>()); setUsage("/em quest track "); - setPermission("elitemobs.quest.command"); + setPermission("elitemobs.quest.track"); setSenderType(SenderType.PLAYER); setDescription("Tracks a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index 0d344b743..63766ad2d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -11,7 +11,7 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.respawn"); + setPermission("elitemobs.respawn.force"); setDescription("Forces all regional bosses to respawn."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index a7a604090..743545e32 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -10,7 +10,7 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.setup.main"); + setPermission("elitemobs.setup"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index 7222579ec..c94084e30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -12,7 +12,7 @@ public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); setUsage("/em setup done"); - setPermission("elitemobs.setup.done"); + setPermission("elitemobs.setup"); setDescription("Toggles whether the setup message will show up."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index f523de7d8..89082a29f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -14,7 +14,7 @@ public SetupToggleCommand() { addLiteral("toggle"); addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); setUsage("/em setup toggle "); - setPermission("elitemobs.setup.toggle"); + setPermission("elitemobs.setup"); setDescription("Allows you to toggle the installation of specified EliteMobs content."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 2d5d0bd9b..2d005cc46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -15,7 +15,7 @@ public ShopCustomOtherCommand() { addLiteral("custom"); addArgument("player", new ArrayList<>()); setUsage("/em shop custom "); - setPermission("elitemobs.shop.custom.player"); + setPermission("elitemobs.shop.custom.other"); setDescription("Opens the EliteMobs shop for custom items for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java index b6e84d237..a4c047071 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -13,7 +13,7 @@ public ShopDynamicCommand() { super(List.of("shop")); addLiteral("dynamic"); setUsage("/em shop dynamic"); - setPermission("elitemobs.shop.command"); + setPermission("elitemobs.shop.dynamic"); setSenderType(SenderType.PLAYER); setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java index eed677e82..f4af0c02d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -15,7 +15,7 @@ public ShopSellOtherCommand() { addLiteral("sell"); addArgument("player", new ArrayList<>()); setUsage("/em shop sell "); - setPermission("elitemobs.shop.sell.player"); + setPermission("elitemobs.shop.sell.other"); setDescription("Opens the EliteMobs shop sell menu for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java index b183dc2fa..8f2871d95 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -21,7 +21,7 @@ public SpawnBossAtCommand() { addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); setUsage("/em spawn bossAt "); - setPermission("elitemobs.spawn.boss.at"); + setPermission("elitemobs.place.admin"); setDescription("Spawns a custom boss at the specified location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index 2d0560276..2deb74068 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -14,7 +14,7 @@ public SpawnBossCommand() { addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em spawn boss "); - setPermission("elitemobs.spawn.boss"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index 8d6955a6e..1fe0eecfc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -22,7 +22,7 @@ public SpawnBossLevelAtCommand() { addArgument("z", new ArrayList<>()); addArgument("level", new ArrayList<>()); setUsage("/em spawn bossAt "); - setPermission("elitemobs.spawn.boss.at.level"); + setPermission("elitemobs.place.admin"); setDescription("Spawns a custom boss at the specified location with the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3d06e9055..3ccbe9497 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -15,7 +15,7 @@ public SpawnBossLevelCommand() { 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.spawn.boss.level"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 8346397de..4823c0c5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -18,7 +18,7 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java index bcf53598e..502bb1811 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -23,7 +23,7 @@ public SpawnEliteAtCommand() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn eliteAt <...>"); - setPermission("elitemobs.spawn.elite.at"); + 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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java index 514a88788..d0e40f1d6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -11,7 +11,7 @@ public class SpawnTeleportCommand extends AdvancedCommand { public SpawnTeleportCommand() { super(List.of("spawntp")); - setPermission("elitemobs.spawntp"); + setPermission("elitemobs.teleport.spawn"); setUsage("/em spawntp"); setDescription("Teleports players to the server spawn."); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java index c99e1152a..35f3162fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -14,6 +14,7 @@ public StartCommand() { setUsage("/em start"); setDescription("When in instanced content, makes the player start the instance."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.instance.start"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java index 27c1d144e..db5660270 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -10,7 +10,7 @@ public class StatsCommand extends AdvancedCommand { public StatsCommand() { super(List.of("stats")); setUsage("/em stats"); - setPermission("elitemobs.*"); + setPermission("elitemobs.stats"); setSenderType(SenderType.PLAYER); setDescription("Displays EliteMobs server stats."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java index 832f2fecc..02a58b06b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -19,6 +19,7 @@ public TrackBossCommand() { setDescription("Tracks a Custom Boss."); setUsage("/em track boss "); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.boss.track"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 8673dfaeb..5a321f703 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -12,9 +12,9 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.transitiveblocks.cancel"); setDescription("Cancels transitive block registration."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java index 2c4d4acd6..d1a14a2b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -15,7 +15,7 @@ public TransitiveBlocksEditAreaCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks editArea "); - setPermission("elitemobs.transitiveblocks.edit.area"); + setPermission("elitemobs.transitiveblocks"); setDescription("Edits large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java index a7274abe6..db6a54c7f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksEditCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks edit "); - setPermission("elitemobs.transitiveblocks.edit.edit"); setDescription("Edits transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java index b869df481..c68cb1115 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksRegisterAreaCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks registerArea "); - setPermission("elitemobs.transitiveblocks.register.area"); setDescription("Registers large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java index 4af68f83f..22504ebed 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksRegisterCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks register "); - setPermission("elitemobs.transitiveblocks.register.register"); setDescription("Registers transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index 96882a5f4..ad1be7cba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -476,7 +476,7 @@ public void initializeValues() { 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); - additionalKillsForRankUpPerTier = ConfigurationEngine.setInt( + baseKillsForRankUp = 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); 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..d8f89e774 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,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; import java.util.Arrays; @@ -15,7 +13,7 @@ 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")); setMovementSpeedAttribute(0.6D); 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..30ea74915 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave11Melee() { "11"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..a99afc165 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 @@ -15,7 +15,7 @@ public WoodLeagueWave11Ranged() { "$normalLevel Arena Crossbowman", "11"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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..200adbb63 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave12Melee() { "12"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..a0ce3c216 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 @@ -15,7 +15,7 @@ public WoodLeagueWave12Ranged() { "$normalLevel Arena Crossbowman", "12"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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..059605609 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,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; import java.util.Arrays; @@ -16,6 +14,6 @@ public WoodLeagueWave13Melee() { "13"); setFollowDistance(60); setPowers(Arrays.asList("corpse.yml", "attack_poison.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..1a0b09714 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 @@ -15,7 +15,7 @@ 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")); } 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..160b4208c 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave14Melee() { "14"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..4acb7ecbf 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 @@ -15,7 +15,7 @@ public WoodLeagueWave14Ranged() { "$normalLevel Arena Crossbowman", "14"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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 36f73b115..8669484e2 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,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; import java.util.Arrays; import java.util.List; @@ -16,7 +14,7 @@ public WoodLeagueWave15Miniboss() { "$bossLevel &4Mr. Oinkers", "15"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml")); setMovementSpeedAttribute(0.6D); setHealthMultiplier(3D); 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..0abbdd6c2 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,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; import java.util.List; @@ -16,7 +14,7 @@ public WoodLeagueWave16Melee() { "16"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + 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..f06942cac 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 @@ -15,7 +15,7 @@ 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")); setDamageMultiplier(0.5D); 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..ec65d5e09 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,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; import java.util.Arrays; @@ -16,6 +14,6 @@ public WoodLeagueWave17Melee() { "17"); setFollowDistance(60); setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..652f7de39 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 @@ -15,7 +15,7 @@ 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")); } 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..cbadbb2dc 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 @@ -16,7 +16,7 @@ public WoodLeagueWave18Melee() { "18"); setFollowDistance(60); setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); - setHelmet(new ItemStack(Material.STICK)); + 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..73b21f52c 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 @@ -15,7 +15,7 @@ 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")); } 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/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/WoodLeagueWave3Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Melee.java index 0eba16db7..e1d251a87 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave3Melee() { "3"); setPowers(List.of("attack_fire.yml")); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } 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/WoodLeagueWave5Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave5Miniboss.java index 8cb3d863e..673843916 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,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; import java.util.Arrays; import java.util.List; @@ -21,6 +19,6 @@ public WoodLeagueWave5Miniboss() { 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..137a62dd0 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave7Melee() { "7"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..a70ee1936 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 @@ -15,7 +15,7 @@ public WoodLeagueWave7Ranged() { "$normalLevel Arena Crossbowman", "7"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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..3148275c3 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave8Melee() { "8"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..235add016 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 @@ -15,7 +15,7 @@ public WoodLeagueWave9Ranged() { "$normalLevel Arena Crossbowman", "9"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(List.of("attack_vacuum.yml")); } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java index e8b703fac..b84b5c3f8 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -41,7 +41,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); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d53051303..ea46282de 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.0 +version: 9.1.1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -31,300 +31,172 @@ commands: 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 - default: true - elitemobs.shop.npc: - description: Allows players to interact with NPCs for dynamic shops - default: true - elitemobs.shop.command: - description: Allows players to open the dynamic shop menu through commands - default: true - elitemobs.customshop.npc: - description: Allows players to interact with NPCs for dynamic shops - default: true - elitemobs.customshop.command: - description: Allows players to open the dynamic shop menu through commands + elitemobs.adventurersguild.command: + description: Allows players to either teleport to the Adventurer's Guild or open the Adventurer's Guild menu default: true - elitemobs.currency.pay: - description: Allows players to run /elitemobs pay [username] [amount] + elitemobs.alt: + description: Allows players to switch menu styles default: true - elitemobs.currency.check: - description: Allows players to run /elitemobs wallet + elitemobs.arena.start: + description: Allows players to start an arena default: true - elitemobs.currency.check.others: - description: Allows players to run /elitemobs check [username] + elitemobs.debug: + description: Gives access to the debug command default: op - elitemobs.events: - description: Allows players to launch all events + elitemobs.discord.link: + description: Gives the link to EliteMobs' discord server default: true - elitemobs.checktier.others: - description: Allows players to run /elitemobs checktier [player] - default: op - elitemobs.gettier: - description: Allows players to run /elitemobs gettier [tier] + elitemobs.discord.message: + description: Allows sending debug messages to discord via DiscordSRV for testing purposes default: op - elitemobs.versionnotification: - description: Allows players to get notified about plugin updates + elitemobs.dismiss: + description: Allows admins to dismiss the initial setup message default: op - elitemobs.adventurersguild.teleport: - description: Allows players to teleport to the adventurer's guild hub using /ag - default: true - elitemobs.adventurersguild.command: - description: Allows players to rank menu using the /em adventurersguild command - default: true - elitemobs.rank.command: - description: Allows players to open the rank menu through /em rank - default: true - elitemobs.rank.npc: - description: Allows players to access the /em rank menu through NPCs - default: true - elitemobs.quest.command: - description: Allows players to take on quests via command - default: true - elitemobs.quest.npc: - description: Allows players to take on quests via EliteMobs NPC - default: true - elitemobs.dungeontp: - description: Allows players to teleport to an elitemobs-set location - default: true - elitemobs.spawntp: - description: Allows players to teleport to the default spawn location of the server. - default: true - elitemobs.back.npc: - description: Allows players to interact with an npc to go back to a previous location. - default: true - elitemobs.shareitem: - description: Shares a held Elite Item on chat. - default: true - elitemobs.scrap.npc: - description: Allows players to scrap items at an npc + elitemobs.dungeon.tp: + description: Allows players to teleport to a dungeon default: true - elitemobs.scrap.command: - description: Allows players to scrap items using a command - default: true - elitemobs.smelt.command: - description: Allows players to smelt items using a command - default: true - elitemobs.smelt.npc: - description: Allows players to smelt items using an npc - default: true - elitemobs.repair.command: - description: Allows players to use the repair command to open the menu for repairing elite items - default: true - elitemobs.repair.npc: - description: Allows players to interact with the NPC for repairing items - default: true - elitemobs.refiner.command: - description: Allows players to use the refiner command to open the menu for upgrading Elite Scrap - default: true - elitemobs.refiner.npc: - description: Allows players to interact with the NPC for upgrading Elite Scrap - default: true - elitemobs.enhancer.command: - description: Allows players to use the enhancer command to open the menu for upgrading Elite Items - default: true - elitemobs.enhancer.npc: - description: Allows players to interact with the NPC for upgrading Elite Items - default: true - elitemobs.unbind.command: - description: Allows players to use the unbind command to open the menu to unbind Elite Items - 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 - elitemobs.enchant.npc: - description: Allows players to interact with the enchanter NPC to enchant Elite Items + elitemobs.command: + description: Allows players to use the main command of the plugin default: true elitemobs.enchant.command: - description: Allows players to use the enchant command to enchant Elite Items - default: true - elitemobs.arena.menu: - description: Allows players to open the Arena menu and join an Arena. - default: true - elitemobs.debug: - description: Allows players to have access to the player/bosses debug command. - default: true - elitemobs.discord.link: - description: Allows players to have access to the Discord link command. + description: Allows players to use the enchant command default: true - elitemobs.discord.message: - description: Allows players to have access to the DiscordSRV message debug command. - default: op elitemobs.event.start: - description: Allows players to start specific events. + description: Allows admins to manually launch an event default: op elitemobs.fireball: - description: Allows players to shoot a fireball at the pointer's location. + description: Allows admins to fire an elite fireball for terrain destruction testing purposes default: op elitemobs.help: - description: Allows players to see all available EliteMobs commands. - default: op - elitemobs.kill.kill: - description: Allows players to kill all elites. - default: op - elitemobs.kill.radius: - description: Allows players to kill all elites in the specified radius. - default: op - elitemobs.kill.type: - description: Allows players to kill all elites of the specified type. - default: op - elitemobs.kill.type.radius: - description: Allows players to kill all elites of the specified type within the given radius. + description: Allows players to run the help command + default: true + elitemobs.kill.command: + description: Allows admins to run the kill commands to kill elites default: op elitemobs.language: - description: Allows players to set the language that the server will use for EliteMobs. + 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.loot.debug: - description: Allows players to equip themselves with a complete armor set, weapons set of the specified level, and food for testing purposes. - default: op - elitemobs.loot.give: - description: Allows players to give the specified loot to a specific player. - default: op - elitemobs.loot.menu: - description: Allows players to open the loot menu and select any loot they want. + description: Gives admins a set of gear of a specific level for testing purposes default: op - elitemobs.loot.random: - description: Allows players to get random loot of the specified level. - default: op - elitemobs.loot.simulate: - description: Allows players to get simulated loot drops for the specified level and player. - default: op - elitemobs.loot.simulate.times: - description: Allows players to get simulated loot drops for a specified number of times for the given level and player. + elitemobs.loot.admin: + description: Lets admins give or obtain EliteMobs loot via command default: op elitemobs.loot.stats: - description: Allows players to see EliteMobs stats for the currently held item. - default: true - elitemobs.loot.stats: - description: Allows players to see EliteMobs stats for the currently held item. - default: op - elitemobs.money.add.all: - description: Allows players to give every player on the server the specified amount of money. + description: Gives the elite stats of gear, for debugging purposes default: op - elitemobs.money.add.player: - description: Allows players to give the specified amount of money to the designated player. + elitemobs.money.admin: + description: Allows admins to manually manipulate player elite currency default: op elitemobs.money.check.self: - description: Allows players to check their EliteMobs currency. + description: Allows users to check their balance default: true - elitemobs.money.check.player: - description: Allows players to check the currency of the specified player. - default: op - elitemobs.money.remove: - description: Allows players to deduct the specified amount of currency from a player. - default: op - elitemobs.money.set: - description: Allows players to set the specified amount of currency for the specified player. - default: op - elitemobs.package: - description: Allows players to package an EliteMobs dungeon for distribution. - default: op - elitemobs.place.boss: - description: Allows players to add a spawn location for the specified boss at their current location. + elitemobs.money.check.others: + description: Allows users to check their balance default: op - elitemobs.place.npc: - description: Allows players to permanently add an NPC to the location the user is standing on. + elitemobs.dungeon.package: + description: Allows admins to package EliteMobs content for distribution default: op - elitemobs.place.treasure: - description: Allows players to permanently add a treasure chest to the location the user is standing on. - default: op - elitemobs.place.wormhole: - description: Allows players to permanently add a wormhole teleport at their current location. + elitemobs.money.pay: + description: Allows users to check their balance + default: true + 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.quest.bypass: - description: Allows players to bypass permission restrictions for elite quests. + description: Allows users to accept a quest default: op - elitemobs.quest.complete: - description: Allows players to force complete all of their currently active elite quests. For debugging use only. + 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 players to leave a quest. Used via menu, can't be directly used. - default: op + description: Allows users to leave a quest + default: true elitemobs.quest.reset.all: - description: Allows players to reset all quests for a specific player. + description: Allows admins to reset all quests for a specific player default: op - elitemobs.quest.reset.quest: - description: Allows players to reset a specific quest for a specific player. + 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.quit: + description: Allows players to quit instanced content + default: true + elitemobs.rank.command: + description: Allows players to join open the rank menu of EliteMobs + default: true elitemobs.rank.set: - description: Allows players to manually set a player's guild rank to a the prestige level and guild level specified. + description: Allows admins to set a specific EliteMobs rank for a specific player default: op elitemobs.reload: - description: Allows players to reload EliteMobs. + description: Allows admins to reload EliteMobs default: op elitemobs.remove: - description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. + description: Allows admins to use the remove command default: op - elitemobs.respawn: - description: Allows players to force respawn all regional bosses. - default: op - elitemobs.setup.main: - description: Allows players to have access to the main command for setting up EliteMobs. - default: op - elitemobs.setup.done: - description: Allows players to toggle whether the setup message will show up in the server chat. + 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.setup.toggle: - description: Allows players to toggle the installation of specified EliteMobs content. + 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: Allows players to use the share item command + default: true elitemobs.shop.custom: - description: Allows players to open the EliteMobs shop for custom items for the specified player. - default: op - elitemobs.shop.sell.player: - description: Allows players to open the EliteMobs shop for custom items for the specified player. - default: op - elitemobs.spawn.boss.at: - description: Allows players to spawn a custom boss at the specified location. - default: op - elitemobs.spawn.boss: - description: Allows players to spawn a custom boss at the location the player is looking at. - default: op - elitemobs.spawn.boss.at.level: - description: Allows players to spawn a custom boss at the specified location with the specified level. - default: op - elitemobs.spawn.boss.level: - description: Allows players to spawn a custom boss at the location the user is looking at with the specified level. - default: op - elitemobs.spawn.elite: - description: Allows players to spawn an elite of a specified type and level, optionally with specific powers, at the targeted location. - default: op - elitemobs.spawn.elite.at: - description: Allows players to spawn an elite of the specified type and level, optionally with specified powers, at the chosen location. - default: op - elitemobs.transitiveblocks.cancel: - description: Allows players to cancel transitive block registration. + description: Allows players to use custom shop command + default: true + elitemobs.shop.custom.other: + description: Allows admins to open the custom shop for other people default: op - elitemobs.transitiveblocks.edit.area: - description: Allows players to edit large transitive blocks areas for use by regional bosses. + elitemobs.shop.dynamic: + description: Allows players to use dynamic shop command + default: true + elitemobs.shop.dynamic.other: + description: Allows admins to open the dynamic shop for other people default: op - elitemobs.transitiveblocks.edit.edit: - description: Allows players to edit transitive blocks for use by regional bosses. + elitemobs.shop.sell.other: + description: Allows admins to open the sell shop for other people default: op - elitemobs.transitiveblocks.register.area: - description: Allows players to register large transitive blocks areas for use by regional bosses. + elitemobs.teleport.spawn: + description: Allows players to use the spawn teleport command + default: true + elitemobs.instance.start: + description: Allows players to use the start command in instances + default: true + elitemobs.stats: + description: Allows admins to get stats related to EliteMobs default: op - elitemobs.transitiveblocks.register.register: - description: Allows players to register transitive blocks for use by regional bosses. + elitemobs.boss.track: + description: Allows players to track trackable bosses + default: true + 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.unbind.force: - description: Allows players to forcefully unbind a held item. + description: Allows admins to force unbind a held item via command default: op elitemobs.version: - description: Allows players to check the server's EliteMobs plugin version. - default: op + description: Allows admins to check the plugin version of EliteMobs + default: op \ No newline at end of file From de9c9a97c6b7fb2fc76f5e2bbc7ece871bc0eb22 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 4 Aug 2024 22:36:03 +0100 Subject: [PATCH 22/78] EliteMobs 9.1.2: - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../elitemobs/dungeons/DungeonProtector.java | 14 +++ .../instanced/dungeons/DungeonInstance.java | 107 +++++++++++++----- .../elitemobs/npcs/NPCInteractions.java | 6 +- .../powers/meta/CustomSummonPower.java | 10 +- src/main/resources/plugin.yml | 39 ++++++- 6 files changed, 140 insertions(+), 38 deletions(-) diff --git a/build.gradle b/build.gradle index 916d080a4..5edfba4a0 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.1' +version '9.1.2' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 8a6e469be..950e208b0 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,6 +1,7 @@ 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; @@ -10,6 +11,9 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import java.util.Locale; public class DungeonProtector implements Listener { @@ -64,6 +68,7 @@ public void preventTntPrimeEvent(TNTPrimeEvent event) { @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); } @@ -113,5 +118,14 @@ public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { event.setCancelled(true); } + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventVanillaMobSpawning(PlayerInteractEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getPlayer().getWorld().getUID())) return; + if (event.getClickedBlock() == null) return; + Material material = event.getClickedBlock().getType(); + if (material.toString().toLowerCase(Locale.ROOT).endsWith("_door") || + material.toString().toLowerCase(Locale.ROOT).endsWith("_trapdoor")) + event.setCancelled(true); + } } 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 2c0007530..93d9e344c 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -72,14 +72,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, 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); - TreasureChest.initializeInstancedTreasureChests(dungeonPackagerConfigFields.getWorldName(), world); - } - }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); + new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -108,7 +101,7 @@ public static void setupInstancedDungeon(Player player, String instancedDungeonC new BukkitRunnable() { @Override public void run() { - initializeInstancedWorld(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); } }.runTask(MetadataHandler.PLUGIN); }); @@ -146,8 +139,6 @@ protected static DungeonInstance initializeInstancedWorld(DungeonPackagerConfigF 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()); @@ -206,14 +197,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 @@ -236,10 +220,6 @@ public void removeInstance() { 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); @@ -247,13 +227,7 @@ public void run() { Logger.warn("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 - //} + new RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } @@ -295,4 +269,77 @@ 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() { + WorldInstantiator.recursivelyDelete(instancedWorldFile); + } + }.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20L * 60 * 2); //wait 2 minutes after unloading world before removing files + } + } } diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java index e1e2756cf..e9723135c 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java @@ -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() { 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 90a4126bc..dcd160317 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -425,12 +425,20 @@ private void processOldFormats(String powerString, String 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]; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ea46282de..16389f548 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.1 +version: 9.1.2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -33,7 +33,10 @@ permissions: description: Gives access to all elitemobs commands default: op elitemobs.adventurersguild.command: - description: Allows players to either teleport to the Adventurer's Guild or open the Adventurer's Guild menu + 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 @@ -131,6 +134,9 @@ permissions: elitemobs.quest.track: description: Allows players to track the objectives of a quest default: true + elitemobs.quest.npc: + description: Allows players to talk to quest npcs + default: true elitemobs.quit: description: Allows players to quit instanced content default: true @@ -199,4 +205,31 @@ permissions: default: op elitemobs.version: description: Allows admins to check the plugin version of EliteMobs - default: op \ No newline at end of file + default: op + elitemobs.rank.npc: + description: Allows players to talk to the rank npc + default: true + elitemobs.shop.dynamic.npc: + description: Allows players to talk to the dynamic shop npc + default: true + elitemobs.shop.custom.npc: + description: Allows players to talk to the custom shop npc + default: true + elitemobs.shop.sell.npc: + description: Allows players to talk to the sell shop npc + default: true + 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 talk to the unbind npc + default: true + elitemobs.enchant.npc: + description: Allows players to talk to the enchant npc + default: true \ No newline at end of file From fe709eb86107ca57c18b9f94aa45c606339cc495 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 8 Aug 2024 11:35:48 +0100 Subject: [PATCH 23/78] EliteMobs 9.1.3: - [New] Added the Dark Cathedral remake! - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [New] Added the scale setting to NPCs to allow for NPC scaling - [Fix] Fixed problem that was causing dungeon instantiation to not delete correctly and the recovery code on startup to not clear instanced dungeons on startup - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers - [Fix] Slimes and similar entities no longer constantly trigger the antiexploit - [Fix] Fixed the /em quest reset all by renaming it to /em quest resetAll Signed-off-by: MagmaGuy --- build.gradle | 4 +-- .../api/EliteMobDamagedByPlayerEvent.java | 2 ++ .../elitemobs/api/EliteMobDamagedEvent.java | 3 ++ .../PreventPathfindingExploit.java | 2 ++ .../elitemobs/commands/CommandHandler.java | 1 + .../commands/QuestResetAllCommand.java | 5 ++- ...thedralLair.off => DarkCathedralLair.java} | 23 +++++-------- .../config/npcs/NPCsConfigFields.java | 4 +++ .../WorldInstancedDungeonPackage.java | 16 +++++++++ .../dungeons/utility/DungeonUtils.java | 2 ++ .../instanced/dungeons/DungeonInstance.java | 33 +++++++------------ .../magmaguy/elitemobs/npcs/NPCEntity.java | 2 ++ src/main/resources/plugin.yml | 2 +- 13 files changed, 57 insertions(+), 42 deletions(-) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{DarkCathedralLair.off => DarkCathedralLair.java} (58%) diff --git a/build.gradle b/build.gradle index 5edfba4a0..8c5b4d6e0 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.2' +version '9.1.3' repositories { maven { @@ -50,7 +50,7 @@ repositories { //MagmaCore maven { - url = 'http://magmaguy.com:50001/releases' + url = 'https://repo.magmaguy.com/releases' allowInsecureProtocol = true } diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 8c0359157..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; @@ -255,6 +256,7 @@ 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) return; 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/combatsystem/antiexploit/PreventPathfindingExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java index 6380c0f63..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,7 @@ 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; @@ -16,6 +17,7 @@ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent 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/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 5f907c5d4..482ab6632 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -68,6 +68,7 @@ public static void registerCommands() { emCommand.registerCommand(new SpawnEliteAtCommand()); emCommand.registerCommand(new DiscordMessageCommand()); emCommand.registerCommand(new DiscordCommand()); + emCommand.registerCommand(new MoneyRemoveCommand()); //User commands // emCommand.registerCommand(new AdventurersGuildCommand()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java index 9f4915e63..18b968908 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -10,10 +10,9 @@ public class QuestResetAllCommand extends AdvancedCommand { public QuestResetAllCommand() { super(List.of("quest")); - addLiteral("reset"); - addLiteral("all"); + addLiteral("resetAll"); addArgument("player", new ArrayList<>()); - setUsage("/em quest reset all "); + setUsage("/em quest resetAll "); setPermission("elitemobs.quest.reset.all"); setDescription("Resets all quests for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java similarity index 58% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java index 88dd9a2ff..0b99ab3b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java @@ -2,11 +2,9 @@ import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; 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() { @@ -15,24 +13,21 @@ public DarkCathedralLair() { "&2[lvl 040] &8The Dark Cathedral", Arrays.asList("&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.NORMAL, 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); } } 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 377527794..ecbff418f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java @@ -75,6 +75,9 @@ public class NPCsConfigFields extends CustomConfigFields { @Getter @Setter private boolean instanced = false; + @Getter + @Setter + private double scale = 1; public NPCsConfigFields(String fileName, boolean isEnabled, @@ -143,6 +146,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) { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index c208a1f1c..40e6829f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -4,6 +4,9 @@ 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,19 @@ 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()){ + Logger.debug("world name: " + worldFile.getName()); + Logger.debug("current name: " + file.getName()); + 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/utility/DungeonUtils.java b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java index 9e63ac406..90504c1ad 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -69,9 +69,11 @@ public static World loadWorld(String worldName, World.Environment environment, D try { WorldCreator worldCreator = new WorldCreator(worldName); worldCreator.environment(environment); + worldCreator.keepSpawnInMemory(false); World world = Bukkit.createWorld(worldCreator); if (world != null) world.setKeepSpawnInMemory(false); world.setDifficulty(Difficulty.HARD); + world.setAutoSave(false); Bukkit.getLogger().setFilter(previousFilter); EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); 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 93d9e344c..94b26f0c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -21,6 +21,7 @@ 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; @@ -71,7 +72,6 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, this.difficultyName = difficultyName; setDifficulty(difficultyName); addNewPlayer(player); - DungeonInstance dungeonInstance = this; new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); @@ -98,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() { - new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); - } - }.runTask(MetadataHandler.PLUGIN); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); }); } @@ -217,19 +212,7 @@ public void removeInstance() { return; } world.getEntities().forEach(entity -> EntityTracker.unregister(entity, RemovalReason.WORLD_UNLOAD)); - new BukkitRunnable() { - @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 RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world - } - }.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) { @@ -276,7 +259,11 @@ private static class InitializeInstancedWorldTask extends BukkitRunnable { private final File file; private final String difficultyName; - public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, String instancedWorldName, Player player, File file, String difficultyName) { + public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, + String instancedWorldName, + Player player, + File file, + String difficultyName) { this.instancedDungeonsConfigFields = instancedDungeonsConfigFields; this.instancedWorldName = instancedWorldName; this.player = player; @@ -337,7 +324,9 @@ public void run() { new BukkitRunnable() { @Override public void run() { - WorldInstantiator.recursivelyDelete(instancedWorldFile); + 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/npcs/NPCEntity.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java index 372cc4f59..0b800b5a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java @@ -23,6 +23,7 @@ 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; @@ -170,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 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 16389f548..75c1f5688 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.2 +version: 9.1.3 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 0b7308ca9625f1ba30ddd87e217463a55ec55cf6 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 11 Aug 2024 23:01:22 +0100 Subject: [PATCH 24/78] EliteMobs 9.1.3: - [New] Updated to Minecraft 1.21.1 - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [New] Added the scale setting to NPCs to allow for NPC scaling - [New] Now correctly preventing players from dumping buckets in elitemobs worlds - [New] Now correctly defaulting to allowing liquid flow in elitemobs worlds, can be configured per-dungeon package to allow or deny through the settings `allowLiquidFlow` in the dungeon packager config - [New] Added the ability to play songs in dungeon packager content using the `song` setting with the same method and syntax as the custom boss song system - [New] Added /em protection bypass command to bypass dungeon protections and edit the world - [Fix] Fixed problem that was causing dungeon instantiation to not delete correctly and the recovery code on startup to not clear instanced dungeons on startup - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers - [Fix] Slimes and similar entities no longer constantly trigger the antiexploit - [Fix] Fixed the /em quest reset all by renaming it to /em quest resetAll Signed-off-by: MagmaGuy --- build.gradle | 9 +- .../com/magmaguy/elitemobs/EliteMobs.java | 2 + .../magmaguy/elitemobs/EventsRegistrer.java | 3 + .../elitemobs/commands/CommandHandler.java | 1 + .../commands/ProtectionBypassCommand.java | 25 ++ .../DungeonPackagerConfigFields.java | 8 + .../premade/DarkCathedralLair.java | 3 +- .../elitemobs/dungeons/DungeonProtector.java | 35 ++- .../elitemobs/dungeons/EliteMobsWorld.java | 1 + .../WorldInstancedDungeonPackage.java | 2 - .../elitemobs/dungeons/WorldPackage.java | 5 + .../dungeons/utility/DungeonUtils.java | 50 +--- .../elitemobs/instanced/MatchInstance.java | 68 ++--- .../custombosses/BossMusic.java | 139 ---------- .../custombosses/CustomBossEntity.java | 4 +- .../custombosses/CustomMusic.java | 243 ++++++++++++++++++ .../custombosses/PhaseBossEntity.java | 11 +- .../elitemobs/powers/scripts/ScriptZone.java | 63 +++-- .../libsdisguises/DisguiseEntity.java | 2 +- src/main/resources/plugin.yml | 5 +- 20 files changed, 420 insertions(+), 259 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomMusic.java diff --git a/build.gradle b/build.gradle index 8c5b4d6e0..e7f928347 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,10 @@ repositories { //MagmaCore maven { url = 'https://repo.magmaguy.com/releases' - allowInsecureProtocol = true + } + //MagmaCore + maven { + url = 'https://repo.magmaguy.com/snapshots' } //Bstats API @@ -110,8 +113,8 @@ dependencies { 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.12.0' - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.8' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.13.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index a27940735..f5b6a62a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -38,6 +38,7 @@ 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.CustomMusic; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; @@ -337,6 +338,7 @@ public void onDisable() { Navigation.shutdown(); BossBarUtil.shutdown(); ScriptAction.shutdown(); + CustomMusic.shutdown(); Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); MagmaCore.shutdown(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 4eb7bc8b8..5f832fc28 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -325,6 +325,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()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 482ab6632..dfe83b9f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -69,6 +69,7 @@ public static void registerCommands() { emCommand.registerCommand(new DiscordMessageCommand()); emCommand.registerCommand(new DiscordCommand()); emCommand.registerCommand(new MoneyRemoveCommand()); + emCommand.registerCommand(new ProtectionBypassCommand()); //User commands // emCommand.registerCommand(new AdventurersGuildCommand()); 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/config/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index ec81efad7..e48e6b2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -102,6 +102,12 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @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); @@ -283,6 +289,8 @@ public void processConfigFields() { 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(); } 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 0b99ab3b6..bb967a2c7 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 @@ -17,7 +17,7 @@ public DarkCathedralLair() { DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_the_dark_cathedral", - World.Environment.NORMAL, + World.Environment.NETHER, true, "em_the_dark_cathedral,47.5,85.2,199.5,163,0", 0, @@ -29,5 +29,6 @@ public DarkCathedralLair() { "&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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 950e208b0..cb4e81cb9 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -11,21 +11,40 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerInteractEvent; +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); } @@ -38,6 +57,7 @@ public void preventBlockBurnDamage(BlockBurnEvent event) { @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); } @@ -75,12 +95,15 @@ public void preventBlockFadeEvent(BlockFadeEvent event) { @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); } @@ -93,6 +116,15 @@ public void preventBlockFire(BlockIgniteEvent event) { @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); } @@ -119,9 +151,10 @@ public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventVanillaMobSpawning(PlayerInteractEvent event) { + 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")) diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java index c746bd6f2..abac43260 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -9,6 +9,7 @@ public class EliteMobsWorld { private static final HashMap eliteMobsWorlds = new HashMap<>(); + @Getter private final DungeonPackagerConfigFields dungeonPackagerConfigFields; @Getter private final boolean allowExplosions; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index 40e6829f4..efee487af 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -31,8 +31,6 @@ public void baseInitialization() { } else { //This removes all instanced worlds not previously correctly removed for (File worldFile : Bukkit.getWorldContainer().listFiles()){ - Logger.debug("world name: " + worldFile.getName()); - Logger.debug("current name: " + file.getName()); if (worldFile.getName().contains(file.getName()) && worldFile.getName().matches(".*_\\d{1,2}$")) { try{ FileUtils.deleteDirectory(worldFile); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 8591340ff..dac8d1c87 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; import com.magmaguy.elitemobs.dungeons.utility.DungeonUtils; +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; @@ -54,6 +55,8 @@ 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,6 +69,8 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); + if (dungeonPackagerConfigFields.getSong() != null) + new CustomMusic(dungeonPackagerConfigFields.getSong(), dungeonPackagerConfigFields, world); // WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); for (Wormhole wormhole : Wormhole.getWormholes()) wormhole.onDungeonInstall(dungeonPackagerConfigFields.getFilename()); 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 90504c1ad..65069d565 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,19 +5,13 @@ import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.dungeons.WorldPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.magmacore.util.Logger; +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) { @@ -46,45 +40,9 @@ public static World loadWorld(WorldPackage worldPackage) { } public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { - if (Bukkit.getWorld(worldName) != null) { - EliteMobsWorld.create(Bukkit.getWorld(worldName).getUID(), dungeonPackagerConfigFields); - return Bukkit.getWorld(worldName); - } - - File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); - - if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { - Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); - return null; - } - - Logger.info("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); - worldCreator.keepSpawnInMemory(false); - World world = Bukkit.createWorld(worldCreator); - if (world != null) world.setKeepSpawnInMemory(false); - world.setDifficulty(Difficulty.HARD); - world.setAutoSave(false); - Bukkit.getLogger().setFilter(previousFilter); - - EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); - - return world; - } catch (Exception exception) { - Bukkit.getLogger().setFilter(previousFilter); - Logger.warn("Failed to load world " + worldName + " !"); - exception.printStackTrace(); - } - return null; + World world = WorldLoader.loadVoidTemporaryWorld(worldName, environment); + if (world != null) EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + return world; } public static boolean unloadWorld(WorldPackage worldPackage) { diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java index 2437e284d..a888875c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java @@ -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/mobconstructor/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java deleted file mode 100644 index 26ca95ece..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.magmacore.util.Logger; -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<>(); - private final CustomBossEntity customBossEntity; - @Getter - private String name; - @Getter - private int durationTicks; - @Getter - private String name2 = null; - @Getter - private int durationTicks2 = -1; - private BukkitTask bukkitTask = null; - - //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: - Logger.warn("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/CustomBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java index cb2556116..b2d479fdd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java @@ -92,7 +92,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; @@ -116,7 +116,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()); 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/PhaseBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java index 7f0d184b1..6bad14855 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java @@ -66,7 +66,7 @@ private void switchPhase(BossPhase bossPhase, RemovalReason removalReason, doubl 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/powers/scripts/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index 2fea67379..e066f3348 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -56,32 +56,7 @@ public void startZoneListener(EliteEntity eliteEntity) { if (!zoneListener) return; entitiesInZone = new HashSet<>(); ScriptActionData scriptActionData = new ScriptActionData(eliteEntity, targets, this); - new BukkitRunnable() { - @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; - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + new ZoneListenerTask(eliteEntity, scriptActionData).runTaskTimer(MetadataHandler.PLUGIN, 0, 1); } public void ZoneEnterEvent(EliteEntity eliteEntity, LivingEntity livingEntity) { @@ -208,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 @@ -267,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/thirdparty/libsdisguises/DisguiseEntity.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java index de1970903..627ad13e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java @@ -65,7 +65,7 @@ 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(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 75c1f5688..214631d41 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -232,4 +232,7 @@ permissions: default: true elitemobs.enchant.npc: description: Allows players to talk to the enchant npc - default: true \ No newline at end of file + default: true + elitemobs.protection.bypass: + description: Allows players to run the bypass command to toggle bypassing dungeon protections + default: op \ No newline at end of file From a5d3df57d5580124dd02192083c75b5b757caec6 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 18 Jun 2024 10:28:21 +0100 Subject: [PATCH 25/78] - Updated all entities, potion effects and enchantments to work with Minecraft 1.21 - Removed Super Mobs - Fixed bug where push action would be cancelled if applied on the same tick a player is damaged by the boss Signed-off-by: MagmaGuy --- build.gradle | 5 +- .../com/magmaguy/elitemobs/EliteMobs.java | 12 -- .../magmaguy/elitemobs/EventsRegistrer.java | 15 -- .../api/EliteMobDamagedByPlayerEvent.java | 4 +- .../api/PlayerDamagedByEliteMobEvent.java | 8 +- .../elitemobs/api/SuperMobDamageEvent.java | 72 ------- .../elitemobs/api/SuperMobDeathEvent.java | 58 ----- .../elitemobs/api/SuperMobRemoveEvent.java | 40 ---- .../elitemobs/api/SuperMobSpawnEvent.java | 61 ------ .../elitemobs/api/utils/EliteItemManager.java | 12 +- .../AlternativeDurabilityLoss.java | 2 +- .../EnderCrystalDamageProtectionBypass.java | 2 +- .../FindSuperMobs.java | 24 --- .../LightningImmunity.java | 2 +- .../LightningSpawnBypass.java | 2 +- .../PreventCreeperPassiveEntityDamage.java | 48 ----- .../antiexploit/PreventMountExploit.java | 2 +- .../combatsystem/combattag/CombatTag.java | 2 +- .../elitemobs/commands/AdminCommands.java | 27 --- .../elitemobs/commands/SpawnCommand.java | 12 -- .../commands/admin/GetTierCommand.java | 4 +- .../elitemobs/commands/admin/KillHandler.java | 33 --- .../commands/admin/StatsCommand.java | 7 - .../custombosses/premade/BalrogConfig.java | 8 +- .../custombosses/premade/EmberConfig.java | 2 +- .../custombosses/premade/IceFaeConfig.java | 2 +- .../premade/ImperialBeeGuardConfig.java | 2 +- .../KillerRabbitOfCaerbannogConfig.java | 8 +- .../custombosses/premade/KrakenConfig.java | 8 +- .../premade/LightningFaeConfig.java | 2 +- .../custombosses/premade/QueenBeeBoss.java | 8 +- .../custombosses/premade/RaugConfig.java | 2 +- .../premade/ChallengersBootsConfig.java | 2 +- .../premade/ChallengersChestplateConfig.java | 2 +- .../premade/ChallengersHelmetConfig.java | 2 +- .../premade/ChallengersLeggingsConfig.java | 2 +- .../premade/ChallengersSwordConfig.java | 2 +- .../premade/DepthsSeekerConfig.java | 2 +- .../premade/DwarvenGreedConfig.java | 2 +- .../EnchantedBookDurabilityConfig.java | 2 +- ...ntedBookProtectionEnvironmentalConfig.java | 2 +- .../premade/GoblinBallistaItem.java | 2 +- .../customitems/premade/GoblinBootsItem.java | 2 +- .../premade/GoblinChestplateItem.java | 2 +- .../premade/GoblinCleaverItem.java | 2 +- .../customitems/premade/GoblinHelmetItem.java | 2 +- .../premade/GoblinLeggingsItem.java | 2 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 2 +- .../premade/GruntsBootsConfig.java | 2 +- .../premade/GruntsChestplateConfig.java | 2 +- .../premade/GruntsHelmetConfig.java | 2 +- .../premade/GruntsLeggingsConfig.java | 2 +- .../premade/GruntsSwordConfig.java | 2 +- .../premade/InvictusBootsConfig.java | 2 +- .../premade/InvictusChestplateConfig.java | 2 +- .../premade/InvictusHelmetConfig.java | 2 +- .../premade/InvictusLeggingsConfig.java | 2 +- .../premade/InvictusPickaxeConfig.java | 2 +- .../premade/InvictusShovelConfig.java | 2 +- .../premade/InvictusSwordConfig.java | 2 +- .../premade/NovicesBootsConfig.java | 2 +- .../premade/NovicesChestplateConfig.java | 2 +- .../premade/NovicesHelmetConfig.java | 2 +- .../premade/NovicesLeggingsConfig.java | 2 +- .../premade/NovicesSwordConfig.java | 2 +- .../premade/RodOfTheDepthsConfig.java | 2 +- .../customitems/premade/TheFellerConfig.java | 2 +- .../customitems/premade/TheStingerConfig.java | 2 +- .../premade/VeteransBootsConfig.java | 2 +- .../premade/VeteransChestplateConfig.java | 2 +- .../premade/VeteransHelmetConfig.java | 2 +- .../premade/VeteransLeggingsConfig.java | 2 +- .../premade/VeteransSwordConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 2 +- .../mobproperties/MobPropertiesConfig.java | 5 - .../premade/SuperChickenConfig.java | 15 -- .../mobproperties/premade/SuperCowConfig.java | 15 -- .../premade/SuperMushroomCowConfig.java | 15 -- .../mobproperties/premade/SuperPigConfig.java | 15 -- .../premade/SuperSheepConfig.java | 15 -- .../powers/premade/ArrowRainConfig.java | 2 +- .../powers/premade/AttackBlindingConfig.java | 2 +- .../powers/premade/AttackConfusingConfig.java | 2 +- .../powers/premade/ZombieBloatConfig.java | 2 +- .../entitytracker/EntityTracker.java | 36 +--- .../elitemobs/items/EliteEnchantments.java | 16 +- .../elitemobs/items/EliteItemLore.java | 16 +- .../EarthquakeEnchantment.java | 2 +- .../FlamethrowerEnchantment.java | 6 +- .../MeteorShowerEnchantment.java | 2 +- .../PlasmaBootsEnchantment.java | 4 +- .../itemconstructor/EnchantmentGenerator.java | 36 ++-- .../itemconstructor/ItemQualityColorizer.java | 96 ++++----- .../potioneffects/PlayerPotionEffects.java | 10 +- .../mobconstructor/MergeHandler.java | 46 ---- .../mobconstructor/SuperMobConstructor.java | 40 ---- .../custombosses/CustomBossTrail.java | 2 +- .../mobdata/PluginMobProperties.java | 2 - .../mobdata/passivemobs/SuperChicken.java | 26 --- .../mobdata/passivemobs/SuperCow.java | 26 --- .../passivemobs/SuperMobProperties.java | 53 ----- .../mobdata/passivemobs/SuperMushroomCow.java | 26 --- .../mobdata/passivemobs/SuperPig.java | 26 --- .../mobdata/passivemobs/SuperSheep.java | 26 --- .../mobs/passive/ChickenHandler.java | 157 -------------- .../elitemobs/mobs/passive/CowHandler.java | 80 ------- .../elitemobs/mobs/passive/EggRunnable.java | 16 -- .../mobs/passive/MushroomCowHandler.java | 112 ---------- .../passive/PassiveEliteMobDeathHandler.java | 108 ---------- .../elitemobs/mobs/passive/PigHandler.java | 63 ------ .../elitemobs/mobs/passive/SheepHandler.java | 200 ------------------ .../elitemobs/playerdata/PlayerItem.java | 8 +- .../magmaguy/elitemobs/powers/BulletHell.java | 2 +- .../elitemobs/powers/ChannelHealing.java | 4 +- .../magmaguy/elitemobs/powers/DeathSlice.java | 2 +- .../powers/EnderDragonDiscoFireballs.java | 2 +- .../powers/EnderDragonPotionBombardment.java | 6 +- .../elitemobs/powers/EnderDragonTornado.java | 2 +- .../magmaguy/elitemobs/powers/Firestorm.java | 6 +- .../elitemobs/powers/FireworksBarrage.java | 4 +- .../magmaguy/elitemobs/powers/FlamePyre.java | 6 +- .../elitemobs/powers/Flamethrower.java | 4 +- .../magmaguy/elitemobs/powers/FrostCone.java | 4 +- .../elitemobs/powers/GoldExplosion.java | 2 +- .../elitemobs/powers/GoldShotgun.java | 2 +- .../elitemobs/powers/GroundPound.java | 2 +- .../elitemobs/powers/MeteorShower.java | 2 +- .../magmaguy/elitemobs/powers/PhotonRay.java | 4 +- .../elitemobs/powers/PlasmaBlaster.java | 4 +- .../elitemobs/powers/SkeletonPillar.java | 4 +- .../com/magmaguy/elitemobs/powers/Taze.java | 2 +- .../elitemobs/powers/ZombieBloat.java | 2 +- .../powers/meta/CustomSummonPower.java | 2 +- .../powers/scripts/ScriptParticles.java | 6 +- .../EnderCrystalLightningRod.java | 2 +- .../elitemobs/utils/DebugBlockLocation.java | 4 +- .../elitemobs/wormhole/WormholeTask.java | 2 +- src/main/resources/plugin.yml | 2 +- 141 files changed, 236 insertions(+), 1763 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperChickenConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperCowConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperMushroomCowConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperPigConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/SuperSheepConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/MergeHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/SuperMobConstructor.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperChicken.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperCow.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMobProperties.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperMushroomCow.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperPig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/passivemobs/SuperSheep.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/ChickenHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/CowHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/EggRunnable.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/MushroomCowHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/PassiveEliteMobDeathHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/PigHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobs/passive/SheepHandler.java diff --git a/build.gradle b/build.gradle index 000c6649d..f93122c7f 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '8.7.16-SNAPSHOT' +version '9.0.0-SNAPSHOT' repositories { maven { @@ -77,8 +77,7 @@ repositories { dependencies { //Spigot API - compileOnly "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT" - // The full CraftBukkit server with no shadowing. Requires mavenLocal. + compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" //BStats API implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 851495ecf..eb42590a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -43,8 +43,6 @@ 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.playerdata.ElitePlayerInventory; import com.magmaguy.elitemobs.playerdata.database.PlayerData; @@ -68,7 +66,6 @@ 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; @@ -218,11 +215,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(); @@ -400,10 +392,6 @@ public void onDisable() { */ 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..75a115e83 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -29,12 +29,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; @@ -102,13 +100,6 @@ 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()) @@ -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()); @@ -232,9 +222,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,8 +265,6 @@ 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 EnderDragonUnstuck()); diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 1b4323c62..5f3b3b49e 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -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)) { 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; } 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/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/utils/EliteItemManager.java b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java index 1dca78eac..a72c2fd35 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; } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 0eaf6afa7..c0d03fbb8 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -30,7 +30,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; } 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/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/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index bd7a645b4..fb9391902 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -12,7 +12,7 @@ public class LightningImmunity implements Listener { @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) public void onLightningStrike(EntityDamageByEntityEvent event){ - if (!event.getDamager().getType().equals(EntityType.LIGHTNING)) return; + 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/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/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/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/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index 419fafcc7..c87210ed9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -233,17 +233,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde 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)), @@ -504,22 +493,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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") diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java index ef7ed08ba..d3a5658be 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -7,10 +7,8 @@ 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 org.bukkit.Bukkit; import org.bukkit.Location; @@ -145,12 +143,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); @@ -177,8 +169,4 @@ private static HashSet getPowers(String[] mobPowers, Command 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 27f12930b..9b2619d06 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -44,7 +44,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); @@ -72,7 +72,7 @@ public static void get(Player player, int tierLevel) { private static void addDurability(ItemStack itemStack){ ItemMeta itemMeta = itemStack.getItemMeta(); HashMap enchantmentIntegerHashMap = new HashMap<>(); - enchantmentIntegerHashMap.put(Enchantment.DURABILITY, 5); + enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); 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..e5e0c4bcd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java @@ -5,11 +5,9 @@ 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 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/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java index a8f0725b9..4f5f698ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -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/config/custombosses/premade/BalrogConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/BalrogConfig.java index d65df6d93..6049a2675 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 @@ -16,10 +16,10 @@ public BalrogConfig() { "dynamic"); setPowers(Collections.singletonList("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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), Particle.FLAME.toString(), Particle.FLAME.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/IceFaeConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/IceFaeConfig.java index 2b767ac61..be97a8262 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 @@ -17,6 +17,6 @@ public IceFaeConfig() { setDamageMultiplier(0.3); setPowers(Collections.singletonList("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..619e3e933 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 @@ -20,6 +20,6 @@ public ImperialBeeGuardConfig() { 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..66a9379c6 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 @@ -15,10 +15,10 @@ 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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.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..c5feefa37 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 @@ -15,10 +15,10 @@ 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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.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..6f7b618b4 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 @@ -17,6 +17,6 @@ public LightningFaeConfig() { setDamageMultiplier(0.3); setPowers(Collections.singletonList("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/QueenBeeBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/QueenBeeBoss.java index 488589cba..352f889a2 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 @@ -19,10 +19,10 @@ public QueenBeeBoss() { setEntityType(EntityType.BEE); setPowers(Collections.singletonList("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(Arrays.asList(Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.toString(), + Particle.LARGE_SMOKE.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/customitems/premade/ChallengersBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java index 124121082..ccfac6f38 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..36f4ced2f 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..c5af48d8d 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..3d82b0ca9 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..1db6f4ca5 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index 3dff27bdb..66387929c 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 @@ -13,7 +13,7 @@ public DepthsSeekerConfig() { 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")); + setEnchantments(Arrays.asList("LURE,3", "LUCK,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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..418e667b8 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 @@ -13,7 +13,7 @@ public DwarvenGreedConfig() { 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")); + setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/EnchantedBookDurabilityConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookDurabilityConfig.java index 9fa012bb1..84434f406 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 @@ -14,7 +14,7 @@ public EnchantedBookDurabilityConfig(){ 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/EnchantedBookProtectionEnvironmentalConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookProtectionEnvironmentalConfig.java index e41651efc..577f5e94b 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 @@ -14,7 +14,7 @@ public EnchantedBookProtectionEnvironmentalConfig(){ 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/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 1733e17d1..5c7be6b92 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 @@ -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(Arrays.asList("ARROW_DAMAGE,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..f0ff0e047 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 @@ -17,7 +17,7 @@ public GoblinBootsItem() { 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")); + setEnchantments(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..70aaec84d 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 @@ -17,7 +17,7 @@ public GoblinChestplateItem() { 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(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..0538c35be 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 @@ -17,7 +17,7 @@ public GoblinCleaverItem() { 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(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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..1162ad080 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 @@ -17,7 +17,7 @@ public GoblinHelmetItem() { 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(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..897d3746b 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 @@ -17,7 +17,7 @@ public GoblinLeggingsItem() { 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(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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..b526d6687 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 @@ -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(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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..24d535131 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 @@ -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(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,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..1fae1f440 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 @@ -17,7 +17,7 @@ public GoblinSlasherItem() { 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(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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..7fa585ec3 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..98fb62745 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..ac575075a 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..ee4d9ad47 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..b74955375 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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..5862f2613 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..260a1c496 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..7d3c68654 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..2d1efceec 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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..8cc544edc 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("DIG_SPEED,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..ec619b4a5 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("DIG_SPEED,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..d2adb23c1 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 @@ -13,7 +13,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/NovicesBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesBootsConfig.java index 98df7fabe..d0d4ebd14 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..de5dca260 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..189462464 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..5e891f5ca 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("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..4b042a516 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,5", "SWEEPING_EDGE,1", "UNBREAKING,5")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } 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..49e59d461 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 @@ -13,7 +13,7 @@ public RodOfTheDepthsConfig() { 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")); + setEnchantments(Arrays.asList("LURE,3", "LUCK,1", "UNBREAKING,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 14fbb4d6c..870774e8c 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 @@ -13,7 +13,7 @@ public TheFellerConfig() { 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")); + setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "SILK_TOUCH,1", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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..7564e67c5 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 @@ -14,7 +14,7 @@ public TheStingerConfig() { 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index 63b850031..fa3e7ae30 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..213a0facb 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..a702eeac8 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..f812d7d5b 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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..436c6204e 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 @@ -9,7 +9,7 @@ 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 93e85d278..ea50b9ea5 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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")); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); setPotionEffects(Arrays.asList("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..87c897770 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 @@ -13,7 +13,7 @@ public ZombieKingsAxeConfig() { 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", + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,5", "DIG_SPEED,5", "UNBREAKING,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")); setItemType(CustomItem.ItemType.UNIQUE); 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..8ef3f3b26 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -44,11 +44,6 @@ 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(), 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/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/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/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/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..28e002484 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -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); } 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..e79b2a59f 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), 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/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/itemconstructor/EnchantmentGenerator.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java index 30b0145cd..48f41b6c8 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java @@ -74,7 +74,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); validEnchantments.putAll(validateEnchantments("LOOT_BONUS_MOBS")); @@ -87,7 +87,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -96,7 +96,7 @@ public static HashMap generateEnchantments(double itemTier 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; @@ -106,7 +106,7 @@ public static HashMap generateEnchantments(double itemTier case STONE_PICKAXE: case WOODEN_PICKAXE: validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); //TODO: this doesn't take config into account @@ -122,7 +122,7 @@ public static HashMap generateEnchantments(double itemTier case STONE_SHOVEL: case WOODEN_SHOVEL: validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { @@ -139,7 +139,7 @@ public static HashMap generateEnchantments(double itemTier if (ItemSettingsConfig.isUseHoesAsWeapons()) validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); validEnchantments.putAll(validateEnchantments("DIG_SPEED")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { @@ -149,7 +149,7 @@ public static HashMap generateEnchantments(double itemTier } break; case SHIELD: - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -161,7 +161,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); - validEnchantments.putAll(validateEnchantments("DURABILITY")); + validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("DIG_SPEED")); @@ -173,9 +173,9 @@ 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")); @@ -190,8 +190,8 @@ public static HashMap generateEnchantments(double itemTier 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")); @@ -204,9 +204,9 @@ 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")); @@ -219,9 +219,9 @@ 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")); @@ -234,7 +234,7 @@ 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")); @@ -244,7 +244,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("DIG_SPEED")); 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/ItemQualityColorizer.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java index 305f27c9d..be472ba44 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemQualityColorizer.java @@ -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/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/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/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/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 25340e4a3..4ea55665d 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -36,7 +36,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) { } 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/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/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index 56dec7027..0cf7a6a98 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -102,10 +102,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/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/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..270750255 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); } 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..c18505ede 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java @@ -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..52a7bd8e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java @@ -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/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..f1408759a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java @@ -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/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/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/meta/CustomSummonPower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java index 6dc9f9a18..5cf702d56 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -517,7 +517,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; 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..23b26b065 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java @@ -44,7 +44,7 @@ private void visualize(ScriptActionData scriptActionData, Location location, Eli } - 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/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/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 2b338bd98..f63ce4e53 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -10,9 +10,9 @@ 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); + location.getWorld().spawnParticle(Particle.EXPLOSION, 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.EXPLOSION, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); } } diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java index b026770e8..26a4358a8 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java @@ -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/plugin.yml b/src/main/resources/plugin.yml index 1266d3b30..f3798c721 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.0.0 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From ec5836ed5dcb9e900841cbe56b4993fac36e0195 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Wed, 19 Jun 2024 14:05:52 +0100 Subject: [PATCH 26/78] - [New] 1.21 update! - [New] Added bossType field to custom bosses, to be used in the future for things like automatic boss bars - [New] Added Breach, Density and Wind Burst enchantments to EliteMobs - [New] Added Infested, Oozing, Raid Omen, Trial Omen, Weaving and Wind Charged potion effects to EliteMobs - [New] Added Bogged and Breeze entity types as valid elites and bosses - [New] All enchantments and potion effects now use the same names as in-game, instead of legacy API names - [New] Added compatibility layer that automatically converts legacy API names to the new equivalent, meaning it is not necessary to update the dungeons for them to keep working - [Removal] Removed Super Mobs - [Removal] Removed Schematic Dungeons, 100% of them will brought back as world-based dungeons. Use BetterStructures shrines as a replacement, they're much better. - [Removal] Removed all traces of WorldEdit as a requirement, since schematic dungeons are no longer a feature - [Removal] Removed the region leveling mode and the nightmare mode, they should either be improved or be their own plugin - [Removal] Removed all the code legacy code used to maintain multi-version support since this build will not be able to support anything before 1.21 - [Tweak] Default test boss no longer uses broadcast as a sample command and instead uses say - [Tweak] Fixed typo in stats page of the player em menu Signed-off-by: MagmaGuy --- build.gradle | 2 - .../elitemobs/ChatColorConverter.java | 2 +- .../com/magmaguy/elitemobs/EliteMobs.java | 13 -- .../magmaguy/elitemobs/EventsRegistrer.java | 19 +- .../api/EliteMobDamagedByPlayerEvent.java | 5 +- ...maticPackageRelativeBossLocationEvent.java | 56 ----- .../elitemobs/api/utils/EliteItemManager.java | 13 +- .../LightningImmunity.java | 4 +- .../PreventUpgradeDiamondToNetherite.java | 6 +- .../elitemobs/combatsystem/CombatSystem.java | 10 +- .../EliteMobDamagedByEliteMobHandler.java | 2 +- .../antiexploit/AmbientDamageExploit.java | 2 +- .../antiexploit/HoneyBlockJumpExploit.java | 2 - .../PreventLargeDarkroomExploit.java | 2 +- .../combatsystem/displays/PopupDisplay.java | 2 +- .../elitemobs/commands/AdminCommands.java | 24 -- .../commands/CustomBossCommandHandler.java | 24 -- .../elitemobs/commands/SpawnCommand.java | 27 ++- .../commands/TreasureChestCommands.java | 23 -- .../commands/admin/GetTierCommand.java | 3 +- .../admin/RelativeCoordinatesCommand.java | 6 - .../commands/admin/RemoveCommand.java | 12 +- .../elitemobs/commands/setup/SetupMenu.java | 6 +- .../elitemobs/config/ConfigurationEngine.java | 6 +- .../config/ConfigurationExporter.java | 8 +- .../elitemobs/config/CustomConfig.java | 6 +- .../elitemobs/config/DefaultConfig.java | 3 +- .../config/EconomySettingsConfig.java | 21 +- .../config/ItemUpgradeSystemConfig.java | 1 + .../config/LegacyValueConverter.java | 76 +++++++ .../elitemobs/config/ModelsConfig.java | 3 +- .../elitemobs/config/QuestsConfig.java | 17 +- .../config/ResourcePackDataConfig.java | 2 +- .../config/SpecialItemSystemsConfig.java | 10 +- .../elitemobs/config/ValidWorldsConfig.java | 15 -- .../CustomBossesConfigFields.java | 10 + .../premade/ImperialBeeGuardConfig.java | 5 +- .../custombosses/premade/QueenBeeBoss.java | 5 +- .../premade/TestCustomBossesConfig.java | 6 +- .../premade/TotemZombie1Boss.java | 13 +- .../premade/WeaponsGoblinBoss.java | 15 +- .../premade/WoodLeagueWave15Miniboss.java | 5 +- .../premade/WoodLeagueWave50Boss.java | 4 +- .../premade/WoodLeagueWave50BossP2.java | 4 +- .../premade/WoodLeagueWave50BossP3.java | 4 +- .../customevents/premade/QueenBeeEvent.java | 4 +- .../customitems/CustomItemsConfigFields.java | 43 ++++ .../premade/ChallengersBootsConfig.java | 2 +- .../premade/ChallengersChestplateConfig.java | 2 +- .../premade/ChallengersHelmetConfig.java | 2 +- .../premade/ChallengersLeggingsConfig.java | 2 +- .../premade/ChallengersSwordConfig.java | 2 +- .../premade/DwarvenGreedConfig.java | 2 +- .../EnchantedBookArrowDamageConfig.java | 20 +- .../EnchantedBookArrowKnockbackConfig.java | 2 +- .../EnchantedBookChannelingConfig.java | 2 +- .../premade/EnchantedBookDamageAllConfig.java | 2 +- .../EnchantedBookDamageArthropodsConfig.java | 2 +- .../EnchantedBookDamageUndeadConfig.java | 4 +- .../EnchantedBookDepthStriderConfig.java | 2 +- .../premade/EnchantedBookDigSpeedConfig.java | 4 +- .../EnchantedBookDurabilityConfig.java | 2 +- .../EnchantedBookEarthquakeConfig.java | 2 +- .../premade/EnchantedBookFlameConfig.java | 2 +- .../EnchantedBookFlamethrowerConfig.java | 2 +- .../EnchantedBookFrostWalkerConfig.java | 2 +- .../premade/EnchantedBookHunterConfig.java | 2 +- .../EnchantedBookIceBreakerConfig.java | 2 +- .../premade/EnchantedBookImpalingConfig.java | 2 +- .../premade/EnchantedBookKnockbackConfig.java | 2 +- .../premade/EnchantedBookLightningConfig.java | 2 +- .../EnchantedBookLootBonusBlocksConfig.java | 4 +- .../EnchantedBookLootBonusMobsConfig.java | 2 +- .../EnchantedBookLoudStrikesConfig.java | 2 +- .../premade/EnchantedBookLoyaltyConfig.java | 2 +- .../premade/EnchantedBookLuckConfig.java | 2 +- .../premade/EnchantedBookLureConfig.java | 2 +- .../premade/EnchantedBookMendingConfig.java | 2 +- .../EnchantedBookMeteorShowerConfig.java | 2 +- .../premade/EnchantedBookMultishotConfig.java | 2 +- .../premade/EnchantedBookOxygenConfig.java | 4 +- .../premade/EnchantedBookPiercingConfig.java | 2 +- .../EnchantedBookPlasmaBootsConfig.java | 2 +- ...ntedBookProtectionEnvironmentalConfig.java | 2 +- ...chantedBookProtectionExplosionsConfig.java | 4 +- .../EnchantedBookProtectionFallConfig.java | 4 +- .../EnchantedBookProtectionFireConfig.java | 4 +- ...chantedBookProtectionProjectileConfig.java | 4 +- .../EnchantedBookQuickChargeConfig.java | 2 +- .../premade/EnchantedBookRiptideConfig.java | 2 +- .../premade/EnchantedBookSilkTouchConfig.java | 2 +- .../premade/EnchantedBookSoulSpeedConfig.java | 2 +- .../EnchantedBookSweepingEdgeConfig.java | 2 +- .../premade/EnchantedBookThornsConfig.java | 2 +- .../EnchantedBookWaterWorkerConfig.java | 4 +- .../premade/GoblinBallistaItem.java | 2 +- .../customitems/premade/GoblinBootsItem.java | 6 +- .../premade/GoblinChestplateItem.java | 7 +- .../premade/GoblinCleaverItem.java | 7 +- .../customitems/premade/GoblinHelmetItem.java | 7 +- .../premade/GoblinLeggingsItem.java | 7 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 7 +- .../premade/GruntsBootsConfig.java | 2 +- .../premade/GruntsChestplateConfig.java | 2 +- .../premade/GruntsHelmetConfig.java | 2 +- .../premade/GruntsLeggingsConfig.java | 2 +- .../premade/GruntsSwordConfig.java | 2 +- .../premade/InvictusBootsConfig.java | 7 +- .../premade/InvictusChestplateConfig.java | 7 +- .../premade/InvictusHelmetConfig.java | 7 +- .../premade/InvictusLeggingsConfig.java | 7 +- .../premade/InvictusPickaxeConfig.java | 7 +- .../premade/InvictusShovelConfig.java | 7 +- .../premade/InvictusSwordConfig.java | 7 +- .../premade/NovicesSwordConfig.java | 2 +- .../customitems/premade/TheFellerConfig.java | 2 +- .../customitems/premade/TheStingerConfig.java | 2 +- .../premade/VeteransBootsConfig.java | 2 +- .../premade/VeteransChestplateConfig.java | 2 +- .../premade/VeteransHelmetConfig.java | 2 +- .../premade/VeteransLeggingsConfig.java | 2 +- .../premade/VeteransSwordConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 4 +- .../customquests/premade/TestQuestConfig.java | 2 +- .../premade/XmasQuest0Config.java | 2 +- .../DungeonPackagerConfigFields.java | 67 ------ ...inidungeon.java => AirShipMinidungeon.off} | 1 - .../premade/BeastsSanctuaryLair.java | 4 +- .../{CatacombsLair.java => CatacombsLair.off} | 1 - .../{ColosseumLair.java => ColosseumLair.off} | 1 - ...thedralLair.java => DarkCathedralLair.off} | 1 - .../premade/DiamondLeagueArena.java | 6 +- .../premade/EnchantmentChallenge1.java | 3 +- .../premade/EnchantmentChallenge10.java | 5 +- .../premade/EnchantmentChallenge11.java | 3 +- .../premade/EnchantmentChallenge12.java | 3 +- .../premade/EnchantmentChallenge13.java | 3 +- .../premade/EnchantmentChallenge14.java | 3 +- .../premade/EnchantmentChallenge15.java | 3 +- .../premade/EnchantmentChallenge16.java | 3 +- .../premade/EnchantmentChallenge17.java | 3 +- .../premade/EnchantmentChallenge18.java | 3 +- .../premade/EnchantmentChallenge19.java | 3 +- .../premade/EnchantmentChallenge2.java | 5 +- .../premade/EnchantmentChallenge20.java | 3 +- .../premade/EnchantmentChallenge3.java | 5 +- .../premade/EnchantmentChallenge4.java | 7 +- .../premade/EnchantmentChallenge5.java | 5 +- .../premade/EnchantmentChallenge6.java | 5 +- .../premade/EnchantmentChallenge7.java | 5 +- .../premade/EnchantmentChallenge8.java | 3 +- .../premade/EnchantmentChallenge9.java | 5 +- .../premade/IronLeagueArena.java | 4 +- .../premade/KnightCastleLair.java | 6 +- ...dungeon.java => PirateShipMinidungeon.off} | 1 - .../premade/{RuinsLair.java => RuinsLair.off} | 1 - .../premade/SteamworksLair.java | 4 +- .../premade/TheBridgeSanctum.java | 2 +- .../premade/TheCityDungeon.java | 2 +- .../premade/TheMinesDungeon.java | 2 +- .../premade/TheNetherWastes.java | 2 +- .../premade/ThePalaceSanctum.java | 2 +- .../premade/UnderGroveLair.java | 4 +- ...ngeon.java => VampireManorMinidungeon.off} | 1 - .../enchantments/EnchantmentsConfig.java | 8 +- .../EnchantmentsConfigFields.java | 2 +- ...kerConfig.java => AquaAffinityConfig.java} | 6 +- ...onfig.java => BaneOfArthropodsConfig.java} | 6 +- ...Config.java => BlastProtectionConfig.java} | 6 +- .../enchantments/premade/BreachConfig.java | 16 ++ .../enchantments/premade/DensityConfig.java | 16 ++ ...SpeedConfig.java => EfficiencyConfig.java} | 6 +- ...lConfig.java => FeatherFallingConfig.java} | 6 +- ...eConfig.java => FireProtectionConfig.java} | 6 +- ...{ArrowFireConfig.java => FlameConfig.java} | 6 +- ...usBlocksConfig.java => FortuneConfig.java} | 6 +- ...nfiniteConfig.java => InfinityConfig.java} | 6 +- ...onusMobsConfig.java => LootingConfig.java} | 6 +- ...uckConfig.java => LuckOfTheSeaConfig.java} | 6 +- ...rrowDamageConfig.java => PowerConfig.java} | 6 +- ...g.java => ProjectileProtectionConfig.java} | 6 +- ...entalConfig.java => ProtectionConfig.java} | 6 +- ...wKnockbackConfig.java => PunchConfig.java} | 6 +- .../enchantments/premade/RepairConfig.java | 2 +- ...ygenConfig.java => RespirationConfig.java} | 6 +- ...ageAllConfig.java => SharpnessConfig.java} | 6 +- ...mageUndeadConfig.java => SmiteConfig.java} | 6 +- ...ilityConfig.java => UnbreakingConfig.java} | 6 +- .../enchantments/premade/WindBurstConfig.java | 16 ++ .../config/menus/premade/ArenaMenuConfig.java | 9 +- .../menus/premade/CustomQuestMenuConfig.java | 2 +- .../menus/premade/PlayerStatusMenuConfig.java | 85 +++---- .../mobproperties/MobPropertiesConfig.java | 37 ++-- .../premade/EliteBoggedConfig.java | 17 ++ .../mobproperties/premade/EliteBreeze.java | 17 ++ .../premade/EliteSlimeConfig.java | 6 +- .../npcs/premade/BinderOfWorldsNPCConfig.java | 3 +- .../npcs/premade/BoneMonasteryTeleporter.java | 2 +- ...raftenminesLabSanctumTeleporterConfig.java | 2 +- .../npcs/premade/TheCaveTeleporter.java | 4 +- .../npcs/premade/TheCityTeleporter.java | 2 +- .../npcs/premade/TheClimbTeleporter.java | 2 +- .../npcs/premade/TheDeepMinesTeleporter.java | 4 +- .../npcs/premade/TheMinesTeleporter.java | 2 +- .../premade/TheNetherWastesTeleporter.java | 2 +- .../npcs/premade/ThePalaceTeleporter.java | 2 +- .../npcs/premade/TheQuarryTeleporter.java | 2 +- .../potioneffects/PotionEffectsConfig.java | 26 ++- ...astDiggingConfig.java => HasteConfig.java} | 6 +- .../potioneffects/premade/InfestedConfig.java | 13 ++ ...rmConfig.java => InstantDamageConfig.java} | 6 +- ...alConfig.java => InstantHealthConfig.java} | 6 +- .../{JumpConfig.java => JumpBoostConfig.java} | 6 +- ...ngConfig.java => MiningFatigueConfig.java} | 6 +- ...ConfusionConfig.java => NauseaConfig.java} | 6 +- .../potioneffects/premade/OozingConfig.java | 13 ++ .../potioneffects/premade/RaidOmenConfig.java | 13 ++ ...tanceConfig.java => ResistanceConfig.java} | 6 +- .../{SlowConfig.java => SlownessConfig.java} | 6 +- ...eDamageConfig.java => StrengthConfig.java} | 6 +- .../premade/TrialOmenConfig.java | 13 ++ .../potioneffects/premade/WeavingConfig.java | 13 ++ .../premade/WindChargedConfig.java | 13 ++ .../powers/premade/GoldShotgunConfig.java | 4 +- .../powers/premade/LightningBoltsConfig.java | 4 +- ...onfig.java => AGAirshipWormholeConfig.off} | 0 .../AGBeastsSanctuaryWormholeConfig.java | 2 +- ...fig.java => AGCatacombsWormholeConfig.off} | 0 ...fig.java => AGColosseumWormholeConfig.off} | 0 ...java => AGDarkCathedralWormholeConfig.off} | 0 .../AGKnightsCastleWormholeConfig.java | 2 +- ...eConfig.java => AGRuinsWormholeConfig.off} | 0 .../premade/AGUnderGroveWormholeConfig.java | 2 +- ....java => AGVampireManorWormholeConfig.off} | 0 .../elitemobs/dungeons/EMPackage.java | 4 +- .../dungeons/SchematicDungeonPackage.java | 208 ------------------ .../elitemobs/dungeons/SchematicPackage.java | 132 ----------- .../elitemobs/events/ActionEvent.java | 4 +- .../nightmaremodeworld/DaylightWatchdog.java | 35 --- .../gamemodes/zoneworld/EliteChunk.java | 45 ---- .../elitemobs/gamemodes/zoneworld/Grid.java | 62 ------ .../gamemodes/zoneworld/ZoneWarner.java | 49 ----- .../instanced/InstancePlayerManager.java | 3 +- .../instanced/arena/ArenaInstance.java | 7 +- .../instanced/dungeons/DungeonInstance.java | 4 +- .../elitemobs/items/EliteItemLore.java | 6 +- .../elitemobs/items/ItemLootShower.java | 3 +- .../magmaguy/elitemobs/items/ShareItem.java | 2 +- .../EarthquakeEnchantment.java | 2 +- .../CurrencyCustomLootEntry.java | 11 +- .../customloottable/CustomLootTable.java | 2 +- .../customloottable/EliteCustomLootEntry.java | 9 +- .../customloottable/SharedLootTable.java | 1 - .../itemconstructor/EnchantmentGenerator.java | 68 +++--- .../itemconstructor/ItemQualityColorizer.java | 4 +- .../potioneffects/ElitePotionEffect.java | 17 +- .../potioneffects/custom/Saturation.java | 2 +- .../menus/InstancedDungeonBrowser.java | 3 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 3 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 2 +- .../elitemobs/mobconstructor/BossType.java | 8 + .../elitemobs/mobconstructor/CustomSpawn.java | 9 +- .../elitemobs/mobconstructor/EliteEntity.java | 7 +- .../PersistentObjectHandler.java | 2 +- .../custombosses/BossMusic.java | 4 +- .../custombosses/CustomBossMegaConsumer.java | 4 +- .../custombosses/CustomBossTrail.java | 3 +- .../custombosses/RegionalBossEntity.java | 16 +- .../transitiveblocks/TransitiveBossBlock.java | 3 - .../mobdata/aggressivemobs/EliteBee.java | 4 - .../mobdata/aggressivemobs/EliteGoat.java | 4 - .../mobdata/aggressivemobs/EliteHoglin.java | 4 - .../mobdata/aggressivemobs/ElitePiglin.java | 4 - .../aggressivemobs/ElitePiglinBrute.java | 4 - .../mobdata/aggressivemobs/EliteWarden.java | 4 - .../mobdata/aggressivemobs/EliteZoglin.java | 4 - .../aggressivemobs/EliteZombifiedPiglin.java | 4 - .../NaturalMobSpawnEventHandler.java | 18 +- .../elitemobs/npcs/NPCDamageEvent.java | 2 +- .../elitemobs/pathfinding/Navigation.java | 24 +- .../playerdata/statusscreen/GearPage.java | 21 +- .../playerdata/statusscreen/StatsPage.java | 2 +- .../elitemobs/powers/EnderDragonTornado.java | 2 +- .../powers/InvulnerabilityArrow.java | 2 +- .../powers/InvulnerabilityFallDamage.java | 2 +- .../powers/InvulnerabilityFireworks.java | 2 +- .../magmaguy/elitemobs/powers/SpiritWalk.java | 2 +- .../com/magmaguy/elitemobs/powers/Taunt.java | 2 +- .../powers/meta/CustomSummonPower.java | 14 +- .../elitemobs/powers/scripts/EliteScript.java | 3 +- .../powers/scripts/ScriptAction.java | 2 - .../powers/scripts/ScriptActionData.java | 4 +- .../powers/scripts/ScriptConditions.java | 2 +- .../powers/scripts/ScriptParticles.java | 12 +- .../powers/scripts/ScriptRelativeVector.java | 6 +- .../elitemobs/powers/scripts/ScriptZone.java | 12 +- .../caching/ScriptActionBlueprint.java | 18 +- .../caching/ScriptConditionsBlueprint.java | 6 +- .../caching/ScriptParticlesBlueprint.java | 6 +- .../ScriptRelativeVectorBlueprint.java | 3 +- .../powerstances/MajorPowerPowerStance.java | 4 +- .../powerstances/MinorPowerPowerStance.java | 4 +- .../powerstances/VisualEffectObfuscator.java | 2 +- .../elitemobs/quests/DynamicQuest.java | 2 +- .../elitemobs/quests/QuestTracking.java | 3 +- .../custommodels/CustomModelInterface.java | 20 +- .../freeminecraftmodels/CustomModelFMM.java | 2 +- .../thirdparty/mythicmobs/MythicMobs.java | 2 +- .../mythicmobs/MythicMobsInterface.java | 4 +- .../placeholderapi/Placeholders.java | 2 +- .../thirdparty/worldedit/WorldEditUtils.java | 75 ------- .../worldguard/WorldGuardCompatibility.java | 78 ++----- .../WorldGuardExplosionBlockDamageFlag.java | 8 +- .../treasurechest/TreasureChest.java | 5 +- .../elitemobs/utils/DebugBlockLocation.java | 8 +- .../elitemobs/utils/WorldInstantiator.java | 2 +- .../elitemobs/utils/shapes/Cuboid.java | 4 +- .../versionnotifier/VersionChecker.java | 2 +- .../magmaguy/elitemobs/wormhole/Wormhole.java | 2 +- .../elitemobs/wormhole/WormholeEntry.java | 3 - src/main/resources/plugin.yml | 3 +- 324 files changed, 969 insertions(+), 1760 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TreasureChestCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{AirShipMinidungeon.java => AirShipMinidungeon.off} (99%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{CatacombsLair.java => CatacombsLair.off} (96%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{ColosseumLair.java => ColosseumLair.off} (97%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{DarkCathedralLair.java => DarkCathedralLair.off} (96%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{PirateShipMinidungeon.java => PirateShipMinidungeon.off} (98%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{RuinsLair.java => RuinsLair.off} (96%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{VampireManorMinidungeon.java => VampireManorMinidungeon.off} (99%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{WaterWorkerConfig.java => AquaAffinityConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DamageArthropodsConfig.java => BaneOfArthropodsConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionExplosionsConfig.java => BlastProtectionConfig.java} (64%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/BreachConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/DensityConfig.java rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DigSpeedConfig.java => EfficiencyConfig.java} (69%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionFallConfig.java => FeatherFallingConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionFireConfig.java => FireProtectionConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowFireConfig.java => FlameConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{LootBonusBlocksConfig.java => FortuneConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowInfiniteConfig.java => InfinityConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{LootBonusMobsConfig.java => LootingConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{LuckConfig.java => LuckOfTheSeaConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowDamageConfig.java => PowerConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionProjectileConfig.java => ProjectileProtectionConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ProtectionEnvironmentalConfig.java => ProtectionConfig.java} (63%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{ArrowKnockbackConfig.java => PunchConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{OxygenConfig.java => RespirationConfig.java} (68%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DamageAllConfig.java => SharpnessConfig.java} (69%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DamageUndeadConfig.java => SmiteConfig.java} (67%) rename src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/{DurabilityConfig.java => UnbreakingConfig.java} (69%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/enchantments/premade/WindBurstConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBoggedConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{FastDiggingConfig.java => HasteConfig.java} (64%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/InfestedConfig.java rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{HarmConfig.java => InstantDamageConfig.java} (64%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{HealConfig.java => InstantHealthConfig.java} (64%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{JumpConfig.java => JumpBoostConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{SlowDiggingConfig.java => MiningFatigueConfig.java} (64%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{ConfusionConfig.java => NauseaConfig.java} (65%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/OozingConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/RaidOmenConfig.java rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{DamageResistanceConfig.java => ResistanceConfig.java} (62%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{SlowConfig.java => SlownessConfig.java} (66%) rename src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/{IncreaseDamageConfig.java => StrengthConfig.java} (63%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/TrialOmenConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WeavingConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/potioneffects/premade/WindChargedConfig.java rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGAirshipWormholeConfig.java => AGAirshipWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGCatacombsWormholeConfig.java => AGCatacombsWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGColosseumWormholeConfig.java => AGColosseumWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGDarkCathedralWormholeConfig.java => AGDarkCathedralWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGRuinsWormholeConfig.java => AGRuinsWormholeConfig.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/wormholes/premade/{AGVampireManorWormholeConfig.java => AGVampireManorWormholeConfig.off} (100%) delete mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/SchematicDungeonPackage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/SchematicPackage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/nightmaremodeworld/DaylightWatchdog.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/EliteChunk.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/Grid.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/gamemodes/zoneworld/ZoneWarner.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/thirdparty/worldedit/WorldEditUtils.java diff --git a/build.gradle b/build.gradle index f93122c7f..512568176 100644 --- a/build.gradle +++ b/build.gradle @@ -82,8 +82,6 @@ dependencies { implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //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 diff --git a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java index ef5b50091..1916f0a58 100644 --- a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java @@ -19,7 +19,7 @@ public static String convert(String string) { } public static List convert(List list) { - if (list == null)return new ArrayList<>(); + if (list == null) return new ArrayList<>(); List convertedList = new ArrayList<>(); for (Object value : list) convertedList.add(convert(value + "")); diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index eb42590a0..f435ce4fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -32,8 +32,6 @@ 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; @@ -79,8 +77,6 @@ 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; @@ -123,12 +119,6 @@ public static void worldScanner() { for (World world : Bukkit.getWorlds()) if (ValidWorldsConfig.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); - } } } @@ -341,8 +331,6 @@ public void onDisable() { 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..."); @@ -391,7 +379,6 @@ public void onDisable() { Repeating tasks that run as long as the server is on */ private void launchRunnables() { - if (!zoneBasedSpawningWorlds.isEmpty()) Grid.initializeGrid(); //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 75a115e83..28ece61c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -19,8 +19,6 @@ 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; @@ -105,9 +103,8 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDisenchantment()) register(new ItemDisenchantPrevention()); - if (!VersionChecker.serverVersionOlderThan(15, 2)) - if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) - register(new PreventUpgradeDiamondToNetherite()); + if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) + register(new PreventUpgradeDiamondToNetherite()); //Mob damage register(new EliteMobGenericDamagedHandler()); @@ -213,7 +210,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()); @@ -265,8 +261,7 @@ public static void registerEvents() { register(new LootMenu.LootMenuEvents()); //Minecraft behavior canceller - if (!VersionChecker.serverVersionOlderThan(16, 0)) - register(new PreventEliteBeeHiveEnter()); + register(new PreventEliteBeeHiveEnter()); register(new EnderDragonUnstuck()); if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities()) register(new VanillaReinforcementsCanceller()); @@ -286,9 +281,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()); @@ -367,10 +360,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/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 5f3b3b49e..2f8f5258b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -16,7 +16,6 @@ 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -139,7 +138,7 @@ private static double secondaryEnchantmentDamageIncrease(Player player, LivingEn 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.SMITE.getMaxLevel(); if (level < 1) return 0D; @@ -258,7 +257,7 @@ else if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE)) private void runAntiexploit(EliteEntity eliteEntity, EntityDamageByEntityEvent event, EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent) { 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/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 a72c2fd35..a6457ac7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java +++ b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java @@ -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/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index fb9391902..a3566e5c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; public class LightningImmunity implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onLightningStrike(EntityDamageByEntityEvent event){ + @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; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index 631dbe4b2..c25f8cdc5 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.items.ItemTagger; import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; 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/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/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index a53f51b46..0872c5094 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java @@ -64,7 +64,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); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index c87210ed9..43bce68e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -257,30 +257,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde 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)), diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java index 13f259eb9..eb0b29814 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java @@ -2,8 +2,6 @@ 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 org.bukkit.Location; @@ -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/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java index d3a5658be..9b4681e3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -32,7 +32,7 @@ public static void spawnEliteEntityTypeCommand(Player player, EntityType entityT EliteEntity eliteEntity = new EliteEntity(); eliteEntity.setLevel(level); - if (powers.isPresent()){ + if (powers.isPresent()) { HashSet mobPowers = getPowers(powers.get(), player); eliteEntity.applyPowers(mobPowers); } else { @@ -152,20 +152,19 @@ 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; } 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 9b2619d06..58e975378 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -57,7 +57,6 @@ public static void get(Player player, int tierLevel) { new EliteItemLore(bow, false); - player.getInventory().addItem(helmet); player.getInventory().addItem(chestplate); player.getInventory().addItem(leggings); @@ -69,7 +68,7 @@ public static void get(Player player, int tierLevel) { } - private static void addDurability(ItemStack itemStack){ + private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); HashMap enchantmentIntegerHashMap = new HashMap<>(); enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); 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..3ff071457 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.SchematicPackage; import com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -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/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java index cc533cde0..cb8d145b0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java @@ -2,11 +2,8 @@ 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; @@ -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/setup/SetupMenu.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java index d8aa49803..29e3b0689 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -7,7 +7,6 @@ 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; @@ -132,10 +131,7 @@ private static void dungeonButtonInteraction(Player player, SetupMenu setupMenu, return; } if (!emPackage.isInstalled()) - if (emPackage instanceof SchematicPackage) - emPackage.install(player, true); - else emPackage.install(player); - else if (emPackage instanceof SchematicPackage) emPackage.uninstall(player); + 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!"); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 82b145e0d..64093b316 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -5,7 +5,6 @@ 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 org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -80,7 +79,6 @@ public static void fileSaverOnlyDefaults(FileConfiguration fileConfiguration, Fi } private static void setComments(FileConfiguration fileConfiguration, String key, List comments) { - if (VersionChecker.serverVersionOlderThan(18, 2)) return; fileConfiguration.setComments(key, comments); } @@ -196,13 +194,13 @@ public static ItemStack setItemStack(File file, FileConfiguration fileConfigurat } 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."); } 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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java index 218dcd24b..22fbef2d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -54,14 +54,14 @@ public static void createResourcePack(CommandSender commandSender) { 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")); + 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")); + 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!"); + 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; @@ -175,7 +175,7 @@ private static void copyFile(File file, Path targetPath) { 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!"); + 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!"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java index 87f384a23..1848717fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java @@ -169,7 +169,7 @@ private void initialize(File file) { 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/"); + new WarningMessage("You can check the file validity by through YAML linters, such as the one at https://www.yamllint.com/"); ex.printStackTrace(); return; } @@ -184,8 +184,8 @@ private void initialize(File file) { //Store for use by the plugin addCustomConfigFields(file.getName(), instancedCustomConfigFields); } catch (Exception ex) { - new WarningMessage("Bad constructor for file " + file.getName()); - ex.printStackTrace(); + new WarningMessage("Bad constructor for file " + file.getName() + " ! You should probably delete that file."); +// ex.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index 61c212daf..bb73aa64f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -193,12 +193,11 @@ 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); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index a5a29b2bb..9aef67a34 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -205,17 +204,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."), diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java index 0aa4c0dad..53be17872 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java @@ -13,6 +13,7 @@ public class ItemUpgradeSystemConfig { private static double enchantedBookChance; @Getter private static double scrapChance; + private ItemUpgradeSystemConfig() { } 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..d71f4b62e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -0,0 +1,76 @@ +package com.magmaguy.elitemobs.config; + +import java.util.Locale; + +public class LegacyValueConverter { + private LegacyValueConverter() { + } + + public static String parseEnchantment(String materialName) { + switch (materialName.toUpperCase(Locale.ROOT)) { + case "POWER": + return "POWER"; + case "ARROW_FIRE": + return "FLAME"; + case "ARROW_INFINITE": + return "INFINITY"; + case "ARROW_KNOCKBACK": + return "PUNCH"; + case "BANE_OF_ARTHROPODS": + return "BANE_OF_ARTHROPODS"; + case "SMITE": + return "SMITE"; + case "EFFICIENCY": + return "EFFICIENCY"; + case "DURABILITY": + return "UNBREAKING"; + case "FORTUNE": + 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 "FEATHER_FALLING": + return "FEATHER_FALLING"; + case "FIRE_PROTECTION": + return "FIRE_PROTECTION"; + case "PROJECTILE_PROTECTION": + return "PROJECTILE_PROTECTION"; + case "AQUA_AFFINITY": + 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; + } + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java index dc58e0f94..01b60cec2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -6,7 +6,8 @@ import java.util.List; public class ModelsConfig { - private ModelsConfig(){} + private ModelsConfig() { + } public static String treasureChest; diff --git a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java index 68e14d13e..90a6d68a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -5,7 +5,6 @@ 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 lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -282,15 +281,13 @@ private static List setEntityTypes(FileConfiguration fileConfigurati 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); - } + 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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java index cdb862561..1a077e54a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java @@ -82,7 +82,7 @@ public static void toggleEliteMobsResourcePackStatus(boolean status) { } } - public static void toggleForceResourcePack(boolean status){ + public static void toggleForceResourcePack(boolean status) { fileConfiguration.set("forceResourcePack", status); forceResourcePack = status; } diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index cfdacdc37..2afad9dc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.items.customitems.CustomItem; import com.magmaguy.elitemobs.utils.WarningMessage; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import lombok.Getter; import org.bukkit.configuration.file.FileConfiguration; @@ -108,11 +107,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"), diff --git a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java index 9d4cf42ca..e93f52dbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -14,10 +14,6 @@ public class ValidWorldsConfig { @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; @@ -37,17 +33,6 @@ public static void initializeConfig() { 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); } 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..898bc3ae7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -6,6 +6,7 @@ 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; @@ -214,6 +215,8 @@ public class CustomBossesConfigFields extends CustomConfigFields implements Cust private boolean neutral = false; @Getter private String onKillMessage; + @Getter + private BossType bossType = BossType.NORMAL; /** * Creates a new default pre-made Custom Boss. The boss is further customized through a builder pattern. @@ -382,6 +385,13 @@ 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) { + new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); + } } public boolean isCustomModelExists() { 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 619e3e933..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,12 +9,10 @@ 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); 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 352f889a2..d9ded5199 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,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; @@ -11,12 +10,10 @@ 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")); setUniqueLootList(Collections.singletonList("the_stinger.yml:1")); setTrails(Arrays.asList(Particle.LARGE_SMOKE.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..1a887fa97 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,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.Material; import org.bukkit.Particle; import org.bukkit.entity.EntityType; @@ -40,11 +39,10 @@ public TestCustomBossesConfig() { 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/TotemZombie1Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/TotemZombie1Boss.java index ea777cb8e..f23c6b3c0 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,13 +15,11 @@ public TotemZombie1Boss() { setPowers(Arrays.asList("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/WeaponsGoblinBoss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WeaponsGoblinBoss.java index e8e873678..4410a3ef6 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -18,14 +17,12 @@ 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")); setSpawnMessage("&cA Weapons Goblin has been sighted!"); 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..36f73b115 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -12,12 +11,10 @@ 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")); 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..19505489b 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -17,8 +16,7 @@ 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", "shield_wall.yml", 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..0c1b37520 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,8 +15,7 @@ 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", "flame_pyre.yml", 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..84cd323d2 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,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.Material; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; @@ -16,8 +15,7 @@ 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", "lightning_bolts.yml", 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/CustomItemsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java index aac25d720..2ceac6f6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java @@ -2,7 +2,9 @@ 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.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -83,5 +85,46 @@ 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(",")) { + new WarningMessage("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(",")) { + new WarningMessage("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; } } 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 ccfac6f38..722f4e7e8 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 36f4ced2f..af578aa61 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 c5af48d8d..e09906e3b 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 3d82b0ca9..18192d44d 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 1db6f4ca5..a760313e7 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/DwarvenGreedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java index 418e667b8..cd672c0c7 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 @@ -13,7 +13,7 @@ public DwarvenGreedConfig() { 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", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("FORTUNE,4", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/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/EnchantedBookArrowKnockbackConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookArrowKnockbackConfig.java index 9d8089859..c3bf2e7e3 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,7 +8,7 @@ import java.util.List; public class EnchantedBookArrowKnockbackConfig extends CustomItemsConfigFields { - public EnchantedBookArrowKnockbackConfig(){ + public EnchantedBookArrowKnockbackConfig() { super("enchanted_book_arrow_knockback", true, Material.BOOK, 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 84434f406..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,7 +8,7 @@ import java.util.List; public class EnchantedBookDurabilityConfig extends CustomItemsConfigFields { - public EnchantedBookDurabilityConfig(){ + public EnchantedBookDurabilityConfig() { super("enchanted_book_durability", true, Material.BOOK, 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..538c7bb27 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,7 +8,7 @@ import java.util.List; public class EnchantedBookFlameConfig extends CustomItemsConfigFields { - public EnchantedBookFlameConfig(){ + public EnchantedBookFlameConfig() { super("enchanted_book_arrow_fire", true, Material.BOOK, 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..a8e5d11f1 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,7 +8,7 @@ import java.util.List; public class EnchantedBookLuckConfig extends CustomItemsConfigFields { - public EnchantedBookLuckConfig(){ + public EnchantedBookLuckConfig() { super("enchanted_book_luck", true, Material.BOOK, 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 577f5e94b..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,7 +8,7 @@ import java.util.List; public class EnchantedBookProtectionEnvironmentalConfig extends CustomItemsConfigFields { - public EnchantedBookProtectionEnvironmentalConfig(){ + public EnchantedBookProtectionEnvironmentalConfig() { super("enchanted_book_protection_environmental", true, Material.BOOK, 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/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 5c7be6b92..051a010f0 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 @@ -14,7 +14,7 @@ public GoblinBallistaItem() { Material.CROSSBOW, "&8Goblin Ballista", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "QUICK_CHARGE,3", "MULTISHOT,1")); + setEnchantments(Arrays.asList("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 f0ff0e047..824e68316 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,7 +2,6 @@ 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; @@ -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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setMaterial(Material.NETHERITE_BOOTS); + setEnchantments(Arrays.asList("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 70aaec84d..a6d88b11b 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 0538c35be..4634322c2 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 1162ad080..0fdb800ea 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 897d3746b..c3e741248 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 b526d6687..1f909e5d8 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 @@ -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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 24d535131..1a6fb6613 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,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 1fae1f440..7e3eef251 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 7fa585ec3..58bebb3fc 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,5", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 98fb62745..4b9e48791 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 ac575075a..9a9dd33b4 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 ee4d9ad47..7439c8751 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 b74955375..111c8de7a 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 5862f2613..8ea25d6f4 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_boots", true, Material.NETHERITE_BOOTS, "&4Invictus Boots", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 260a1c496..cd9caded1 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_chestplate", true, Material.NETHERITE_CHESTPLATE, "&4Invictus Chestplate", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 7d3c68654..12beeca3a 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_helmet", true, Material.NETHERITE_HELMET, "&4Invictus Helmet", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 2d1efceec..5d0f114e3 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_leggings", true, Material.NETHERITE_LEGGINGS, "&4Invictus Leggings", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 8cc544edc..7b43f3e85 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_pickaxe", true, Material.NETHERITE_PICKAXE, "&4Invictus Pickaxe", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 ec619b4a5..dab2b0359 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_shovel", true, Material.NETHERITE_SHOVEL, "&4Invictus Shovel", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 d2adb23c1..72e8632ca 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_sword", true, Material.NETHERITE_SWORD, "&4Invictus Sword", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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/NovicesSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java index 4b042a516..08395d999 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 870774e8c..956586568 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 @@ -13,7 +13,7 @@ public TheFellerConfig() { 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", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("FORTUNE,4", "SILK_TOUCH,1", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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 7564e67c5..8ddacaf59 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 @@ -14,7 +14,7 @@ public TheStingerConfig() { Material.GOLDEN_SWORD, "&eThe Stinger", Arrays.asList("&aFloat like a butterfly,", "&asting like a bee!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "UNBREAKING,1", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("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/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index fa3e7ae30..8860d84b7 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 213a0facb..9284f9720 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 a702eeac8..bdb6b7cf0 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 f812d7d5b..b9c51e254 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 436c6204e..bfbadbfcd 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index ea50b9ea5..9fb072f1c 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); setPotionEffects(Arrays.asList("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 87c897770..cfc38d25e 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 @@ -13,8 +13,8 @@ public ZombieKingsAxeConfig() { 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", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "WATER_WORKER,5", "FLAMETHROWER,1")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", + "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); setPotionEffects(Arrays.asList("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/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/XmasQuest0Config.java b/src/main/java/com/magmaguy/elitemobs/config/customquests/premade/XmasQuest0Config.java index b0fb4797f..b7ee0e5d4 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 @@ -10,7 +10,7 @@ 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")), + Map.of("Objective1", Map.of("objectiveType", "FETCH_ITEM", "filename", "xmas_lost_present.yml", "amount", 10, "itemName", "Lost Present")), Arrays.asList( "filename=xmas_treat.yml:amount=10:chance=.3", "filename=xmas_treat_v2.yml:amount=1:chance=.3", 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..d6bd939a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -2,8 +2,6 @@ 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 lombok.Getter; @@ -49,7 +47,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; @@ -305,11 +302,6 @@ public DungeonPackagerConfigFields(String fileName, 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); @@ -337,14 +329,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); @@ -390,29 +374,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 +390,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/AirShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off similarity index 99% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off index 62ee849a6..16cea48dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.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; 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..e9dd5f275 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,14 +4,14 @@ 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, "&2[lvl 130] &6The Beasts Sanctuary", - Arrays.asList("&6Confront the beasts!"), + List.of("&6Confront the beasts!"), DiscordLinks.premiumMinidungeons, DungeonSizeCategory.LAIR, "em_beasts_sanctuary", 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 96% 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..be0c67159 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; 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 97% 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..1c259c713 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; 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.off similarity index 96% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off index 6ac37644d..4a620649a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.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; 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..256016c36 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, "&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", 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..81547090c 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge1() { super("enchantment_challenge_1_sanctum", false, "&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", 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..2fed2e58c 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, "&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", 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..f43af8bca 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge11() { super("enchantment_challenge_11_sanctum", false, "&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", 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..602b051e7 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge12() { super("enchantment_challenge_12_sanctum", false, "&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", 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..a7fe23b3a 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge13() { super("enchantment_challenge_13_sanctum", false, "&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", 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..b99263a7a 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge14() { super("enchantment_challenge_14_sanctum", false, "&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", 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..18ce21bbe 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge15() { super("enchantment_challenge_15_sanctum", false, "&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", 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..de617c2f4 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge16() { super("enchantment_challenge_16_sanctum", false, "&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", 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..f6454d65d 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge17() { super("enchantment_challenge_17_sanctum", false, "&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", 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..281594d1e 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge18() { super("enchantment_challenge_18_sanctum", false, "&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", 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..1eb473381 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge19() { super("enchantment_challenge_19_sanctum", false, "&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", 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..3ab15ee7a 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, "&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", 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..93db6c776 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge20() { super("enchantment_challenge_20_sanctum", false, "&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", 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..f1a315127 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, "&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", 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..468658c26 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, "&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", @@ -29,7 +28,7 @@ public EnchantmentChallenge4(){ "em_id_enchantment_challenge_4", 1); 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..7d651e30d 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, "&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", 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..9e9a723dd 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, "&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", 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..e314b3c84 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, "&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", 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..42a76e44b 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,7 +4,6 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public EnchantmentChallenge8() { super("enchantment_challenge_8_sanctum", false, "&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", 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..30c2dc208 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, "&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", 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..5f3ae29c8 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, "&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", 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..2b2ed7af9 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,14 +4,14 @@ 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, "&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", @@ -25,6 +25,6 @@ public KnightCastleLair() { "&fAssault the castle!", "&fNow leaving the castle!", "the_knight_castle" - ); + ); } } 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.off similarity index 98% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off index 431fbd020..8b11cfa7d 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.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; 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 96% 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..c7cd8aceb 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; 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..e8ffd7191 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,14 +4,14 @@ 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, "&2[lvl 140] &6The Steamworks", - Arrays.asList("&fA steampunk inspired lair!"), + List.of("&fA steampunk inspired lair!"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_steamworks_lair", 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..519fa12dd 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheBridgeSanctum extends DungeonPackagerConfigFields { - public TheBridgeSanctum(){ + public TheBridgeSanctum() { super("the_bridge_sanctum", false, "&2[lvl 025] &3The Bridge Sanctum", 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..e38f58c8c 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheCityDungeon extends DungeonPackagerConfigFields { - public TheCityDungeon(){ + public TheCityDungeon() { super("the_city_dungeon", false, "&2[lvl 030] &3The City Dungeon", 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..4fffed566 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheMinesDungeon extends DungeonPackagerConfigFields { - public TheMinesDungeon(){ + public TheMinesDungeon() { super("the_mines_dungeon", false, "&2[lvl 020] &3The Mines Dungeon", 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..76f06d123 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 @@ -9,7 +9,7 @@ import java.util.Map; public class TheNetherWastes extends DungeonPackagerConfigFields { - public TheNetherWastes(){ + public TheNetherWastes() { super("the_nether_wastes_dungeon", false, "&2[lvl 050] &3The Nether Wastes Dungeon", 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..b115b2f63 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 @@ -9,7 +9,7 @@ import java.util.Map; public class ThePalaceSanctum extends DungeonPackagerConfigFields { - public ThePalaceSanctum(){ + public ThePalaceSanctum() { super("the_palace_sanctum", false, "&2[lvl 030] &3The Palace Sanctum", 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..2e4c88416 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,14 +4,14 @@ 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, "&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", 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 99% 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..008a99de9 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; 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..16bd68c60 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,7 @@ package com.magmaguy.elitemobs.config.enchantments; import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -20,10 +21,15 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { + EnchantmentsConfigFields test = enchantments.get(string); + if (test == null) { + new WarningMessage("Failed to find enchant file " + string); + new Exception().printStackTrace(); + } return enchantments.get(string); } 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/premade/ArenaMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/ArenaMenuConfig.java index 47dce9098..90c0f330b 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 @@ -4,7 +4,6 @@ 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 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/CustomQuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java index 0e418cfe3..83d08f73b 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 @@ -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/PlayerStatusMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/PlayerStatusMenuConfig.java index 4a4aaaafe..bc487f6e2 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 @@ -5,7 +5,6 @@ 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 lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -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); @@ -406,30 +400,21 @@ public void processAdditionalFields() { ItemStackGenerator.generateItemStack(Material.DIAMOND_SWORD, "&4Damage: $damage", Arrays.asList("&fBase damage dealt to Elites.", - "&fBased on the level of your weapon!")),true); + "&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); + "&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", + Arrays.asList("&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); @@ -442,34 +427,22 @@ public void processAdditionalFields() { "&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", + 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); 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", @@ -478,7 +451,7 @@ public void processAdditionalFields() { Arrays.asList("&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", @@ -506,7 +479,7 @@ public void processAdditionalFields() { 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!", 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 8ef3f3b26..487606694 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -2,7 +2,6 @@ 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; @@ -47,7 +46,18 @@ public class MobPropertiesConfig { 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 EliteBreeze() + )); public static HashMap getMobProperties() { @@ -59,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/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/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java new file mode 100644 index 000000000..e89c9d654 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.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 EliteBreeze extends MobPropertiesConfigFields { + public EliteBreeze() { + super("elite_breeze", + EntityType.BOGGED, + 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/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/npcs/premade/BinderOfWorldsNPCConfig.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/premade/BinderOfWorldsNPCConfig.java index d388d2838..774e587bd 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 @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.List; public class BinderOfWorldsNPCConfig extends NPCsConfigFields { public BinderOfWorldsNPCConfig() { @@ -15,7 +16,7 @@ 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( "The things I've seen...\\nYou wouldn't believe it.", 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/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/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/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/potioneffects/PotionEffectsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java index b517caa87..92191d0e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/potioneffects/PotionEffectsConfig.java @@ -14,34 +14,40 @@ public class PotionEffectsConfig { 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) { 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/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/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/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 9c9270745..49b1dd578 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -72,7 +72,7 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - new SchematicDungeonPackage(dungeonPackagerConfigFields); + new WarningMessage("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; } } else { @@ -88,7 +88,7 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldDungeonPackage(dungeonPackagerConfigFields); break; case SCHEMATIC: - new SchematicDungeonPackage(dungeonPackagerConfigFields); + new WarningMessage("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; } } 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/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 006f73e15..7df8ac857 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -8,7 +8,6 @@ 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 org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -153,8 +152,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/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/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/arena/ArenaInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java index aeddbb268..d05ed83d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -262,9 +262,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 + 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!"); } } } 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..bd09fa72a 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -74,7 +74,7 @@ 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); + }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -250,7 +250,7 @@ public void run() { }.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 + }.runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } private void setDifficulty(String difficultyName) { diff --git a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 28e002484..22c49b336 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -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..7513c9976 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -54,10 +54,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; } 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 e79b2a59f..7e3553b1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/EarthquakeEnchantment.java @@ -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/customloottable/CurrencyCustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java index 1cdd85ce5..4816fed96 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java @@ -74,14 +74,17 @@ 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); + case "currencyamount" -> + currencyAmount = MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename); default -> new WarningMessage("Failed to read custom loot option " + key + " in " + configFilename); } } 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..a19a3766f 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CustomLootTable.java @@ -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..8423326d4 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/EliteCustomLootEntry.java @@ -48,9 +48,12 @@ 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); } 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..506bc5baf 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customloottable/SharedLootTable.java @@ -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 48f41b6c8..3af70a168 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,9 +71,9 @@ 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("SHARPNESS")); + validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("SMITE")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); @@ -83,7 +83,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case BOW: - validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); + validEnchantments.putAll(validateEnchantments("POWER")); validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); @@ -92,7 +92,7 @@ public static HashMap generateEnchantments(double itemTier 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")); @@ -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("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("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,13 +137,13 @@ 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("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")); } @@ -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("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: @@ -177,13 +177,13 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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: @@ -193,9 +193,9 @@ public static HashMap generateEnchantments(double itemTier 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; @@ -208,9 +208,9 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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; @@ -223,10 +223,10 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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")); @@ -241,7 +241,7 @@ public static HashMap generateEnchantments(double itemTier 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("UNBREAKING")); 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 be472ba44..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); } 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..a591776c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -2,6 +2,8 @@ import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfig; import com.magmaguy.elitemobs.utils.WarningMessage; +import org.bukkit.NamespacedKey; +import org.bukkit.Registry; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -18,10 +20,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", stringObject[0].toLowerCase(Locale.ROOT))); + if (potionEffectType == null) { + new WarningMessage("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,8 +45,8 @@ 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) { 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/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index 3c4f8869f..fb0193d01 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -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..2fc5c4b40 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -213,7 +213,8 @@ private void handleBottomInventory(InventoryClickEvent event) { moveOneItemUp(ENCHANTED_BOOK_SLOT, event); else //Make sure enchant books themselves can't be enchanted - return; + { + } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && event.getView().getTopInventory().getItem(LUCKY_TICKET_SLOT) == null) { moveOneItemUp(LUCKY_TICKET_SLOT, event); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index 92cdcf069..9193dfbd8 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -173,7 +173,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); 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..98bde5175 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -0,0 +1,8 @@ +package com.magmaguy.elitemobs.mobconstructor; + +public enum BossType { + NORMAL, + MINIBOSS, + BOSS, + 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..54233739c 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -15,7 +15,6 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.*; @@ -241,7 +240,8 @@ 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 (Boolean.FALSE.equals(playerLocation.getWorld().getGameRuleValue(GameRule.DO_MOB_SPAWNING))) + continue; if (!customSpawnConfigFields.getValidWorlds().isEmpty()) if (!customSpawnConfigFields.getValidWorlds().contains(playerLocation.getWorld())) continue; @@ -275,10 +275,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..879e9c211 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -23,7 +23,6 @@ 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 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); @@ -283,11 +282,11 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR 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); } 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/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java index a31a596d6..caefe80e1 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java @@ -115,13 +115,13 @@ public void run() { cancel(); return; } - player.playSound(player.getLocation(), name, 1f, 1f); + 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); + player.playSound(player.getLocation(), name, 1f, 1f); songTask = new BukkitRunnable() { @Override public void run() { 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..9cfa6b5cd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java @@ -173,8 +173,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); 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 4ea55665d..a18650c41 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -5,7 +5,6 @@ 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 org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; @@ -49,7 +48,7 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - if (!VersionChecker.serverVersionOlderThan(18, 0) && particle.equals(Particle.BLOCK_MARKER)) + if (particle.equals(Particle.BLOCK_MARKER)) return; bukkitTasks.add(new BukkitRunnable() { @Override 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..f78da9a09 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; @@ -21,8 +20,6 @@ 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; @@ -310,21 +307,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/TransitiveBossBlock.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBossBlock.java index 193a30a5a..a8f11a3de 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,7 +2,6 @@ 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; @@ -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(); 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/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/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/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/mobspawning/NaturalMobSpawnEventHandler.java b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java index c3b1f21f1..3337129c3 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 || @@ -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/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index b6b8d4ae3..178143ea8 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -37,18 +37,18 @@ 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(); } @EventHandler(ignoreCancelled = true) 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/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/powers/EnderDragonTornado.java b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java index 270750255..2275bd811 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/EnderDragonTornado.java @@ -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/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/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/Taunt.java b/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java index 60c8be7aa..0f440e84d 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/Taunt.java @@ -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/meta/CustomSummonPower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java index 5cf702d56..ba34e1394 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -9,7 +9,6 @@ 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; @@ -655,18 +654,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/scripts/EliteScript.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java index a7170f9a0..e93ffe173 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java @@ -89,7 +89,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..2de641a7a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -14,7 +14,6 @@ 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 lombok.Getter; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; @@ -354,7 +353,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()))); } 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..decfb2c18 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java @@ -82,7 +82,7 @@ public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, Scri } //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 +94,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..b6688cadb 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java @@ -21,7 +21,7 @@ public class ScriptConditions { private final ScriptConditionsBlueprint conditionsBlueprint; private ScriptTargets scriptTargets = null; - private EliteScript eliteScript; + private final EliteScript eliteScript; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; 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 23b26b065..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,11 +36,11 @@ 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(); } @@ -79,7 +79,7 @@ else if (particleBlueprint.getParticle().equals(Particle.DUST_COLOR_TRANSITION)) particleBlueprint.getToBlue()), 1)); else if (particleBlueprint.getParticle().equals(Particle.WITCH) - //|| particleBlueprint.getParticle().equals(Particle.WITCH_AMBIENT) todo: 1.20.6 changed this name + //|| 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/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index b4c629237..ded2378a3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -58,10 +58,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<>(); }; } 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..783949501 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 @@ -144,10 +144,12 @@ protected void processKeyAndValue(String key, Object value) { } 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 +164,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 +188,12 @@ 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); + default -> + new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } 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..9efc277c1 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 @@ -64,9 +64,11 @@ 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); 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..a0a15f694 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 @@ -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 -> + new WarningMessage("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..f8c1b3884 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 @@ -55,7 +55,8 @@ 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 -> + new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } } 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/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..5206a6d1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -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/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/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/placeholderapi/Placeholders.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java index 6ce153d20..09784d6f8 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java @@ -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..62b0b0f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,11 +1,9 @@ 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.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.domains.DefaultDomain; import com.sk89q.worldguard.protection.flags.Flags; @@ -15,7 +13,6 @@ 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; @@ -27,28 +24,28 @@ 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() { @@ -309,35 +306,4 @@ public static void protectMinidungeonArea(ProtectedRegion protectedRegion) { 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!"); - } - } - } 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..ccdc6a0f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -116,9 +116,8 @@ public void doInteraction(Player player) { if (playerIsInCooldown(player)) { 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); diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index f63ce4e53..739884148 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.util.Vector; @@ -8,11 +7,8 @@ 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, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); - else - location.getWorld().spawnParticle(Particle.EXPLOSION, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); + //todo: restore barrier blocks here, block data was required for the snapshot version of this + location.getWorld().spawnParticle(Particle.BLOCK_MARKER, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); } } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java b/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java index 3d44cd118..3ac0c0705 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/WorldInstantiator.java @@ -69,7 +69,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/shapes/Cuboid.java b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java index 2f682e76d..e8530e76e 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java @@ -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()); + x / 2D + centerLocation.getBlockX(), y / 2D + centerLocation.getBlockY(), z / 2D + centerLocation.getBlockZ(), + -x / 2D + centerLocation.getBlockX(), centerLocation.getBlockY(), -z / 2D + centerLocation.getBlockZ()); return livingEntity.getBoundingBox().overlaps(boundingBox); } diff --git a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index e59c8a85d..6c779e0b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -25,7 +25,7 @@ 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 VersionChecker() { } diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java index af790ddfe..7a71d00db 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java @@ -30,7 +30,7 @@ public class Wormhole { 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..bb4444467 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java @@ -3,7 +3,6 @@ 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; @@ -79,8 +78,6 @@ private Location getDungeonLocation() { 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; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f3798c721..8d46b9225 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0 +version: 9.0.0-SNAPSHOT-1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -11,7 +11,6 @@ softdepend: - HolographicDisplays - DiscordSRV - LibsDisguises -- WorldEdit - ModelEngine - Geyser-Spigot - MythicMobs From 3bc61f9937d341987828df3e3e533ad684036cec Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 20 Jun 2024 16:01:32 +0100 Subject: [PATCH 27/78] EliteMobs 9.0.0-SNAPSHOT-2 - [New] Added Sounds.yml - [New] Quests, rank ups and opening treasure chests now have custom sounds in the resource pack - [New] Debug items now come with higher durability - [New] Dungeons all now install by default when imported, no longer requiring admins to run /em setup to install them - [New] Added compatibility layer to allow old transitive blocks to be interpreted correctly by their new minecraft values - [Fix] Fixed bug related to debug particles - [Removal] Removed dungeonLocationType from the dungeon packager, it was a legacy value - [Tweak] Minor refactors Signed-off-by: MagmaGuy --- .../com/magmaguy/elitemobs/EliteMobs.java | 4 + .../magmaguy/elitemobs/EventsRegistrer.java | 2 + .../GuildRankMenuHandler.java | 3 + .../elitemobs/api/QuestAcceptEvent.java | 9 +- .../elitemobs/api/QuestCompleteEvent.java | 3 + .../elitemobs/api/QuestLeaveEvent.java | 3 + .../elitemobs/api/QuestProgressionEvent.java | 2 + .../AlternativeDurabilityLoss.java | 3 +- .../elitemobs/commands/AdminCommands.java | 32 +- .../elitemobs/commands/ArenaCommands.java | 1 + .../elitemobs/commands/SetupHandler.java | 51 --- .../commands/admin/GetTierCommand.java | 6 +- .../elitemobs/commands/setup/SetupMenu.java | 135 +++---- .../elitemobs/config/AntiExploitConfig.java | 24 +- .../config/LegacyValueConverter.java | 6 + .../elitemobs/config/SoundsConfig.java | 14 +- .../CustomQuestsConfigFields.java | 6 - .../DungeonPackagerConfigFields.java | 128 +------ .../premade/AirShipMinidungeon.off | 2 +- .../premade/BeastsSanctuaryLair.java | 5 +- .../premade/BinderOfWorldsSanctum.java | 5 +- .../premade/BoneMonasteryDungeon.java | 5 +- .../dungeonpackager/premade/CatacombsLair.off | 2 +- .../dungeonpackager/premade/ColosseumLair.off | 2 +- .../premade/CraftenminesLabSanctum.java | 5 +- .../premade/DarkCathedralLair.off | 2 +- .../premade/DarkSpireMinidungeon.java | 5 +- .../premade/DiamondLeagueArena.java | 5 +- .../premade/EnchantmentChallenge1.java | 5 +- .../premade/EnchantmentChallenge10.java | 5 +- .../premade/EnchantmentChallenge11.java | 5 +- .../premade/EnchantmentChallenge12.java | 5 +- .../premade/EnchantmentChallenge13.java | 5 +- .../premade/EnchantmentChallenge14.java | 5 +- .../premade/EnchantmentChallenge15.java | 5 +- .../premade/EnchantmentChallenge16.java | 5 +- .../premade/EnchantmentChallenge17.java | 5 +- .../premade/EnchantmentChallenge18.java | 5 +- .../premade/EnchantmentChallenge19.java | 5 +- .../premade/EnchantmentChallenge2.java | 5 +- .../premade/EnchantmentChallenge20.java | 5 +- .../premade/EnchantmentChallenge3.java | 5 +- .../premade/EnchantmentChallenge4.java | 5 +- .../premade/EnchantmentChallenge5.java | 5 +- .../premade/EnchantmentChallenge6.java | 5 +- .../premade/EnchantmentChallenge7.java | 5 +- .../premade/EnchantmentChallenge8.java | 5 +- .../premade/EnchantmentChallenge9.java | 5 +- .../premade/FireworksLair.java | 5 +- .../premade/FrostPalaceSanctum.java | 5 +- .../premade/HallosseumLair.java | 5 +- .../premade/InvasionMinidungeon.java | 5 +- .../premade/IronLeagueArena.java | 5 +- .../premade/KnightCastleLair.java | 6 +- .../premade/NorthPoleMinidungeon.java | 5 +- .../premade/OasisAdventure.java | 5 +- .../premade/OasisPyramidSanctum.java | 5 +- .../premade/PirateShipMinidungeon.off | 2 +- .../premade/PrimisAdventure.java | 5 +- .../premade/PrimisBloodTempleSanctum.java | 5 +- .../premade/PrimisGladiusInvasionDungeon.java | 5 +- .../dungeonpackager/premade/RuinsLair.off | 2 +- .../premade/SewersMinidungeon.java | 5 +- .../ShadowOfTheBinderOfWorldsLair.java | 5 +- .../premade/SteamworksLair.java | 5 +- .../premade/TheBridgeSanctum.java | 5 +- .../premade/TheCaveSanctum.java | 5 +- .../premade/TheCityDungeon.java | 5 +- .../premade/TheClimbDungeon.java | 5 +- .../premade/TheDeepMinesDungeon.java | 5 +- .../premade/TheMinesDungeon.java | 5 +- .../premade/TheNetherWastes.java | 5 +- .../premade/ThePalaceSanctum.java | 5 +- .../premade/TheQuarryDungeon.java | 5 +- .../premade/UnderGroveLair.java | 5 +- .../premade/VampireManorMinidungeon.off | 2 +- .../wormholes/WormholeConfigFields.java | 2 +- .../elitemobs/dungeons/DungeonProtector.java | 96 +++++ .../elitemobs/dungeons/EMPackage.java | 16 - .../elitemobs/dungeons/EliteMobsWorld.java | 43 +++ .../dungeons/WorldDungeonPackage.java | 8 +- .../elitemobs/dungeons/WorldPackage.java | 3 +- .../dungeons/utility/DungeonUtils.java | 14 +- .../elitemobs/events/ActionEvent.java | 4 +- .../instanced/dungeons/DungeonInstance.java | 7 +- .../transitiveblocks/TransitiveBlock.java | 3 +- .../worldguard/WorldGuardCompatibility.java | 335 +++++++++--------- .../treasurechest/TreasureChest.java | 3 + .../elitemobs/utils/DebugBlockLocation.java | 11 +- .../elitemobs/worlds/CustomWorldLoading.java | 3 + src/main/resources/plugin.yml | 2 +- 91 files changed, 617 insertions(+), 635 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java create mode 100644 src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f435ce4fe..deb362c9c 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -26,6 +26,7 @@ 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; @@ -113,6 +114,7 @@ public static void initializeConfigs() { //SoundsConfig.initializeConfig(); //ModelsConfig.initializeConfig(); DungeonsConfig.initializeConfig(); + SoundsConfig.initializeConfig(); } public static void worldScanner() { @@ -368,6 +370,8 @@ public void onDisable() { ProceduralShopMenu.shutdown(); + EliteMobsWorld.shutdown(); + //save cached data Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); PlayerData.closeConnection(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 28ece61c1..d691fb16a 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -16,6 +16,7 @@ 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; @@ -350,6 +351,7 @@ public static void registerEvents() { register(new WorldGuardDungeonFlag()); register(new WorldGuardExplosionBlockDamageFlag()); } + register(new DungeonProtector()); register(new EntityTransformHandler()); register(new EliteBlazeWaterDamagePrevention()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 9c7724ecd..913756e3a 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -4,6 +4,7 @@ import com.magmaguy.elitemobs.config.AdventurersGuildConfig; 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; @@ -61,6 +62,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 +96,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); } /** diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java index 3ed1bbf62..03317ad67 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java @@ -2,6 +2,7 @@ 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; @@ -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/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index c0d03fbb8..68669c69c 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -65,8 +65,9 @@ public static void doDurabilityLoss(Player player) { if (ItemSettingsConfig.isPreventEliteItemsFromBreaking()) { damageable.setDamage(maxDurability - 1); itemStack.setItemMeta(damageable); - } else + } else { itemStack.setAmount(0); + } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index 43bce68e8..fadb018cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -90,34 +90,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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); @@ -697,8 +669,8 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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()); + if (eliteEntity instanceof CustomBossEntity customBossEntity) { + customBossEntity.getBossTrace().postLog((Player) commandContext.getSender()); return; } })); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java index 9a1c4cd86..5179f8289 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; public class ArenaCommands { + private 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/SetupHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java index 190fb6ea4..0b5f635b7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java @@ -1,12 +1,7 @@ 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 { @@ -19,50 +14,4 @@ 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 58e975378..a6309b02e 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() { } @@ -70,9 +68,7 @@ public static void get(Player player, int tierLevel) { private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); - HashMap enchantmentIntegerHashMap = new HashMap<>(); - enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); - ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); + itemMeta.addEnchant(Enchantment.UNBREAKING, 5, true); itemStack.setItemMeta(itemMeta); } 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 29e3b0689..17cc70b34 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -7,8 +7,10 @@ import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.*; +import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.SpigotMessage; import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; @@ -27,20 +29,19 @@ 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<>(); + private final int previousIcon = 27; + Inventory inventory; + Player player; 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; HashMap minidungeonHashMap = new HashMap<>(); + boolean adventurersGuildIsDownloaded = false; @Getter private int currentPage = 1; - boolean adventurersGuildIsDownloaded = false; public SetupMenu(Player player) { this.inventory = Bukkit.createInventory(player, 54, "Setup menu"); @@ -66,53 +67,6 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup } } - private void redrawMenu(int page, Inventory inventory) { - currentPage = page; - setupMenus.remove(inventory); - this.inventory = inventory; - inventory.clear(); - //reserve resource pack status - customResourcePackStatus(); - //reserve adventurer's guild - adventurersGuildWorldStatus(); - //iterate through dungeons - dungeonStatuses(); - //Set icons - addNavigationElements(); - player.openInventory(inventory); - setupMenus.put(inventory, this); - } - - private void addNavigationElements() { - ItemStack infoButton = GetLootMenuConfig.infoItem; - List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:", - "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy", - "&62) &fPut content in the &2imports &ffolder of EliteMobs", - "&63) &fDo &2/em reload", - "&64) &fDo &2/em setup", - "&65) &fClick on &eyellow &ficons to install!", - "Click to get more info!")); - ItemMeta itemMeta = infoButton.getItemMeta(); - itemMeta.setLore(lore); - infoButton.setItemMeta(itemMeta); - inventory.setItem(infoIcon, infoButton); - - ItemStack previousButton = GetLootMenuConfig.previousLootItem; - ItemMeta previousButtonMeta = previousButton.getItemMeta(); - previousButtonMeta.setDisplayName("Previous page"); - previousButton.setItemMeta(previousButtonMeta); - if (currentPage > 1) - inventory.setItem(previousIcon, previousButton); - - ItemStack nextButton = GetLootMenuConfig.nextLootItem; - ItemMeta nextButtonMeta = nextButton.getItemMeta(); - nextButtonMeta.setDisplayName("Next page"); - nextButton.setItemMeta(nextButtonMeta); - int totalPages = (int) Math.ceil(emPackages.size() / 28d); - if (totalPages > 1 && currentPage < totalPages) - inventory.setItem(nextIcon, nextButton); - } - public static void forceResourcePack(Player player) { ResourcePackDataConfig.toggleForceResourcePack(true); player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); @@ -158,11 +112,6 @@ private static void adventurersGuildButtonInteraction(Player player, SetupMenu s 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()) @@ -197,6 +146,53 @@ private static void adventurersGuildButtonInteraction(Player player, SetupMenu s } } + private void redrawMenu(int page, Inventory inventory) { + currentPage = page; + setupMenus.remove(inventory); + this.inventory = inventory; + inventory.clear(); + //reserve resource pack status + customResourcePackStatus(); + //reserve adventurer's guild + adventurersGuildWorldStatus(); + //iterate through dungeons + dungeonStatuses(); + //Set icons + addNavigationElements(); + player.openInventory(inventory); + setupMenus.put(inventory, this); + } + + private void addNavigationElements() { + ItemStack infoButton = GetLootMenuConfig.infoItem; + List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:", + "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy", + "&62) &fPut content in the &2imports &ffolder of EliteMobs", + "&63) &fDo &2/em reload", + "&64) &fDo &2/em setup", + "&65) &fClick on &eyellow &ficons to install!", + "Click to get more info!")); + ItemMeta itemMeta = infoButton.getItemMeta(); + itemMeta.setLore(lore); + infoButton.setItemMeta(itemMeta); + inventory.setItem(infoIcon, infoButton); + + ItemStack previousButton = GetLootMenuConfig.previousLootItem; + ItemMeta previousButtonMeta = previousButton.getItemMeta(); + previousButtonMeta.setDisplayName("Previous page"); + previousButton.setItemMeta(previousButtonMeta); + if (currentPage > 1) + inventory.setItem(previousIcon, previousButton); + + ItemStack nextButton = GetLootMenuConfig.nextLootItem; + ItemMeta nextButtonMeta = nextButton.getItemMeta(); + nextButtonMeta.setDisplayName("Next page"); + nextButton.setItemMeta(nextButtonMeta); + int totalPages = (int) Math.ceil(emPackages.size() / 28d); + if (totalPages > 1 && currentPage < totalPages) + inventory.setItem(nextIcon, nextButton); + } + private void dungeonStatuses() { //Counter has to account for pages int dungeonCounter = 0; @@ -220,23 +216,8 @@ private void dungeonStatuses() { 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; - } + addWorldDungeon(emPackage, inventoryLocationCounter); + minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; inventoryLocationCounter++; diff --git a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java index e68549c59..6b0641834 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java @@ -7,6 +7,7 @@ import java.util.List; public class AntiExploitConfig { + 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 @@ -44,38 +45,32 @@ public static void initializeConfig() { 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); @@ -86,4 +81,5 @@ public static void initializeConfig() { 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 index d71f4b62e..42fb1f950 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -73,4 +73,10 @@ public static String parsePotionEffect(String potionEffectName) { 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/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index eb0e8a45d..92fd4f3c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java @@ -23,31 +23,31 @@ public static void initializeConfig() { 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); + file, fileConfiguration, "questAcceptSound", "elitemobs:quest.accept", false); ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } 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..7b52edd01 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java @@ -21,9 +21,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(); @@ -103,8 +100,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 +117,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); } 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 d6bd939a4..a78c176c3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -10,7 +10,6 @@ import org.bukkit.World; import org.bukkit.util.Vector; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -19,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; @@ -99,6 +96,9 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter @Setter private boolean enchantmentChallenge = false; + @Getter + @Setter + private boolean allowExplosions; public DungeonPackagerConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); @@ -136,7 +136,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; @@ -152,6 +153,7 @@ public DungeonPackagerConfigFields(String filename, this.regionEnterMessage = regionEnterMessage; this.regionLeaveMessage = regionLeaveMessage; this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; defaultDungeon = true; } @@ -173,7 +175,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; @@ -192,113 +195,7 @@ public DungeonPackagerConfigFields(String filename, this.rawDungeonObjectives = rawDungeonObjectives; this.dungeonConfigFolderName = dungeonConfigFolderName; this.contentLevel = contentLevel; - 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 - */ - 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); - 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; } @@ -306,12 +203,6 @@ public DungeonPackagerConfigFields(String fileName, 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); @@ -353,6 +244,7 @@ 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); processAdditionalFields(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off index 16cea48dd..a2c641bb9 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off @@ -11,7 +11,7 @@ public class AirShipMinidungeon extends DungeonPackagerConfigFields { public AirShipMinidungeon() { super( "airship_minidungeon", - false, + true, "&2[lvl 045-055] &6The Airship", Arrays.asList("&fAn awesome airship full of undead pirates!", "&6Credits: MagmaGuy, 69OzCanOfBepis", 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 e9dd5f275..0837e31e2 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 @@ -9,7 +9,7 @@ public class BeastsSanctuaryLair extends DungeonPackagerConfigFields { public BeastsSanctuaryLair() { super("beasts_sanctuary_lair", - false, + true, "&2[lvl 130] &6The Beasts Sanctuary", List.of("&6Confront the beasts!"), DiscordLinks.premiumMinidungeons, @@ -24,6 +24,7 @@ public BeastsSanctuaryLair() { "&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..f795aa65a 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 @@ -11,7 +11,7 @@ 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"), @@ -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..3f5de8c35 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 @@ -11,7 +11,7 @@ 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"), @@ -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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off index be0c67159..0b64e9905 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off @@ -10,7 +10,7 @@ import java.util.Collections; 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!", "&6Credits: Realm of Lotheridon"), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off index 1c259c713..8071ed2f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off @@ -10,7 +10,7 @@ import java.util.Arrays; 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", "&fmulti-phased battle, first mounted boss,", 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..36de8c98b 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 @@ -11,7 +11,7 @@ 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"), @@ -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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off index 4a620649a..88dd9a2ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off @@ -11,7 +11,7 @@ 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!", "&fA classic that all servers need!", 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..d1b0ccb68 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 @@ -9,7 +9,7 @@ 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!", "&fMade for those who want a real challenge!", @@ -26,6 +26,7 @@ public DarkSpireMinidungeon() { "&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 256016c36..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 @@ -9,7 +9,7 @@ public class DiamondLeagueArena extends DungeonPackagerConfigFields { public DiamondLeagueArena() { super("diamond_league_arena", - false, + true, "&5[lvl 100-150] &fThe Diamond League Arena", List.of("&fFace the Diamond League Arena!"), DiscordLinks.freeMinidungeons, @@ -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 81547090c..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge1 extends DungeonPackagerConfigFields { public EnchantmentChallenge1() { super("enchantment_challenge_1_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 01", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 2fed2e58c..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge10 extends DungeonPackagerConfigFields { public EnchantmentChallenge10() { super("enchantment_challenge_10_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 10", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 f43af8bca..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge11 extends DungeonPackagerConfigFields { public EnchantmentChallenge11() { super("enchantment_challenge_11_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 11", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 602b051e7..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge12 extends DungeonPackagerConfigFields { public EnchantmentChallenge12() { super("enchantment_challenge_12_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 12", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 a7fe23b3a..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge13 extends DungeonPackagerConfigFields { public EnchantmentChallenge13() { super("enchantment_challenge_13_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 13", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 b99263a7a..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge14 extends DungeonPackagerConfigFields { public EnchantmentChallenge14() { super("enchantment_challenge_14_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 14", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 18ce21bbe..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge15 extends DungeonPackagerConfigFields { public EnchantmentChallenge15() { super("enchantment_challenge_15_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 15", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 de617c2f4..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge16 extends DungeonPackagerConfigFields { public EnchantmentChallenge16() { super("enchantment_challenge_16_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 16", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 f6454d65d..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge17 extends DungeonPackagerConfigFields { public EnchantmentChallenge17() { super("enchantment_challenge_17_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 17", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 281594d1e..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge18 extends DungeonPackagerConfigFields { public EnchantmentChallenge18() { super("enchantment_challenge_18_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 18", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 1eb473381..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge19 extends DungeonPackagerConfigFields { public EnchantmentChallenge19() { super("enchantment_challenge_19_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 19", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 3ab15ee7a..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge2 extends DungeonPackagerConfigFields { public EnchantmentChallenge2() { super("enchantment_challenge_2_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 02", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 93db6c776..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge20 extends DungeonPackagerConfigFields { public EnchantmentChallenge20() { super("enchantment_challenge_20_sanctum", - false, + true, "&2[lvl 000-200] &6Enchantment Challenge 20", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.premiumMinidungeons, @@ -26,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 f1a315127..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge3 extends DungeonPackagerConfigFields { public EnchantmentChallenge3() { super("enchantment_challenge_3_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 03", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 468658c26..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge4 extends DungeonPackagerConfigFields { public EnchantmentChallenge4() { super("enchantment_challenge_4_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 04", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,7 +26,8 @@ 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))); setEnchantmentChallenge(true); 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 7d651e30d..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge5 extends DungeonPackagerConfigFields { public EnchantmentChallenge5() { super("enchantment_challenge_5_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 05", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 9e9a723dd..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge6 extends DungeonPackagerConfigFields { public EnchantmentChallenge6() { super("enchantment_challenge_6_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 06", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 e314b3c84..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge7 extends DungeonPackagerConfigFields { public EnchantmentChallenge7() { super("enchantment_challenge_7_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 07", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 42a76e44b..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge8 extends DungeonPackagerConfigFields { public EnchantmentChallenge8() { super("enchantment_challenge_8_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 08", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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 30c2dc208..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 @@ -10,7 +10,7 @@ public class EnchantmentChallenge9 extends DungeonPackagerConfigFields { public EnchantmentChallenge9() { super("enchantment_challenge_9_sanctum", - false, + true, "&2[lvl 000-200] &fEnchantment Challenge 09", List.of("&fAn enchantment challenge dungeon!"), DiscordLinks.freeMinidungeons, @@ -26,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..94c9ec00d 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public FireworksLair() { "&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..ea29d5208 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 @@ -11,7 +11,7 @@ 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", "the queen of ice!", @@ -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..c905a352a 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public HallosseumLair() { "&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..f53ef5ff5 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public InvasionMinidungeon() { "&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 5f3ae29c8..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 @@ -9,7 +9,7 @@ public class IronLeagueArena extends DungeonPackagerConfigFields { public IronLeagueArena() { super("iron_league_arena", - false, + true, "&2[lvl 050-100] &fThe Iron League Arena", List.of("&fFace the Iron League Arena!"), DiscordLinks.freeMinidungeons, @@ -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 2b2ed7af9..015ea0546 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 @@ -9,7 +9,7 @@ public class KnightCastleLair extends DungeonPackagerConfigFields { public KnightCastleLair() { super("knights_castle_lair", - false, + true, "&2[lvl 095] &fThe Knight's Castle", List.of("&fChallenge the knights of the castle!"), DiscordLinks.freeMinidungeons, @@ -24,7 +24,7 @@ public KnightCastleLair() { "&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..247d7b656 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public NorthPoleMinidungeon() { "&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..1ebc4c2cb 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 @@ -9,7 +9,7 @@ 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"), @@ -25,7 +25,8 @@ public OasisAdventure() { "&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..455c4719c 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 @@ -11,7 +11,7 @@ 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"), @@ -28,7 +28,8 @@ 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))); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off index 8b11cfa7d..3de4f94ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off @@ -10,7 +10,7 @@ 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", "&fbosses made for players starting to get good,", 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..27f328016 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 @@ -9,7 +9,7 @@ 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"), @@ -25,7 +25,8 @@ public PrimisAdventure() { "&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..3aefee028 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 @@ -11,7 +11,7 @@ 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"), @@ -28,7 +28,8 @@ 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))); } 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..a46d4cf31 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 @@ -11,7 +11,7 @@ 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"), DiscordLinks.premiumMinidungeons, @@ -27,7 +27,8 @@ 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), diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off index c7cd8aceb..9fa5eccb3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off @@ -10,7 +10,7 @@ import java.util.List; 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", "&fNorse mythology, be prepared for a smiting!", 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..af70c536b 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 @@ -9,7 +9,7 @@ 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"), @@ -26,6 +26,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..312147208 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 @@ -9,7 +9,7 @@ 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"), @@ -25,6 +25,7 @@ public ShadowOfTheBinderOfWorldsLair() { "&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 e8ffd7191..bc0d59940 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 @@ -9,7 +9,7 @@ public class SteamworksLair extends DungeonPackagerConfigFields { public SteamworksLair() { super("steamworks_lair", - false, + true, "&2[lvl 140] &6The Steamworks", List.of("&fA steampunk inspired lair!"), DiscordLinks.freeMinidungeons, @@ -24,6 +24,7 @@ public SteamworksLair() { "&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 519fa12dd..e82a38921 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 @@ -11,7 +11,7 @@ public class TheBridgeSanctum extends DungeonPackagerConfigFields { 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"), @@ -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..c0e5d7873 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 @@ -11,7 +11,7 @@ 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"), @@ -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 e38f58c8c..b135a5a4f 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 @@ -11,7 +11,7 @@ public class TheCityDungeon extends DungeonPackagerConfigFields { 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"), @@ -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..dafbc9154 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 @@ -11,7 +11,7 @@ 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"), @@ -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..96cd82d74 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 @@ -11,7 +11,7 @@ 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"), @@ -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 4fffed566..1c8a64927 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 @@ -11,7 +11,7 @@ public class TheMinesDungeon extends DungeonPackagerConfigFields { 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_"), @@ -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/TheNetherWastes.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherWastes.java index 76f06d123..f0714a345 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 @@ -11,7 +11,7 @@ public class TheNetherWastes extends DungeonPackagerConfigFields { 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_"), @@ -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 b115b2f63..0ef8587f6 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 @@ -11,7 +11,7 @@ public class ThePalaceSanctum extends DungeonPackagerConfigFields { 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"), @@ -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..4b08260a5 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 @@ -11,7 +11,7 @@ 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"), @@ -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 2e4c88416..64eff941b 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 @@ -9,7 +9,7 @@ public class UnderGroveLair extends DungeonPackagerConfigFields { public UnderGroveLair() { super("under_grove_lair", - false, + true, "&2[lvl 170] &6The Under Grove", List.of("&6Stop the dryad's ritual!"), DiscordLinks.premiumMinidungeons, @@ -24,6 +24,7 @@ public UnderGroveLair() { "&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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off index 008a99de9..4663fa25b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off @@ -9,7 +9,7 @@ import java.util.Arrays; public class VampireManorMinidungeon extends DungeonPackagerConfigFields { public VampireManorMinidungeon() { super("vampire_manor", - false, + true, "&2[lvl 170] &cThe Vampire Manor", Arrays.asList("&fPrepare to spill blood!", "&6Credits: MagmaGuy, 69OzCanOfBepis"), 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..f10215e03 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/wormholes/WormholeConfigFields.java @@ -28,7 +28,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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java new file mode 100644 index 000000000..c6098d3e0 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -0,0 +1,96 @@ +package com.magmaguy.elitemobs.dungeons; + +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.EntityExplodeEvent; + +public class DungeonProtector implements Listener { + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockDamage(BlockDamageEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockBreak(BlockBreakEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) 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; + 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; + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBonemeal(BlockFertilizeEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; + event.setCancelled(true); + } + + @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidFlow(BlockFromToEvent event){ + if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) 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; + 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); + } + + +} diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 49b1dd578..28da1c75f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -75,22 +75,6 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WarningMessage("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; } - } 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 WarningMessage("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; - } } } 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..c746bd6f2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -0,0 +1,43 @@ +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<>(); + 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/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/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 8b8df85eb..9a117376a 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -3,7 +3,6 @@ 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.wormhole.Wormhole; import lombok.Getter; @@ -66,7 +65,7 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); - WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); +// 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.")); 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..cf47ac349 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -1,5 +1,7 @@ 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; @@ -37,14 +39,14 @@ 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) { + public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { @@ -67,6 +69,9 @@ public static World loadWorld(String worldName, World.Environment environment) { if (world != null) world.setKeepSpawnInMemory(false); world.setDifficulty(Difficulty.HARD); Bukkit.getLogger().setFilter(previousFilter); + + EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + return world; } catch (Exception exception) { Bukkit.getLogger().setFilter(previousFilter); @@ -90,6 +95,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/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 7df8ac857..9b1fba505 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -55,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: 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 bd09fa72a..a201a3df6 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,7 +14,6 @@ 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 lombok.Getter; import org.bukkit.Bukkit; @@ -136,13 +135,13 @@ 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); +// 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()); 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..046654fc2 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,5 +1,6 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; @@ -35,7 +36,7 @@ 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); 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 62b0b0f7e..f1c4aeca3 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,26 +1,13 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.utils.WarningMessage; -import com.sk89q.worldedit.bukkit.BukkitAdapter; 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.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 { @@ -144,166 +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); - } +// 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); +// } } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index ccdc6a0f0..a3baa5901 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -4,6 +4,7 @@ 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; @@ -122,6 +123,8 @@ public void doInteraction(Player player) { 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() { diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 739884148..1f21941eb 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,14 +1,19 @@ package com.magmaguy.elitemobs.utils; +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) { - //todo: restore barrier blocks here, block data was required for the snapshot version of this - location.getWorld().spawnParticle(Particle.BLOCK_MARKER, 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.LIGHT)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java index cebef64d0..b0ace1e1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java +++ b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java @@ -1,6 +1,8 @@ package com.magmaguy.elitemobs.worlds; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.WarningMessage; import org.bukkit.Bukkit; @@ -31,6 +33,7 @@ public static void startupWorldInitialization() { 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!"); + EliteMobsWorld.create(worldCreator.createWorld().getUID(), DungeonPackagerConfig.getDungeonPackages().get("adventurers_guild.yml")); } catch (Exception ex) { new WarningMessage("Failed to generate Adventurer's Guild World!"); ex.printStackTrace(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8d46b9225..20d85e1ac 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0-SNAPSHOT-1 +version: 9.0.0-SNAPSHOT-2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 43f159477d01e75a051d06217e76d5293afcf1bd Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sat, 22 Jun 2024 18:05:58 +0100 Subject: [PATCH 28/78] EliteMobs 9.0.0-SNAPSHOT-3 - [New] Outdated dungeons are now highlighted in orange in the em setup menu - [New] Items will no longer be dropped when they have no durability left, instead they will simply be deactivated and players will be warned that the items won't work until they are repaired again - [New] Damage indicators and dialogue now use text displays instead of armor stands - [Fix] Changed debug block look to barrier instead of light bulb - [Fix] Fixed problem that all would allow vanilla mobs to spawn in dungeons - [Fix] Fixed problem that would allow elite events to happen in worlds - [Fix] Fixed issue where projectile-caused explosions would sometimes not regenerate correctly even though the configuration was set to regenerate them - [Removal] Removed default schematics folder Signed-off-by: MagmaGuy --- .../com/magmaguy/elitemobs/EliteMobs.java | 14 -- .../GuildRankMenuHandler.java | 4 +- .../elitemobs/api/PlayerTeleportEvent.java | 8 +- .../AlternativeDurabilityLoss.java | 37 +---- .../combatsystem/displays/PopupDisplay.java | 25 ++-- .../guild/AdventurersGuildCommand.java | 55 +------ .../elitemobs/commands/setup/SetupMenu.java | 136 ++---------------- .../config/AdventurersGuildConfig.java | 33 ----- .../config/ConfigurationImporter.java | 2 +- .../elitemobs/config/ItemSettingsConfig.java | 11 +- .../config/SchematicsFolderConfig.java | 26 ---- .../DungeonPackagerConfigFields.java | 34 +++++ .../premade/AdventurersGuildHub.java | 29 ++++ .../elitemobs/dungeons/DungeonProtector.java | 7 + .../elitemobs/dungeons/EMPackage.java | 5 + .../elitemobs/dungeons/WorldPackage.java | 1 + .../elitemobs/events/CustomEvent.java | 3 + .../elitemobs/explosionregen/Explosion.java | 5 +- .../instanced/InstanceDeathLocation.java | 16 +-- .../instanced/dungeons/DungeonInstance.java | 2 +- .../SoulbindEnchantment.java | 6 +- .../elitemobs/npcs/chatter/NPCChatBubble.java | 8 +- .../npcs/chatter/NPCProximitySensor.java | 6 +- .../elitemobs/playerdata/PlayerItem.java | 17 +++ .../magmaguy/elitemobs/powers/ShieldWall.java | 4 +- .../elitemobs/utils/DebugBlockLocation.java | 2 +- .../elitemobs/utils/DialogArmorStand.java | 12 +- .../elitemobs/utils/VisualArmorStand.java | 29 ---- .../elitemobs/utils/VisualDisplay.java | 47 ++++++ .../elitemobs/worlds/CustomWorldLoading.java | 60 -------- 30 files changed, 222 insertions(+), 422 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/SchematicsFolderConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AdventurersGuildHub.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/VisualArmorStand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index deb362c9c..f06a343d5 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; @@ -60,7 +59,6 @@ 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 org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; @@ -84,7 +82,6 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations DefaultConfig.initializeConfig(); - SchematicsFolderConfig.initializeConfigs(); ResourcePackDataConfig.initializeConfig(); ItemSettingsConfig.initializeConfig(); ProceduralItemGenerationSettingsConfig.initializeConfig(); @@ -230,17 +227,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(); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 913756e3a..51ae8477a 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -279,14 +279,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/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index e5a62b28f..f579167be 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,6 +1,5 @@ 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.playerdata.database.PlayerData; @@ -75,9 +74,12 @@ public void executeTeleport() { ((WorldPackage) emPackage).getWorld() == destination.getWorld()) return; - if (AdventurersGuildConfig.getGuildWorldLocation() != null && - Objects.equals(AdventurersGuildConfig.getGuildWorldLocation().getWorld(), originalLocation.getWorld())) + EMPackage adventurersGuildPackage = EMPackage.getContent("adventurers_guild_hub"); + if (adventurersGuildPackage == null || !adventurersGuildPackage.isInstalled() || + adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation() == null || + Objects.equals(adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation().getWorld(), originalLocation.getWorld())) return; + PlayerData.setBackTeleportLocation(player, originalLocation); } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 68669c69c..275500332 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; @@ -83,32 +78,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/combatsystem/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index 0872c5094..8b1a2cf6b 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java @@ -11,13 +11,14 @@ 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 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; @@ -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/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 17cc70b34..ea17b69f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,17 +1,11 @@ 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.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.EventCaller; import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -39,7 +33,6 @@ public class SetupMenu { 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)); HashMap minidungeonHashMap = new HashMap<>(); - boolean adventurersGuildIsDownloaded = false; @Getter private int currentPage = 1; @@ -94,58 +87,6 @@ else if (!emPackage.uninstall(player)) { } } - 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(); - 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 redrawMenu(int page, Inventory inventory) { currentPage = page; setupMenus.remove(inventory); @@ -153,8 +94,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 @@ -200,7 +139,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())))); @@ -212,11 +151,11 @@ 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); - addWorldDungeon(emPackage, inventoryLocationCounter); + addDungeonPackagerContent(emPackage, inventoryLocationCounter); minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; @@ -224,7 +163,7 @@ private void dungeonStatuses() { } } - private void addWorldDungeon(EMPackage emPackage, int counter) { + private void addDungeonPackagerContent(EMPackage emPackage, int counter) { String itemName = emPackage.getDungeonPackagerConfigFields().getName(); List lore = new ArrayList<>(); @@ -236,26 +175,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()) @@ -267,17 +189,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!"); @@ -301,7 +221,7 @@ private void customResourcePackStatus() { boolean resourceState = ResourcePackDataConfig.isEliteMobsResourcePackEnabled(); 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; @@ -311,29 +231,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) { @@ -347,11 +244,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..7aaf10e90 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,10 +1,7 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.ChatColorConverter; -import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; import lombok.Getter; -import lombok.Setter; -import org.bukkit.Location; import org.bukkit.configuration.file.FileConfiguration; import java.io.File; @@ -24,15 +21,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; @@ -85,12 +73,6 @@ public class AdventurersGuildConfig { private AdventurersGuildConfig() { } - public static void toggleGuildInstall() { - guildWorldIsEnabled = !guildWorldIsEnabled; - fileConfiguration.set("guildHubIsEnabledv2", guildWorldIsEnabled); - save(); - } - public static void save() { ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } @@ -107,18 +89,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); @@ -444,9 +414,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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java index 0e9fa98c0..1642611ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java @@ -108,7 +108,7 @@ public static void initializeConfigs() { 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); + new WarningMessage("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); 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?"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java index 3a7d97f6b..57381df60 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java @@ -98,9 +98,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 @@ -310,12 +308,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."), 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/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index a78c176c3..fd96a24ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -199,6 +199,40 @@ public DungeonPackagerConfigFields(String filename, defaultDungeon = true; } + //For the adventurer's guild hub + public DungeonPackagerConfigFields(String filename, + boolean isEnabled, + String name, + List customInfo, + String downloadLink, + String worldName, + World.Environment environment, + Boolean protect, + String teleportLocationString, + int dungeonVersion, + String playerInfo, + String regionEnterMessage, + String regionLeaveMessage, + String dungeonConfigFolderName, + boolean allowExplosions) { + super(filename, isEnabled); + this.contentType = ContentType.HUB; + this.name = name; + this.customInfo = customInfo; + this.downloadLink = downloadLink; + this.worldName = worldName; + this.environment = environment; + this.protect = protect; + this.teleportLocationString = teleportLocationString; + this.dungeonVersion = dungeonVersion; + this.playerInfo = playerInfo; + this.regionEnterMessage = regionEnterMessage; + this.regionLeaveMessage = regionLeaveMessage; + this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; + defaultDungeon = true; + } + @Override public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, false, true); 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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index c6098d3e0..d059fb8cf 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -4,6 +4,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.*; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityExplodeEvent; public class DungeonProtector implements Listener { @@ -92,5 +93,11 @@ public void preventLeafDecay(LeavesDecayEvent event){ 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); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 28da1c75f..f0d748779 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -37,6 +37,11 @@ public class EMPackage { protected List treasureChestList = new ArrayList<>(); protected List npcEntities = new ArrayList<>(); + public boolean isOutOfDate() { + if (!isInstalled) return false; + return outOfDate; + } + public EMPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; emPackages.put(dungeonPackagerConfigFields.getFilename(), this); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 9a117376a..1fe07038f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -85,4 +85,5 @@ public boolean uninstall(Player player) { world = null; return true; } + } diff --git a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java index 8ed92029a..30c762418 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java @@ -6,6 +6,7 @@ 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; @@ -58,6 +59,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())); } diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index abf08c100..4625ad1f1 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,9 @@ 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/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index 529bfcc05..eb9658198 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -4,13 +4,13 @@ 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 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/dungeons/DungeonInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java index a201a3df6..45420aca4 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -200,7 +200,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."); +// announce("MagmaGuy's note: This is still a work in progress, please be patient! Hope you enjoyed your run."); new BukkitRunnable() { @Override 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..7b43e90fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java @@ -8,13 +8,13 @@ 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 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/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/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index 0cf7a6a98..d4f10cb6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -1,7 +1,9 @@ package com.magmaguy.elitemobs.playerdata; +import com.magmaguy.elitemobs.ChatColorConverter; 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; @@ -13,6 +15,7 @@ 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; @@ -53,6 +56,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 +74,12 @@ private boolean fullUpdate(ItemStack itemStack) { if (itemStack == null) return fillNullItem(); + if (isOnLastDamage(itemStack)) { + player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace( + "$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + return fillNullItem(); + } + // //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; 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/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 1f21941eb..5af9ea6b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -13,7 +13,7 @@ public DebugBlockLocation(Location location) { location.getBlock().getY() + .5, location.getBlock().getZ() + .5, 1, - Bukkit.createBlockData(Material.LIGHT)); + Bukkit.createBlockData(Material.BARRIER)); } } 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/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..0f139d7d2 --- /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.ChatColorConverter; +import com.magmaguy.elitemobs.entitytracker.EntityTracker; +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/worlds/CustomWorldLoading.java b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java deleted file mode 100644 index b0ace1e1c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.magmaguy.elitemobs.worlds; - -import com.magmaguy.elitemobs.config.AdventurersGuildConfig; -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; -import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; -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!"); - EliteMobsWorld.create(worldCreator.createWorld().getUID(), DungeonPackagerConfig.getDungeonPackages().get("adventurers_guild.yml")); - } 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; - } - -} From b62cfe3bc186976079d8a44314f4e9af0338cb26 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 27 Jun 2024 16:49:48 +0100 Subject: [PATCH 29/78] EliteMobs 9.0.1 - [New] Added option to disable pvp in dungeons, defaulting to not allow pvp, to dungeons.yml - [New] Plugin will no longer try to load for unsupported Minecraft versions (versions older than Minecraft 1.21) - [Tweak] Changed several plugin defaults to be natively written for Minecraft 1.21 - [Fix] Fixed bug where reloading EliteMobs would remove the world protections for already loaded worlds - [Fix] Fixed error associated with trying to read potion effects - [Fix] Improved the compatibility layer to better take old enchantments and potion effects into account, reenabling effects on items generated before 9.0 - [Fix] Fixed error spam related to custom boss trails Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../com/magmaguy/elitemobs/EliteMobs.java | 6 ++ .../elitemobs/config/DungeonsConfig.java | 7 ++ .../config/LegacyValueConverter.java | 18 ++--- .../premade/DepthsSeekerConfig.java | 4 +- .../EnchantedBookArrowInfiniteConfig.java | 2 +- .../EnchantedBookArrowKnockbackConfig.java | 2 +- .../premade/EnchantedBookFlameConfig.java | 2 +- .../premade/EnchantedBookLuckConfig.java | 2 +- .../premade/GoblinCleaverItem.java | 2 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 2 +- .../premade/LuckyCharmsConfig.java | 2 +- .../premade/RodOfTheDepthsConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 2 +- .../enchantments/EnchantmentsConfig.java | 9 ++- .../elitemobs/dungeons/DungeonProtector.java | 68 +++++++++++-------- .../elitemobs/dungeons/WorldPackage.java | 1 + .../dungeons/utility/DungeonUtils.java | 5 ++ .../itemconstructor/EnchantmentGenerator.java | 10 +-- .../potioneffects/ElitePotionEffect.java | 3 +- .../custombosses/CustomBossTrail.java | 8 ++- src/main/resources/plugin.yml | 2 +- 25 files changed, 105 insertions(+), 62 deletions(-) diff --git a/build.gradle b/build.gradle index 512568176..76a2bbd37 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.0-SNAPSHOT' +version '9.0.1-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f06a343d5..d6ff23ffe 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -134,6 +134,12 @@ public void onEnable() { MetadataHandler.PLUGIN = this; Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion()); + if (VersionChecker.serverVersionOlderThan(21,0)){ + new WarningMessage("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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index 6f7c979a6..d0105bdd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -26,6 +26,8 @@ public class DungeonsConfig { private static String instancedDungeonCompleteMessage; @Getter private static String instancedDungeonClosingInstanceMessage; + @Getter + private static boolean friendlyFireInDungeons; private DungeonsConfig() { } @@ -72,6 +74,11 @@ public static void initializeConfig() { file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); + friendlyFireInDungeons = ConfigurationEngine.setBoolean( + List.of("Sets if PvP will be allowed in dungeons"), + fileConfiguration, "friendlyFireInDungeons", false + ); + 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 index 42fb1f950..c03efc4ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -8,7 +8,7 @@ private LegacyValueConverter() { public static String parseEnchantment(String materialName) { switch (materialName.toUpperCase(Locale.ROOT)) { - case "POWER": + case "ARROW_DAMAGE": return "POWER"; case "ARROW_FIRE": return "FLAME"; @@ -16,15 +16,15 @@ public static String parseEnchantment(String materialName) { return "INFINITY"; case "ARROW_KNOCKBACK": return "PUNCH"; - case "BANE_OF_ARTHROPODS": + case "DAMAGE_ARTHROPODS": return "BANE_OF_ARTHROPODS"; - case "SMITE": + case "DAMAGE_UNDEAD": return "SMITE"; - case "EFFICIENCY": + case "DIG_SPEED": return "EFFICIENCY"; case "DURABILITY": return "UNBREAKING"; - case "FORTUNE": + case "LOOT_BONUS_BLOCKS": return "FORTUNE"; case "LOOT_BONUS_MOBS": return "LOOTING"; @@ -36,13 +36,13 @@ public static String parseEnchantment(String materialName) { return "PROTECTION"; case "BLAST_PROTECTION": return "BLAST_PROTECTION"; - case "FEATHER_FALLING": + case "PROTECTION_FALL": return "FEATHER_FALLING"; - case "FIRE_PROTECTION": + case "PROTECTION_FIRE": return "FIRE_PROTECTION"; - case "PROJECTILE_PROTECTION": + case "PROTECTION_PROJECTILE": return "PROJECTILE_PROTECTION"; - case "AQUA_AFFINITY": + case "WATER_WORKER": return "AQUA_AFFINITY"; default: return materialName; 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 66387929c..f4135e948 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 @@ -13,8 +13,8 @@ public DepthsSeekerConfig() { 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", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK,0,self,continuous")); + setEnchantments(Arrays.asList("LURE,3", "LUCK_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); + setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK_OF_THE_SEA,0,self,continuous")); setItemType(CustomItem.ItemType.UNIQUE); } } 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 c3bf2e7e3..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 @@ -14,7 +14,7 @@ public EnchantedBookArrowKnockbackConfig() { 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/EnchantedBookFlameConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookFlameConfig.java index 538c7bb27..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 @@ -14,7 +14,7 @@ public EnchantedBookFlameConfig() { 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/EnchantedBookLuckConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/EnchantedBookLuckConfig.java index a8e5d11f1..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 @@ -14,7 +14,7 @@ public EnchantedBookLuckConfig() { 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/GoblinCleaverItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinCleaverItem.java index 4634322c2..8d25f4031 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 @@ -14,7 +14,7 @@ public GoblinCleaverItem() { Material.NETHERITE_AXE, "&8Goblin Cleaver", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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/GoblinPokerItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java index 1f909e5d8..18f8f4c42 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 @@ -14,7 +14,7 @@ public GoblinPokerItem() { Material.TRIDENT, "&8Goblin Poker", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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 1a6fb6613..ab49b074a 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(Arrays.asList("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 7e3eef251..b56592181 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 @@ -14,7 +14,7 @@ public GoblinSlasherItem() { Material.NETHERITE_SWORD, "&8Goblin Slasher", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 3cbcfa73c..4f251360b 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 @@ -14,7 +14,7 @@ public LuckyCharmsConfig() { "&bLucky Charms", Arrays.asList("&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")); + setPotionEffects(List.of("LUCK_OF_THE_SEA,0,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 49e59d461..213325b25 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 @@ -13,7 +13,7 @@ public RodOfTheDepthsConfig() { 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", "UNBREAKING,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LURE,3", "LUCK_OF_THE_SEA,1", "UNBREAKING,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 9fb072f1c..95736297d 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOTING,5")); setPotionEffects(Arrays.asList("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 cfc38d25e..d8fd9b37c 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 @@ -14,7 +14,7 @@ public ZombieKingsAxeConfig() { "&4Zombie King's Axe", Arrays.asList("The axe of the one Zombies", "call their king.", "The bloodlust is palpable.")); setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); + "FIRE_ASPECT,4", "LOOTING,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); setPotionEffects(Arrays.asList("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/enchantments/EnchantmentsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java index 16bd68c60..26fa661df 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,7 @@ package com.magmaguy.elitemobs.config.enchantments; import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -21,12 +22,14 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { - EnchantmentsConfigFields test = enchantments.get(string); + String newString = LegacyValueConverter.parseEnchantment(string.replace(".yml", "")) + ".yml"; + newString = newString.toLowerCase(Locale.ROOT); + EnchantmentsConfigFields test = enchantments.get(newString); if (test == null) { - new WarningMessage("Failed to find enchant file " + string); + new WarningMessage("Failed to find enchant file " + newString); new Exception().printStackTrace(); } - return enchantments.get(string); + return enchantments.get(newString); } public static EnchantmentsConfigFields getEnchantment(Enchantment enchantment) { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index d059fb8cf..8a6e469be 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,103 +1,117 @@ package com.magmaguy.elitemobs.dungeons; +import com.magmaguy.elitemobs.config.DungeonsConfig; +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.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; public class DungeonProtector implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventPlayerBlockDamage(BlockDamageEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockDamage(BlockDamageEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventPlayerBlockBreak(BlockBreakEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockBreak(BlockBreakEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockBurnDamage(BlockBurnEvent event){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockPlace(BlockCanBuildEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setBuildable(false); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockExplosionEvent(BlockExplodeEvent event){ + @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){ + @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){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockFadeEvent(BlockFadeEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBonemeal(BlockFertilizeEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBonemeal(BlockFertilizeEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventLiquidFlow(BlockFromToEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidFlow(BlockFromToEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockFire(BlockIgniteEvent event){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockPlace(BlockPlaceEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventLeafDecay(LeavesDecayEvent event){ + @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){ + 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); + } + + } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 1fe07038f..0f964427e 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -41,6 +41,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; } 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 cf47ac349..02d206bbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -47,6 +47,11 @@ public static World loadWorld(WorldPackage worldPackage) { } public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { + if (Bukkit.getWorld(worldName) != null) { + EliteMobsWorld.create(Bukkit.getWorld(worldName).getUID(), dungeonPackagerConfigFields); + return Bukkit.getWorld(worldName); + } + File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { 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 3af70a168..725ce0426 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java @@ -77,16 +77,16 @@ public static HashMap generateEnchantments(double itemTier 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("POWER")); - validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); - validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); - validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); + 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")); @@ -237,7 +237,7 @@ public static HashMap generateEnchantments(double itemTier 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: 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 a591776c2..e3da5dddb 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -1,5 +1,6 @@ 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 org.bukkit.NamespacedKey; @@ -20,7 +21,7 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", stringObject[0].toLowerCase(Locale.ROOT))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0].toLowerCase(Locale.ROOT)))); if (potionEffectType == null) { new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; 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 a18650c41..65404b752 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -48,7 +48,13 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - if (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/resources/plugin.yml b/src/main/resources/plugin.yml index 20d85e1ac..8f39796ff 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0-SNAPSHOT-2 +version: 9.0.1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From eedf942a4f340a89b5708eed868073b24c85bca6 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 2 Jul 2024 13:19:53 +0100 Subject: [PATCH 30/78] EliteMobs 9.0.2 - [New] Added the NAVIGATE script action, which makes a mob navigate to the given block, with a maximum navigation time, an optional teleport failsafe and a velocity option - [New] Added ZoneEnterEvent and ZoneLeaveEvent for elite scripts. This allows scripters to trigger actions based on entities entering and leaving zones set in scripts. The DIRECT_TARGET of ZoneEnterEvent and ZoneLeaveEvent is the entity that entered or left, and due to how the internal logic works only absolute points (specific coordinates) and points relative to the boss can be used for scanning entering and leaving. - [New] No durability left messages for elite items now appear in the boss bar instead of spamming chat - [New] Treasure Chests can now be added to dungeon instances by using "instanced: true" in their configuration files and adding the locations the same way it is done with regional bosses - [New] Added minimum event cooldown for timed events, defaulted to 4 minutes, to prevent multiple events to happen all at once when players join worlds with queued events - [New] Added warning for items using INSTANT_DAMAGE/HARM potion effects due to the tendency of making players/admins not understand why they're healing undead mobs. We will be redoing all default/officially distributed loot that uses these potion effects, which shouldn't be more than a few cases. - [New] Added listedInTeleports option for dungeon packager that can prevent certain dungeons from being listed in the teleports page of the EM menu - [New] Added fireDamageMultiplier, poisonDamageMultiplier, witherDamageMultiplier to dungeons.yml which modify how much damage those damage sources deal inside of EliteMobs dungeon worlds to better balance combat - [New] Added safeguard in case a script gives players god mode (never recommended to do this) to remove god mode when they log off or the server shuts down - [Fix] Fixed issue where players would get permanently slowed down due to a Minecraft bug - [Fix] Fixed Zombie Necronomicon power now accounting for zombies potentially turnining into drowned - [Fix] Fixed maven repo readme - [Fix] Updated sonatype access to be token-based to reenable publishing the API - [Fix] Fixed an issue that caused EliteMobDamagedByEliteMobEvent scripts not to work correctly - [Fix] Fixed issue that caused quests to show the wrong level for the bosses in kill quests - [Fix] Fixed bug where teleports page could contain currently not installed content Signed-off-by: MagmaGuy --- README.md | 6 +- build.gradle | 12 +-- .../com/magmaguy/elitemobs/EliteMobs.java | 6 ++ .../magmaguy/elitemobs/EventsRegistrer.java | 4 + .../elitemobs/api/ScriptZoneEnterEvent.java | 29 +++++++ .../elitemobs/api/ScriptZoneLeaveEvent.java | 29 +++++++ .../EnvironmentalDungeonDamage.java | 20 +++++ .../FixPlayerSpeedOnRespawn.java | 14 ++++ .../PlayerQuitCleanup.java | 14 ++++ .../elitemobs/config/DungeonsConfig.java | 22 ++++- .../elitemobs/config/EventsConfig.java | 7 +- .../CustomBossesConfigFields.java | 2 +- .../customitems/CustomItemsConfigFields.java | 9 ++- .../CustomTreasureChestConfigFields.java | 6 ++ .../DungeonPackagerConfigFields.java | 4 + .../elitemobs/dungeons/WorldPackage.java | 2 +- .../magmaguy/elitemobs/events/TimedEvent.java | 3 + .../instanced/dungeons/DungeonInstance.java | 2 + .../potioneffects/ElitePotionEffect.java | 2 +- .../elitemobs/mobconstructor/CustomSpawn.java | 10 +-- .../custombosses/ElitePowerParser.java | 11 +-- .../custombosses/RegionalBossEntity.java | 1 + .../elitemobs/pathfinding/Navigation.java | 44 ++++++++++ .../elitemobs/playerdata/PlayerItem.java | 28 +++++-- .../statusscreen/TeleportsPage.java | 3 + .../elitemobs/powers/ZombieNecronomicon.java | 18 ++--- .../elitemobs/powers/meta/ElitePower.java | 2 +- .../elitemobs/powers/scripts/EliteScript.java | 33 +++++++- .../powers/scripts/ScriptAction.java | 40 +++++++-- .../powers/scripts/ScriptActionData.java | 9 +++ .../powers/scripts/ScriptEvents.java | 2 + .../powers/scripts/ScriptListener.java | 41 +++++++--- .../elitemobs/powers/scripts/ScriptZone.java | 57 ++++++++++++- .../caching/ScriptActionBlueprint.java | 3 + .../caching/ScriptEventsBlueprint.java | 10 +++ .../powers/scripts/enums/ActionType.java | 3 +- .../treasurechest/TreasureChest.java | 70 +++++++++++----- .../magmaguy/elitemobs/utils/BossBarUtil.java | 81 +++++++++++++++++++ .../utils/ConfigurationLocation.java | 47 ++++++++++- src/main/resources/plugin.yml | 2 +- 40 files changed, 613 insertions(+), 95 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java create mode 100644 src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java create mode 100644 src/main/java/com/magmaguy/elitemobs/utils/BossBarUtil.java 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 76a2bbd37..f27628f29 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.1-SNAPSHOT' +version '9.0.2-SNAPSHOT' repositories { maven { @@ -182,14 +182,16 @@ artifacts { archives javadocJar, sourcesJar } -ext.isReleaseVersion = !version.contains("SNAPSHOT") +//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 +// 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 = "https://s01.oss.sonatype.org/content/repositories/snapshots/"; credentials { username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index d6ff23ffe..8c3becb3a 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -42,8 +42,10 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; 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; @@ -55,6 +57,7 @@ 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.BossBarUtil; import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ServerTime; import com.magmaguy.elitemobs.utils.WarningMessage; @@ -363,6 +366,9 @@ public void onDisable() { ProceduralShopMenu.shutdown(); EliteMobsWorld.shutdown(); + Navigation.shutdown(); + BossBarUtil.shutdown(); + ScriptAction.shutdown(); //save cached data Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index d691fb16a..a2ac40314 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -107,6 +107,10 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) register(new PreventUpgradeDiamondToNetherite()); + register(new FixPlayerSpeedOnRespawn()); + register(new EnvironmentalDungeonDamage()); + register(new PlayerQuitCleanup()); + //Mob damage register(new EliteMobGenericDamagedHandler()); register(new EliteMobDamagedByEliteMobHandler()); 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/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/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java new file mode 100644 index 000000000..ea5f4de1b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java @@ -0,0 +1,14 @@ +package com.magmaguy.elitemobs.collateralminecraftchanges; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class FixPlayerSpeedOnRespawn implements Listener { + @EventHandler + public void onPlayerRespawn(PlayerRespawnEvent event) { + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0)); + } +} 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..cf7069ae3 --- /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/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index d0105bdd2..8ec9e8c08 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -28,6 +28,12 @@ public class DungeonsConfig { 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() { } @@ -73,11 +79,21 @@ public static void initializeConfig() { List.of("Sets the message that appears when an instanced dungeon closing"), file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); - friendlyFireInDungeons = ConfigurationEngine.setBoolean( List.of("Sets if PvP will be allowed in dungeons"), - fileConfiguration, "friendlyFireInDungeons", false - ); + 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); ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java index 8999ca60f..37d2b3339 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java @@ -12,6 +12,8 @@ public class EventsConfig { @Getter private static int actionEventMinimumCooldown; @Getter + private static int timedEventMinimumCooldown; + @Getter private static boolean actionEventsEnabled; @Getter private static boolean timedEventsEnabled; @@ -28,7 +30,10 @@ public static void initializeConfig() { 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"), 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 898bc3ae7..e3d98fa33 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -244,7 +244,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")) 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 2ceac6f6d..1a0184059 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java @@ -98,9 +98,7 @@ private void updatePostProcessor() { String[] split = enchantment.split(","); String result = LegacyValueConverter.parseEnchantment(split[0]); if (result.equals(split[0])) newEnchantments.add(enchantment); - else { - newEnchantments.add(result + "," + split[1]); - } + else newEnchantments.add(result + "," + split[1]); } enchantments = newEnchantments; @@ -126,5 +124,10 @@ private void updatePostProcessor() { } } potionEffects = newPotionEffects; + + potionEffects.forEach(potionEffect->{ + if (potionEffect.contains("INSTANT_DAMAGE")) + new WarningMessage("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/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index f74bf05c3..2f78f13f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java @@ -7,6 +7,7 @@ import com.magmaguy.elitemobs.utils.ConfigurationLocation; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; +import lombok.Setter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -49,6 +50,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 +112,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) @@ -157,6 +162,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; 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 fd96a24ed..3db03e8fb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -99,6 +99,9 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter @Setter private boolean allowExplosions; + @Getter + @Setter + private boolean listedInTeleports = true; public DungeonPackagerConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); @@ -279,6 +282,7 @@ public void processConfigFields() { 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); processAdditionalFields(); } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 0f964427e..c8c3cf4fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -55,7 +55,7 @@ public void baseInitialization() { if (isDownloaded && isInstalled) { world = DungeonUtils.loadWorld(this); dungeonPackagerConfigFields.initializeWorld(); - } + } else isInstalled = false; } diff --git a/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java b/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java index 82172ae44..4a4771972 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/TimedEvent.java @@ -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; @@ -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/instanced/dungeons/DungeonInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java index 45420aca4..b85806480 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,6 +14,7 @@ import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; +import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.*; import lombok.Getter; import org.bukkit.Bukkit; @@ -72,6 +73,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, 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); } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); 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 e3da5dddb..aa65beda9 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -21,7 +21,7 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0].toLowerCase(Locale.ROOT)))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); if (potionEffectType == null) { new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java index 54233739c..a3ac05e2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -8,6 +8,7 @@ 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; @@ -115,7 +116,6 @@ public void run() { }.runTaskAsynchronously(MetadataHandler.PLUGIN); else spawn(); - } private void spawn() { @@ -129,7 +129,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; @@ -165,13 +165,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; @@ -240,6 +239,7 @@ public Location generateRandomSpawnLocation() { Location playerLocation = player.getLocation(); if (!ValidWorldsConfig.getValidWorlds().contains(playerLocation.getWorld().getName())) 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()) 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..b98882225 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java @@ -3,6 +3,7 @@ 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; @@ -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,7 +36,7 @@ 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) @@ -86,7 +87,7 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos if (powersConfigFields == null) { new WarningMessage("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()); @@ -96,11 +97,11 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos 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; 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 f78da9a09..cdc567e2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java @@ -48,6 +48,7 @@ public class RegionalBossEntity extends CustomBossEntity implements PersistentOb @Getter @Setter private List onRemoveTransitiveBlocks; + @Getter private boolean removed = false; private BukkitTask respawnTask = null; diff --git a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index 178143ea8..410287c9e 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 HashMap currentlyNavigating = new HashMap(); + public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; if (regionalBossEntity.getUnsyncedLivingEntity() != null && @@ -51,6 +60,41 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .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) public void makeReturningBossesInvulnerable(WanderBackToPointStartEvent event) { if (!event.isHardObjective()) return; diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index d4f10cb6d..f544a4fae 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -10,6 +10,7 @@ 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 org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -41,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 @@ -75,22 +78,31 @@ private boolean fullUpdate(ItemStack itemStack) { return fillNullItem(); if (isOnLastDamage(itemStack)) { - player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace( - "$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + 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; - if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { - if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { - player.getWorld().dropItem(player.getLocation(), itemStack); - itemStack.setAmount(0); - itemStack = new ItemStack(Material.AIR); + if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { + if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { + player.getWorld().dropItem(player.getLocation(), itemStack); + itemStack.setAmount(0); + itemStack = new ItemStack(Material.AIR); + } } - } //Neither offhand nor armor contribute to baseline damage outside of the enchants, so we reset the damage before anything this.eliteDamage = 0; 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..177653bc0 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -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" + @@ -91,6 +92,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/ZombieNecronomicon.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java index 00b68cef4..266003f8f 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; @@ -35,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - //todo: Shouldn't this be static? + private 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) { @@ -227,7 +227,7 @@ public void run() { eliteEntity.addReinforcement(customBossEntity); - entityList.add(customBossEntity.getLivingEntity()); + entityList.add(customBossEntity); } else { @@ -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/meta/ElitePower.java b/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java index 6614f782c..3cbe35933 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/ElitePower.java @@ -81,7 +81,7 @@ public static void addPower(EliteEntity eliteEntity, PowersConfigFields configFi new WarningMessage("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() { 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 e93ffe173..750ba3320 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/EliteScript.java @@ -25,22 +25,26 @@ public class EliteScript extends ElitePower implements Cloneable { 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 * 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 2de641a7a..969f57725 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -9,6 +9,7 @@ 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; @@ -30,14 +31,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; @@ -48,6 +48,10 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; + public static void shutdown(){ + invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); + } + public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; @@ -212,6 +216,7 @@ 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); default -> new WarningMessage("Failed to determine action type " + blueprint.getActionType() + " in script " + blueprint.getScriptName() + " for file " + blueprint.getScriptFilename()); } @@ -299,7 +304,10 @@ 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 @@ -518,6 +526,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()); }); @@ -662,4 +676,20 @@ 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) { + new WarningMessage("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()); + }); + } } \ 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 decfb2c18..994d92d98 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java @@ -81,6 +81,15 @@ public ScriptActionData(ScriptTargets scriptTargets, ScriptZone scriptZone, Scri this.inheritedScriptActionData = inheritedScriptActionData; } + //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) { this.eliteEntity = inheritedScriptActionData.getEliteEntity(); 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..b510405b3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java @@ -7,6 +7,7 @@ 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) { + new WarningMessage("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/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index ded2378a3..98c9c625e 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.EventCaller; import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.*; 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,49 @@ 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 BukkitRunnable() { + @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; + } + }.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: 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 783949501..cd0d776f4 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 @@ -107,6 +107,8 @@ public class ScriptActionBlueprint { private float volume = 1f; @Getter private float pitch = 1f; + @Getter + private float velocity = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -192,6 +194,7 @@ protected void processKeyAndValue(String key, Object value) { scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, scriptFilename, (Map) value); case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); + case "velocity" -> velocity = parseFloat(key, value, scriptName); default -> new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } 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..7a7a87ea6 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 @@ -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,6 +30,14 @@ 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 + " !"); } 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..16314c860 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,8 @@ public enum ActionType { PLAY_ANIMATION(true), SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), - SUMMON_ENTITY(false); + SUMMON_ENTITY(false), + NAVIGATE(false); @Getter private final boolean requiresLivingEntity; diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index a3baa5901..4f3c0d143 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.treasurechest; +import com.google.common.collect.ArrayListMultimap; import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; @@ -11,10 +12,7 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; 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.elitemobs.utils.*; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -32,15 +30,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; @@ -62,26 +66,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) @@ -115,7 +128,8 @@ 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; @@ -123,16 +137,20 @@ public void doInteraction(Player player) { if (ThreadLocalRandom.current().nextDouble() < customTreasureChestConfigFields.getMimicChance()) doMimic(); else doTreasure(player); - player.playSound(player.getLocation(), SoundsConfig.treasureChestOpenSound,1,1); + 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; } @@ -141,7 +159,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()); } @@ -178,6 +197,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; @@ -256,9 +278,13 @@ public enum DropStyle { public static class TreasureChestEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { + Developer.message("0"); if (event.getClickedBlock() == null) return; + Developer.message("1"); TreasureChest treasureChest = getTreasureChest(event.getClickedBlock().getLocation()); + Developer.message("2"); if (treasureChest == null) return; + Developer.message("3"); event.setCancelled(true); if (GuildRank.getMaxGuildRank(event.getPlayer()) < treasureChest.customTreasureChestConfigFields.getChestTier()) treasureChest.lowRankMessage(event.getPlayer()); 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..a6e454582 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java @@ -52,9 +52,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]); @@ -91,4 +88,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; + 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); + return null; + } + return new Location(instancedWorld, x, y, z, yaw, pitch); + } + } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8f39796ff..ae83b8987 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.1 +version: 9.0.2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 09e70afcbf98190336520cba32b0982877b8a8c1 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 7 Jul 2024 13:21:26 +0100 Subject: [PATCH 31/78] EliteMobs 9.0.3 - [New] The Nether Bell Sanctum - the last story mode sanctum is out! - [New] Withers can now be used as valid elites - [Fix] Updated the villager profession code to fit the new Spigot 1.21 API - [Fix] Fixed Breezes and Bogged not working correctly as elites - [Fix] Fixed Minecraft bug that caused speed potion effects to last forever under certain circumstances - [Tweak] Minor improvement to configuration generation Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../FixPlayerSpeedOnRespawn.java | 1 + .../elitemobs/config/ConfigurationEngine.java | 7 +++- .../premade/TheNetherBellSanctum.java | 38 +++++++++++++++++++ .../mobproperties/MobPropertiesConfig.java | 4 +- ...liteBreeze.java => EliteBreezeConfig.java} | 6 +-- .../premade/EliteWitherConfig.java | 18 +++++++++ .../config/npcs/NPCsConfigFields.java | 6 ++- .../npcs/premade/StoryDungeonsQuestGiver.java | 12 +++--- .../npcs/premade/TheNetherBellTeleporter.java | 26 +++++++++++++ .../LightningEnchantment.java | 4 +- .../elitemobs/mobconstructor/EliteEntity.java | 5 ++- .../mobdata/aggressivemobs/EliteBogged.java | 16 ++++++++ .../mobdata/aggressivemobs/EliteBreeze.java | 16 ++++++++ .../aggressivemobs/EliteMobProperties.java | 3 ++ .../mobdata/aggressivemobs/EliteWither.java | 17 +++++++++ .../treasurechest/TreasureChest.java | 9 ++--- src/main/resources/plugin.yml | 2 +- 18 files changed, 170 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java rename src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/{EliteBreeze.java => EliteBreezeConfig.java} (74%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/npcs/premade/TheNetherBellTeleporter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBogged.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteBreeze.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/mobdata/aggressivemobs/EliteWither.java diff --git a/build.gradle b/build.gradle index f27628f29..9cf1a7dd0 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.2-SNAPSHOT' +version '9.0.3-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java index ea5f4de1b..5b1defcd0 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java @@ -10,5 +10,6 @@ public class FixPlayerSpeedOnRespawn 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)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 64093b316..6e89a7855 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -83,7 +83,12 @@ private static void setComments(FileConfiguration fileConfiguration, String key, } public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - fileConfiguration.addDefault(key, defaultValue); + try { + fileConfiguration.addDefault(key, defaultValue); + } catch (Exception e) { + new WarningMessage("Attempted to write key " + key + " with value " + defaultValue + " to " + fileConfiguration.getName() + " and that contained an illegal argument!"); + e.printStackTrace(); + } return fileConfiguration.getBoolean(key); } 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..ed22a2e06 --- /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.Arrays; +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", + Arrays.asList("&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/mobproperties/MobPropertiesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java index 487606694..a2016203e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -56,8 +56,8 @@ public class MobPropertiesConfig { new EliteHoglinConfig(), new ElitePiglinBruteConfig(), new EliteBeeConfig(), - new EliteBreeze() - + new EliteBreezeConfig(), + new EliteWitherConfig() )); public static HashMap getMobProperties() { diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java similarity index 74% rename from src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java rename to src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java index e89c9d654..201efca76 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreezeConfig.java @@ -5,10 +5,10 @@ import java.util.List; -public class EliteBreeze extends MobPropertiesConfigFields { - public EliteBreeze() { +public class EliteBreezeConfig extends MobPropertiesConfigFields { + public EliteBreezeConfig() { super("elite_breeze", - EntityType.BOGGED, + EntityType.BREEZE, true, "&2Lvl &2$level &2Elite &eBreeze", List.of("$player &cwas blown away by $entity!"), 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..eff26cef7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java @@ -0,0 +1,18 @@ +package com.magmaguy.elitemobs.config.mobproperties.premade; + +import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfigFields; +import org.bukkit.entity.EntityType; + +import java.util.Arrays; + +public class EliteWitherConfig extends MobPropertiesConfigFields { + public EliteWitherConfig() { + super("elite_wither", + EntityType.WITHER, + true, + "&fLvl &2$level &7Elite &5Wither", + Arrays.asList("$player &cangered $entity&c!", + "$player &chas met $entity's &cfury!"), + 12); + } +} 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..2068c866a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java @@ -122,7 +122,11 @@ 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. + } 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)); 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/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/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/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index 879e9c211..12a20aa66 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -278,7 +278,6 @@ 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); @@ -290,6 +289,10 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR 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 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/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/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/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index 4f3c0d143..f34961cf0 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -12,7 +12,10 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.*; +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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -278,13 +281,9 @@ public enum DropStyle { public static class TreasureChestEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { - Developer.message("0"); if (event.getClickedBlock() == null) return; - Developer.message("1"); TreasureChest treasureChest = getTreasureChest(event.getClickedBlock().getLocation()); - Developer.message("2"); if (treasureChest == null) return; - Developer.message("3"); event.setCancelled(true); if (GuildRank.getMaxGuildRank(event.getPlayer()) < treasureChest.customTreasureChestConfigFields.getChestTier()) treasureChest.lowRankMessage(event.getPlayer()); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ae83b8987..541022761 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.2 +version: 9.0.3 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 22d7dab34d53111be5b71d3e6ed8ca367c1fde5c Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Wed, 17 Jul 2024 04:32:48 +0100 Subject: [PATCH 32/78] EliteMobs 9.0.4 - [New] The official EliteMobs resource packs is now automatically placed in the exports folder of EliteMobs to be used by my new plugin, ResourcePackManager, which can automatically merge and host resource packs! - [New] Added the scale setting to custom bosses, allowing them to be larger or smaller - [Fix] Fixed issue where the back teleported would not work correctly - [Removal] Removed /em generateresourcepack command, now replaced with the much better ResourcePackManager plugin that does it automatically Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../elitemobs/api/PlayerTeleportEvent.java | 21 +- .../elitemobs/commands/AdminCommands.java | 8 - .../config/ConfigurationExporter.java | 207 +++++------------- .../CustomBossesConfigFields.java | 4 + .../initialsetup/FirstTimeSetup.java | 6 +- .../custombosses/CustomBossMegaConsumer.java | 5 + src/main/resources/plugin.yml | 2 +- 8 files changed, 78 insertions(+), 177 deletions(-) diff --git a/build.gradle b/build.gradle index 9cf1a7dd0..c3ab731e3 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.3-SNAPSHOT' +version '9.0.4-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index f579167be..05177dd22 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,15 +1,12 @@ package com.magmaguy.elitemobs.api; -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(); @@ -67,20 +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; - - EMPackage adventurersGuildPackage = EMPackage.getContent("adventurers_guild_hub"); - if (adventurersGuildPackage == null || !adventurersGuildPackage.isInstalled() || - adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation() == null || - Objects.equals(adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation().getWorld(), originalLocation.getWorld())) - return; - - PlayerData.setBackTeleportLocation(player, originalLocation); } public static class PlayerTeleportEventExecutor implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index fadb018cb..003ce635a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -12,7 +12,6 @@ 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; @@ -692,13 +691,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde } })); - // /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") diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java index 22fbef2d0..2e9526b60 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 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) { + new WarningMessage("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) { + new WarningMessage("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 { + new WarningMessage("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/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index e3d98fa33..11f3afb7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -217,6 +217,8 @@ public class CustomBossesConfigFields extends CustomConfigFields implements Cust 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. @@ -392,6 +394,8 @@ public void processConfigFields() { } catch (Exception e) { new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); } + + this.scale = processDouble("scale", scale, 1, false); } public boolean isCustomModelExists() { diff --git a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java index 85f0346c6..4bea48f57 100644 --- a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java +++ b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java @@ -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/mobconstructor/custombosses/CustomBossMegaConsumer.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java index 9cfa6b5cd..d4163689f 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossMegaConsumer.java @@ -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()); @@ -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/resources/plugin.yml b/src/main/resources/plugin.yml index 541022761..05e08f7c5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.3 +version: 9.0.4 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From a74477d09beb890de7d0d5ae0d844b008ca8337d Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 25 Jul 2024 09:11:19 +0100 Subject: [PATCH 33/78] EliteMobs 9.0.5 - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Almost all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 63 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../elitemobs/ChatColorConverter.java | 29 - .../com/magmaguy/elitemobs/EliteMobs.java | 124 +-- .../magmaguy/elitemobs/EventsRegistrer.java | 2 +- .../magmaguy/elitemobs/MetadataHandler.java | 6 +- .../GuildRankMenuHandler.java | 2 +- .../announcements/AnnouncementPriority.java | 2 +- .../elitemobs/api/EliteDamageEvent.java | 3 +- .../elitemobs/api/PlayerPreTeleportEvent.java | 2 +- .../elitemobs/api/QuestAcceptEvent.java | 2 +- .../elitemobs/api/QuestRewardEvent.java | 2 +- .../api/instanced/MatchInstantiateEvent.java | 2 +- .../api/instanced/MatchJoinEvent.java | 2 +- .../AlternativeDurabilityLoss.java | 2 +- .../FixPlayerOnLoginOrRespawn.java | 28 + .../FixPlayerSpeedOnRespawn.java | 15 - .../PlayerDeathMessageByEliteMob.java | 2 +- .../PlayerQuitCleanup.java | 2 +- .../elitemobs/commands/AdminCommands.java | 896 ------------------ .../commands/AdventurersGuildCommand.java | 21 + .../elitemobs/commands/AltCommand.java | 24 + .../elitemobs/commands/ArenaCommand.java | 22 + .../elitemobs/commands/ArenaCommands.java | 4 +- .../elitemobs/commands/CommandHandler.java | 144 --- .../elitemobs/commands/CommandManager.java | 96 ++ .../commands/CurrencyCommandsHandler.java | 6 +- .../commands/CustomBossCommandHandler.java | 2 +- .../elitemobs/commands/DebugCommand.java | 25 + .../elitemobs/commands/DiscordCommand.java | 21 + .../commands/DiscordMessageCommand.java | 24 + .../elitemobs/commands/DismissCommand.java | 21 + .../commands/DungeonTeleportCommand.java | 23 + .../elitemobs/commands/EliteMobsCommand.java | 23 + .../elitemobs/commands/EnchantCommand.java | 24 + .../elitemobs/commands/EventCommand.java | 23 + .../elitemobs/commands/FireballCommand.java | 26 + .../elitemobs/commands/GuildRankCommands.java | 2 +- .../elitemobs/commands/HelpCommand.java | 29 + .../elitemobs/commands/KillCommand.java | 20 + .../elitemobs/commands/KillRadiusCommand.java | 24 + .../elitemobs/commands/KillTypeCommand.java | 26 + .../commands/KillTypeRadiusCommand.java | 29 + .../elitemobs/commands/LanguageCommand.java | 31 + .../elitemobs/commands/LootCommand.java | 21 + .../elitemobs/commands/LootDebugCommand.java | 26 + .../elitemobs/commands/LootGiveCommand.java | 27 + .../elitemobs/commands/LootMenuCommand.java | 23 + .../elitemobs/commands/LootRandomCommand.java | 27 + .../commands/LootSimulateCommand.java | 30 + .../commands/LootSimulateMultipleCommand.java | 32 + .../elitemobs/commands/LootStats.java | 37 + .../commands/MoneyAddAllCommand.java | 28 + .../elitemobs/commands/MoneyAddCommand.java | 29 + .../elitemobs/commands/MoneyCheckCommand.java | 27 + .../commands/MoneyCheckPlayerCommand.java | 24 + .../commands/MoneyRemoveCommand.java | 28 + .../elitemobs/commands/MoneySetCommand.java | 27 + .../elitemobs/commands/PackageCommand.java | 8 +- .../commands/PackageDungeonCommand.java | 22 + .../elitemobs/commands/PayCommand.java | 26 + .../elitemobs/commands/PlaceBossCommand.java | 25 + .../elitemobs/commands/PlaceNPCCommand.java | 26 + .../commands/PlaceTreasureChestCommand.java | 25 + .../commands/PlaceWormholeCommand.java | 41 + .../commands/QuestAcceptCommand.java | 25 + .../commands/QuestBypassCommand.java | 21 + .../commands/QuestCompleteCommand.java | 23 + .../elitemobs/commands/QuestLeaveCommand.java | 23 + .../commands/QuestResetAllCommand.java | 26 + .../elitemobs/commands/QuestResetCommand.java | 25 + .../elitemobs/commands/QuestTrackCommand.java | 25 + .../elitemobs/commands/QuitCommand.java | 23 + .../elitemobs/commands/RankCommand.java | 22 + .../elitemobs/commands/RankSetCommand.java | 26 + .../elitemobs/commands/ReloadCommand.java | 29 + .../elitemobs/commands/RemoveCommand.java | 21 + .../elitemobs/commands/RepairCommand.java | 26 + .../elitemobs/commands/RespawnAllCommand.java | 23 + .../elitemobs/commands/ScrapCommand.java | 26 + .../elitemobs/commands/SetupCommand.java | 22 + .../elitemobs/commands/SetupDoneCommand.java | 26 + .../elitemobs/commands/SetupHandler.java | 17 - .../commands/SetupToggleCommand.java | 29 + .../elitemobs/commands/ShareItemCommand.java | 22 + .../elitemobs/commands/ShopCustomCommand.java | 25 + .../commands/ShopCustomOtherCommand.java | 29 + .../commands/ShopDynamicCommand.java | 25 + .../commands/ShopProceduralOtherCommand.java | 29 + .../commands/ShopSellOtherCommand.java | 30 + .../commands/SpawnBossAtCommand.java | 40 + .../elitemobs/commands/SpawnBossCommand.java | 27 + .../commands/SpawnBossLevelAtCommand.java | 42 + .../commands/SpawnBossLevelCommand.java | 29 + .../elitemobs/commands/SpawnCommand.java | 16 +- .../elitemobs/commands/SpawnElite.java | 33 + .../commands/SpawnEliteAtCommand.java | 43 + .../commands/SpawnTeleportCommand.java | 24 + .../elitemobs/commands/StartCommand.java | 26 + .../elitemobs/commands/StatsCommand.java | 21 + .../elitemobs/commands/TrackBossCommand.java | 37 + .../TransitiveBlocksCancelCommand.java | 21 + .../TransitiveBlocksEditAreaCommand.java | 24 + .../commands/TransitiveBlocksEditCommand.java | 24 + .../TransitiveBlocksRegisterAreaCommand.java | 24 + .../TransitiveBlocksRegisterCommand.java | 24 + .../elitemobs/commands/UnbindCommand.java | 26 + .../commands/UnbindForceCommand.java | 27 + .../elitemobs/commands/UserCommands.java | 358 ------- .../elitemobs/commands/VersionCommand.java | 25 + .../admin/CheckTierOthersCommand.java | 35 - .../elitemobs/commands/admin/DebugScreen.java | 2 +- .../commands/admin/EventCommand.java | 2 +- .../commands/admin/GetTierCommand.java | 12 +- .../elitemobs/commands/admin/KillHandler.java | 2 +- .../elitemobs/commands/admin/LootCommand.java | 2 +- .../admin/RelativeCoordinatesCommand.java | 2 +- .../commands/admin/ReloadCommand.java | 13 - .../commands/admin/RemoveCommand.java | 2 +- .../commands/admin/SimLootCommand.java | 6 +- .../commands/admin/StatsCommand.java | 2 +- .../commands/admin/VersionCommand.java | 18 - .../commands/combat/CheckTierCommand.java | 27 - .../elitemobs/commands/setup/SetupMenu.java | 10 +- .../config/AdventurersGuildConfig.java | 187 ++-- .../elitemobs/config/AntiExploitConfig.java | 18 +- .../elitemobs/config/ArenasConfig.java | 15 +- .../elitemobs/config/CombatTagConfig.java | 17 +- .../elitemobs/config/ConfigurationEngine.java | 165 +--- .../config/ConfigurationExporter.java | 10 +- .../config/ConfigurationImporter.java | 40 +- .../elitemobs/config/CustomConfig.java | 193 ---- .../elitemobs/config/CustomConfigFields.java | 366 +------ .../config/CustomConfigFieldsInterface.java | 5 - .../elitemobs/config/DatabaseConfig.java | 15 +- .../elitemobs/config/DefaultConfig.java | 52 +- .../elitemobs/config/DiscordSRVConfig.java | 15 +- .../elitemobs/config/DungeonsConfig.java | 16 +- .../config/EconomySettingsConfig.java | 42 +- .../elitemobs/config/EventsConfig.java | 18 +- .../elitemobs/config/ItemSettingsConfig.java | 16 +- .../config/ItemUpgradeSystemConfig.java | 28 - .../config/LegacyValueConverter.java | 21 + .../config/MobCombatSettingsConfig.java | 18 +- .../elitemobs/config/ModelsConfig.java | 18 +- ...roceduralItemGenerationSettingsConfig.java | 44 +- .../elitemobs/config/QuestsConfig.java | 176 ++-- .../config/ResourcePackDataConfig.java | 48 +- .../elitemobs/config/SoundsConfig.java | 19 +- .../config/SpecialItemSystemsConfig.java | 39 +- .../elitemobs/config/UnusedNodeHandler.java | 31 - .../elitemobs/config/ValidWorldsConfig.java | 41 +- .../elitemobs/config/WormholesConfig.java | 16 +- .../customarenas/CustomArenasConfig.java | 2 +- .../CustomArenasConfigFields.java | 3 +- .../custombosses/CustomBossesConfig.java | 6 +- .../CustomBossesConfigFields.java | 33 +- .../customevents/CustomEventsConfig.java | 2 +- .../CustomEventsConfigFields.java | 7 +- .../config/customitems/CustomItemsConfig.java | 2 +- .../customitems/CustomItemsConfigFields.java | 13 +- .../premade/DepthsSeekerConfig.java | 2 +- .../premade/LuckyCharmsConfig.java | 2 +- .../customquests/CustomQuestsConfig.java | 2 +- .../CustomQuestsConfigFields.java | 20 +- .../customspawns/CustomSpawnConfig.java | 2 +- .../customspawns/CustomSpawnConfigFields.java | 3 +- .../CustomTreasureChestConfigFields.java | 9 +- .../CustomTreasureChestsConfig.java | 8 +- .../DungeonPackagerConfig.java | 2 +- .../DungeonPackagerConfigFields.java | 4 +- .../premade/OasisPyramidSanctum.java | 1 + .../premade/PrimisBloodTempleSanctum.java | 1 + .../premade/PrimisGladiusInvasionDungeon.java | 1 + .../enchantments/EnchantmentsConfig.java | 6 +- .../elitemobs/config/menus/MenusConfig.java | 2 +- .../config/menus/MenusConfigFields.java | 3 +- .../menus/premade/CustomQuestMenuConfig.java | 2 +- .../menus/premade/DynamicQuestMenuConfig.java | 2 +- .../MobPropertiesConfigFields.java | 2 +- .../elitemobs/config/npcs/NPCsConfig.java | 2 +- .../config/npcs/NPCsConfigFields.java | 11 +- .../elitemobs/config/powers/PowersConfig.java | 2 +- .../config/powers/PowersConfigFields.java | 4 +- .../translations/TranslationsConfig.java | 8 +- .../TranslationsConfigFields.java | 24 +- .../config/wormholes/WormholeConfig.java | 2 +- .../wormholes/WormholeConfigFields.java | 3 +- .../elitemobs/dungeons/EMPackage.java | 16 +- .../WorldInstancedDungeonPackage.java | 2 +- .../elitemobs/dungeons/WorldPackage.java | 6 +- .../dungeons/utility/DungeonUtils.java | 9 +- .../elitemobs/economy/VaultCompatibility.java | 9 +- .../elitemobs/events/ActionEvent.java | 4 +- .../elitemobs/events/CustomEvent.java | 9 +- .../elitemobs/events/MoonPhaseDetector.java | 4 +- .../magmaguy/elitemobs/events/TimedEvent.java | 8 +- .../elitemobs/explosionregen/Explosion.java | 3 +- .../initialsetup/FirstTimeSetup.java | 2 +- .../instanced/InstanceDeathLocation.java | 2 +- .../elitemobs/instanced/MatchInstance.java | 2 +- .../instanced/arena/ArenaInstance.java | 22 +- .../elitemobs/instanced/arena/ArenaWaves.java | 8 +- .../instanced/dungeons/DungeonInstance.java | 14 +- .../DungeonKillPercentageObjective.java | 6 +- .../dungeons/DungeonKillTargetObjective.java | 6 +- .../dungeons/EnchantmentDungeonInstance.java | 2 +- .../elitemobs/items/EliteItemLore.java | 6 +- .../elitemobs/items/ItemLootShower.java | 22 +- .../magmaguy/elitemobs/items/ItemTagger.java | 6 +- .../magmaguy/elitemobs/items/LootTables.java | 7 +- .../customenchantments/RepairEnchantment.java | 4 +- .../SoulbindEnchantment.java | 2 +- .../SummonMerchantEnchantment.java | 2 +- .../SummonWolfEnchantment.java | 6 +- .../items/customitems/CustomItem.java | 33 +- .../CurrencyCustomLootEntry.java | 4 +- .../customloottable/CustomLootEntry.java | 4 +- .../customloottable/CustomLootTable.java | 2 +- .../customloottable/EliteCustomLootEntry.java | 12 +- .../ItemStackCustomLootEntry.java | 4 +- .../customloottable/SharedLootTable.java | 2 +- .../itemconstructor/ItemConstructor.java | 2 +- .../itemconstructor/MaterialGenerator.java | 9 +- .../items/itemconstructor/NameGenerator.java | 15 +- .../potioneffects/ElitePotionEffect.java | 6 +- .../magmaguy/elitemobs/menus/ArenaMenu.java | 2 +- .../menus/InstancedDungeonBrowser.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 4 +- .../magmaguy/elitemobs/menus/LootMenu.java | 2 +- .../elitemobs/menus/ScrapperMenu.java | 2 +- .../magmaguy/elitemobs/menus/SellMenu.java | 2 +- .../elitemobs/menus/SharedShopElements.java | 2 +- .../elitemobs/mobconstructor/BossType.java | 1 + .../elitemobs/mobconstructor/CustomSpawn.java | 20 +- .../elitemobs/mobconstructor/EliteEntity.java | 6 +- .../custombosses/BossMusic.java | 6 +- .../custombosses/BossTrace.java | 60 -- .../custombosses/CustomBossBossBar.java | 11 +- .../custombosses/CustomBossDeath.java | 2 +- .../custombosses/CustomBossEntity.java | 44 +- .../CustomBossEscapeMechanism.java | 2 +- .../custombosses/CustomBossMegaConsumer.java | 40 +- .../custombosses/CustomBossMount.java | 8 +- .../custombosses/ElitePowerParser.java | 12 +- .../custombosses/InstancedBossEntity.java | 6 +- .../custombosses/PhaseBossEntity.java | 10 +- .../custombosses/RegionalBossEntity.java | 8 +- .../transitiveblocks/TransitiveBlock.java | 4 +- .../TransitiveBlockCommand.java | 4 +- .../transitiveblocks/TransitiveBossBlock.java | 6 +- .../NaturalMobSpawnEventHandler.java | 2 +- .../magmaguy/elitemobs/npcs/NPCEntity.java | 104 +- .../elitemobs/npcs/NPCInteractions.java | 6 +- .../ondeathcommands/OnDeathCommands.java | 4 +- .../elitemobs/pathfinding/Navigation.java | 4 +- .../elitemobs/playerdata/PlayerItem.java | 16 +- .../playerdata/database/GenerateDatabase.java | 9 +- .../playerdata/database/PlayerData.java | 51 +- .../playerdata/database/PortOldData.java | 6 +- .../statusscreen/BossTrackingPage.java | 6 +- .../statusscreen/PlayerStatusScreen.java | 2 +- .../statusscreen/TeleportsPage.java | 9 +- .../EnderDragonEndermiteBombardment.java | 4 +- .../magmaguy/elitemobs/powers/PhotonRay.java | 4 +- .../elitemobs/powers/SummonTheReturned.java | 4 +- .../com/magmaguy/elitemobs/powers/Taunt.java | 2 +- .../elitemobs/powers/ZombieFriends.java | 2 +- .../elitemobs/powers/ZombieNecronomicon.java | 10 +- .../elitemobs/powers/ZombieParents.java | 6 +- .../powers/meta/CombatEnterScanPower.java | 2 - .../powers/meta/CustomSummonPower.java | 66 +- .../elitemobs/powers/meta/ElitePower.java | 6 +- .../elitemobs/powers/scripts/EliteScript.java | 2 +- .../powers/scripts/ScriptAction.java | 60 +- .../powers/scripts/ScriptActionData.java | 8 +- .../powers/scripts/ScriptConditions.java | 2 +- .../powers/scripts/ScriptListener.java | 4 +- .../powers/scripts/ScriptTargets.java | 16 +- .../elitemobs/powers/scripts/ScriptZone.java | 12 +- .../scripts/caching/EliteScriptBlueprint.java | 4 +- .../caching/ScriptActionBlueprint.java | 10 +- .../caching/ScriptActionsBlueprint.java | 4 +- .../caching/ScriptConditionsBlueprint.java | 4 +- .../caching/ScriptCooldownsBlueprint.java | 4 +- .../caching/ScriptEventsBlueprint.java | 4 +- .../caching/ScriptParticlesBlueprint.java | 6 +- .../ScriptRelativeVectorBlueprint.java | 5 +- .../caching/ScriptTargetsBlueprint.java | 6 +- .../scripts/caching/ScriptZoneBlueprint.java | 4 +- .../powers/scripts/enums/ActionType.java | 3 +- .../elitemobs/quests/CustomQuest.java | 6 +- .../elitemobs/quests/QuestTracking.java | 2 +- .../quests/menus/QuestInventoryMenu.java | 2 +- .../elitemobs/quests/menus/QuestMenu.java | 2 +- .../objectives/CustomFetchObjective.java | 4 +- .../objectives/CustomObjectivesParser.java | 10 +- .../quests/objectives/QuestObjectives.java | 6 +- .../playercooldowns/PlayerQuestCooldowns.java | 4 +- .../elitemobs/quests/rewards/RewardEntry.java | 6 +- .../modelengine/CustomModelMEG.java | 23 +- .../discordsrv/DiscordSRVAnnouncement.java | 6 +- .../libsdisguises/DisguiseEntity.java | 12 +- .../elitemobs/thirdparty/paper/PaperMC.java | 4 +- .../worldguard/WorldGuardCompatibility.java | 52 +- .../treasurechest/TreasureChest.java | 8 +- .../utils/ConfigurationLocation.java | 13 +- .../elitemobs/utils/DebugMessage.java | 28 - .../magmaguy/elitemobs/utils/DeepCopy.java | 21 - .../magmaguy/elitemobs/utils/Developer.java | 21 - .../magmaguy/elitemobs/utils/InfoMessage.java | 9 - .../elitemobs/utils/ItemStackGenerator.java | 2 +- .../elitemobs/utils/ItemStackSerializer.java | 5 +- .../elitemobs/utils/MapListInterpreter.java | 24 +- .../elitemobs/utils/PotionEffectTypeUtil.java | 3 +- .../elitemobs/utils/SpigotMessage.java | 2 +- .../elitemobs/utils/StringColorAnimator.java | 2 +- .../elitemobs/utils/VisualDisplay.java | 2 +- .../elitemobs/utils/WarningMessage.java | 21 - .../elitemobs/utils/WorldInstantiator.java | 9 +- .../com/magmaguy/elitemobs/utils/ZipFile.java | 161 ---- .../elitemobs/utils/shapes/Cuboid.java | 6 +- .../elitemobs/utils/shapes/Cylinder.java | 4 +- .../magmaguy/elitemobs/utils/shapes/Ray.java | 4 +- .../versionnotifier/VersionChecker.java | 27 +- .../elitemobs/wormhole/VisualEffects.java | 4 +- .../elitemobs/wormhole/WormholeEntry.java | 15 +- .../elitemobs/wormhole/WormholeTask.java | 2 +- src/main/resources/AdventurersGuild.yml | 0 src/main/resources/CombatTag.yml | 0 .../resources/ItemsCustomLootSettings.yml | 0 src/main/resources/ItemsDropSettings.yml | 0 .../resources/ItemsProceduralSettings.yml | 0 src/main/resources/MobCombatSettings.yml | 0 src/main/resources/ValidWorlds.yml | 0 src/main/resources/events.yml | 0 src/main/resources/playerGuildRank.yml | 0 src/main/resources/playerMoneyData.yml | 0 src/main/resources/plugin.yml | 8 +- src/main/resources/translation.yml | 0 340 files changed, 3524 insertions(+), 4015 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/LootStats.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/UserCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/admin/CheckTierOthersCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/admin/ReloadCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/admin/VersionCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/combat/CheckTierCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/CustomConfigFieldsInterface.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossTrace.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/DebugMessage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/DeepCopy.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/Developer.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/InfoMessage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/WarningMessage.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/ZipFile.java delete mode 100644 src/main/resources/AdventurersGuild.yml delete mode 100644 src/main/resources/CombatTag.yml delete mode 100644 src/main/resources/ItemsCustomLootSettings.yml delete mode 100644 src/main/resources/ItemsDropSettings.yml delete mode 100644 src/main/resources/ItemsProceduralSettings.yml delete mode 100644 src/main/resources/MobCombatSettings.yml delete mode 100644 src/main/resources/ValidWorlds.yml delete mode 100644 src/main/resources/events.yml delete mode 100644 src/main/resources/playerGuildRank.yml delete mode 100644 src/main/resources/playerMoneyData.yml delete mode 100644 src/main/resources/translation.yml diff --git a/build.gradle b/build.gradle index c3ab731e3..7e99f3d7f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ 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,6 +12,17 @@ plugins { compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + options.release = 21 +} + //Fixes issues with utf-8 in the translations files. Why? Don't know. processResources { def props = [version: version] @@ -23,7 +34,7 @@ processResources { } group 'com.magmaguy' -version '9.0.4-SNAPSHOT' +version '9.0.5' repositories { maven { @@ -42,13 +53,18 @@ repositories { mavenLocal() //Spigot API & CloudCommands - maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } +// 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 = 'http://magmaguy.com:50001/releases' + allowInsecureProtocol = true + } //Bstats API maven { url = 'https://repo.codemc.org/repository/maven-public' } @@ -72,7 +88,6 @@ repositories { artifact() } } - } dependencies { @@ -82,14 +97,6 @@ dependencies { implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' - //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' @@ -99,7 +106,7 @@ 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' @@ -113,8 +120,8 @@ dependencies { 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" @@ -125,6 +132,9 @@ dependencies { //Advanced AI goals implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.11.2-SNAPSHOT' + //Advanced AI goals + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' + // Mythic Mobs integration - currently only for arenas compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } @@ -143,9 +153,6 @@ 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) @@ -167,35 +174,19 @@ 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 = "https://s01.oss.sonatype.org/content/repositories/snapshots/"; + 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 1916f0a58..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 8c3becb3a..1f33f06be 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -5,7 +5,7 @@ */ import com.magmaguy.easyminecraftgoals.NMSManager; -import com.magmaguy.elitemobs.commands.CommandHandler; +import com.magmaguy.elitemobs.commands.CommandManager; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -58,11 +58,11 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.BossBarUtil; -import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ServerTime; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.versionnotifier.VersionChecker; 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; @@ -84,42 +84,40 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations - DefaultConfig.initializeConfig(); - ResourcePackDataConfig.initializeConfig(); - ItemSettingsConfig.initializeConfig(); - ProceduralItemGenerationSettingsConfig.initializeConfig(); + new DefaultConfig(); + new ResourcePackDataConfig(); + 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(); - SoundsConfig.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); } @@ -127,18 +125,16 @@ public static void worldScanner() { @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)){ - new WarningMessage("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."); + 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; } @@ -152,9 +148,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); } } @@ -173,14 +169,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; } @@ -188,7 +184,7 @@ public void onEnable() { EventsRegistrer.registerEvents(); //Launch the local data cache - DatabaseConfig.initializeConfig(); + new DatabaseConfig(); PlayerData.initializeDatabaseConnection(); ElitePlayerInventory.initialize(); @@ -253,7 +249,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(); } @@ -262,17 +258,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(); + new CommandManager(); - SpecialItemSystemsConfig.initializeConfig(); + new SpecialItemSystemsConfig(); /* Check for new plugin version or for dungeon updates @@ -284,11 +281,15 @@ public void onEnable() { @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) @@ -298,41 +299,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 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(); @@ -341,40 +323,24 @@ 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(); - EliteMobsWorld.shutdown(); Navigation.shutdown(); BossBarUtil.shutdown(); ScriptAction.shutdown(); - - //save cached data - Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); + Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); - Bukkit.getLogger().info("[EliteMobs] All done! Good night."); - + MagmaCore.shutdown(); + Logger.info("All done! Good night."); } /* diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index a2ac40314..e127f438e 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -107,7 +107,7 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) register(new PreventUpgradeDiamondToNetherite()); - register(new FixPlayerSpeedOnRespawn()); + register(new FixPlayerOnLoginOrRespawn()); register(new EnvironmentalDungeonDamage()); register(new PlayerQuitCleanup()); 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/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 51ae8477a..0a3986fe2 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.adventurersguild; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; @@ -8,6 +7,7 @@ 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; 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/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/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java index 03317ad67..3e3cce76c 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java @@ -1,11 +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; 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/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/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 275500332..24c42aa45 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -79,7 +79,7 @@ public void onPlayerDeath(PlayerDeathEvent event) { } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerShoot(EntityShootBowEvent event){ + public void onPlayerShoot(EntityShootBowEvent event) { if (!EliteItemManager.isEliteMobsItem(event.getBow())) return; if (isOnLastDamage(event.getBow())) event.setCancelled(true); } 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..fa6bf49a6 --- /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.PlayerLoginEvent; +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 onPlayerRespawn(PlayerLoginEvent 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/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java deleted file mode 100644 index 5b1defcd0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.collateralminecraftchanges; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class FixPlayerSpeedOnRespawn 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)); - } -} 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 index cf7069ae3..3a88714f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java @@ -7,7 +7,7 @@ public class PlayerQuitCleanup implements Listener { @EventHandler - public void onPlayerQuit(PlayerQuitEvent event){ + public void onPlayerQuit(PlayerQuitEvent event) { if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer())) event.getPlayer().setInvulnerable(false); } 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 003ce635a..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ /dev/null @@ -1,896 +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.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")))); - - 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 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 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 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) { - customBossEntity.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 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/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java new file mode 100644 index 000000000..1ec601fb5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class AdventurersGuildCommand extends AdvancedCommand { + public AdventurersGuildCommand() { + super(List.of("adventurersguild", "ag")); + 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() { + com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + } +} \ 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..01b258753 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -0,0 +1,24 @@ +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.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."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + PlayerData.setUseBookMenus(getCurrentPlayerSender(), !PlayerData.getUseBookMenus(getCurrentPlayerSender().getUniqueId())); + Logger.sendMessage(getCurrentCommandSender(), 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..030c1908c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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 "); + setDescription("When in instanced content, makes the player start the instance."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + ArenaCommands.openArenaMenu(getCurrentPlayerSender(), getStringArgument("arenaID")); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java index 5179f8289..50d8010f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java @@ -4,7 +4,9 @@ import org.bukkit.entity.Player; public class ArenaCommands { - private ArenaCommands(){} + private 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 deleted file mode 100644 index 2a5faef8b..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -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. - */ - -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(); - } - - 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); - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java new file mode 100644 index 000000000..1acb36c11 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java @@ -0,0 +1,96 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; + +public class CommandManager extends com.magmaguy.magmacore.command.CommandManager { + public CommandManager() { + super(MetadataHandler.PLUGIN, "elitemobs"); + } + + @Override + public void registerCommands() { + //Admin commands + registerCommand(new SetupCommand()); + registerCommand(new SetupDoneCommand()); + registerCommand(new SetupToggleCommand()); + registerCommand(new SpawnBossCommand()); + registerCommand(new SpawnBossLevelCommand()); + registerCommand(new SpawnBossAtCommand()); + registerCommand(new SpawnBossLevelAtCommand()); + registerCommand(new PlaceBossCommand()); + registerCommand(new PlaceTreasureChestCommand()); + registerCommand(new PlaceNPCCommand()); + registerCommand(new RemoveCommand()); + registerCommand(new DebugCommand()); + registerCommand(new EventCommand()); + registerCommand(new StatsCommand()); + registerCommand(new LootMenuCommand()); + registerCommand(new LootGiveCommand()); + registerCommand(new LootRandomCommand()); + registerCommand(new LootSimulateMultipleCommand()); + registerCommand(new LootSimulateCommand()); + registerCommand(new VersionCommand()); + registerCommand(new ReloadCommand()); + registerCommand(new KillCommand()); + registerCommand(new KillRadiusCommand()); + registerCommand(new KillTypeCommand()); + registerCommand(new KillTypeRadiusCommand()); + registerCommand(new LootDebugCommand()); + registerCommand(new MoneyAddCommand()); + registerCommand(new MoneyAddAllCommand()); + registerCommand(new MoneySetCommand()); + registerCommand(new MoneyCheckPlayerCommand()); + registerCommand(new UnbindForceCommand()); + registerCommand(new FireballCommand()); + registerCommand(new RespawnAllCommand()); + registerCommand(new PackageDungeonCommand()); + registerCommand(new LanguageCommand()); + registerCommand(new PlaceWormholeCommand()); + registerCommand(new LootStats()); + registerCommand(new ShopProceduralOtherCommand()); + registerCommand(new ShopCustomOtherCommand()); + registerCommand(new ShopSellOtherCommand()); + registerCommand(new QuestBypassCommand()); + registerCommand(new QuestCompleteCommand()); + registerCommand(new QuestResetCommand()); + registerCommand(new QuestResetAllCommand()); + registerCommand(new TransitiveBlocksCancelCommand()); + registerCommand(new TransitiveBlocksRegisterCommand()); + registerCommand(new TransitiveBlocksEditCommand()); + registerCommand(new TransitiveBlocksRegisterAreaCommand()); + registerCommand(new TransitiveBlocksEditAreaCommand()); + registerCommand(new RankSetCommand()); + registerCommand(new SpawnElite()); + registerCommand(new SpawnEliteAtCommand()); + registerCommand(new DiscordMessageCommand()); + registerCommand(new DiscordCommand()); + + //User commands + registerCommand(new AdventurersGuildCommand()); + registerCommand(new ShareItemCommand()); + registerCommand(new ShopDynamicCommand()); + registerCommand(new ShopCustomCommand()); + registerCommand(new RepairCommand()); + registerCommand(new EnchantCommand()); + registerCommand(new ScrapCommand()); + registerCommand(new UnbindCommand()); + registerCommand(new MoneyCheckCommand()); + registerCommand(new QuestAcceptCommand()); + registerCommand(new QuestTrackCommand()); + registerCommand(new QuestLeaveCommand()); + registerCommand(new RankCommand()); + registerCommand(new LootCommand()); + registerCommand(new QuitCommand()); + registerCommand(new StartCommand()); + registerCommand(new ArenaCommand()); + registerCommand(new DismissCommand()); + registerCommand(new AltCommand()); + registerCommand(new SpawnTeleportCommand()); + registerCommand(new DungeonTeleportCommand()); + registerCommand(new TrackBossCommand()); + registerCommand(new PayCommand()); + + registerCommand(new EliteMobsCommand()); + registerCommand(new HelpCommand()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index 82373bb98..e6de39500 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 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 eb0b29814..71fbd2efb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java @@ -1,9 +1,9 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields; 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; 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..4eed4aad6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -0,0 +1,25 @@ +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.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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute() { + DebugScreen.open(getCurrentPlayerSender(), 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..4ea9e1ac4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Links to the EliteMobs discord."); + } + + @Override + public void execute() { + Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + } +} \ No newline at end of file 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..97c796060 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes"); + } + + @Override + public void execute() { + new DiscordSRVAnnouncement(getStringSequenceArgument("message")); + Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); + } +} \ No newline at end of file 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..0af89d79c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.playerdata.database.PlayerData; +import com.magmaguy.magmacore.command.AdvancedCommand; +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"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + PlayerData.setDismissEMStatusScreenMessage(getCurrentPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(getCurrentPlayerSender().getUniqueId())); + } +} 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..c50bc0416 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.dungeontp"); + setDescription("Teleports players to Lairs, Minidungeons and Dungeons."); + setUsage("/em dungeontp "); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + DungeonCommands.teleport(getCurrentPlayerSender(), 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..a07eb3d2f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -0,0 +1,23 @@ +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.SenderType; + +import java.util.List; + +public class EliteMobsCommand extends AdvancedCommand { + public EliteMobsCommand() { + super(List.of("em", "elitemobs")); + setDescription("The main command for EliteMobs, opens the main menu."); + setUsage("/em"); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + if (DefaultConfig.isEmLeadsToStatusMenu()) + new PlayerStatusScreen(getCurrentPlayerSender()); + } +} \ 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..c2766a35e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -0,0 +1,24 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + new ItemEnchantmentMenu(getCurrentPlayerSender()); + } +} 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..489fe0ef5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.events.TimedEvent; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Triggers a timed event to start at the next available time and place."); + } + + @Override + public void execute() { + com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(getCurrentCommandSender(), 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..c1a8cb366 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.entitytracker.EntityTracker; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Shoots a fireball, to test terrain protections and explosion regeneration."); + } + + @Override + public void execute() { + Fireball fireball = (Fireball) getCurrentPlayerSender().getWorld().spawnEntity(getCurrentPlayerSender().getLocation(), EntityType.FIREBALL); + fireball.setDirection(getCurrentPlayerSender().getLocation().getDirection().normalize()); + fireball.setShooter(getCurrentPlayerSender()); + 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..4cdca44e4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Lists all commands."); + } + + @Override + public void execute() { + Logger.sendMessage(getCurrentCommandSender(), "Commands:"); + CommandManager.getInstance().commands.forEach(command -> { + if (getCurrentCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.usage, command.description)); + } else { + Logger.sendSimpleMessage(getCurrentCommandSender(), command.usage); + Logger.sendSimpleMessage(getCurrentCommandSender(), command.description); + } + }); + } +} \ 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..a8b97ca43 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -0,0 +1,20 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class KillCommand extends AdvancedCommand { + public KillCommand() { + super(List.of("kill")); + setUsage("/em kill"); + setPermission("elitemobs.*"); + setDescription("Kills all elites."); + } + + @Override + public void execute() { + KillHandler.killAggressiveMobs(getCurrentCommandSender()); + } +} \ 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..ee0629fa8 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites in the specified radius."); + } + + @Override + public void execute() { + KillHandler.radiusKillAggressiveMobs(getCurrentPlayerSender(), 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..15d6e8ee7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites of the specified type."); + } + + @Override + public void execute() { + KillHandler.killEntityType(getCurrentPlayerSender(), EntityType.valueOf(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..0d412be6f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.admin.KillHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Kills all elites of the specified type."); + } + + @Override + public void execute() { + KillHandler.radiusKillSpecificMobs(getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("type")), + 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..99c1ab744 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -0,0 +1,31 @@ +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.util.Logger; + +import java.util.List; + +public class LanguageCommand extends AdvancedCommand { + public LanguageCommand() { + super(List.of("language")); + addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); + setUsage("/em language "); + setPermission("elitemobs.*"); + setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + } + + @Override + public void execute() { + String language = getStringArgument("language"); + if (!TranslationsConfig.getTranslationConfigs().containsKey(language)) { + Logger.sendMessage(getCurrentCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(getCurrentCommandSender(), key)); + return; + } + DefaultConfig.setLanguage(getCurrentCommandSender(), language); + Logger.sendMessage(getCurrentCommandSender(), "&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..53b255fdc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.LootMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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() { + LootMenu.openMenu(getCurrentPlayerSender()); + } +} 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..82a55be01 --- /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.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em loot test "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + GetTierCommand.get(getCurrentPlayerSender(), 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..9159eaed2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -0,0 +1,27 @@ +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.SenderType; + +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Gives loot to a player."); + } + + @Override + public void execute() { + LootCommand.give(getCurrentCommandSender(), getStringArgument("playerName"), 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..2ff145bbc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.GetLootMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Opens the loot menu."); + } + + @Override + public void execute() { + new GetLootMenu(getCurrentPlayerSender()); + } +} \ 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..5bff2f261 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -0,0 +1,27 @@ +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.SenderType; + +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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot random "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Gives loot to a player."); + } + + @Override + public void execute() { + SimLootCommand.forcePositiveLoot(getCurrentCommandSender(), getStringArgument("playerName"), 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..5986986de --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -0,0 +1,30 @@ +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.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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot simulate "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified level and player."); + } + + @Override + public void execute() { + SimLootCommand.run( + getCurrentPlayerSender(), + getIntegerArgument("level"), + 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..4f8988bc2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -0,0 +1,32 @@ +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.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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); + setUsage("/em loot simulate "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + SimLootCommand.runMultipleTimes( + getCurrentPlayerSender(), + getIntegerArgument("level"), + getIntegerArgument("times"), + 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..4dc8c73f9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -0,0 +1,37 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.api.utils.EliteItemManager; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Provides EliteMobs stats for the currently held item."); + } + + @Override + public void execute() { + Player player = getCurrentPlayerSender(); + 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..8d13578c1 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.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.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class MoneyAddAllCommand extends AdvancedCommand { + public MoneyAddAllCommand() { + super(List.of("money")); + addLiteral("add"); + addLiteral("all"); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money add all "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.addAllCommand( + getCurrentCommandSender(), + 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..08328ad15 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +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<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money add "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.addCommand( + getCurrentCommandSender(), + getStringArgument("player"), + 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..d2e35b5d6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -0,0 +1,27 @@ +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.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"); + setSenderType(SenderType.PLAYER); + setDescription("Checks the EliteMobs currency"); + } + + @Override + public void execute() { + if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) + new PlayerStatusScreen(getCurrentPlayerSender()); + else + CurrencyCommandsHandler.walletCommand(getCurrentPlayerSender()); + } +} 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..01f299276 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -0,0 +1,24 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; + +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 check "); + setPermission("elitemobs.*"); + setDescription("Checks how much currency you have."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.checkCommand( + getCurrentCommandSender(), + getStringArgument("player")); + } +} \ No newline at end of file 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..e99856ac9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.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.SenderType; + +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Deducts the specified amount of currency from a player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.subtractCommand( + getStringArgument("player"), + 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..517ab97a5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; + +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.*"); + setDescription("Sets the specified amount of currency to a player."); + } + + @Override + public void execute() { + CurrencyCommandsHandler.setCommand( + getCurrentCommandSender(), + getStringArgument("player"), + 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..d9ba2bac9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; + +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.*"); + setDescription("Packages an EliteMobs dungeon for distribution."); + } + + @Override + public void execute() { + new PackageCommand(getCurrentCommandSender(), getStringArgument("dungeonName"), 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..98f778fed --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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 "); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + CurrencyCommandsHandler.payCommand( + getCurrentPlayerSender(), + getStringArgument("player"), + 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..a80c2017e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.ArrayList; +import java.util.List; + +public class PlaceBossCommand extends AdvancedCommand { + public PlaceBossCommand() { + super(List.of("place")); + addLiteral("boss"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + setUsage("/em addSpawn boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute() { + CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + } +} \ 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..d093d367a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -0,0 +1,26 @@ +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.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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Permanently adds an npc to the location the user is standing on."); + } + + @Override + public void execute() { + NPCCommands.set(getCurrentPlayerSender(), 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..ad8ee1d5a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Permanently adds a treasure chest to the location the user is standing on."); + } + + @Override + public void execute() { + CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + } +} \ 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..9ff0df62e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -0,0 +1,41 @@ +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.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 wormhole <1/2>"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + } + + @Override + public void execute() { + for (Wormhole wormhole : Wormhole.getWormholes()) { + if (wormhole.getWormholeConfigFields().getFilename().equals(getStringArgument("wormholeFilename"))) + switch (getStringArgument("wormholeOption")) { + case "1": + wormhole.getWormholeEntry1().updateLocation(getCurrentPlayerSender()); + return; + case "2": + wormhole.getWormholeEntry2().updateLocation(getCurrentPlayerSender()); + return; + default: + Logger.sendMessage(getCurrentCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + } + } + Logger.sendMessage(getCurrentCommandSender(), "Failed to set location for this wormhole."); + } +} \ No newline at end of file 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..9b10521ed --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.command"); + setSenderType(SenderType.PLAYER); + setDescription("Accepts a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute() { + QuestCommand.joinQuest(getStringArgument("questID"), getCurrentPlayerSender()); + } +} 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..413fbdbe6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class QuestBypassCommand extends AdvancedCommand { + public QuestBypassCommand() { + super(List.of("quest")); + addLiteral("bypass"); + setUsage("/em quest bypass"); + setPermission("elitemobs.*"); + setDescription("Bypasses permission restrictions for elite quests."); + } + + @Override + public void execute() { + QuestCommand.bypassQuestRequirements(getCurrentPlayerSender()); + } +} \ 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..bd98d8b1c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Forces all of your currently active elite quests to be completed. For debugging use only."); + } + + @Override + public void execute() { + QuestCommand.completeQuest(getCurrentPlayerSender()); + } +} \ 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..1ea94da6d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class QuestLeaveCommand extends AdvancedCommand { + public QuestLeaveCommand() { + super(List.of("quest")); + addLiteral("leave"); + setUsage("/em quest leave"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Leaves a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute() { + QuestCommand.leaveQuest(getCurrentPlayerSender(), 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..c000e8877 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -0,0 +1,26 @@ +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 java.util.ArrayList; +import java.util.List; + +public class QuestResetAllCommand extends AdvancedCommand { + public QuestResetAllCommand() { + super(List.of("quest")); + addLiteral("reset"); + addLiteral("all"); + addArgument("player", new ArrayList<>()); + addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); + setUsage("/em quest reset "); + setPermission("elitemobs.*"); + setDescription("Resets all quests for a specific player."); + } + + @Override + public void execute() { + QuestCommand.resetQuests(getCurrentCommandSender(), 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..e80d057fb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -0,0 +1,25 @@ +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 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.*"); + setDescription("Resets a specific quest for a specific player."); + } + + @Override + public void execute() { + QuestCommand.resetQuest(getCurrentCommandSender(), getStringArgument("player"), 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..06802a94f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.quests.QuestCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.command"); + setSenderType(SenderType.PLAYER); + setDescription("Tracks a quest. Used via menu, can't be directly used."); + } + + @Override + public void execute() { + QuestCommand.trackQuest(getStringArgument("questID"), getCurrentPlayerSender()); + } +} 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..d543f3016 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.instanced.MatchInstance; +import com.magmaguy.magmacore.command.AdvancedCommand; +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() { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(getCurrentPlayerSender()); + if (matchInstance != null) + matchInstance.removeAnyKind(getCurrentPlayerSender()); + } +} \ 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..cacf7c07d --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; +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."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + } +} \ 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..a1012bc61 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; + +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.*"); + setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified."); + } + + @Override + public void execute() { + GuildRankCommands.setGuildRank(getCurrentCommandSender(), + getStringArgument("player"), + getIntegerArgument("prestigeLevel"), + 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..46a469de3 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + 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() { + reload(getCurrentCommandSender()); + } +} \ 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..350acdf31 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content."); + } + + @Override + public void execute() { + com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(getCurrentPlayerSender()); + } +} \ 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..55f0209b5 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -0,0 +1,26 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + RepairMenu repairMenu = new RepairMenu(); + repairMenu.constructRepairMenu(getCurrentPlayerSender()); + } + } +} 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..4536c0d31 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -0,0 +1,23 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class RespawnAllCommand extends AdvancedCommand { + public RespawnAllCommand() { + super(List.of("respawn")); + addLiteral("all"); + setUsage("/em respawn all"); + setPermission("elitemobs.*"); + setDescription("Forces all regional bosses to respawn."); + } + + @Override + public void execute() { + 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..f1bd65d76 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -0,0 +1,26 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + ScrapperMenu scrapperMenu = new ScrapperMenu(); + scrapperMenu.constructScrapMenu(getCurrentPlayerSender()); + } + } +} 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..e23b0ce2e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.setup.SetupMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; + +import java.util.List; + +public class SetupCommand extends AdvancedCommand { + public SetupCommand() { + super(List.of("setup")); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("The main command for setting up EliteMobs!"); + setUsage("/em setup"); + } + + @Override + public void execute() { + new SetupMenu(getCurrentPlayerSender()); + } +} 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..5091430a6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.util.Logger; + +import java.util.List; + +public class SetupDoneCommand extends AdvancedCommand { + public SetupDoneCommand() { + super(List.of("setup")); + addLiteral("done"); + setUsage("/setup done"); + setPermission("elitemobs.*"); + setDescription("Toggles whether the setup message will show up."); + } + + @Override + public void execute() { + DefaultConfig.toggleSetupDone(); + if (DefaultConfig.isSetupDone()) + Logger.sendMessage(getCurrentCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this."); + else + Logger.sendMessage(getCurrentCommandSender(), "&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 0b5f635b7..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.commands.setup.SetupMenu; -import com.magmaguy.elitemobs.dungeons.EMPackage; -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); - } -} 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..78e6e3b35 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.magmacore.command.AdvancedCommand; +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")); + setPermission("elitemobs.*"); + setDescription("Sets up EliteMobs content!"); + setUsage("/em setup toggle"); + addLiteral("toggle"); + addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); + } + + @Override + public void execute() { + String dungeon = getStringArgument("empackages"); + if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) + Logger.sendMessage(getCurrentCommandSender(), "Not a valid em package!"); + EMPackage emPackage = EMPackage.getEmPackages().get(dungeon); + if (emPackage.install()) + Logger.sendMessage(getCurrentCommandSender(), "Successfully installed 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..1189648ac --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -0,0 +1,22 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.items.ShareItem; +import com.magmaguy.magmacore.command.AdvancedCommand; +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("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + } + + @Override + public void execute() { + ShareItem.showOnChat(getCurrentPlayerSender()); + } +} 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..3907223a9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -0,0 +1,25 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + CustomShopMenu.customShopInitializer(getCurrentPlayerSender()); + } +} 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..be44f5a22 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.CustomShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Opens the EliteMobs shop for custom items."); + } + + @Override + public void execute() { + try { + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(getCurrentCommandSender(), "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..b13ccf3f4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -0,0 +1,25 @@ +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.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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + ProceduralShopMenu.shopInitializer(getCurrentPlayerSender()); + } +} 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..67b331977 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.ProceduralShopMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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() { + try { + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(getCurrentCommandSender(), "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..d3847eed2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -0,0 +1,30 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.SellMenu; +import com.magmaguy.magmacore.command.AdvancedCommand; +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 custom "); + setPermission("elitemobs.*"); + setDescription("Opens the EliteMobs shop for custom items."); + } + + @Override + public void execute() { + SellMenu sellMenu = new SellMenu(); + try { + sellMenu.constructSellMenu(Bukkit.getPlayer(getStringArgument("player"))); + } catch (Exception ex) { + Logger.sendMessage(getCurrentCommandSender(), "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..8e3d72342 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -0,0 +1,40 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; +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("/setup spawnAt boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + getStringArgument("filename"), + getStringArgument("worldName"), + new Vector( + getDoubleArgument("x"), + getDoubleArgument("y"), + 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..de21fe16b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -0,0 +1,27 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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("/setup spawn boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + 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..0c21ed5f9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -0,0 +1,42 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.SenderType; +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("/setup spawn bossAt "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + getStringArgument("filename"), + getStringArgument("worldName"), + new Vector( + getDoubleArgument("x"), + getDoubleArgument("y"), + getDoubleArgument("z")), + 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..986f72362 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -0,0 +1,29 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; +import com.magmaguy.magmacore.command.AdvancedCommand; +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("/setup spawn boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); + } + + @Override + public void execute() { + SpawnCommand.spawnCustomBossCommand( + getCurrentPlayerSender(), + getStringArgument("filename"), + 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 9b4681e3e..322e88eeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -1,6 +1,5 @@ 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; @@ -10,6 +9,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; 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; @@ -27,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); + String[] powersArray = powers.get().split(" "); + HashSet mobPowers = getPowers(powersArray, player); eliteEntity.applyPowers(mobPowers); } else { eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity)); @@ -46,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, @@ -63,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); 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..4ad1e71c4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -0,0 +1,33 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + } + + @Override + public void execute() { + SpawnCommand.spawnEliteEntityTypeCommand( + getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("entityType")), + getIntegerArgument("level"), + Optional.of(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..fef05b732 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -0,0 +1,43 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.powers.meta.ElitePower; +import com.magmaguy.magmacore.command.AdvancedCommand; +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 elite <...>"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + } + + @Override + public void execute() { + SpawnCommand.spawnEliteEntityTypeCommand( + getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("entityType")), + getStringArgument("world"), + new Vector( + getIntegerArgument("x"), + getIntegerArgument("y"), + getIntegerArgument("z")), + getIntegerArgument("level"), + Optional.of(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..4d3029a8b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -0,0 +1,24 @@ +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.SenderType; + +import java.util.List; + +public class SpawnTeleportCommand extends AdvancedCommand { + public SpawnTeleportCommand() { + super(List.of("spawntp")); + setPermission("elitemobs.spawntp"); + setUsage("/em spawntp"); + setDescription("Teleports players to the server spawn."); + setSenderType(SenderType.PLAYER); + } + + @Override + public void execute() { + if (DefaultConfig.getDefaultSpawnLocation() != null) + PlayerPreTeleportEvent.teleportPlayer(getCurrentPlayerSender(), 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..82447a712 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -0,0 +1,26 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.instanced.MatchInstance; +import com.magmaguy.magmacore.command.AdvancedCommand; +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); + } + + @Override + public void execute() { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(getCurrentPlayerSender()); + if (matchInstance != null) { + matchInstance.countdownMatch(); + } else + Logger.sendMessage(getCurrentCommandSender(), "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..db0e4764f --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setSenderType(SenderType.PLAYER); + setDescription("Displays EliteMobs server stats."); + } + + @Override + public void execute() { + com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(getCurrentPlayerSender()); + } +} \ 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..cac58c1e4 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -0,0 +1,37 @@ +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.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); + } + + @Override + public void execute() { + try { + for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) + if (customBossEntity.getEliteUUID().equals(UUID.fromString(getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(getCurrentPlayerSender()); + return; + } + Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + } catch (Exception ex) { + //happens when players try to track an entity that has despawned for any reason + Logger.sendMessage(getCurrentCommandSender(), 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..9c5f99c25 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -0,0 +1,21 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand; +import com.magmaguy.magmacore.command.AdvancedCommand; + +import java.util.List; + +public class TransitiveBlocksCancelCommand extends AdvancedCommand { + public TransitiveBlocksCancelCommand() { + super(List.of("transitiveBlocks")); + addLiteral("cancel"); + setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender()); + } +} \ 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..8ae26b164 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Edits large transitive blocks areas for use by regional bosses."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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..936f496e2 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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..a16414ca1 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Registers large transitive blocks areas for use by regional bosses."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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..66c304a25 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -0,0 +1,24 @@ +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 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 cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); + } + + @Override + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false); + } +} \ No newline at end of file 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..7c4e19c93 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -0,0 +1,26 @@ +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.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() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + UnbindMenu unbindMenu = new UnbindMenu(); + unbindMenu.constructUnbinderMenu(getCurrentPlayerSender()); + } + } +} 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..ca1237a23 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -0,0 +1,27 @@ +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.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.*"); + setDescription("Forcefully unbinds a held item."); + } + + @Override + public void execute() { + ItemStack itemStack = getCurrentPlayerSender().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..765e84ddb --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -0,0 +1,25 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.AdvancedCommand; +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.*"); + setDescription("Checks the server's plugin version."); + } + + @Override + public void execute() { + Logger.sendMessage( + getCurrentCommandSender(), + 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..7cb25431c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -1,6 +1,5 @@ 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; @@ -8,6 +7,7 @@ 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 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 a6309b02e..8cbeb76d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -55,14 +55,18 @@ 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)); } 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 e5e0c4bcd..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,10 +1,10 @@ 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.magmacore.util.ChatColorConverter; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; 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/RelativeCoordinatesCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java index 3ff071457..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,8 +1,8 @@ package com.magmaguy.elitemobs.commands.admin; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.dungeons.EMPackage; 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; 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 cb8d145b0..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,12 +1,12 @@ 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.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; 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 4f5f698ac..aff87c328 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -1,6 +1,5 @@ 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; @@ -8,6 +7,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.CommandSender; 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/setup/SetupMenu.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java index ea17b69f2..05bf15fc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.SpigotMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -60,10 +60,10 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup } } - public static void forceResourcePack(Player player) { - ResourcePackDataConfig.toggleForceResourcePack(true); - player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); - } +// 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 diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index 7aaf10e90..96882a5f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,15 +1,14 @@ 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.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 @@ -67,19 +66,96 @@ public class AdventurersGuildConfig { @Getter private static boolean disableCommonerRank; - private static File file; - private static FileConfiguration fileConfiguration; + public AdventurersGuildConfig() { + super("AdventurersGuild.yml"); + } + + public static String getRankName(int prestigeTier, int rankTier) { + return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]); + } - private AdventurersGuildConfig() { + 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"; + } } - public static void save() { - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, 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"; + } } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("AdventurersGuild.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @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); @@ -425,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 6b0641834..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,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 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; @@ -33,13 +32,12 @@ 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", @@ -77,9 +75,5 @@ public static void initializeConfig() { 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 6e89a7855..778e82472 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,102 +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.magmacore.util.ChatColorConverter; +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) { - fileConfiguration.setComments(key, comments); - } - - public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - try { - fileConfiguration.addDefault(key, defaultValue); - } catch (Exception e) { - new WarningMessage("Attempted to write key " + key + " with value " + defaultValue + " to " + fileConfiguration.getName() + " and that contained an illegal argument!"); - e.printStackTrace(); - } - 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); @@ -112,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) @@ -149,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()) @@ -194,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); } 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); } 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) @@ -215,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 2e9526b60..d0fbb9990 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.scheduler.BukkitRunnable; import java.io.*; @@ -27,7 +27,7 @@ public void run() { try { Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports")); } catch (Exception exception) { - new WarningMessage("Failed to create exports directory! Tell the dev!"); + Logger.warn("Failed to create exports directory! Tell the dev!"); exception.printStackTrace(); } } @@ -36,7 +36,7 @@ public void run() { 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) { - new WarningMessage("Failed to download official resource pack! Tell the dev!"); + Logger.warn("Failed to download official resource pack! Tell the dev!"); e.printStackTrace(); } } @@ -66,7 +66,7 @@ public static void downloadFile(String fileURL, String saveFilePath) throws IOEx // Opens input stream from the HTTP connection InputStream inputStream = httpConn.getInputStream(); - String saveFilePathWithName = saveFilePath + File.separatorChar+ fileName; + String saveFilePathWithName = saveFilePath + File.separatorChar + fileName; // Opens an output stream to save into file FileOutputStream outputStream = new FileOutputStream(saveFilePathWithName); @@ -81,7 +81,7 @@ public static void downloadFile(String fileURL, String saveFilePath) throws IOEx inputStream.close(); } else { - new WarningMessage("No file to download. Server replied HTTP code: " + responseCode); + Logger.warn("No file to download. Server replied HTTP code: " + responseCode); } httpConn.disconnect(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java index 1642611ba..2ec691a57 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java @@ -1,12 +1,11 @@ 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 com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.ZipFile; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -27,7 +26,7 @@ public static void initializeConfigs() { try { Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "imports")); } catch (Exception exception) { - new WarningMessage("Failed to create import directory! Tell the dev!"); + Logger.warn("Failed to create import directory! Tell the dev!"); exception.printStackTrace(); } return; @@ -37,7 +36,7 @@ public static void initializeConfigs() { 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!"); + Logger.warn("Failed to get imports folder! Report this to the dev!"); return; } @@ -47,10 +46,11 @@ public static void initializeConfigs() { for (File zippedFile : importsFile.listFiles()) { File unzippedFile; try { - if (zippedFile.getName().contains(".zip")) unzippedFile = ZipFile.unzip(zippedFile.getName()); + if (zippedFile.getName().contains(".zip")) + unzippedFile = ZipFile.unzip(zippedFile, new File(zippedFile.getAbsolutePath().replace(".zip", ""))); else unzippedFile = zippedFile; } catch (Exception e) { - new WarningMessage("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); + Logger.warn("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); e.printStackTrace(); continue; } @@ -105,18 +105,18 @@ public static void initializeConfigs() { if (CustomModel.customModelsEnabled()) { importedModels = true; } else - new WarningMessage("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); + Logger.warn("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); break; case "schematics": - new WarningMessage("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); + Logger.warn("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); 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?"); + Logger.warn("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!"); + Logger.warn("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); e.printStackTrace(); continue; } @@ -124,7 +124,7 @@ public static void initializeConfigs() { unzippedFile.delete(); zippedFile.delete(); } catch (Exception ex) { - new WarningMessage("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); + Logger.warn("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); ex.printStackTrace(); } } @@ -142,7 +142,7 @@ 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()); + Logger.info("Cleaning up " + file.getPath()); file.delete(); } @@ -151,16 +151,16 @@ private static void moveWorlds(File worldcontainerFile) { 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()); + Logger.info("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!"); + Logger.warn("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!"); + Logger.warn("Failed to move worlds for " + file.getName() + "! Tell the dev!"); exception.printStackTrace(); } } @@ -168,10 +168,10 @@ private static void moveWorlds(File worldcontainerFile) { private static void moveDirectory(File unzippedDirectory, Path targetPath, boolean force) { for (File file : unzippedDirectory.listFiles()) try { - new InfoMessage("Adding " + file.getCanonicalPath()); + Logger.info("Adding " + file.getCanonicalPath()); moveFile(file, targetPath, force); } catch (Exception exception) { - new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!"); + Logger.warn("Failed to move directories for " + file.getName() + "! Tell the dev!"); exception.printStackTrace(); } } @@ -191,7 +191,7 @@ private static void moveFile(File file, Path targetPath, boolean force) { 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!"); + Logger.warn("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 1848717fe..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 validity 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() + " ! You should probably delete that file."); -// 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 +128,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 +153,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( @@ -196,16 +201,7 @@ public static void initializeConfig() { 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); + 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); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - - 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 8ec9e8c08..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; @@ -35,12 +34,12 @@ public class DungeonsConfig { @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"), @@ -94,8 +93,5 @@ public static void initializeConfig() { 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); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index 9aef67a34..20a73bea6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,17 +1,17 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; +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 @@ -82,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; @@ -264,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 37d2b3339..2d72be5c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.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 EventsConfig { +public class EventsConfig extends ConfigurationFile { @Getter private static boolean announcementBroadcastWorldOnly; @Getter @@ -18,13 +17,12 @@ public class EventsConfig { @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); @@ -33,7 +31,7 @@ public static void initializeConfig() { fileConfiguration, "actionEventMinimumCooldownMinutes", 4); timedEventMinimumCooldown = ConfigurationEngine.setInt( List.of("Sets the minimum cooldown, in minutes, between timed events"), - fileConfiguration, "actionEventMinimumCooldownMinutes", 4); + 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"), @@ -43,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 57381df60..5c3e787db 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.List; -public class ItemSettingsConfig { +public class ItemSettingsConfig extends ConfigurationFile { @Getter private static String shopItemSource; @Getter @@ -120,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.", @@ -343,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 53be17872..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java +++ /dev/null @@ -1,28 +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 index c03efc4ed..e72f2a185 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -1,5 +1,7 @@ package com.magmaguy.elitemobs.config; +import org.bukkit.Particle; + import java.util.Locale; public class LegacyValueConverter { @@ -74,6 +76,25 @@ public static String parsePotionEffect(String 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(); + default: + return potionEffectName; + } + } + public static String parseDeserializedBlocks(String originalDeserializedBlock) { if (originalDeserializedBlock.endsWith("grass")) return originalDeserializedBlock.replace("grass", "grass_block[snowy=false]"); 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 01b60cec2..0114dfdaf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -1,24 +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..ecec2451e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -1,21 +1,18 @@ 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,14 +57,28 @@ public class ProceduralItemGenerationSettingsConfig { private static List verbs; @Getter private static List verbers; + @Getter + private static ProceduralItemGenerationSettingsConfig instance; + + public ProceduralItemGenerationSettingsConfig() { + super("ProceduralItemGenerationSettings.yml"); + instance = this; + } + + 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() { doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); @@ -1449,21 +1460,6 @@ public static void initializeConfig() { "Slapper" ), true); - ConfigurationEngine.fileSaverCustomValues(fileConfiguration, file); - 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 90a6d68a1..fa5a2824c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -4,7 +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.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -15,7 +16,7 @@ import java.util.Arrays; import java.util.List; -public class QuestsConfig { +public class QuestsConfig extends ConfigurationFile { @Getter private static boolean requireQuestTurnIn; @@ -104,12 +105,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<>(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() + )); + + 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) { + 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."), @@ -251,87 +333,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() - )); - - 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 index 1a077e54a..01ba3e076 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; 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; @@ -17,7 +17,7 @@ import java.io.IOException; import java.net.URL; -public class ResourcePackDataConfig { +public class ResourcePackDataConfig extends ConfigurationFile { @Getter public static boolean eliteMobsResourcePackEnabled; @@ -31,23 +31,11 @@ public class ResourcePackDataConfig { public static String resourcePackLink; @Getter public static byte[] SHA1 = null; - private static File file; - private static FileConfiguration fileConfiguration; + public static ResourcePackDataConfig instance; - 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 ResourcePackDataConfig() { + super("resource_pack_config.yml"); + instance = this; } public static void updateSHA1() { @@ -59,21 +47,21 @@ public void run() { 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)"); + Logger.warn("[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."); + Logger.warn("[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); + instance.fileConfiguration.set("eliteMobsResourcePackEnabled", status); + ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); eliteMobsResourcePackEnabled = status; displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; if (status) { @@ -83,7 +71,7 @@ public static void toggleEliteMobsResourcePackStatus(boolean status) { } public static void toggleForceResourcePack(boolean status) { - fileConfiguration.set("forceResourcePack", status); + instance.fileConfiguration.set("forceResourcePack", status); forceResourcePack = status; } @@ -91,6 +79,18 @@ public static void sendResourcePack(Player player) { player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); } + @Override + public void initializeValues() { + 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; + } + public static class ResourcePackDataConfigEvents implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLogin(PlayerJoinEvent event) { diff --git a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index 92fd4f3c4..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,10 +13,12 @@ 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); @@ -48,8 +46,5 @@ public static void initializeConfig() { 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); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index 2afad9dc1..536569ffa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -1,15 +1,15 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.utils.WarningMessage; +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<>(); @@ -40,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."), @@ -152,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 e93f52dbd..fe1a8dc9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -1,28 +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 FileConfiguration fileConfiguration; - private static File file; + private static ValidWorldsConfig instance; - private ValidWorldsConfig() { + public ValidWorldsConfig() { + super("ValidWorlds.yml"); + instance = this; } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("ValidWorlds.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public static void addWorld(String worldName) { + if (instance.fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return; + + 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); + } + + @Override + public void initializeValues() { for (World world : Bukkit.getWorlds()) ConfigurationEngine.setBoolean(fileConfiguration, "Valid worlds." + world.getName(), true); @@ -32,19 +41,5 @@ public static void initializeConfig() { for (String key : validWorldsSection.getKeys(false)) if (validWorldsSection.getBoolean(key)) validWorlds.add(key); - - 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/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/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 11f3afb7e..b0e1f3584 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -1,16 +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; @@ -20,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<>(); @@ -273,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; } } @@ -285,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); } } @@ -295,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); } } @@ -305,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); @@ -339,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); @@ -392,7 +391,7 @@ public void processConfigFields() { try { this.bossType = BossType.valueOf(bossTypeString.toUpperCase(Locale.ROOT)); } catch (Exception e) { - new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); + Logger.warn("Boss type for boss " + filename + " is not a valid boss type!"); } this.scale = processDouble("scale", scale, 1, false); @@ -420,16 +419,16 @@ private HashMap processDamageModifiers(String path, HashMap(), true); 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 1a0184059..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,10 +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.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -12,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 @@ -92,7 +91,7 @@ private void updatePostProcessor() { List newEnchantments = new ArrayList<>(); for (String enchantment : enchantments) { if (!enchantment.contains(",")) { - new WarningMessage("Invalid format for enchantment in file " + filename + " for enchantment " + enchantment + " : missing ',' for valid level after the enchantment name"); + 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(","); @@ -105,7 +104,7 @@ private void updatePostProcessor() { List newPotionEffects = new ArrayList<>(); for (String potionEffect : potionEffects) { if (!potionEffect.contains(",")) { - new WarningMessage("Invalid format for potion effect in file " + filename + " for potion effect " + potionEffect + " : missing ',' for valid level after the potion effect name"); + 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(","); @@ -125,9 +124,9 @@ private void updatePostProcessor() { } potionEffects = newPotionEffects; - potionEffects.forEach(potionEffect->{ + potionEffects.forEach(potionEffect -> { if (potionEffect.contains("INSTANT_DAMAGE")) - new WarningMessage("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."); + 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/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index f4135e948..f56ab5db4 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 @@ -14,7 +14,7 @@ public DepthsSeekerConfig() { "&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_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK_OF_THE_SEA,0,self,continuous")); + setPotionEffects(Arrays.asList("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/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 4f251360b..3cbcfa73c 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 @@ -14,7 +14,7 @@ public LuckyCharmsConfig() { "&bLucky Charms", Arrays.asList("&aPart of a complete breakfast!", "&cNote: Absolutely not a part of", "&ca complete breakfast.")); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(List.of("LUCK_OF_THE_SEA,0,self,continuous")); + setPotionEffects(List.of("LUCK,0,self,continuous")); setDropWeight("1"); } } 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 7b52edd01..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<>(); @@ -23,9 +24,6 @@ public class CustomQuestsConfigFields extends CustomConfigFields implements Cust private int questLevel = 0; @Getter @Setter - protected Map> customObjectives = new HashMap(); - @Getter - @Setter private List customRewardsList = new ArrayList<>(); @Getter @Setter @@ -141,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); } @@ -156,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!"); } } @@ -184,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/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/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index 2f78f13f5..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,10 +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 lombok.Setter; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -123,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); } /** @@ -173,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 3db03e8fb..ec81efad7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; 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; @@ -246,7 +246,7 @@ public void processConfigFields() { 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; } 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 455c4719c..fcb138eb3 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 @@ -32,5 +32,6 @@ public OasisPyramidSanctum() { false); setDifficulties(List.of( Map.of("name", "normal", "id", 0))); + setListedInTeleports(false); } } 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 3aefee028..efb87a384 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 @@ -32,5 +32,6 @@ public PrimisBloodTempleSanctum() { 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 a46d4cf31..90d9e9f05 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 @@ -35,5 +35,6 @@ public PrimisGladiusInvasionDungeon() { Map.of("name", "mythic", "id", 2, "levelSync", 12) )); setMaxPlayerCount(5); + setListedInTeleports(false); } } 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 26fa661df..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,8 +1,8 @@ package com.magmaguy.elitemobs.config.enchantments; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.CustomConfig; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -26,7 +26,7 @@ public static EnchantmentsConfigFields getEnchantment(String string) { newString = newString.toLowerCase(Locale.ROOT); EnchantmentsConfigFields test = enchantments.get(newString); if (test == null) { - new WarningMessage("Failed to find enchant file " + newString); + Logger.warn("Failed to find enchant file " + newString); new Exception().printStackTrace(); } return enchantments.get(newString); 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/CustomQuestMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomQuestMenuConfig.java index 83d08f73b..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; 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..5528b24af 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; 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/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 2068c866a..377527794 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 @@ -113,7 +112,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?"); } } @@ -152,7 +151,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?"); } } @@ -163,7 +162,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/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/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 f10215e03..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 diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index f0d748779..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; @@ -37,11 +37,6 @@ public class EMPackage { protected List treasureChestList = new ArrayList<>(); protected List npcEntities = new ArrayList<>(); - public boolean isOutOfDate() { - if (!isInstalled) return false; - return outOfDate; - } - public EMPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; emPackages.put(dungeonPackagerConfigFields.getFilename(), this); @@ -77,12 +72,17 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - new WarningMessage("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."); + 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 */ @@ -115,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/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index bdb189387..c208a1f1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -1,9 +1,9 @@ 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 org.bukkit.entity.Player; import java.io.File; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index c8c3cf4fa..8591340ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -1,10 +1,10 @@ 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.utils.WarningMessage; 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; @@ -28,7 +28,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; } 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 02d206bbe..9e63ac406 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,8 +5,7 @@ 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.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Difficulty; @@ -55,11 +54,11 @@ public static World loadWorld(String worldName, World.Environment environment, D 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!"); + Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); return null; } - new InfoMessage("Loading world " + worldName + " !"); + Logger.info("Loading world " + worldName + " !"); Filter filter = newFilter -> false; @@ -80,7 +79,7 @@ public static World loadWorld(String worldName, World.Environment environment, D return world; } catch (Exception exception) { Bukkit.getLogger().setFilter(previousFilter); - new WarningMessage("Failed to load world " + worldName + " !"); + Logger.warn("Failed to load world " + worldName + " !"); exception.printStackTrace(); } return null; 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/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 9b1fba505..43dd58b52 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -7,7 +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.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -90,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); diff --git a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java index 30c762418..b5873d709 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/CustomEvent.java @@ -11,8 +11,7 @@ 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; @@ -91,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); @@ -156,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 4a4771972..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; @@ -107,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; @@ -150,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; } diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index 4625ad1f1..848fe63e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java +++ b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java @@ -321,7 +321,8 @@ public static class ExplosionEvent implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void entityExplodeEvent(EntityExplodeEvent event) { Entity entity = event.getEntity(); - if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) entity = shooter; + if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) + entity = shooter; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity); if (eliteEntity != null) { generateExplosion(event); diff --git a/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java b/src/main/java/com/magmaguy/elitemobs/initialsetup/FirstTimeSetup.java index 4bea48f57..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; diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index eb9658198..696e75ff1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -1,10 +1,10 @@ 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.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java index 9b3cbb538..2437e284d 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; 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 d05ed83d0..467f217c5 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -1,6 +1,5 @@ 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; @@ -15,8 +14,9 @@ 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; @@ -113,14 +113,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 +135,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 +160,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; } } @@ -244,7 +244,7 @@ private void spawnBosses() { 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(); @@ -253,7 +253,7 @@ private void spawnBosses() { customBossEntity.setRandomLoot(false); customBossEntity.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), true); 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); @@ -263,9 +263,9 @@ private void spawnBosses() { 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!"); + 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) { - 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!"); + 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!"); } } } 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 b85806480..2c0007530 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -15,7 +15,11 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.*; +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.bukkit.Bukkit; import org.bukkit.Location; @@ -225,7 +229,7 @@ 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)); @@ -240,7 +244,7 @@ public void run() { dungeonInstances.remove(dungeonInstance); if (!Bukkit.unloadWorld(world, false)) { - new WarningMessage("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); + Logger.warn("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); return; } new BukkitRunnable() { @@ -266,7 +270,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; } @@ -274,7 +278,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 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/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 22c49b336..3e5d8eecb 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; @@ -12,7 +11,8 @@ 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 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; } diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index 7513c9976..e0d720677 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; @@ -11,7 +10,8 @@ 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.Logger; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -206,7 +206,7 @@ private Item generateCurrencyItem(Material material, Location location, double v 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); @@ -232,7 +232,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); } @@ -247,7 +247,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); } @@ -261,7 +261,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); } @@ -275,7 +275,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); } @@ -289,7 +289,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); } @@ -302,7 +302,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); } @@ -315,7 +315,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); } @@ -328,7 +328,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/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/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 7b43e90fc..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; @@ -9,6 +8,7 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.items.EliteItemLore; import com.magmaguy.elitemobs.utils.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; 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 4816fed96..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; @@ -85,7 +85,7 @@ public CurrencyCustomLootEntry(List entries, Map configMa 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); + 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 a19a3766f..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; 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 8423326d4..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; @@ -55,7 +55,7 @@ public EliteCustomLootEntry(List entries, Map configMap, 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); @@ -158,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++) @@ -219,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 506bc5baf..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; 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..e967da277 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; @@ -9,6 +8,7 @@ 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 org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; 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 aa65beda9..268cd32ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -2,7 +2,7 @@ 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; @@ -23,7 +23,7 @@ public ElitePotionEffect(String string) { int duration = 2 * 20; PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); if (potionEffectType == null) { - new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); + Logger.warn("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; } if (potionEffectType.equals(PotionEffectType.NIGHT_VISION)) @@ -51,7 +51,7 @@ public ElitePotionEffect(String string) { 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/menus/ArenaMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java index 2141e4441..ac94fb56b 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.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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index fb0193d01..f884985fc 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index 2fc5c4b40..d6f39502a 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.SpecialItemSystemsConfig; @@ -12,6 +11,7 @@ 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 net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -212,7 +212,7 @@ 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 + //Make sure enchant books themselves can't be enchanted { } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 612e92c2e..25202dc8d 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 73ef13cd0..42c4e12d7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -1,6 +1,5 @@ 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; @@ -11,6 +10,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java index 1f2b36ea6..1d20fa872 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -1,6 +1,5 @@ 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; @@ -11,6 +10,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; 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/mobconstructor/BossType.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java index 98bde5175..4009119dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -4,5 +4,6 @@ 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 a3ac05e2a..2fcb4547a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -14,8 +14,7 @@ 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.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); @@ -190,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 { @@ -201,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; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index 12a20aa66..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,7 +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.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -496,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/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java index caefe80e1..26ca95ece 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.EntityType; @@ -15,6 +15,7 @@ public class BossMusic { private final HashMap players = new HashMap<>(); + private final CustomBossEntity customBossEntity; @Getter private String name; @Getter @@ -24,7 +25,6 @@ public class BossMusic { @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) { @@ -55,7 +55,7 @@ private void parse(String rawString, int entryNumber) { } break; default: - new WarningMessage("Failed to get value for boss music!"); + Logger.warn("Failed to get value for boss music!"); } } } 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..0eebe530e 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 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; @@ -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..a86c13599 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 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..cb2556116 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; @@ -52,8 +55,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; @@ -171,14 +172,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 +186,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 +195,6 @@ public void spawn(Location spawnLocation, boolean silent) { } public void spawn(boolean silent) { - bossTrace.setSpawn(); if (livingEntity != null && livingEntity.isValid()) return; @@ -205,7 +203,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 +217,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 +231,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; } @@ -490,11 +488,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); if (livingEntity != null) persistentLocation = livingEntity.getLocation(); //Remove the living entity super.remove(removalReason); 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 d4163689f..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()); } } 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/ElitePowerParser.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java index b98882225..5e5a59a2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/ElitePowerParser.java @@ -9,7 +9,7 @@ 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; @@ -43,7 +43,7 @@ public static HashSet parsePowers(CustomBossesConfigFields customBos 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 @@ -85,12 +85,12 @@ 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, customBossEntity); } } else - new WarningMessage("No valid power name in boss config " + customBossesConfigFields.getFilename()); + Logger.warn("No valid power name in boss config " + customBossesConfigFields.getFilename()); } } } @@ -110,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..7f0d184b1 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,13 +54,13 @@ 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); 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 cdc567e2e..937ac2233 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/RegionalBossEntity.java @@ -14,7 +14,7 @@ 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; @@ -142,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() + " !"); } } } @@ -178,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); @@ -239,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); } 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 046654fc2..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,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -39,7 +39,7 @@ public static List serializeTransitiveBlocks(List deser 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 a8f11a3de..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 @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.api.EliteMobSpawnEvent; 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; @@ -53,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; } } @@ -69,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/mobspawning/NaturalMobSpawnEventHandler.java b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java index 3337129c3..a834e9ece 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/mobspawning/NaturalMobSpawnEventHandler.java @@ -106,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() || diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java index e337528f9..372cc4f59 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,7 +17,8 @@ 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; @@ -41,8 +41,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 +73,6 @@ public NPCEntity(NPCsConfigFields npCsConfigFields, String locationString) { spawn(); persistentObjectHandler = new PersistentObjectHandler(this); } - /** * Spawns NPCs for dungeon instancing. */ @@ -78,16 +86,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 +116,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 +157,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 || @@ -192,7 +189,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(); } } @@ -315,18 +312,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 +351,6 @@ private String selectString(List strings) { return null; } - public static class NPCEntityEvents implements Listener { @EventHandler public void worldUnloadEvent(WorldUnloadEvent event) { @@ -378,4 +362,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..e1e2756cf 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; @@ -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/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 410287c9e..f9599c613 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -21,7 +21,7 @@ public class Navigation implements Listener { - private static HashMap currentlyNavigating = new HashMap(); + private static final HashMap currentlyNavigating = new HashMap(); public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; @@ -60,7 +60,7 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .register(); } - public static void shutdown(){ + public static void shutdown() { currentlyNavigating.values().forEach(BukkitTask::cancel); currentlyNavigating.clear(); } diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index f544a4fae..dfcd53f2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.playerdata; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.ItemSettingsConfig; @@ -11,6 +10,7 @@ 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; @@ -87,7 +87,7 @@ private boolean fullUpdate(ItemStack itemStack) { return fillNullItem(); } - if (displayingAsBroken){ + if (displayingAsBroken) { BossBarUtil.HideBrokenItemBossBar(equipmentSlot, player); displayingAsBroken = false; } @@ -96,13 +96,13 @@ private boolean fullUpdate(ItemStack itemStack) { // if (itemStack.isSimilar(this.itemStack)) // return false; - if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { - if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { - player.getWorld().dropItem(player.getLocation(), itemStack); - itemStack.setAmount(0); - itemStack = new ItemStack(Material.AIR); - } + if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { + if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { + player.getWorld().dropItem(player.getLocation(), itemStack); + itemStack.setAmount(0); + itemStack = new ItemStack(Material.AIR); } + } //Neither offhand nor armor contribute to baseline damage outside of the enchants, so we reset the damage before anything this.eliteDamage = 0; 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..b01cc634d 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; @@ -60,12 +59,12 @@ private static void addEntryIfEmpty(String columnName, ColumnValues columnValues if (resultSet.next()) { //Developer.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..5c6cabd04 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/BossTrackingPage.java @@ -5,7 +5,7 @@ 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.Logger; 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/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/TeleportsPage.java b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java index 177653bc0..c64a0655c 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 net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -70,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); 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/PhotonRay.java b/src/main/java/com/magmaguy/elitemobs/powers/PhotonRay.java index f1408759a..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); 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 0f440e84d..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; 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 266003f8f..058503d28 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java @@ -11,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; @@ -28,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. @@ -36,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - private ArrayList entityList = new ArrayList<>(); + private final ArrayList entityList = new ArrayList<>(); public ZombieNecronomicon() { super(PowersConfig.getPower("zombie_necronomicon.yml")); @@ -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); @@ -233,7 +233,7 @@ public void run() { 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; 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 ba34e1394..90a4126bc 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -15,7 +15,7 @@ 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.*; @@ -46,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); @@ -61,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() { @@ -72,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()) @@ -137,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": @@ -157,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; } @@ -195,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; } @@ -287,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": @@ -295,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": @@ -303,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": @@ -315,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": @@ -323,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": @@ -331,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": @@ -339,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": @@ -347,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": @@ -355,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; } @@ -401,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) @@ -418,7 +418,7 @@ 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); } } @@ -445,7 +445,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); @@ -462,7 +462,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); @@ -472,7 +472,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); @@ -499,7 +499,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); @@ -526,7 +526,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(); @@ -611,7 +611,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()) @@ -626,7 +626,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()) 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 3cbe35933..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,7 +78,7 @@ 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)); @@ -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 750ba3320..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,9 +21,9 @@ 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, EliteEntity eliteEntity) { super(scriptBlueprint.getCustomConfigFields()); 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 969f57725..64bdee8e1 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; @@ -14,7 +13,8 @@ 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.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.*; @@ -48,11 +49,6 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; - public static void shutdown(){ - invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); - } - - public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; this.scriptTargets = new ScriptTargets(blueprint.getScriptTargets(), eliteScript); @@ -64,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 @@ -74,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; } @@ -92,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; } @@ -217,8 +216,9 @@ private void runActions(ScriptActionData 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)) @@ -242,7 +242,7 @@ 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)); @@ -259,12 +259,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()); @@ -273,12 +273,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())); @@ -287,13 +287,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); @@ -313,7 +313,7 @@ private void runPotionEffect(ScriptActionData scriptActionData) { //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) && @@ -327,7 +327,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); } @@ -336,7 +336,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); } @@ -477,7 +477,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; } @@ -622,7 +622,6 @@ else if (blueprint.getVValue() != null) } private void runModifyDamage(ScriptActionData scriptActionData) { - if (scriptActionData.getEvent() instanceof EliteDamageEvent eliteDamageEvent) { eliteDamageEvent.setDamage(eliteDamageEvent.getDamage() * blueprint.getMultiplier()); } @@ -633,7 +632,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; } @@ -683,7 +682,7 @@ private void runNavigate(ScriptActionData scriptActionData) { if (!(eliteEntity instanceof CustomBossEntity customBossEntity)) return; 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; } @@ -692,4 +691,17 @@ private void runNavigate(ScriptActionData scriptActionData) { 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 994d92d98..adc4cca3e 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 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 b6688cadb..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 ScriptTargets scriptTargets = null; private final EliteScript eliteScript; + private ScriptTargets scriptTargets = null; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; 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 b510405b3..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,7 +3,7 @@ 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; @@ -25,7 +25,7 @@ public static void runEvent(FallingEntityDataPair fallingEntityDataPair, Locatio 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!"); + Logger.warn("Elite script " + string + " does not exist for landing scripts!"); return; } iteratedScript.check(landingLocation, fallingEntityDataPair.getScriptActionData()); 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..4bde7b10e 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); @@ -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; } } @@ -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 98c9c625e..2fea67379 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -11,8 +11,8 @@ import com.magmaguy.elitemobs.powers.scripts.caching.ScriptZoneBlueprint; import com.magmaguy.elitemobs.powers.scripts.enums.TargetType; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.*; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -101,7 +101,7 @@ protected Collection getZoneEntities(ScriptActionData scriptAction 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<>(); } } @@ -137,7 +137,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<>(); } } @@ -159,7 +159,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)) @@ -168,7 +168,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)) @@ -177,7 +177,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; 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 cd0d776f4..4390f4ed8 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; @@ -109,6 +109,8 @@ public class ScriptActionBlueprint { private float pitch = 1f; @Getter private float velocity = 1f; + @Getter + private double scale = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -141,7 +143,7 @@ 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); @@ -195,8 +197,8 @@ protected void processKeyAndValue(String key, Object value) { case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); case "velocity" -> velocity = parseFloat(key, value, scriptName); - default -> - new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + case "scale" -> scale = parseFloat(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 9efc277c1..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; @@ -74,7 +74,7 @@ private void processKeyAndValue(String key, Object value) { 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 7a7a87ea6..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; @@ -39,7 +39,7 @@ public ScriptEventsBlueprint(ConfigurationSection configurationSection, String s 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 a0a15f694..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; @@ -89,7 +89,7 @@ private void processKeyAndValue(String key, Object value) { 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!"); + 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 f8c1b3884..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,8 +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 16314c860..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 @@ -33,7 +33,8 @@ public enum ActionType { SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), SUMMON_ENTITY(false), - NAVIGATE(false); + NAVIGATE(false), + SCALE(false); @Getter private final boolean requiresLivingEntity; 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/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index 5206a6d1c..de0bbcaa2 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; @@ -16,6 +15,7 @@ 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 lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; 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..e91bb23ce 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 net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; 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..c09e4d2c2 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; @@ -18,6 +17,7 @@ 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 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..2019dc36f 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,7 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -25,6 +25,8 @@ public class QuestObjectives implements Serializable { + @Getter + private final UUID uuid = UUID.randomUUID(); @Getter @Setter protected QuestReward questReward; @@ -40,8 +42,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 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/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..de1970903 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java @@ -1,7 +1,7 @@ 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.*; @@ -32,7 +32,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 +49,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,7 +58,7 @@ 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) { @@ -108,8 +108,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/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/worldguard/WorldGuardCompatibility.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java index f1c4aeca3..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,6 +1,6 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.flags.IntegerFlag; import com.sk89q.worldguard.protection.flags.StateFlag; @@ -40,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"); } @@ -148,7 +148,7 @@ public static boolean initialize() { // members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); // global.setOwners(members); // } catch (Exception ex) { -// new WarningMessage("Failed to protect minidungeon world area!"); +// Logger.warn("Failed to protect minidungeon world area!"); // } // } // @@ -169,7 +169,7 @@ public static boolean initialize() { // members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); // global.setOwners(members); // } catch (Exception ex) { -// new WarningMessage("Failed to protect minidungeon world area!"); +// Logger.warn("Failed to protect minidungeon world area!"); // } // } // @@ -233,13 +233,13 @@ public static boolean initialize() { // 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!"); +// Logger.warn("The region name picked did not exist!"); // return false; // } // protectMinidungeonArea(protectedRegion); // return true; // } catch (Exception ex) { -// new WarningMessage("Failed to protect region " + regionName + " !"); +// Logger.warn("Failed to protect region " + regionName + " !"); // return false; // } // } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index f34961cf0..acf28eb97 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.treasurechest; import com.google.common.collect.ArrayListMultimap; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.config.DefaultConfig; @@ -14,8 +13,9 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -113,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?"); } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java index a6e454582..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; @@ -74,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); @@ -124,9 +125,9 @@ public static Location serializeWithInstance(World instancedWorld, String locati } 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(instancedWorld, x, y, z, yaw, pitch); 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/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 index 1f5955239..8e46e37a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java index f98be82c8..7f53a21b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; @@ -33,7 +34,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/SpigotMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java index 052244e87..080b80cfc 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java @@ -1,6 +1,6 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; +import com.magmaguy.magmacore.util.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; 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/VisualDisplay.java b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java index 0f139d7d2..4f935b9dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; 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; 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 3ac0c0705..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()) { 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 e8530e76e..edae9f180 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; 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 6c779e0b9..47c2564dd 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 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 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/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/WormholeEntry.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java index bb4444467..3399255e5 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeEntry.java @@ -1,6 +1,5 @@ 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.entitytracker.EntityTracker; @@ -9,7 +8,8 @@ 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; @@ -55,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(); @@ -69,23 +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); } 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 26a4358a8..54403879d 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; 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 05e08f7c5..ccf8aaa7a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.4 +version: 9.0.5 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -18,6 +18,12 @@ softdepend: - InfernalMobs - FreeMinecraftModels +commands: + elitemobs: + description: Main command + aliases: + - em + permissions: elitemobs.*: description: Gives access to all elitemobs commands diff --git a/src/main/resources/translation.yml b/src/main/resources/translation.yml deleted file mode 100644 index e69de29bb..000000000 From 0341a881897bf5f5791109b81891b339919cb78b Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:30:54 +0200 Subject: [PATCH 34/78] Update DiscordCommand.java --- .../com/magmaguy/elitemobs/commands/DiscordCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java index 4ea9e1ac4..19bd0b56a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -9,8 +9,8 @@ public class DiscordCommand extends AdvancedCommand { public DiscordCommand() { super(List.of("discord")); - setUsage("/em discord "); - setPermission("elitemobs.*"); + setUsage("/em discord"); + setPermission("elitemobs.discord.link"); setDescription("Links to the EliteMobs discord."); } @@ -18,4 +18,4 @@ public DiscordCommand() { public void execute() { Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); } -} \ No newline at end of file +} From f246b67ee218fcf9bb061d84ba9ea34f403917e2 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:36:32 +0200 Subject: [PATCH 35/78] Update DiscordMessageCommand.java --- .../magmaguy/elitemobs/commands/DiscordMessageCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java index 97c796060..5f6d4750f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -12,7 +12,7 @@ public DiscordMessageCommand() { super(List.of("discord")); addArgument("message", new ArrayList<>()); setUsage("/em discord "); - setPermission("elitemobs.*"); + setPermission("elitemobs.discord.message"); setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes"); } @@ -21,4 +21,4 @@ public void execute() { new DiscordSRVAnnouncement(getStringSequenceArgument("message")); Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); } -} \ No newline at end of file +} From afd1756bd66e359365a0c31d6cfc328ff49ecab1 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:58:57 +0200 Subject: [PATCH 36/78] Command updates --- .../elitemobs/commands/ArenaCommand.java | 3 +- .../elitemobs/commands/DebugCommand.java | 4 +- .../elitemobs/commands/EventCommand.java | 2 +- .../elitemobs/commands/FireballCommand.java | 2 +- .../elitemobs/commands/HelpCommand.java | 2 +- .../elitemobs/commands/KillCommand.java | 2 +- .../elitemobs/commands/KillRadiusCommand.java | 2 +- .../elitemobs/commands/KillTypeCommand.java | 4 +- .../commands/KillTypeRadiusCommand.java | 6 +- .../elitemobs/commands/LanguageCommand.java | 2 +- .../elitemobs/commands/LootCommand.java | 2 +- .../elitemobs/commands/LootDebugCommand.java | 6 +- .../elitemobs/commands/LootGiveCommand.java | 4 +- .../elitemobs/commands/LootMenuCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 4 +- .../commands/LootSimulateCommand.java | 2 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../elitemobs/commands/LootStats.java | 2 +- .../commands/MoneyAddAllCommand.java | 4 +- .../elitemobs/commands/MoneyAddCommand.java | 4 +- .../elitemobs/commands/MoneyCheckCommand.java | 4 +- .../commands/MoneyCheckPlayerCommand.java | 4 +- .../commands/MoneyRemoveCommand.java | 2 +- .../elitemobs/commands/MoneySetCommand.java | 4 +- .../commands/PackageDungeonCommand.java | 2 +- .../elitemobs/commands/PlaceBossCommand.java | 6 +- .../elitemobs/commands/PlaceNPCCommand.java | 2 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 4 +- .../commands/QuestBypassCommand.java | 2 +- .../commands/QuestCompleteCommand.java | 2 +- .../elitemobs/commands/QuestLeaveCommand.java | 2 +- .../commands/QuestResetAllCommand.java | 5 +- .../elitemobs/commands/QuestResetCommand.java | 2 +- .../elitemobs/commands/RankSetCommand.java | 2 +- .../elitemobs/commands/ReloadCommand.java | 2 +- .../elitemobs/commands/RemoveCommand.java | 2 +- src/main/resources/plugin.yml | 119 +++++++++++++++++- 38 files changed, 173 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index 030c1908c..af2d710d3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -11,7 +11,8 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setDescription("When in instanced content, makes the player start the instance."); + setPermission("elitemobs.event.start"); + setDescription("Open the Arena menu."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index 4eed4aad6..ce7c82e5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -13,9 +13,9 @@ public DebugCommand() { super(List.of("debug")); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em debug "); - setPermission("elitemobs.*"); + setPermission("elitemobs.debug"); setSenderType(SenderType.PLAYER); - setDescription("Toggles whether the setup message will show up."); + setDescription("Debug bosses or players."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java index 489fe0ef5..b04d02cbc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -11,7 +11,7 @@ public EventCommand() { super(List.of("event")); addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList()); setUsage("/em event "); - setPermission("elitemobs.*"); + setPermission("elitemobs.event.start"); setSenderType(SenderType.PLAYER); setDescription("Triggers a timed event to start at the next available time and place."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java index c1a8cb366..ff4ae49db 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -11,7 +11,7 @@ public class FireballCommand extends AdvancedCommand { public FireballCommand() { super(List.of("fireball")); setUsage("/em fireball"); - setPermission("elitemobs.*"); + setPermission("elitemobs.fireball"); setDescription("Shoots a fireball, to test terrain protections and explosion regeneration."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index 4cdca44e4..af4408e1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -10,7 +10,7 @@ public class HelpCommand extends AdvancedCommand { public HelpCommand() { super(List.of("help")); setUsage("/em help"); - setPermission("elitemobs.*"); + setPermission("elitemobs.help"); setDescription("Lists all commands."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index a8b97ca43..263e4b123 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -9,7 +9,7 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.*"); + setPermission("elitemobs.kill.kill"); setDescription("Kills all elites."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java index ee0629fa8..a408e4477 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -12,7 +12,7 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.*"); + setPermission("elitemobs.kill.radius"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java index 15d6e8ee7..e060bcb84 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -13,8 +13,8 @@ public KillTypeCommand() { super(List.of("kill")); addLiteral("type"); addArgument("type", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.*"); + setUsage("/em kill type "); + setPermission("elitemobs.kill.type"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java index 0d412be6f..90d86f7be 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -14,10 +14,10 @@ public KillTypeRadiusCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.*"); + setUsage("/em kill type "); + setPermission("elitemobs.kill.type.radius"); setSenderType(SenderType.PLAYER); - setDescription("Kills all elites of the specified type."); + setDescription("Kills all elites of the specified type within the specified radius."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java index 99c1ab744..0b6f9e2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -12,7 +12,7 @@ public LanguageCommand() { super(List.of("language")); addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); setUsage("/em language "); - setPermission("elitemobs.*"); + setPermission("elitemobs.language"); setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java index 53b255fdc..36c241e2f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -18,4 +18,4 @@ public LootCommand() { public void execute() { LootMenu.openMenu(getCurrentPlayerSender()); } -} +} \ 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 index 82a55be01..34478b53c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -13,10 +13,10 @@ public LootDebugCommand() { super(List.of("loot")); addLiteral("debug"); addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - setUsage("/em loot test "); - setPermission("elitemobs.*"); + setUsage("/em loot debug "); + setPermission("elitemobs.loot.debug"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 9159eaed2..9fccf132c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -15,9 +15,9 @@ public LootGiveCommand() { addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.give"); setSenderType(SenderType.PLAYER); - setDescription("Gives loot to a player."); + setDescription("Gives the specified loot to a specific player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java index 2ff145bbc..7c99be803 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -11,7 +11,7 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.menu"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 5bff2f261..0f8a0f0ee 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -15,9 +15,9 @@ public LootRandomCommand() { addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.random"); setSenderType(SenderType.PLAYER); - setDescription("Gives loot to a player."); + setDescription("Gives the player random loot of the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 5986986de..c166db304 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -15,7 +15,7 @@ public LootSimulateCommand() { addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.simulate"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index 4f8988bc2..730bb8db7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -16,7 +16,7 @@ public LootSimulateMultipleCommand() { addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.simulate.times"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java index 4dc8c73f9..ab6430518 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -13,7 +13,7 @@ public LootStats() { super(List.of("loot")); addLiteral("stats"); setUsage("/em loot stats"); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.stats"); setSenderType(SenderType.PLAYER); setDescription("Provides EliteMobs stats for the currently held item."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 8d13578c1..f5cc69e87 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -14,9 +14,9 @@ public MoneyAddAllCommand() { addLiteral("all"); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add all "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.add.all"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Gives every player on the server the specified amount of money."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 08328ad15..d83f008d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -14,9 +14,9 @@ public MoneyAddCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.add.player"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Gives the specified amount of money to the designated player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java index d2e35b5d6..33e655a4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -12,9 +12,9 @@ public MoneyCheckCommand() { super(List.of("money")); addLiteral("check"); setUsage("/em money check"); - setPermission("elitemobs.money.check"); + setPermission("elitemobs.money.check.self"); setSenderType(SenderType.PLAYER); - setDescription("Checks the EliteMobs currency"); + setDescription("Checks your EliteMobs currency."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 01f299276..e17d33f5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -11,8 +11,8 @@ public MoneyCheckPlayerCommand() { addLiteral("check"); addArgument("player", new ArrayList<>()); setUsage("/em check "); - setPermission("elitemobs.*"); - setDescription("Checks how much currency you have."); + setPermission("elitemobs.money.check.player"); + setDescription("Checks the currency of the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index e99856ac9..a05b654dc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -14,7 +14,7 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.remove"); setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java index 517ab97a5..d4a8db4c9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -13,8 +13,8 @@ public MoneySetCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money set "); - setPermission("elitemobs.*"); - setDescription("Sets the specified amount of currency to a player."); + setPermission("elitemobs.money.set"); + setDescription("Sets the specified amount of currency for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index d9ba2bac9..44bb71c85 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -11,7 +11,7 @@ public PackageDungeonCommand() { addArgument("dungeonName", new ArrayList<>()); addArgument("version", new ArrayList<>()); setUsage("/em package "); - setPermission("elitemobs.*"); + setPermission("elitemobs.package"); setDescription("Packages an EliteMobs dungeon for distribution."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index a80c2017e..00074c33c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -12,10 +12,10 @@ public PlaceBossCommand() { super(List.of("place")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/em addSpawn boss "); - setPermission("elitemobs.*"); + setUsage("/em place boss "); + setPermission("elitemobs.place.boss"); setSenderType(SenderType.PLAYER); - setDescription("Toggles whether the setup message will show up."); + setDescription("Add a spawn location for the specified boss at your current location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java index d093d367a..537d52c62 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -14,7 +14,7 @@ public PlaceNPCCommand() { addLiteral("npc"); addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet())); setUsage("/em place npc "); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.npc"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds an npc to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index ad8ee1d5a..e5bd38b37 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -13,7 +13,7 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.treasure"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds a treasure chest to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 9ff0df62e..2612668e1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -16,9 +16,9 @@ public PlaceWormholeCommand() { addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); setUsage("/em wormhole <1/2>"); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.wormhole"); setSenderType(SenderType.PLAYER); - setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + setDescription("Place a wormhole teleport at your current location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 413fbdbe6..63b0f4411 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -10,7 +10,7 @@ public QuestBypassCommand() { super(List.of("quest")); addLiteral("bypass"); setUsage("/em quest bypass"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.bypass"); setDescription("Bypasses permission restrictions for elite quests."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java index bd98d8b1c..c23f2557c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -11,7 +11,7 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.complete"); setSenderType(SenderType.PLAYER); setDescription("Forces all of your currently active elite quests to be completed. For debugging use only."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 1ea94da6d..933c12cc2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -11,7 +11,7 @@ public QuestLeaveCommand() { super(List.of("quest")); addLiteral("leave"); setUsage("/em quest leave"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.leave"); setSenderType(SenderType.PLAYER); setDescription("Leaves a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java index c000e8877..b87c868b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -13,9 +13,8 @@ public QuestResetAllCommand() { addLiteral("reset"); addLiteral("all"); addArgument("player", new ArrayList<>()); - addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); - setUsage("/em quest reset "); - setPermission("elitemobs.*"); + setUsage("/em quest reset all "); + setPermission("elitemobs.quest.reset.all"); setDescription("Resets all quests for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java index e80d057fb..890d5a680 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -14,7 +14,7 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.reset.quest"); setDescription("Resets a specific quest for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java index a1012bc61..b2c2c5c46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -12,7 +12,7 @@ public RankSetCommand() { addArgument("prestigeLevel", new ArrayList<>()); addArgument("guildLevel", new ArrayList<>()); setUsage("/em rank "); - setPermission("elitemobs.*"); + setPermission("elitemobs.rank.set"); setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java index 46a469de3..1cfdc72a5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -11,7 +11,7 @@ public class ReloadCommand extends AdvancedCommand { public ReloadCommand() { super(List.of("reload")); setUsage("/em reload"); - setPermission("elitemobs.*"); + setPermission("elitemobs.reload"); setDescription("Reloads EliteMobs."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java index 350acdf31..f8e33fcf4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -9,7 +9,7 @@ public class RemoveCommand extends AdvancedCommand { public RemoveCommand() { super(List.of("remove")); setUsage("/em remove"); - setPermission("elitemobs.*"); + setPermission("elitemobs.remove"); setSenderType(SenderType.PLAYER); setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content."); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ccf8aaa7a..d192b08f7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -149,4 +149,121 @@ permissions: 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 + default: true + elitemobs.arena.menu: + description: Allows players to open the Arena menu and join an Arena. + default: true + elitemobs.debug: + description: Allows players to have access to the player/bosses debug command. + default: true + elitemobs.discord.link: + description: Allows players to have access to the Discord link command. + default: true + elitemobs.discord.message: + description: Allows players to have access to the DiscordSRV message debug command. + default: op + elitemobs.event.start: + description: Allows players to start specific events. + default: op + elitemobs.fireball: + description: Allows players to shoot a fireball at the pointer's location. + default: op + elitemobs.help: + description: Allows players to see all available EliteMobs commands. + default: op + elitemobs.kill.kill: + description: Allows players to kill all elites. + default: op + elitemobs.kill.radius: + description: Allows players to kill all elites in the specified radius. + default: op + elitemobs.kill.type: + description: Allows players to kill all elites of the specified type. + default: op + elitemobs.kill.type.radius: + description: Allows players to kill all elites of the specified type within the given radius. + default: op + elitemobs.language: + description: Allows players to set the language that the server will use for EliteMobs. + default: op + elitemobs.loot.debug: + description: Allows players to equip themselves with a complete armor set, weapons set of the specified level, and food for testing purposes. + default: op + elitemobs.loot.give: + description: Allows players to give the specified loot to a specific player. + default: op + elitemobs.loot.menu: + description: Allows players to open the loot menu and select any loot they want. + default: op + elitemobs.loot.random: + description: Allows players to get random loot of the specified level. + default: op + elitemobs.loot.simulate: + description: Allows players to get simulated loot drops for the specified level and player. + default: op + elitemobs.loot.simulate.times: + description: Allows players to get simulated loot drops for a specified number of times for the given level and player. + default: op + elitemobs.loot.stats: + description: Allows players to see EliteMobs stats for the currently held item. + default: true + elitemobs.loot.stats: + description: Allows players to see EliteMobs stats for the currently held item. + default: op + elitemobs.money.add.all: + description: Allows players to give every player on the server the specified amount of money. + default: op + elitemobs.money.add.player: + description: Allows players to give the specified amount of money to the designated player. + default: op + elitemobs.money.check.self: + description: Allows players to check their EliteMobs currency. + default: true + elitemobs.money.check.player: + description: Allows players to check the currency of the specified player. + default: op + elitemobs.money.remove: + description: Allows players to deduct the specified amount of currency from a player. + default: op + elitemobs.money.set: + description: Allows players to set the specified amount of currency for the specified player. + default: op + elitemobs.package: + description: Allows players to package an EliteMobs dungeon for distribution. + default: op + elitemobs.place.boss: + description: Allows players to add a spawn location for the specified boss at their current location. + default: op + elitemobs.place.npc: + description: Allows players to permanently add an NPC to the location the user is standing on. + default: op + elitemobs.place.treasure: + description: Allows players to permanently add a treasure chest to the location the user is standing on. + default: op + elitemobs.place.wormhole: + description: Allows players to permanently add a wormhole teleport at their current location. + default: op + elitemobs.quest.bypass: + description: Allows players to bypass permission restrictions for elite quests. + default: op + elitemobs.quest.complete: + description: Allows players to force complete all of their currently active elite quests. For debugging use only. + default: op + elitemobs.quest.leave: + description: Allows players to leave a quest. Used via menu, can't be directly used. + default: op + elitemobs.quest.reset.all: + description: Allows players to reset all quests for a specific player. + default: op + elitemobs.quest.reset.quest: + description: Allows players to reset a specific quest for a specific player. + default: op + elitemobs.rank.set: + description: Allows players to manually set a player's guild rank to a the prestige level and guild level specified. + default: op + elitemobs.reload: + description: Allows players to reload EliteMobs. + default: op + elitemobs.remove: + description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. + default: op \ No newline at end of file From 1d6471c3d0e673c7a41e318b59eb95524b49a937 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 26 Jul 2024 08:45:19 +0100 Subject: [PATCH 37/78] EliteMobs 9.0.5 - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Almost all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 6 +++--- .../commands/AdventurersGuildCommand.java | 5 +++-- .../elitemobs/commands/AltCommand.java | 7 ++++--- .../elitemobs/commands/ArenaCommand.java | 6 ++++-- .../elitemobs/commands/ArenaCommands.java | 14 -------------- .../elitemobs/commands/DebugCommand.java | 5 +++-- .../elitemobs/commands/DiscordCommand.java | 5 +++-- .../commands/DiscordMessageCommand.java | 7 ++++--- .../elitemobs/commands/DismissCommand.java | 5 +++-- .../commands/DungeonTeleportCommand.java | 5 +++-- .../elitemobs/commands/EliteMobsCommand.java | 9 +++++---- .../elitemobs/commands/EnchantCommand.java | 7 ++++--- .../elitemobs/commands/EventCommand.java | 5 +++-- .../elitemobs/commands/FireballCommand.java | 9 +++++---- .../elitemobs/commands/HelpCommand.java | 13 +++++++------ .../elitemobs/commands/KillCommand.java | 5 +++-- .../elitemobs/commands/KillRadiusCommand.java | 5 +++-- .../elitemobs/commands/KillTypeCommand.java | 7 +++---- .../commands/KillTypeRadiusCommand.java | 9 +++++---- .../elitemobs/commands/LanguageCommand.java | 13 +++++++------ .../elitemobs/commands/LootCommand.java | 5 +++-- .../elitemobs/commands/LootDebugCommand.java | 5 +++-- .../elitemobs/commands/LootGiveCommand.java | 7 +++---- .../elitemobs/commands/LootMenuCommand.java | 5 +++-- .../elitemobs/commands/LootRandomCommand.java | 7 +++---- .../commands/LootSimulateCommand.java | 9 +++++---- .../commands/LootSimulateMultipleCommand.java | 11 ++++++----- .../elitemobs/commands/LootStats.java | 5 +++-- .../commands/MoneyAddAllCommand.java | 9 ++++----- .../elitemobs/commands/MoneyAddCommand.java | 11 +++++------ .../elitemobs/commands/MoneyCheckCommand.java | 7 ++++--- .../commands/MoneyCheckPlayerCommand.java | 7 ++++--- .../commands/MoneyRemoveCommand.java | 9 ++++----- .../elitemobs/commands/MoneySetCommand.java | 9 +++++---- .../commands/PackageDungeonCommand.java | 7 +++++-- .../elitemobs/commands/PayCommand.java | 9 +++++---- .../elitemobs/commands/PlaceBossCommand.java | 5 +++-- .../elitemobs/commands/PlaceNPCCommand.java | 5 +++-- .../commands/PlaceTreasureChestCommand.java | 5 +++-- .../commands/PlaceWormholeCommand.java | 15 ++++++++------- .../commands/QuestAcceptCommand.java | 5 +++-- .../commands/QuestBypassCommand.java | 7 +++++-- .../commands/QuestCompleteCommand.java | 5 +++-- .../elitemobs/commands/QuestLeaveCommand.java | 5 +++-- .../commands/QuestResetAllCommand.java | 6 +++--- .../elitemobs/commands/QuestResetCommand.java | 7 +++++-- .../elitemobs/commands/QuestTrackCommand.java | 5 +++-- .../elitemobs/commands/QuitCommand.java | 7 ++++--- .../elitemobs/commands/RankCommand.java | 7 ++++--- .../elitemobs/commands/RankSetCommand.java | 11 ++++++----- .../elitemobs/commands/ReloadCommand.java | 5 +++-- .../elitemobs/commands/RemoveCommand.java | 5 +++-- .../elitemobs/commands/RepairCommand.java | 7 ++++--- .../elitemobs/commands/RespawnAllCommand.java | 3 ++- .../elitemobs/commands/ScrapCommand.java | 7 ++++--- .../elitemobs/commands/SetupCommand.java | 5 +++-- .../elitemobs/commands/SetupDoneCommand.java | 7 ++++--- .../commands/SetupToggleCommand.java | 9 +++++---- .../elitemobs/commands/ShareItemCommand.java | 5 +++-- .../elitemobs/commands/ShopCustomCommand.java | 7 ++++--- .../commands/ShopCustomOtherCommand.java | 7 ++++--- .../commands/ShopDynamicCommand.java | 7 ++++--- .../commands/ShopProceduralOtherCommand.java | 7 ++++--- .../commands/ShopSellOtherCommand.java | 7 ++++--- .../commands/SpawnBossAtCommand.java | 17 ++++++++--------- .../elitemobs/commands/SpawnBossCommand.java | 7 ++++--- .../commands/SpawnBossLevelAtCommand.java | 19 +++++++++---------- .../commands/SpawnBossLevelCommand.java | 9 +++++---- .../elitemobs/commands/SpawnElite.java | 11 ++++++----- .../commands/SpawnEliteAtCommand.java | 19 ++++++++++--------- .../commands/SpawnTeleportCommand.java | 5 +++-- .../elitemobs/commands/StartCommand.java | 7 ++++--- .../elitemobs/commands/StatsCommand.java | 5 +++-- .../elitemobs/commands/TrackBossCommand.java | 11 ++++++----- .../TransitiveBlocksCancelCommand.java | 7 +++++-- .../TransitiveBlocksEditAreaCommand.java | 12 ++++++++++-- .../commands/TransitiveBlocksEditCommand.java | 11 +++++++++-- .../TransitiveBlocksRegisterAreaCommand.java | 12 ++++++++++-- .../TransitiveBlocksRegisterCommand.java | 10 ++++++++-- .../elitemobs/commands/UnbindCommand.java | 7 ++++--- .../commands/UnbindForceCommand.java | 5 +++-- .../elitemobs/commands/VersionCommand.java | 5 +++-- 82 files changed, 357 insertions(+), 274 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java diff --git a/build.gradle b/build.gradle index 7e99f3d7f..1b0db9183 100644 --- a/build.gradle +++ b/build.gradle @@ -116,8 +116,8 @@ dependencies { 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' +// //reflections - used for config initialization +// implementation group: 'org.reflections', name: 'reflections', version: '0.10.2' //lombok compileOnly 'org.projectlombok:lombok:1.18.34' @@ -153,7 +153,7 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') - relocate('org.reflections', packagePath + '.reflections') +// relocate('org.reflections', packagePath + '.reflections') } archiveClassifier.set(null) archiveFileName.set(project.name + ".jar") diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 1ec601fb5..9c7dbbe5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public AdventurersGuildCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + 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 index 01b258753..b78d4e5bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public AltCommand() { } @Override - public void execute() { - PlayerData.setUseBookMenus(getCurrentPlayerSender(), !PlayerData.getUseBookMenus(getCurrentPlayerSender().getUniqueId())); - Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getSwitchEMStyleMessage()); + 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 index af2d710d3..c66063126 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -1,6 +1,8 @@ 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; @@ -17,7 +19,7 @@ public ArenaCommand() { } @Override - public void execute() { - ArenaCommands.openArenaMenu(getCurrentPlayerSender(), getStringArgument("arenaID")); + 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 50d8010f0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.menus.ArenaMenu; -import org.bukkit.entity.Player; - -public class ArenaCommands { - private 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/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index ce7c82e5e..34f06fa3b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -3,6 +3,7 @@ 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; @@ -19,7 +20,7 @@ public DebugCommand() { } @Override - public void execute() { - DebugScreen.open(getCurrentPlayerSender(), getStringArgument("filename")); + 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 index 19bd0b56a..b06eb76f3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public DiscordCommand() { } @Override - public void execute() { - Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + 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 index 5f6d4750f..64988902c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,8 +18,8 @@ public DiscordMessageCommand() { } @Override - public void execute() { - new DiscordSRVAnnouncement(getStringSequenceArgument("message")); - Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); + 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 index 0af89d79c..500607785 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public DismissCommand() { } @Override - public void execute() { - PlayerData.setDismissEMStatusScreenMessage(getCurrentPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(getCurrentPlayerSender().getUniqueId())); + public void execute(CommandData commandData) { + PlayerData.setDismissEMStatusScreenMessage(commandData.getPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(commandData.getPlayerSender().getUniqueId())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index c50bc0416..f0fb2b029 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,7 +18,7 @@ public DungeonTeleportCommand() { } @Override - public void execute() { - DungeonCommands.teleport(getCurrentPlayerSender(), getStringArgument("dungeonID")); + 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 index a07eb3d2f..82b5e1e2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -3,21 +3,22 @@ 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; +import java.util.ArrayList; public class EliteMobsCommand extends AdvancedCommand { public EliteMobsCommand() { - super(List.of("em", "elitemobs")); + super(new ArrayList<>()); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); setSenderType(SenderType.PLAYER); } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.isEmLeadsToStatusMenu()) - new PlayerStatusScreen(getCurrentPlayerSender()); + 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 index c2766a35e..1e7bfa81c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public EnchantCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - new ItemEnchantmentMenu(getCurrentPlayerSender()); + 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 index b04d02cbc..61a496b6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public EventCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(getCurrentCommandSender(), getStringArgument("filename")); + 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 index ff4ae49db..f15b47354 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,10 +17,10 @@ public FireballCommand() { } @Override - public void execute() { - Fireball fireball = (Fireball) getCurrentPlayerSender().getWorld().spawnEntity(getCurrentPlayerSender().getLocation(), EntityType.FIREBALL); - fireball.setDirection(getCurrentPlayerSender().getLocation().getDirection().normalize()); - fireball.setShooter(getCurrentPlayerSender()); + 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); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index af4408e1e..792b9e523 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.Player; @@ -15,14 +16,14 @@ public HelpCommand() { } @Override - public void execute() { - Logger.sendMessage(getCurrentCommandSender(), "Commands:"); + public void execute(CommandData commandData) { + Logger.sendMessage(commandData.getCommandSender(), "Commands:"); CommandManager.getInstance().commands.forEach(command -> { - if (getCurrentCommandSender() instanceof Player player) { - player.spigot().sendMessage(Logger.hoverMessage(command.usage, command.description)); + if (commandData.getCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.getUsage(), command.getDescription())); } else { - Logger.sendSimpleMessage(getCurrentCommandSender(), command.usage); - Logger.sendSimpleMessage(getCurrentCommandSender(), command.description); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getUsage()); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getDescription()); } }); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index 263e4b123..ca0f27243 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -14,7 +15,7 @@ public KillCommand() { } @Override - public void execute() { - KillHandler.killAggressiveMobs(getCurrentCommandSender()); + 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 index a408e4477..d4e84cd57 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,7 +19,7 @@ public KillRadiusCommand() { } @Override - public void execute() { - KillHandler.radiusKillAggressiveMobs(getCurrentPlayerSender(), getIntegerArgument("radius")); + 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 index e060bcb84..6cec36a67 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.entity.EntityType; import java.util.ArrayList; @@ -15,12 +15,11 @@ public KillTypeCommand() { addArgument("type", new ArrayList<>()); setUsage("/em kill type "); setPermission("elitemobs.kill.type"); - setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } @Override - public void execute() { - KillHandler.killEntityType(getCurrentPlayerSender(), EntityType.valueOf(getStringArgument("type"))); + 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 index 90d86f7be..a76c7b2d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -2,6 +2,7 @@ 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; @@ -21,9 +22,9 @@ public KillTypeRadiusCommand() { } @Override - public void execute() { - KillHandler.radiusKillSpecificMobs(getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("type")), - getIntegerArgument("range")); + 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 index 0b6f9e2b4..27574baf1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -3,6 +3,7 @@ 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.List; @@ -17,15 +18,15 @@ public LanguageCommand() { } @Override - public void execute() { - String language = getStringArgument("language"); + public void execute(CommandData commandData) { + String language = commandData.getStringArgument("language"); if (!TranslationsConfig.getTranslationConfigs().containsKey(language)) { - Logger.sendMessage(getCurrentCommandSender(), "Language not found. Valid languages:"); - TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(getCurrentCommandSender(), key)); + Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key)); return; } - DefaultConfig.setLanguage(getCurrentCommandSender(), language); - Logger.sendMessage(getCurrentCommandSender(), "&2Language set to " + language + + 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 index 36c241e2f..d1035a41f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public LootCommand() { } @Override - public void execute() { - LootMenu.openMenu(getCurrentPlayerSender()); + 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 index 34478b53c..f6217a661 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -3,6 +3,7 @@ import com.magmaguy.elitemobs.commands.admin.GetTierCommand; 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; @@ -20,7 +21,7 @@ public LootDebugCommand() { } @Override - public void execute() { - GetTierCommand.get(getCurrentPlayerSender(), getIntegerArgument("level")); + 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 index 9fccf132c..166ffeebb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -3,7 +3,7 @@ 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.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,11 @@ public LootGiveCommand() { addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); setPermission("elitemobs.loot.give"); - setSenderType(SenderType.PLAYER); setDescription("Gives the specified loot to a specific player."); } @Override - public void execute() { - LootCommand.give(getCurrentCommandSender(), getStringArgument("playerName"), getStringArgument("filename")); + 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 index 7c99be803..28b92ffa8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public LootMenuCommand() { } @Override - public void execute() { - new GetLootMenu(getCurrentPlayerSender()); + 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 index 0f8a0f0ee..04f6fcedb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -3,7 +3,7 @@ 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.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,11 @@ public LootRandomCommand() { addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); setPermission("elitemobs.loot.random"); - setSenderType(SenderType.PLAYER); setDescription("Gives the player random loot of the specified level."); } @Override - public void execute() { - SimLootCommand.forcePositiveLoot(getCurrentCommandSender(), getStringArgument("playerName"), getIntegerArgument("level")); + 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 index c166db304..752a7b82b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -3,6 +3,7 @@ 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; @@ -21,10 +22,10 @@ public LootSimulateCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SimLootCommand.run( - getCurrentPlayerSender(), - getIntegerArgument("level"), - getStringArgument("playerName")); + 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 index 730bb8db7..ca0236728 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -3,6 +3,7 @@ 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; @@ -22,11 +23,11 @@ public LootSimulateMultipleCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SimLootCommand.runMultipleTimes( - getCurrentPlayerSender(), - getIntegerArgument("level"), - getIntegerArgument("times"), - getStringArgument("playerName")); + 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 index ab6430518..9e81fb2f6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -2,6 +2,7 @@ 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; @@ -19,8 +20,8 @@ public LootStats() { } @Override - public void execute() { - Player player = getCurrentPlayerSender(); + public void execute(CommandData commandData) { + Player player = commandData.getPlayerSender(); ItemStack item = player.getInventory().getItemInMainHand(); double attackSpeed = EliteItemManager.getAttackSpeed(item); double damage = EliteItemManager.getBaseDamage(item); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index f5cc69e87..69a41cdd6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,14 +15,13 @@ public MoneyAddAllCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add all "); setPermission("elitemobs.money.add.all"); - setSenderType(SenderType.PLAYER); setDescription("Gives every player on the server the specified amount of money."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.addAllCommand( - getCurrentCommandSender(), - getDoubleArgument("amount")); + 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 index d83f008d0..62480a03a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,15 +15,14 @@ public MoneyAddCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); setPermission("elitemobs.money.add.player"); - setSenderType(SenderType.PLAYER); setDescription("Gives the specified amount of money to the designated player."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.addCommand( - getCurrentCommandSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index 33e655a4a..14cee4268 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,10 +19,10 @@ public MoneyCheckCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) - new PlayerStatusScreen(getCurrentPlayerSender()); + new PlayerStatusScreen(commandData.getPlayerSender()); else - CurrencyCommandsHandler.walletCommand(getCurrentPlayerSender()); + 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 index e17d33f5c..29a6736e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -1,6 +1,7 @@ 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; @@ -16,9 +17,9 @@ public MoneyCheckPlayerCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.checkCommand( - getCurrentCommandSender(), - getStringArgument("player")); + commandData.getCommandSender(), + commandData.getStringArgument("player")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index a05b654dc..a2d17c061 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,14 +15,13 @@ public MoneyRemoveCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); setPermission("elitemobs.money.remove"); - setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.subtractCommand( - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index d4a8db4c9..9de1d06e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,10 +19,10 @@ public MoneySetCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.setCommand( - getCurrentCommandSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + commandData.getCommandSender(), + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index 44bb71c85..1e867ea92 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -1,6 +1,7 @@ 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; @@ -16,7 +17,9 @@ public PackageDungeonCommand() { } @Override - public void execute() { - new PackageCommand(getCurrentCommandSender(), getStringArgument("dungeonName"), getStringArgument("version")); + 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 index 98f778fed..3a7961030 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,10 +18,10 @@ public PayCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.payCommand( - getCurrentPlayerSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index 00074c33c..21ca47b73 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public PlaceBossCommand() { } @Override - public void execute() { - CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + 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 index 537d52c62..c1f31c9cd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -3,6 +3,7 @@ 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; @@ -20,7 +21,7 @@ public PlaceNPCCommand() { } @Override - public void execute() { - NPCCommands.set(getCurrentPlayerSender(), getStringArgument("filename")); + 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 index e5bd38b37..2753aed75 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public PlaceTreasureChestCommand() { } @Override - public void execute() { - CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + 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/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 2612668e1..186e4dcf5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -3,6 +3,7 @@ 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; @@ -22,20 +23,20 @@ public PlaceWormholeCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(getStringArgument("wormholeFilename"))) - switch (getStringArgument("wormholeOption")) { + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("wormholeFilename"))) + switch (commandData.getStringArgument("wormholeOption")) { case "1": - wormhole.getWormholeEntry1().updateLocation(getCurrentPlayerSender()); + wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); return; case "2": - wormhole.getWormholeEntry2().updateLocation(getCurrentPlayerSender()); + wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender()); return; default: - Logger.sendMessage(getCurrentCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); } } - Logger.sendMessage(getCurrentCommandSender(), "Failed to set location for this 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/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index 9b10521ed..29a552ad2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public QuestAcceptCommand() { } @Override - public void execute() { - QuestCommand.joinQuest(getStringArgument("questID"), getCurrentPlayerSender()); + 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 index 63b0f4411..2854671a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -2,6 +2,8 @@ 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; @@ -11,11 +13,12 @@ public QuestBypassCommand() { addLiteral("bypass"); setUsage("/em quest bypass"); setPermission("elitemobs.quest.bypass"); + setSenderType(SenderType.PLAYER); setDescription("Bypasses permission restrictions for elite quests."); } @Override - public void execute() { - QuestCommand.bypassQuestRequirements(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + QuestCommand.bypassQuestRequirements(commandData.getPlayerSender()); } } \ 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 index c23f2557c..63831dcdc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public QuestCompleteCommand() { } @Override - public void execute() { - QuestCommand.completeQuest(getCurrentPlayerSender()); + 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/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 933c12cc2..306478b72 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public QuestLeaveCommand() { } @Override - public void execute() { - QuestCommand.leaveQuest(getCurrentPlayerSender(), getStringArgument("questID")); + 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 index b87c868b9..9f4915e63 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -1,8 +1,8 @@ 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 java.util.ArrayList; import java.util.List; @@ -19,7 +19,7 @@ public QuestResetAllCommand() { } @Override - public void execute() { - QuestCommand.resetQuests(getCurrentCommandSender(), getStringArgument("player")); + 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 index 890d5a680..46d9e5586 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -3,6 +3,8 @@ 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; @@ -16,10 +18,11 @@ public QuestResetCommand() { setUsage("/em quest reset "); setPermission("elitemobs.quest.reset.quest"); setDescription("Resets a specific quest for a specific player."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - QuestCommand.resetQuest(getCurrentCommandSender(), getStringArgument("player"), getStringArgument("questName")); + 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 index 06802a94f..8629cc3a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public QuestTrackCommand() { } @Override - public void execute() { - QuestCommand.trackQuest(getStringArgument("questID"), getCurrentPlayerSender()); + 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 index d543f3016..148b2b2bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,9 +16,9 @@ public QuitCommand() { } @Override - public void execute() { - MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender()); if (matchInstance != null) - matchInstance.removeAnyKind(getCurrentPlayerSender()); + 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 index cacf7c07d..39a4bdcbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,8 +16,8 @@ public RankCommand() { } @Override - public void execute() { - if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + 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 index b2c2c5c46..b4730d04b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,10 +18,10 @@ public RankSetCommand() { } @Override - public void execute() { - GuildRankCommands.setGuildRank(getCurrentCommandSender(), - getStringArgument("player"), - getIntegerArgument("prestigeLevel"), - getIntegerArgument("guildLevel")); + 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 index 1cfdc72a5..efc3774b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -2,6 +2,7 @@ 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; @@ -23,7 +24,7 @@ public static void reload(CommandSender commandSender) { } @Override - public void execute() { - reload(getCurrentCommandSender()); + 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 index f8e33fcf4..2110beb14 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public RemoveCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(getCurrentPlayerSender()); + 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 index 55f0209b5..2dca59643 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public RepairCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { RepairMenu repairMenu = new RepairMenu(); - repairMenu.constructRepairMenu(getCurrentPlayerSender()); + 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 index 4536c0d31..bd845d9df 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -15,7 +16,7 @@ public RespawnAllCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> { if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn(); }); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index f1bd65d76..ea92414cc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public ScrapCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { ScrapperMenu scrapperMenu = new ScrapperMenu(); - scrapperMenu.constructScrapMenu(getCurrentPlayerSender()); + 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 index e23b0ce2e..d31265acf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,7 +17,7 @@ public SetupCommand() { } @Override - public void execute() { - new SetupMenu(getCurrentPlayerSender()); + 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 index 5091430a6..c8186bdc7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,11 +17,11 @@ public SetupDoneCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { DefaultConfig.toggleSetupDone(); if (DefaultConfig.isSetupDone()) - Logger.sendMessage(getCurrentCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this."); + 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(getCurrentCommandSender(), "&aEliteMobs will once again send messages on login. You can do [/em setup done] again to revert this."); + 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/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 78e6e3b35..3d5ade5d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,12 +19,12 @@ public SetupToggleCommand() { } @Override - public void execute() { - String dungeon = getStringArgument("empackages"); + public void execute(CommandData commandData) { + String dungeon = commandData.getStringArgument("empackages"); if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) - Logger.sendMessage(getCurrentCommandSender(), "Not a valid em package!"); + Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!"); EMPackage emPackage = EMPackage.getEmPackages().get(dungeon); if (emPackage.install()) - Logger.sendMessage(getCurrentCommandSender(), "Successfully installed content!"); + Logger.sendMessage(commandData.getCommandSender(), "Successfully installed 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 index 1189648ac..415c820b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,7 +17,7 @@ public ShareItemCommand() { } @Override - public void execute() { - ShareItem.showOnChat(getCurrentPlayerSender()); + 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 index 3907223a9..587dcdc7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,8 +19,8 @@ public ShopCustomCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - CustomShopMenu.customShopInitializer(getCurrentPlayerSender()); + 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 index be44f5a22..4973844da 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,11 +20,11 @@ public ShopCustomOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { - CustomShopMenu.customShopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index b13ccf3f4..993484c24 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,8 +19,8 @@ public ShopDynamicCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - ProceduralShopMenu.shopInitializer(getCurrentPlayerSender()); + 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 index 67b331977..5984710df 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,11 +20,11 @@ public ShopProceduralOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { - ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index d3847eed2..237f811a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,12 +20,12 @@ public ShopSellOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SellMenu sellMenu = new SellMenu(); try { - sellMenu.constructSellMenu(Bukkit.getPlayer(getStringArgument("player"))); + sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index 8e3d72342..08ce864f7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -22,19 +22,18 @@ public SpawnBossAtCommand() { addArgument("z", new ArrayList<>()); setUsage("/setup spawnAt boss "); setPermission("elitemobs.*"); - setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getStringArgument("worldName"), + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), new Vector( - getDoubleArgument("x"), - getDoubleArgument("y"), - getDoubleArgument("z"))); + 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 index de21fe16b..e64ecad12 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,9 +20,9 @@ public SpawnBossCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename")); + 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 index 0c21ed5f9..f8629dd5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -23,20 +23,19 @@ public SpawnBossLevelAtCommand() { addArgument("level", new ArrayList<>()); setUsage("/setup spawn bossAt "); setPermission("elitemobs.*"); - setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getStringArgument("worldName"), + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), new Vector( - getDoubleArgument("x"), - getDoubleArgument("y"), - getDoubleArgument("z")), - getIntegerArgument("level")); + 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 index 986f72362..3eab1fadb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -2,6 +2,7 @@ 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; @@ -20,10 +21,10 @@ public SpawnBossLevelCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getIntegerArgument("level")); + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getIntegerArgument("level")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 4ad1e71c4..b93daf058 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -2,6 +2,7 @@ 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; @@ -23,11 +24,11 @@ public SpawnElite() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnEliteEntityTypeCommand( - getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("entityType")), - getIntegerArgument("level"), - Optional.of(getStringSequenceArgument("powers"))); + 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 index fef05b732..9d8478165 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -2,6 +2,7 @@ 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; @@ -28,16 +29,16 @@ public SpawnEliteAtCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnEliteEntityTypeCommand( - getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("entityType")), - getStringArgument("world"), + commandData.getPlayerSender(), + EntityType.valueOf(commandData.getStringArgument("entityType")), + commandData.getStringArgument("world"), new Vector( - getIntegerArgument("x"), - getIntegerArgument("y"), - getIntegerArgument("z")), - getIntegerArgument("level"), - Optional.of(getStringSequenceArgument("powers"))); + 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 index 4d3029a8b..514a88788 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public SpawnTeleportCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.getDefaultSpawnLocation() != null) - PlayerPreTeleportEvent.teleportPlayer(getCurrentPlayerSender(), DefaultConfig.getDefaultSpawnLocation()); + 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 index 82447a712..c99e1152a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,11 +17,11 @@ public StartCommand() { } @Override - public void execute() { - MatchInstance matchInstance = MatchInstance.getPlayerInstance(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(commandData.getPlayerSender()); if (matchInstance != null) { matchInstance.countdownMatch(); } else - Logger.sendMessage(getCurrentCommandSender(), "You are not queued for instanced content!"); + 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 index db0e4764f..27c1d144e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public StatsCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(getCurrentPlayerSender()); + 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 index cac58c1e4..832f2fecc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -3,6 +3,7 @@ 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; @@ -21,17 +22,17 @@ public TrackBossCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) - if (customBossEntity.getEliteUUID().equals(UUID.fromString(getStringArgument("id")))) { - customBossEntity.getCustomBossBossBar().addTrackingPlayer(getCurrentPlayerSender()); + if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandData.getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(commandData.getPlayerSender()); return; } - Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + 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(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + 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 index 9c5f99c25..1bd6ed1af 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -2,6 +2,8 @@ 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; @@ -12,10 +14,11 @@ public TransitiveBlocksCancelCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender()); + 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 index 8ae26b164..753b51b7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,16 @@ public TransitiveBlocksEditAreaCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Edits large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), true, true); + 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 index 936f496e2..24e386a4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,15 @@ public TransitiveBlocksEditCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), true); + 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 index a16414ca1..4a18e7785 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,16 @@ public TransitiveBlocksRegisterAreaCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Registers large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false, true); + 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 index 66c304a25..5bdb76b5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,14 @@ public TransitiveBlocksRegisterCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false); + 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/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index 7c4e19c93..d3b038b46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public UnbindCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { UnbindMenu unbindMenu = new UnbindMenu(); - unbindMenu.constructUnbinderMenu(getCurrentPlayerSender()); + 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 index ca1237a23..ad957e55b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -3,6 +3,7 @@ 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; @@ -19,8 +20,8 @@ public UnbindForceCommand() { } @Override - public void execute() { - ItemStack itemStack = getCurrentPlayerSender().getInventory().getItemInMainHand(); + public void execute(CommandData commandData) { + ItemStack itemStack = commandData.getPlayerSender().getInventory().getItemInMainHand(); if (ItemTagger.isEliteItem(itemStack)) SoulbindEnchantment.removeEnchantment(itemStack); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index 765e84ddb..cae741a0f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,9 +18,9 @@ public VersionCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { Logger.sendMessage( - getCurrentCommandSender(), + commandData.getCommandSender(), ChatColor.WHITE + " version " + ChatColor.GREEN + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion()); } } \ No newline at end of file From ce03dda9d3681c2e80d42bd80978317450cbd8f8 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:05:49 +0200 Subject: [PATCH 38/78] Finished going through commands --- .../java/com/magmaguy/elitemobs/commands/RepairCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/RespawnAllCommand.java | 2 +- .../java/com/magmaguy/elitemobs/commands/ScrapCommand.java | 2 +- .../java/com/magmaguy/elitemobs/commands/SetupCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/SetupDoneCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/SetupToggleCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/ShareItemCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/ShopCustomCommand.java | 2 +- .../magmaguy/elitemobs/commands/ShopCustomOtherCommand.java | 4 ++-- .../com/magmaguy/elitemobs/commands/ShopDynamicCommand.java | 2 +- .../magmaguy/elitemobs/commands/ShopSellOtherCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/SpawnBossCommand.java | 4 ++-- .../elitemobs/commands/SpawnBossLevelAtCommand.java | 6 +++--- .../magmaguy/elitemobs/commands/SpawnBossLevelCommand.java | 6 +++--- .../java/com/magmaguy/elitemobs/commands/SpawnElite.java | 2 +- .../magmaguy/elitemobs/commands/SpawnEliteAtCommand.java | 6 +++--- .../elitemobs/commands/TransitiveBlocksCancelCommand.java | 2 +- .../elitemobs/commands/TransitiveBlocksEditAreaCommand.java | 4 ++-- .../elitemobs/commands/TransitiveBlocksEditCommand.java | 6 +++--- .../commands/TransitiveBlocksRegisterAreaCommand.java | 4 ++-- .../elitemobs/commands/TransitiveBlocksRegisterCommand.java | 6 +++--- .../java/com/magmaguy/elitemobs/commands/UnbindCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/UnbindForceCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/VersionCommand.java | 4 ++-- 25 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java index 2dca59643..a1d6adeab 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -14,7 +14,7 @@ public RepairCommand() { 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"); + setDescription("Opens the repair item menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index bd845d9df..0d344b743 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -11,7 +11,7 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.*"); + setPermission("elitemobs.respawn"); setDescription("Forces all regional bosses to respawn."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index ea92414cc..534216f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -14,7 +14,7 @@ public ScrapCommand() { 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"); + setDescription("Opens the scrap menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index d31265acf..a7a604090 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -10,7 +10,7 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.*"); + setPermission("elitemobs.setup.main"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index c8186bdc7..509091122 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -12,7 +12,7 @@ public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); setUsage("/setup done"); - setPermission("elitemobs.*"); + setPermission("elitemobs.setup.done"); setDescription("Toggles whether the setup message will show up."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 3d5ade5d0..cbfb4e4eb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -11,11 +11,11 @@ public class SetupToggleCommand extends AdvancedCommand { public SetupToggleCommand() { super(List.of("setup")); - setPermission("elitemobs.*"); - setDescription("Sets up EliteMobs content!"); - setUsage("/em setup toggle"); addLiteral("toggle"); addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); + setUsage("/em setup toggle "); + setPermission("elitemobs.setup.toggle"); + setDescription("Allows you to toggle the installation of specified EliteMobs content."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java index 415c820b5..46b26dea2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -13,7 +13,7 @@ public ShareItemCommand() { setUsage("/em shareItem"); setPermission("elitemobs.shareitem"); setSenderType(SenderType.PLAYER); - setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + setDescription("Shares the stats of the currently held EliteMobs item in chat."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java index 587dcdc7b..51d1ee9db 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -15,7 +15,7 @@ public ShopCustomCommand() { 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"); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 4973844da..2d5d0bd9b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -15,8 +15,8 @@ public ShopCustomOtherCommand() { addLiteral("custom"); addArgument("player", new ArrayList<>()); setUsage("/em shop custom "); - setPermission("elitemobs.*"); - setDescription("Opens the EliteMobs shop for custom items."); + setPermission("elitemobs.shop.custom.player"); + setDescription("Opens the EliteMobs shop for custom items for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java index 993484c24..b6e84d237 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -15,7 +15,7 @@ public ShopDynamicCommand() { setUsage("/em shop dynamic"); setPermission("elitemobs.shop.command"); setSenderType(SenderType.PLAYER); - setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub"); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java index 237f811a9..eed677e82 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -14,9 +14,9 @@ public ShopSellOtherCommand() { super(List.of("shop")); addLiteral("sell"); addArgument("player", new ArrayList<>()); - setUsage("/em shop custom "); - setPermission("elitemobs.*"); - setDescription("Opens the EliteMobs shop for custom items."); + setUsage("/em shop sell "); + setPermission("elitemobs.shop.sell.player"); + setDescription("Opens the EliteMobs shop sell menu for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java index 08ce864f7..b183dc2fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -20,9 +20,9 @@ public SpawnBossAtCommand() { addArgument("x", new ArrayList<>()); addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); - setUsage("/setup spawnAt boss "); - setPermission("elitemobs.*"); - setDescription("Spawns a custom boss at the location the user is looking at."); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.spawn.boss.at"); + setDescription("Spawns a custom boss at the specified location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index e64ecad12..2d0560276 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -13,8 +13,8 @@ public SpawnBossCommand() { super(List.of("spawn")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/setup spawn boss "); - setPermission("elitemobs.*"); + setUsage("/em spawn boss "); + setPermission("elitemobs.spawn.boss"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index f8629dd5d..8d6955a6e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -21,9 +21,9 @@ public SpawnBossLevelAtCommand() { addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); addArgument("level", new ArrayList<>()); - setUsage("/setup spawn bossAt "); - setPermission("elitemobs.*"); - setDescription("Spawns a custom boss at the location the user is looking at."); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.spawn.boss.at.level"); + setDescription("Spawns a custom boss at the specified location with the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3eab1fadb..3d06e9055 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -14,10 +14,10 @@ public SpawnBossLevelCommand() { 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("/setup spawn boss "); - setPermission("elitemobs.*"); + setUsage("/em spawn boss "); + setPermission("elitemobs.spawn.boss.level"); setSenderType(SenderType.PLAYER); - setDescription("Spawns a custom boss at the location the user is looking at."); + setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index b93daf058..8346397de 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -18,7 +18,7 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.*"); + setPermission("elitemobs.spawn.elite"); setSenderType(SenderType.PLAYER); setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java index 9d8478165..bcf53598e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -22,10 +22,10 @@ public SpawnEliteAtCommand() { addArgument("entityType", new ArrayList<>()); addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); - setUsage("/em spawn elite <...>"); - setPermission("elitemobs.*"); + setUsage("/em spawn eliteAt <...>"); + setPermission("elitemobs.spawn.elite.at"); setSenderType(SenderType.PLAYER); - setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + setDescription("Spawns an elite of the specified type and level, optionally with specified powers, at the chosen location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 1bd6ed1af..8673dfaeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -12,7 +12,7 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setPermission("elitemobs.transitiveblocks.cancel"); setDescription("Cancels transitive block registration."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java index 753b51b7b..2c4d4acd6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -14,8 +14,8 @@ public TransitiveBlocksEditAreaCommand() { addLiteral("editArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setUsage("/em transitiveBlocks editArea "); + setPermission("elitemobs.transitiveblocks.edit.area"); setDescription("Edits large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java index 24e386a4a..a7274abe6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -14,9 +14,9 @@ public TransitiveBlocksEditCommand() { addLiteral("edit"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); - setDescription("Cancels transitive block registration."); + setUsage("/em transitiveBlocks edit "); + setPermission("elitemobs.transitiveblocks.edit.edit"); + setDescription("Edits transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java index 4a18e7785..b869df481 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -14,8 +14,8 @@ public TransitiveBlocksRegisterAreaCommand() { addLiteral("registerArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setUsage("/em transitiveBlocks registerArea "); + setPermission("elitemobs.transitiveblocks.register.area"); setDescription("Registers large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java index 5bdb76b5c..4af68f83f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -14,9 +14,9 @@ public TransitiveBlocksRegisterCommand() { addLiteral("register"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); - setDescription("Cancels transitive block registration."); + setUsage("/em transitiveBlocks register "); + setPermission("elitemobs.transitiveblocks.register.register"); + setDescription("Registers transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index d3b038b46..742eb9385 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -14,7 +14,7 @@ public UnbindCommand() { 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"); + setDescription("Opens the unbind menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java index ad957e55b..f853fa85b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -15,7 +15,7 @@ public UnbindForceCommand() { addLiteral("force"); setUsage("/em unbind force"); setSenderType(SenderType.PLAYER); - setPermission("elitemobs.*"); + setPermission("elitemobs.unbind.force"); setDescription("Forcefully unbinds a held item."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index cae741a0f..3a7669ba6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -13,8 +13,8 @@ public class VersionCommand extends AdvancedCommand { public VersionCommand() { super(List.of("version")); setUsage("/em version"); - setPermission("elitemobs.*"); - setDescription("Checks the server's plugin version."); + setPermission("elitemobs.version"); + setDescription("Checks the server's EliteMobs plugin version."); } @Override From 2c7e8db8e233e85057377db1dec2029c4c70cdcd Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:06:18 +0200 Subject: [PATCH 39/78] Updated plugin.yml with the rest of permissions --- src/main/resources/plugin.yml | 59 ++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d192b08f7..7862ba231 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -266,4 +266,61 @@ permissions: default: op elitemobs.remove: description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. - default: op \ No newline at end of file + default: op + elitemobs.respawn: + description: Allows players to force respawn all regional bosses. + default: op + elitemobs.setup.main: + description: Allows players to have access to the main command for setting up EliteMobs. + default: op + elitemobs.setup.done: + description: Allows players to toggle whether the setup message will show up in the server chat. + default: op + elitemobs.setup.toggle: + description: Allows players to toggle the installation of specified EliteMobs content. + default: op + elitemobs.shop.custom: + description: Allows players to open the EliteMobs shop for custom items for the specified player. + default: op + elitemobs.shop.sell.player: + description: Allows players to open the EliteMobs shop for custom items for the specified player. + default: op + elitemobs.spawn.boss.at: + description: Allows players to spawn a custom boss at the specified location. + default: op + elitemobs.spawn.boss: + description: Allows players to spawn a custom boss at the location the player is looking at. + default: op + elitemobs.spawn.boss.at.level: + description: Allows players to spawn a custom boss at the specified location with the specified level. + default: op + elitemobs.spawn.boss.level: + description: Allows players to spawn a custom boss at the location the user is looking at with the specified level. + default: op + elitemobs.spawn.elite: + description: Allows players to spawn an elite of a specified type and level, optionally with specific powers, at the targeted location. + default: op + elitemobs.spawn.elite.at: + description: Allows players to spawn an elite of the specified type and level, optionally with specified powers, at the chosen location. + default: op + elitemobs.transitiveblocks.cancel: + description: Allows players to cancel transitive block registration. + default: op + elitemobs.transitiveblocks.edit.area: + description: Allows players to edit large transitive blocks areas for use by regional bosses. + default: op + elitemobs.transitiveblocks.edit.edit: + description: Allows players to edit transitive blocks for use by regional bosses. + default: op + elitemobs.transitiveblocks.register.area: + description: Allows players to register large transitive blocks areas for use by regional bosses. + default: op + elitemobs.transitiveblocks.register.register: + description: Allows players to register transitive blocks for use by regional bosses. + default: op + elitemobs.unbind.force: + description: Allows players to forcefully unbind a held item. + default: op + elitemobs.version: + description: Allows players to check the server's EliteMobs plugin version. + default: op From be7e6ef3fb5f543a6d0aa65c6cb1af43a0b5f1dd Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:13:05 +0200 Subject: [PATCH 40/78] Updated SetupDoneCommand.java fixed help text for SetupDoneCommand --- .../java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index 509091122..7222579ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -11,7 +11,7 @@ public class SetupDoneCommand extends AdvancedCommand { public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); - setUsage("/setup done"); + setUsage("/em setup done"); setPermission("elitemobs.setup.done"); setDescription("Toggles whether the setup message will show up."); } From dff5c0a5c219846a3b24e605b39599b7cebda1b0 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:49:26 +0200 Subject: [PATCH 41/78] Updated MoneyCheckPlayerCommand.java fixed setusage for MoneyCheckPlayer --- .../magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 29a6736e7..62bb4caff 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -11,7 +11,7 @@ public MoneyCheckPlayerCommand() { super(List.of("money")); addLiteral("check"); addArgument("player", new ArrayList<>()); - setUsage("/em check "); + setUsage("/em money check "); setPermission("elitemobs.money.check.player"); setDescription("Checks the currency of the specified player."); } @@ -22,4 +22,4 @@ public void execute(CommandData commandData) { commandData.getCommandSender(), commandData.getStringArgument("player")); } -} \ No newline at end of file +} From 66de9c03399376b14237af5c78ac466fa34b2a74 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:44:43 +0200 Subject: [PATCH 42/78] Some minor edits to commands --- .../com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java | 2 +- src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 186e4dcf5..3b326e924 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -16,7 +16,7 @@ public PlaceWormholeCommand() { addLiteral("wormhole"); addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); - setUsage("/em wormhole <1/2>"); + setUsage("/em place wormhole <1/2>"); setPermission("elitemobs.place.wormhole"); setSenderType(SenderType.PLAYER); setDescription("Place a wormhole teleport at your current location."); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java index 39a4bdcbe..b85485726 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -11,7 +11,7 @@ public class RankCommand extends AdvancedCommand { public RankCommand() { super(List.of("rank")); setUsage("/em rank"); - setDescription("Opens the EliteMobs rank menu."); + setDescription("Opens the EliteMobs rank menu or teleports you to the Adventurer's Guild."); setSenderType(SenderType.PLAYER); } From 78a7669313757fc627be9af31914259bfd0b375e Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Mon, 29 Jul 2024 16:17:08 +0100 Subject: [PATCH 43/78] EliteMobs 9.1.0 SNAPSHOT: - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Nearly all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [New] All content imports are now handled by MagmaCore. This update now also allows content to be installed incorrectly - meaning packs from other plugins can be correctly imported in EliteMobs and moved to the right place, content for plugins not yet installed in the server will prepare the content ahead of time if the server installs those plugins in the future - [New] The pirate ship minidungeon has been readded to the plugin defaults as it has now been updated out of being a schematic dungeon - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [New] Resource pack option in the em setup menu has been tweaked to recommend the Resource Pack Manager plugin instead, this will be further tweaked after public release - [New] Importing content with models will now automatically and immediately host the content if FMM and RSPM are installed, meaning dungeons with models will now work after a single EliteMobs reload to install if from the imports - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Fix] Elite projectiles can no longer survive chunk unloads - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 62 +----- .../com/magmaguy/elitemobs/EliteMobs.java | 7 +- .../elitemobs/adventurersguild/GuildRank.java | 2 +- .../api/EliteMobDamagedByPlayerEvent.java | 2 +- .../FixPlayerOnLoginOrRespawn.java | 4 +- .../ItemEnchantmentPrevention.java | 2 +- .../PreventUpgradeDiamondToNetherite.java | 2 +- .../combatsystem/EliteProjectile.java | 2 + .../combatsystem/displays/PopupDisplay.java | 2 +- .../elitemobs/commands/CommandHandler.java | 102 +++++++++ .../elitemobs/commands/CommandManager.java | 96 --------- .../commands/CurrencyCommandsHandler.java | 2 +- .../elitemobs/commands/HelpCommand.java | 19 +- .../elitemobs/commands/LootDebugCommand.java | 3 +- .../elitemobs/commands/LootGiveCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 4 +- .../commands/LootSimulateCommand.java | 4 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../commands/MoneyAddAllCommand.java | 8 +- .../elitemobs/commands/MoneyAddCommand.java | 2 +- .../elitemobs/commands/PlaceBossCommand.java | 8 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 2 +- .../commands/QuestBypassCommand.java | 6 + .../commands/SetupToggleCommand.java | 9 +- .../elitemobs/commands/admin/DebugScreen.java | 2 +- .../elitemobs/commands/admin/NPCCommands.java | 2 +- .../commands/admin/StatsCommand.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 23 +- .../elitemobs/config/ConfigurationEngine.java | 2 +- .../config/ConfigurationImporter.java | 199 ------------------ .../config/LegacyValueConverter.java | 8 + ...roceduralItemGenerationSettingsConfig.java | 3 +- .../premade/TheLivingDeadConfig.java | 2 +- .../premade/PirateShipMinidungeon.java | 34 +++ .../premade/PirateShipMinidungeon.off | 66 ------ .../config/menus/premade/ArenaMenuConfig.java | 2 +- .../menus/premade/BuyOrSellMenuConfig.java | 2 +- .../menus/premade/CustomShopMenuConfig.java | 2 +- .../menus/premade/GetLootMenuConfig.java | 2 +- .../menus/premade/GuildRankMenuConfig.java | 2 +- .../premade/ItemEnchantmentMenuConfig.java | 2 +- .../menus/premade/PlayerStatusMenuConfig.java | 2 +- .../premade/ProceduralShopMenuConfig.java | 2 +- .../config/menus/premade/QuestMenuConfig.java | 2 +- .../menus/premade/RepairMenuConfig.java | 2 +- .../menus/premade/ScrapperMenuConfig.java | 2 +- .../config/menus/premade/SellMenuConfig.java | 2 +- .../menus/premade/UnbinderMenuConfig.java | 2 +- .../elitemobs/economy/EconomyHandler.java | 2 +- .../elitemobs/items/EliteItemLore.java | 2 +- .../elitemobs/items/ItemLootShower.java | 4 +- .../elitemobs/items/ItemWorthCalculator.java | 2 +- .../items/ScalableItemConstructor.java | 2 +- .../itemconstructor/ItemConstructor.java | 2 +- .../menus/InstancedDungeonBrowser.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 2 +- .../magmaguy/elitemobs/menus/LootMenu.java | 2 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 2 +- .../elitemobs/menus/ScrapperMenu.java | 2 +- .../magmaguy/elitemobs/menus/SellMenu.java | 4 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 2 +- .../custombosses/CustomBossBossBar.java | 2 +- .../custombosses/CustomBossDeath.java | 2 +- .../custombosses/CustomBossTrail.java | 2 +- .../statusscreen/BossTrackingPage.java | 4 +- .../statusscreen/TeleportsPage.java | 2 +- .../elitemobs/powers/GoldExplosion.java | 2 +- .../elitemobs/powers/GoldShotgun.java | 2 +- .../elitemobs/quests/QuestTracking.java | 2 +- .../quests/menus/QuestInventoryMenu.java | 2 +- .../elitemobs/quests/menus/QuestMenu.java | 2 +- .../placeholderapi/Placeholders.java | 2 +- .../treasurechest/TreasureChest.java | 2 +- .../elitemobs/utils/ItemStackGenerator.java | 76 ------- .../elitemobs/utils/ItemStackSerializer.java | 1 + .../com/magmaguy/elitemobs/utils/Round.java | 12 -- .../elitemobs/utils/SpigotMessage.java | 32 --- .../versionnotifier/VersionChecker.java | 2 +- src/main/resources/plugin.yml | 6 +- 80 files changed, 280 insertions(+), 630 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/Round.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java diff --git a/build.gradle b/build.gradle index 1b0db9183..d22f97548 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import org.apache.tools.ant.filters.ReplaceTokens - plugins { id 'java-library' id 'idea' @@ -14,16 +12,11 @@ compileTestJava.options.encoding = "UTF-8" java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(17) } } -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' - options.release = 21 -} - -//Fixes issues with utf-8 in the translations files. Why? Don't know. +//Fixes issues with utf-8 in the translations files. processResources { def props = [version: version] inputs.properties props @@ -34,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.0.5' +version '9.1.0' repositories { maven { @@ -53,13 +46,8 @@ 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 = 'http://magmaguy.com:50001/releases' @@ -77,10 +65,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/' @@ -93,8 +79,6 @@ repositories { dependencies { //Spigot API compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" - //BStats API - implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' //Vault @@ -112,31 +96,23 @@ dependencies { 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.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' + // Mythic Mobs integration - currently only for arenas + compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' - //Advanced AI goals + ///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.11.2-SNAPSHOT' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0' - //Advanced AI goals - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' - - // Mythic Mobs integration - currently only for arenas - compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } artifacts { // task 'build' runs generates uberjar @@ -153,30 +129,12 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') -// 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 -} - - -//ext.isReleaseVersion = !version.contains("SNAPSHOT") - publishing { repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 1f33f06be..502a143c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -5,7 +5,7 @@ */ import com.magmaguy.easyminecraftgoals.NMSManager; -import com.magmaguy.elitemobs.commands.CommandManager; +import com.magmaguy.elitemobs.commands.CommandHandler; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -222,7 +222,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 @@ -267,7 +268,7 @@ public void onEnable() { //Commands // new CommandHandler(); - new CommandManager(); + CommandHandler.registerCommands(); new SpecialItemSystemsConfig(); 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/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 2f8f5258b..8c0359157 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -15,7 +15,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.magmacore.util.Round; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java index fa6bf49a6..7293e3822 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java @@ -4,7 +4,7 @@ import org.bukkit.attribute.Attribute; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -19,7 +19,7 @@ public void onPlayerRespawn(PlayerRespawnEvent event) { } @EventHandler - public void onPlayerRespawn(PlayerLoginEvent event) { + 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()) 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/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index c25f8cdc5..3de63fa7d 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.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.Listener; 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/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java index 8b1a2cf6b..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,8 +10,8 @@ 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.VisualDisplay; +import com.magmaguy.magmacore.util.Round; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java new file mode 100644 index 000000000..97d1734f0 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -0,0 +1,102 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.CommandManager; + +public class CommandHandler { + private static CommandManager emCommand; + private static CommandManager adventurersGuildCommand; + private CommandHandler() { + } + + 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 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()); + + //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 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/CommandManager.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java deleted file mode 100644 index 1acb36c11..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.MetadataHandler; - -public class CommandManager extends com.magmaguy.magmacore.command.CommandManager { - public CommandManager() { - super(MetadataHandler.PLUGIN, "elitemobs"); - } - - @Override - public void registerCommands() { - //Admin commands - registerCommand(new SetupCommand()); - registerCommand(new SetupDoneCommand()); - registerCommand(new SetupToggleCommand()); - registerCommand(new SpawnBossCommand()); - registerCommand(new SpawnBossLevelCommand()); - registerCommand(new SpawnBossAtCommand()); - registerCommand(new SpawnBossLevelAtCommand()); - registerCommand(new PlaceBossCommand()); - registerCommand(new PlaceTreasureChestCommand()); - registerCommand(new PlaceNPCCommand()); - registerCommand(new RemoveCommand()); - registerCommand(new DebugCommand()); - registerCommand(new EventCommand()); - registerCommand(new StatsCommand()); - registerCommand(new LootMenuCommand()); - registerCommand(new LootGiveCommand()); - registerCommand(new LootRandomCommand()); - registerCommand(new LootSimulateMultipleCommand()); - registerCommand(new LootSimulateCommand()); - registerCommand(new VersionCommand()); - registerCommand(new ReloadCommand()); - registerCommand(new KillCommand()); - registerCommand(new KillRadiusCommand()); - registerCommand(new KillTypeCommand()); - registerCommand(new KillTypeRadiusCommand()); - registerCommand(new LootDebugCommand()); - registerCommand(new MoneyAddCommand()); - registerCommand(new MoneyAddAllCommand()); - registerCommand(new MoneySetCommand()); - registerCommand(new MoneyCheckPlayerCommand()); - registerCommand(new UnbindForceCommand()); - registerCommand(new FireballCommand()); - registerCommand(new RespawnAllCommand()); - registerCommand(new PackageDungeonCommand()); - registerCommand(new LanguageCommand()); - registerCommand(new PlaceWormholeCommand()); - registerCommand(new LootStats()); - registerCommand(new ShopProceduralOtherCommand()); - registerCommand(new ShopCustomOtherCommand()); - registerCommand(new ShopSellOtherCommand()); - registerCommand(new QuestBypassCommand()); - registerCommand(new QuestCompleteCommand()); - registerCommand(new QuestResetCommand()); - registerCommand(new QuestResetAllCommand()); - registerCommand(new TransitiveBlocksCancelCommand()); - registerCommand(new TransitiveBlocksRegisterCommand()); - registerCommand(new TransitiveBlocksEditCommand()); - registerCommand(new TransitiveBlocksRegisterAreaCommand()); - registerCommand(new TransitiveBlocksEditAreaCommand()); - registerCommand(new RankSetCommand()); - registerCommand(new SpawnElite()); - registerCommand(new SpawnEliteAtCommand()); - registerCommand(new DiscordMessageCommand()); - registerCommand(new DiscordCommand()); - - //User commands - registerCommand(new AdventurersGuildCommand()); - registerCommand(new ShareItemCommand()); - registerCommand(new ShopDynamicCommand()); - registerCommand(new ShopCustomCommand()); - registerCommand(new RepairCommand()); - registerCommand(new EnchantCommand()); - registerCommand(new ScrapCommand()); - registerCommand(new UnbindCommand()); - registerCommand(new MoneyCheckCommand()); - registerCommand(new QuestAcceptCommand()); - registerCommand(new QuestTrackCommand()); - registerCommand(new QuestLeaveCommand()); - registerCommand(new RankCommand()); - registerCommand(new LootCommand()); - registerCommand(new QuitCommand()); - registerCommand(new StartCommand()); - registerCommand(new ArenaCommand()); - registerCommand(new DismissCommand()); - registerCommand(new AltCommand()); - registerCommand(new SpawnTeleportCommand()); - registerCommand(new DungeonTeleportCommand()); - registerCommand(new TrackBossCommand()); - registerCommand(new PayCommand()); - - registerCommand(new EliteMobsCommand()); - registerCommand(new HelpCommand()); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index e6de39500..e11cdfd9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java @@ -2,8 +2,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index 792b9e523..c2b49187d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,13 +19,15 @@ public HelpCommand() { @Override public void execute(CommandData commandData) { Logger.sendMessage(commandData.getCommandSender(), "Commands:"); - CommandManager.getInstance().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()); - } - }); + 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/LootDebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java index f6217a661..ada2a14e9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.elitemobs.commands.admin.GetTierCommand; -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; @@ -13,7 +12,7 @@ public class LootDebugCommand extends AdvancedCommand { public LootDebugCommand() { super(List.of("loot")); addLiteral("debug"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>()); setUsage("/em loot debug "); setPermission("elitemobs.loot.debug"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 166ffeebb..0014a9663 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -14,7 +14,7 @@ public LootGiveCommand() { addLiteral("give"); addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); - setUsage("/em loot give "); + setUsage("/em loot give "); setPermission("elitemobs.loot.give"); setDescription("Gives the specified loot to a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 04f6fcedb..7ae31801d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -12,8 +12,8 @@ public class LootRandomCommand extends AdvancedCommand { public LootRandomCommand() { super(List.of("loot")); addLiteral("random"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - addArgument("playerName", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot random "); setPermission("elitemobs.loot.random"); setDescription("Gives the player random loot of the specified level."); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 752a7b82b..5284dc1e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -13,8 +13,8 @@ public class LootSimulateCommand extends AdvancedCommand { public LootSimulateCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - addArgument("playerName", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot simulate "); setPermission("elitemobs.loot.simulate"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index ca0236728..cf7eba055 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -13,7 +13,7 @@ public class LootSimulateMultipleCommand extends AdvancedCommand { public LootSimulateMultipleCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>()); addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 69a41cdd6..d751e4547 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; import com.magmaguy.magmacore.command.CommandData; @@ -10,10 +9,9 @@ public class MoneyAddAllCommand extends AdvancedCommand { public MoneyAddAllCommand() { super(List.of("money")); - addLiteral("add"); - addLiteral("all"); - addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - setUsage("/em money add all "); + addLiteral("addAll"); + addArgument("amount", new ArrayList<>()); + setUsage("/em money addAll "); setPermission("elitemobs.money.add.all"); setDescription("Gives every player on the server the specified amount of money."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 62480a03a..31d4d871c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -11,7 +11,7 @@ public class MoneyAddCommand extends AdvancedCommand { public MoneyAddCommand() { super(List.of("money")); addLiteral("add"); - addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("player", new ArrayList<>()); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); setPermission("elitemobs.money.add.player"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index 21ca47b73..9e6093dec 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -1,18 +1,24 @@ 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"); - addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + 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.boss"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index 2753aed75..fb1b012ca 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -21,6 +21,6 @@ public PlaceTreasureChestCommand() { @Override public void execute(CommandData commandData) { - CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender()); + 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 index 3b326e924..261fa79d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -25,7 +25,7 @@ public PlaceWormholeCommand() { @Override public void execute(CommandData commandData) { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("wormholeFilename"))) + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename"))) switch (commandData.getStringArgument("wormholeOption")) { case "1": wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 2854671a1..83619bbae 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -1,9 +1,11 @@ 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; @@ -20,5 +22,9 @@ public QuestBypassCommand() { @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/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index cbfb4e4eb..f523de7d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -24,7 +24,12 @@ public void execute(CommandData commandData) { 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()) - Logger.sendMessage(commandData.getCommandSender(), "Successfully installed content!"); + 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/admin/DebugScreen.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java index 7cb25431c..e39885c30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -6,8 +6,8 @@ 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/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/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java index aff87c328..d3c5bd302 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -6,8 +6,8 @@ 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; 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 05bf15fc1..a2baef37f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.SpigotMessage; 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; @@ -50,14 +50,17 @@ 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) { diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 778e82472..c47c3692e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; 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; 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 2ec691a57..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.MetadataHandler; -import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; -import com.magmaguy.magmacore.util.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) { - Logger.warn("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) { - Logger.warn("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, new File(zippedFile.getAbsolutePath().replace(".zip", ""))); - else unzippedFile = zippedFile; - } catch (Exception e) { - Logger.warn("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 - Logger.warn("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); - break; - case "schematics": - Logger.warn("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); - break; - default: - Logger.warn("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) { - Logger.warn("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); - e.printStackTrace(); - continue; - } - try { - unzippedFile.delete(); - zippedFile.delete(); - } catch (Exception ex) { - Logger.warn("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); - Logger.info("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()) { - Logger.info("Overriding existing directory " + destinationFile.getPath()); - if (Bukkit.getWorld(file.getName()) != null) { - Bukkit.unloadWorld(file.getName(), false); - Logger.warn("Unloaded world " + file.getName() + " for safe replacement!"); - } - deleteDirectory(destinationFile); - } - FileUtils.moveDirectory(file, destinationFile); - } catch (Exception exception) { - Logger.warn("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 { - Logger.info("Adding " + file.getCanonicalPath()); - moveFile(file, targetPath, force); - } catch (Exception exception) { - Logger.warn("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) { - Logger.warn("Failed to move directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index e72f2a185..a05612a0f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -90,6 +90,14 @@ public static String parseParticle(String potionEffectName) { 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(); default: return potionEffectName; } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java index ecec2451e..33ba488b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -62,7 +62,6 @@ public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile { public ProceduralItemGenerationSettingsConfig() { super("ProceduralItemGenerationSettings.yml"); - instance = this; } private void addMaterial(Material material) { @@ -79,6 +78,8 @@ public void cacheMaterials() { @Override public void initializeValues() { + instance = this; + doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); 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..83547319e 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,7 +1,7 @@ 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; 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 new file mode 100644 index 000000000..f9aaa7e5e --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.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.Arrays; + +public class PirateShipMinidungeon extends DungeonPackagerConfigFields { + public PirateShipMinidungeon() { + super("pirate_ship_minidungeon", + true, + "&2[lvl 010-020] &6The Pirate Ship", + Arrays.asList("&fA fun, challenging minidungeon full of", + "&fbosses made for players starting to get good,", + "&fat EliteMobs!", + "&6Credits: MagmaGuy & Realm of Lotheridon"), + DiscordLinks.freeMinidungeons, + DungeonSizeCategory.MINIDUNGEON, + "em_pirate_ship", + World.Environment.NORMAL, + true, + "em_the_pirate_ship,-85,63,243.5,-150,0", + 0, + "Difficulty: &6Medium\n" + + "$bossCount bosses, from level $lowestTier to $highestTier\n" + + "&6One of the best hunting grounds for" + + "&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!", + "the_pirate_ship", + false); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off deleted file mode 100644 index 3de4f94ff..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off +++ /dev/null @@ -1,66 +0,0 @@ -package com.magmaguy.elitemobs.config.dungeonpackager.premade; - -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -import com.magmaguy.elitemobs.utils.DiscordLinks; -import org.bukkit.util.Vector; - -import java.util.Arrays; -import java.util.List; - -public class PirateShipMinidungeon extends DungeonPackagerConfigFields { - public PirateShipMinidungeon() { - super("pirate_ship_minidungeon", - true, - "&2[lvl 010-020] &6The Pirate Ship", - Arrays.asList("&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, - DungeonSizeCategory.MINIDUNGEON, - "em_pirate_ship.schem", - true, - new Vector(16, -6, -1), - new Vector(-20, 58, 90), - "-17,1,49,0,0", - 0, - "Difficulty: &6Medium\n" + - "$bossCount bosses, from level $lowestTier to $highestTier\n" + - "&6One of the best hunting grounds for" + - "&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"); - } -} 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 90c0f330b..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,7 +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.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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..92f8bade2 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,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.Material; import org.bukkit.inventory.ItemStack; 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..3c7146b40 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,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.Arrays; 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..d10bea9e4 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,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 lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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..d7f6d3e9b 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,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 lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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 bc487f6e2..078211799 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,7 +4,7 @@ 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.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; 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..fad0a5f59 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,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.Arrays; 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..c8db6f1e7 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,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.Material; import org.bukkit.inventory.ItemStack; 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..3add3eebb 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,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.Material; import org.bukkit.inventory.ItemStack; 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..5d5e59f92 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,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.Material; import org.bukkit.inventory.ItemStack; 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..cbcca2963 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,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.Material; import org.bukkit.inventory.ItemStack; 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..3746afa01 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,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 lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 3e5d8eecb..3edba4109 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -10,9 +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.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; diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index e0d720677..4fbd06cf8 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -8,10 +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.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; 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/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/itemconstructor/ItemConstructor.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java index e967da277..71a2cc1c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java @@ -7,8 +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/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index f884985fc..e9bdefa43 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -5,8 +5,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index d6f39502a..d9a77bd98 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -10,8 +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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 25202dc8d..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.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/RepairMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java index 933ee6a43..e160d12ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -6,7 +6,7 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 42c4e12d7..ee4246745 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -9,8 +9,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java index 1d20fa872..3e59aec15 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -8,9 +8,9 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index 9193dfbd8..b6b0c1099 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -8,7 +8,7 @@ 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; 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 0eebe530e..fe43e4b3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -3,9 +3,9 @@ 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.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; 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 a86c13599..d4654b4fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java @@ -4,8 +4,8 @@ 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/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 65404b752..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,7 +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.magmacore.util.ItemStackGenerator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; 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 5c6cabd04..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.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; 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 c64a0655c..65d12c34a 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -4,8 +4,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java b/src/main/java/com/magmaguy/elitemobs/powers/GoldExplosion.java index c18505ede..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; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java b/src/main/java/com/magmaguy/elitemobs/powers/GoldShotgun.java index 52a7bd8e5..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; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index de0bbcaa2..2b350027d 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -13,9 +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; 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 e91bb23ce..e1cee7b08 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java @@ -5,8 +5,8 @@ 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; 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 c09e4d2c2..642964af8 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java @@ -16,8 +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/thirdparty/placeholderapi/Placeholders.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/placeholderapi/Placeholders.java index 09784d6f8..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; diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index acf28eb97..122ef2245 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -12,10 +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.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; 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 8e46e37a6..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.magmacore.util.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 7f53a21b4..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,7 @@ package com.magmaguy.elitemobs.utils; 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; 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 080b80cfc..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.magmacore.util.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/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index 47c2564dd..01c35ca90 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.SpigotMessage; 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; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7862ba231..84686f0dd 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.5 +version: 9.1.0-SNAPSHOT author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -23,6 +23,10 @@ commands: description: Main command aliases: - em + adventurersguild: + description: Main command + aliases: + - ag permissions: elitemobs.*: From 9be41c3581b24c72325259647db5e04a7d5fef7a Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 2 Aug 2024 12:49:20 +0100 Subject: [PATCH 44/78] EliteMobs 9.1.0: - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Nearly all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [New] All content imports are now handled by MagmaCore. This update now also allows content to be installed incorrectly - meaning packs from other plugins can be correctly imported in EliteMobs and moved to the right place, content for plugins not yet installed in the server will prepare the content ahead of time if the server installs those plugins in the future - [New] The pirate ship minidungeon has been readded to the plugin defaults as it has now been updated out of being a schematic dungeon - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [New] Resource pack option in the em setup menu has been tweaked to recommend the Resource Pack Manager plugin instead, this will be further tweaked after public release - [New] Importing content with models will now automatically and immediately host the content if FMM and RSPM are installed, meaning dungeons with models will now work after a single EliteMobs reload to install if from the imports - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Fix] Elite projectiles can no longer survive chunk unloads - [Removal] Removed trace system from custom bosses - [Removal] Removed the resource pack data config, now handled by ResourcePackManager Signed-off-by: MagmaGuy --- build.gradle | 4 +- .../com/magmaguy/elitemobs/EliteMobs.java | 1 - .../magmaguy/elitemobs/EventsRegistrer.java | 2 - .../GuildRankMenuHandler.java | 4 +- .../commands/AdventurersGuildCommand.java | 4 +- .../elitemobs/commands/CommandHandler.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 3 +- .../elitemobs/config/DefaultConfig.java | 4 +- .../config/LegacyValueConverter.java | 10 ++ .../config/ResourcePackDataConfig.java | 102 ------------------ .../premade/PirateShipMinidungeon.java | 2 +- .../magmaguy/elitemobs/menus/ArenaMenu.java | 4 +- .../elitemobs/menus/BuyOrSellMenu.java | 6 +- .../elitemobs/menus/CustomShopMenu.java | 6 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 4 +- .../elitemobs/menus/ProceduralShopMenu.java | 6 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 5 +- .../elitemobs/menus/ScrapperMenu.java | 5 +- .../magmaguy/elitemobs/menus/SellMenu.java | 3 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 5 +- .../custombosses/CustomBossBossBar.java | 2 +- .../powers/scripts/ScriptAction.java | 9 +- .../elitemobs/utils/shapes/Cuboid.java | 10 +- src/main/resources/plugin.yml | 2 +- 24 files changed, 57 insertions(+), 148 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java diff --git a/build.gradle b/build.gradle index d22f97548..4051736de 100644 --- a/build.gradle +++ b/build.gradle @@ -110,8 +110,8 @@ dependencies { 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.11.2-SNAPSHOT' - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.12.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.8' } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 502a143c2..a27940735 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -85,7 +85,6 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations new DefaultConfig(); - new ResourcePackDataConfig(); new ItemSettingsConfig(); new ProceduralItemGenerationSettingsConfig(); PotionEffectsConfig.initializeConfigs(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index e127f438e..4eb7bc8b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -88,8 +88,6 @@ public static void registerEvents() { register(new Navigation()); - register(new ResourcePackDataConfig.ResourcePackDataConfigEvents()); - register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener()); register(new VersionChecker.VersionCheckerEvents()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 0a3986fe2..fd00f7ca7 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.adventurersguild; 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; @@ -114,7 +114,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); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 9c7dbbe5d..1c6f75897 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -4,11 +4,11 @@ import com.magmaguy.magmacore.command.CommandData; import com.magmaguy.magmacore.command.SenderType; -import java.util.List; +import java.util.ArrayList; public class AdventurersGuildCommand extends AdvancedCommand { public AdventurersGuildCommand() { - super(List.of("adventurersguild", "ag")); + super(new ArrayList<>()); setUsage("/em adventurersguild"); setPermission("elitemobs.adventurersguild.command"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 97d1734f0..eea0afcea 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -69,7 +69,7 @@ public static void registerCommands() { emCommand.registerCommand(new DiscordCommand()); //User commands - emCommand.registerCommand(new AdventurersGuildCommand()); +// emCommand.registerCommand(new AdventurersGuildCommand()); emCommand.registerCommand(new ShareItemCommand()); emCommand.registerCommand(new ShopDynamicCommand()); emCommand.registerCommand(new ShopCustomCommand()); 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 a2baef37f..b3fee7974 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.magmacore.util.ChatColorConverter; @@ -221,7 +220,7 @@ 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.YELLOW_STAINED_GLASS_PANE; diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index 3cc651db0..6972a4ecf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -76,6 +76,8 @@ public class DefaultConfig extends ConfigurationFile { private static String bossAlreadyGoneMessage; @Getter private static boolean resetPlayerScaleOnLogin; + @Getter + private static boolean forceMenuUnicode; public DefaultConfig() { super("config.yml"); @@ -202,6 +204,6 @@ public void initializeValues() { 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); 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); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index a05612a0f..3a0b9fcdd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -98,6 +98,16 @@ public static String parseParticle(String potionEffectName) { 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; } 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 01ba3e076..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.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.Logger; -import lombok.Getter; -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -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 extends ConfigurationFile { - - @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; - public static ResourcePackDataConfig instance; - - public ResourcePackDataConfig() { - super("resource_pack_config.yml"); - instance = this; - } - - 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) { - Logger.warn("[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) { - Logger.warn("[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) { - instance.fileConfiguration.set("eliteMobsResourcePackEnabled", status); - ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); - eliteMobsResourcePackEnabled = status; - displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; - if (status) { - updateSHA1(); - Bukkit.getOnlinePlayers().forEach(ResourcePackDataConfig::sendResourcePack); - } - } - - public static void toggleForceResourcePack(boolean status) { - instance.fileConfiguration.set("forceResourcePack", status); - forceResourcePack = status; - } - - public static void sendResourcePack(Player player) { - player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); - } - - @Override - public void initializeValues() { - 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; - } - - 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/dungeonpackager/premade/PirateShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java index f9aaa7e5e..18a471e88 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 @@ -17,7 +17,7 @@ public PirateShipMinidungeon() { "&6Credits: MagmaGuy & Realm of Lotheridon"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, - "em_pirate_ship", + "em_the_pirate_ship", World.Environment.NORMAL, true, "em_the_pirate_ship,-85,63,243.5,-150,0", diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java index ac94fb56b..44544f352 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ArenaMenu.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.menus; 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; @@ -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/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index d9a77bd98..67d3dfef0 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.menus; +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; @@ -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); 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 e160d12ec..e8b703fac 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -3,7 +3,6 @@ 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.magmacore.util.ItemStackGenerator; @@ -55,7 +54,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 +63,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); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index ee4246745..55c881ab7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -5,7 +5,6 @@ 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; @@ -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 3e59aec15..653e6e536 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -3,7 +3,6 @@ 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; @@ -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/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index b6b0c1099..16c47a94c 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -3,7 +3,6 @@ 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; @@ -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); 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 fe43e4b3e..51655d24e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -43,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); } 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 64bdee8e1..dea4169e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -407,7 +407,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 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 edae9f180..f3a352a97 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java @@ -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/resources/plugin.yml b/src/main/resources/plugin.yml index 84686f0dd..d53051303 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.0-SNAPSHOT +version: 9.1.0 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 719d98db95ead9dc8737a905fe5521477ceb8f20 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 4 Aug 2024 02:47:44 +0100 Subject: [PATCH 45/78] EliteMobs 9.1.1: - [New] Redid all permissions - [New] Readded /em adventurersguild as an alternative for /ag - [Fix] Fixed error related to repairing items - [Fix] Fixed quest turn in not working in book menus - [Tweak] Removed sticks being worn as helmets by the wood league arena bosses Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../PreventPathfindingExploit.java | 3 + .../commands/AdventurersGuildArgCommand.java | 22 ++ .../elitemobs/commands/AltCommand.java | 1 + .../elitemobs/commands/ArenaCommand.java | 2 +- .../elitemobs/commands/CommandHandler.java | 2 + .../elitemobs/commands/DismissCommand.java | 1 + .../commands/DungeonTeleportCommand.java | 2 +- .../elitemobs/commands/EliteMobsCommand.java | 1 + .../elitemobs/commands/KillCommand.java | 2 +- .../elitemobs/commands/KillRadiusCommand.java | 2 +- .../elitemobs/commands/KillTypeCommand.java | 2 +- .../commands/KillTypeRadiusCommand.java | 2 +- .../elitemobs/commands/LootGiveCommand.java | 2 +- .../elitemobs/commands/LootMenuCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 2 +- .../commands/LootSimulateCommand.java | 2 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../commands/MoneyAddAllCommand.java | 2 +- .../elitemobs/commands/MoneyAddCommand.java | 2 +- .../commands/MoneyCheckPlayerCommand.java | 2 +- .../commands/MoneyRemoveCommand.java | 2 +- .../elitemobs/commands/MoneySetCommand.java | 2 +- .../elitemobs/commands/PayCommand.java | 1 + .../elitemobs/commands/PlaceBossCommand.java | 2 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 2 +- .../commands/QuestAcceptCommand.java | 2 +- .../commands/QuestCompleteCommand.java | 2 +- .../commands/QuestCompleteQuestCommand.java | 26 ++ .../elitemobs/commands/QuestResetCommand.java | 2 +- .../elitemobs/commands/QuestTrackCommand.java | 2 +- .../elitemobs/commands/RespawnAllCommand.java | 2 +- .../elitemobs/commands/SetupCommand.java | 2 +- .../elitemobs/commands/SetupDoneCommand.java | 2 +- .../commands/SetupToggleCommand.java | 2 +- .../commands/ShopCustomOtherCommand.java | 2 +- .../commands/ShopDynamicCommand.java | 2 +- .../commands/ShopSellOtherCommand.java | 2 +- .../commands/SpawnBossAtCommand.java | 2 +- .../elitemobs/commands/SpawnBossCommand.java | 2 +- .../commands/SpawnBossLevelAtCommand.java | 2 +- .../commands/SpawnBossLevelCommand.java | 2 +- .../elitemobs/commands/SpawnElite.java | 2 +- .../commands/SpawnEliteAtCommand.java | 2 +- .../commands/SpawnTeleportCommand.java | 2 +- .../elitemobs/commands/StartCommand.java | 1 + .../elitemobs/commands/StatsCommand.java | 2 +- .../elitemobs/commands/TrackBossCommand.java | 1 + .../TransitiveBlocksCancelCommand.java | 2 +- .../TransitiveBlocksEditAreaCommand.java | 2 +- .../commands/TransitiveBlocksEditCommand.java | 2 +- .../TransitiveBlocksRegisterAreaCommand.java | 2 +- .../TransitiveBlocksRegisterCommand.java | 2 +- .../config/AdventurersGuildConfig.java | 2 +- .../premade/WoodLeagueWave10Boss.java | 4 +- .../WoodLeagueWave10Reinforcement.java | 4 +- .../premade/WoodLeagueWave11Melee.java | 4 +- .../premade/WoodLeagueWave11Ranged.java | 2 +- .../premade/WoodLeagueWave12Melee.java | 4 +- .../premade/WoodLeagueWave12Ranged.java | 2 +- .../premade/WoodLeagueWave13Melee.java | 4 +- .../premade/WoodLeagueWave13Ranged.java | 2 +- .../premade/WoodLeagueWave14Melee.java | 4 +- .../premade/WoodLeagueWave14Ranged.java | 2 +- .../premade/WoodLeagueWave15Miniboss.java | 4 +- .../premade/WoodLeagueWave16Melee.java | 4 +- .../premade/WoodLeagueWave16Ranged.java | 2 +- .../premade/WoodLeagueWave17Melee.java | 4 +- .../premade/WoodLeagueWave17Ranged.java | 2 +- .../premade/WoodLeagueWave18Melee.java | 2 +- .../premade/WoodLeagueWave19Ranged.java | 2 +- .../premade/WoodLeagueWave1Melee.java | 4 +- .../premade/WoodLeagueWave1Ranged.java | 2 +- .../premade/WoodLeagueWave2Melee.java | 4 +- .../premade/WoodLeagueWave2Ranged.java | 2 +- .../premade/WoodLeagueWave3Melee.java | 4 +- .../premade/WoodLeagueWave4Melee.java | 4 +- .../premade/WoodLeagueWave4Ranged.java | 2 +- .../premade/WoodLeagueWave5Miniboss.java | 4 +- .../premade/WoodLeagueWave6Melee.java | 4 +- .../premade/WoodLeagueWave6Ranged.java | 2 +- .../premade/WoodLeagueWave7Melee.java | 4 +- .../premade/WoodLeagueWave7Ranged.java | 2 +- .../premade/WoodLeagueWave8Melee.java | 4 +- .../premade/WoodLeagueWave9Ranged.java | 2 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 2 +- src/main/resources/plugin.yml | 358 ++++++------------ 88 files changed, 251 insertions(+), 354 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java diff --git a/build.gradle b/build.gradle index 4051736de..916d080a4 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.0' +version '9.1.1' repositories { maven { 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..6380c0f63 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,7 @@ import com.magmaguy.easyminecraftgoals.NMSManager; import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent; +import org.bukkit.entity.Mob; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -11,6 +12,8 @@ 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; event.getEliteMobEntity().incrementAntiExploit(5, "no path to player"); 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/AltCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java index b78d4e5bf..4a6f18b00 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -14,6 +14,7 @@ public AltCommand() { super(List.of("alt")); setUsage("/em alt"); setDescription("Changes the style of the /em menu."); + setPermission("elitemobs.alt"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index c66063126..9c97bb5ab 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -13,7 +13,7 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setPermission("elitemobs.event.start"); + setPermission("elitemobs.arena.start"); setDescription("Open the Arena menu."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index eea0afcea..5f907c5d4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -55,6 +55,7 @@ public static void registerCommands() { 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()); @@ -92,6 +93,7 @@ public static void registerCommands() { emCommand.registerCommand(new DungeonTeleportCommand()); emCommand.registerCommand(new TrackBossCommand()); emCommand.registerCommand(new PayCommand()); + emCommand.registerCommand(new AdventurersGuildArgCommand()); emCommand.registerCommand(new EliteMobsCommand()); emCommand.registerCommand(new HelpCommand()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java index 500607785..bb1b02fd4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -12,6 +12,7 @@ public DismissCommand() { super(List.of("dismiss")); setDescription("Dismisses /em menu message."); setUsage("/em dismiss"); + setPermission("elitemobs.dismiss"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index f0fb2b029..5c71e0f63 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -11,7 +11,7 @@ public class DungeonTeleportCommand extends AdvancedCommand { public DungeonTeleportCommand() { super(List.of("dungeontp")); addArgument("dungeonID", new ArrayList<>()); - setPermission("elitemobs.dungeontp"); + setPermission("elitemobs.dungeon.tp"); setDescription("Teleports players to Lairs, Minidungeons and Dungeons."); setUsage("/em dungeontp "); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java index 82b5e1e2a..c41a1a6b2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -13,6 +13,7 @@ public EliteMobsCommand() { super(new ArrayList<>()); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); + setPermission("elitemobs.command"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index ca0f27243..70c740edd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -10,7 +10,7 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.kill.kill"); + setPermission("elitemobs.kill.command"); setDescription("Kills all elites."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java index d4e84cd57..978c494a7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -13,7 +13,7 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.kill.radius"); + setPermission("elitemobs.kill.command"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java index 6cec36a67..03b0ffdc6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -14,7 +14,7 @@ public KillTypeCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); setUsage("/em kill type "); - setPermission("elitemobs.kill.type"); + setPermission("elitemobs.kill.command"); setDescription("Kills all elites of the specified type."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java index a76c7b2d9..33cd0d2e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -16,7 +16,7 @@ public KillTypeRadiusCommand() { addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); setUsage("/em kill type "); - setPermission("elitemobs.kill.type.radius"); + setPermission("elitemobs.kill.command"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type within the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 0014a9663..5938e9cfb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -15,7 +15,7 @@ public LootGiveCommand() { addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); - setPermission("elitemobs.loot.give"); + setPermission("elitemobs.loot.admin"); setDescription("Gives the specified loot to a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java index 28b92ffa8..9126a677b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -12,7 +12,7 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.loot.menu"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 7ae31801d..60c979976 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -15,7 +15,7 @@ public LootRandomCommand() { addArgument("level", new ArrayList<>()); addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot random "); - setPermission("elitemobs.loot.random"); + setPermission("elitemobs.loot.admin"); setDescription("Gives the player random loot of the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 5284dc1e6..9dbd97527 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -16,7 +16,7 @@ public LootSimulateCommand() { addArgument("level", new ArrayList<>()); addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.simulate"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index cf7eba055..a38e117cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -17,7 +17,7 @@ public LootSimulateMultipleCommand() { addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.simulate.times"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index d751e4547..176e7f042 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -12,7 +12,7 @@ public MoneyAddAllCommand() { addLiteral("addAll"); addArgument("amount", new ArrayList<>()); setUsage("/em money addAll "); - setPermission("elitemobs.money.add.all"); + setPermission("elitemobs.money.admin"); setDescription("Gives every player on the server the specified amount of money."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 31d4d871c..e7089faa2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -14,7 +14,7 @@ public MoneyAddCommand() { addArgument("player", new ArrayList<>()); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); - setPermission("elitemobs.money.add.player"); + setPermission("elitemobs.money.admin"); setDescription("Gives the specified amount of money to the designated player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 62bb4caff..a73f8def9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -12,7 +12,7 @@ public MoneyCheckPlayerCommand() { addLiteral("check"); addArgument("player", new ArrayList<>()); setUsage("/em money check "); - setPermission("elitemobs.money.check.player"); + setPermission("elitemobs.money.check.others"); setDescription("Checks the currency of the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index a2d17c061..3bb188cd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -14,7 +14,7 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.money.remove"); + setPermission("elitemobs.money.admin"); setDescription("Deducts the specified amount of currency from a player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java index 9de1d06e0..5a1c9802d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -14,7 +14,7 @@ public MoneySetCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money set "); - setPermission("elitemobs.money.set"); + setPermission("elitemobs.money.admin"); setDescription("Sets the specified amount of currency for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java index 3a7961030..fdd48e0a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -14,6 +14,7 @@ public PayCommand() { addArgument("amount", new ArrayList<>()); setDescription("Send money to a player, minus tax."); setUsage("/em pay "); + setPermission("elitemobs.money.pay"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index 9e6093dec..2a65ae715 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -20,7 +20,7 @@ public PlaceBossCommand() { regionalBosses.add(entry.getKey()); addArgument("filename", regionalBosses); setUsage("/em place boss "); - setPermission("elitemobs.place.boss"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Add a spawn location for the specified boss at your current location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index fb1b012ca..b47ae3621 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -14,7 +14,7 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.place.treasure"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds a treasure chest to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 261fa79d9..04cb8aa06 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -17,7 +17,7 @@ public PlaceWormholeCommand() { addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); setUsage("/em place wormhole <1/2>"); - setPermission("elitemobs.place.wormhole"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Place a wormhole teleport at your current location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index 29a552ad2..e5526ea69 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -14,7 +14,7 @@ public QuestAcceptCommand() { addLiteral("accept"); addArgument("questID", new ArrayList<>()); setUsage("/em quest accept "); - setPermission("elitemobs.quest.command"); + setPermission("elitemobs.quest.accept"); setSenderType(SenderType.PLAYER); setDescription("Accepts a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java index 63831dcdc..232fb266a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -12,7 +12,7 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.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."); } 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/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java index 46d9e5586..f57951bbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -16,7 +16,7 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.quest.reset.quest"); + setPermission("elitemobs.quest.reset"); setDescription("Resets a specific quest for a specific player."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java index 8629cc3a6..207a34243 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -14,7 +14,7 @@ public QuestTrackCommand() { addLiteral("track"); addArgument("questID", new ArrayList<>()); setUsage("/em quest track "); - setPermission("elitemobs.quest.command"); + setPermission("elitemobs.quest.track"); setSenderType(SenderType.PLAYER); setDescription("Tracks a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index 0d344b743..63766ad2d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -11,7 +11,7 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.respawn"); + setPermission("elitemobs.respawn.force"); setDescription("Forces all regional bosses to respawn."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index a7a604090..743545e32 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -10,7 +10,7 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.setup.main"); + setPermission("elitemobs.setup"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index 7222579ec..c94084e30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -12,7 +12,7 @@ public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); setUsage("/em setup done"); - setPermission("elitemobs.setup.done"); + setPermission("elitemobs.setup"); setDescription("Toggles whether the setup message will show up."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index f523de7d8..89082a29f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -14,7 +14,7 @@ public SetupToggleCommand() { addLiteral("toggle"); addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); setUsage("/em setup toggle "); - setPermission("elitemobs.setup.toggle"); + setPermission("elitemobs.setup"); setDescription("Allows you to toggle the installation of specified EliteMobs content."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 2d5d0bd9b..2d005cc46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -15,7 +15,7 @@ public ShopCustomOtherCommand() { addLiteral("custom"); addArgument("player", new ArrayList<>()); setUsage("/em shop custom "); - setPermission("elitemobs.shop.custom.player"); + setPermission("elitemobs.shop.custom.other"); setDescription("Opens the EliteMobs shop for custom items for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java index b6e84d237..a4c047071 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -13,7 +13,7 @@ public ShopDynamicCommand() { super(List.of("shop")); addLiteral("dynamic"); setUsage("/em shop dynamic"); - setPermission("elitemobs.shop.command"); + setPermission("elitemobs.shop.dynamic"); setSenderType(SenderType.PLAYER); setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java index eed677e82..f4af0c02d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -15,7 +15,7 @@ public ShopSellOtherCommand() { addLiteral("sell"); addArgument("player", new ArrayList<>()); setUsage("/em shop sell "); - setPermission("elitemobs.shop.sell.player"); + setPermission("elitemobs.shop.sell.other"); setDescription("Opens the EliteMobs shop sell menu for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java index b183dc2fa..8f2871d95 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -21,7 +21,7 @@ public SpawnBossAtCommand() { addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); setUsage("/em spawn bossAt "); - setPermission("elitemobs.spawn.boss.at"); + setPermission("elitemobs.place.admin"); setDescription("Spawns a custom boss at the specified location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index 2d0560276..2deb74068 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -14,7 +14,7 @@ public SpawnBossCommand() { addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em spawn boss "); - setPermission("elitemobs.spawn.boss"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index 8d6955a6e..1fe0eecfc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -22,7 +22,7 @@ public SpawnBossLevelAtCommand() { addArgument("z", new ArrayList<>()); addArgument("level", new ArrayList<>()); setUsage("/em spawn bossAt "); - setPermission("elitemobs.spawn.boss.at.level"); + setPermission("elitemobs.place.admin"); setDescription("Spawns a custom boss at the specified location with the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3d06e9055..3ccbe9497 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -15,7 +15,7 @@ public SpawnBossLevelCommand() { 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.spawn.boss.level"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 8346397de..4823c0c5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -18,7 +18,7 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java index bcf53598e..502bb1811 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -23,7 +23,7 @@ public SpawnEliteAtCommand() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn eliteAt <...>"); - setPermission("elitemobs.spawn.elite.at"); + 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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java index 514a88788..d0e40f1d6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -11,7 +11,7 @@ public class SpawnTeleportCommand extends AdvancedCommand { public SpawnTeleportCommand() { super(List.of("spawntp")); - setPermission("elitemobs.spawntp"); + setPermission("elitemobs.teleport.spawn"); setUsage("/em spawntp"); setDescription("Teleports players to the server spawn."); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java index c99e1152a..35f3162fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -14,6 +14,7 @@ public StartCommand() { setUsage("/em start"); setDescription("When in instanced content, makes the player start the instance."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.instance.start"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java index 27c1d144e..db5660270 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -10,7 +10,7 @@ public class StatsCommand extends AdvancedCommand { public StatsCommand() { super(List.of("stats")); setUsage("/em stats"); - setPermission("elitemobs.*"); + setPermission("elitemobs.stats"); setSenderType(SenderType.PLAYER); setDescription("Displays EliteMobs server stats."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java index 832f2fecc..02a58b06b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -19,6 +19,7 @@ public TrackBossCommand() { setDescription("Tracks a Custom Boss."); setUsage("/em track boss "); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.boss.track"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 8673dfaeb..5a321f703 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -12,9 +12,9 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.transitiveblocks.cancel"); setDescription("Cancels transitive block registration."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java index 2c4d4acd6..d1a14a2b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -15,7 +15,7 @@ public TransitiveBlocksEditAreaCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks editArea "); - setPermission("elitemobs.transitiveblocks.edit.area"); + setPermission("elitemobs.transitiveblocks"); setDescription("Edits large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java index a7274abe6..db6a54c7f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksEditCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks edit "); - setPermission("elitemobs.transitiveblocks.edit.edit"); setDescription("Edits transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java index b869df481..c68cb1115 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksRegisterAreaCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks registerArea "); - setPermission("elitemobs.transitiveblocks.register.area"); setDescription("Registers large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java index 4af68f83f..22504ebed 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksRegisterCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks register "); - setPermission("elitemobs.transitiveblocks.register.register"); setDescription("Registers transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index 96882a5f4..ad1be7cba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -476,7 +476,7 @@ public void initializeValues() { 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); - additionalKillsForRankUpPerTier = ConfigurationEngine.setInt( + baseKillsForRankUp = 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); 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..d8f89e774 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,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; import java.util.Arrays; @@ -15,7 +13,7 @@ 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")); setMovementSpeedAttribute(0.6D); 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..30ea74915 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave11Melee() { "11"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..a99afc165 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 @@ -15,7 +15,7 @@ public WoodLeagueWave11Ranged() { "$normalLevel Arena Crossbowman", "11"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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..200adbb63 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave12Melee() { "12"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..a0ce3c216 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 @@ -15,7 +15,7 @@ public WoodLeagueWave12Ranged() { "$normalLevel Arena Crossbowman", "12"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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..059605609 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,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; import java.util.Arrays; @@ -16,6 +14,6 @@ public WoodLeagueWave13Melee() { "13"); setFollowDistance(60); setPowers(Arrays.asList("corpse.yml", "attack_poison.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..1a0b09714 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 @@ -15,7 +15,7 @@ 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")); } 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..160b4208c 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave14Melee() { "14"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..4acb7ecbf 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 @@ -15,7 +15,7 @@ public WoodLeagueWave14Ranged() { "$normalLevel Arena Crossbowman", "14"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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 36f73b115..8669484e2 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,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; import java.util.Arrays; import java.util.List; @@ -16,7 +14,7 @@ public WoodLeagueWave15Miniboss() { "$bossLevel &4Mr. Oinkers", "15"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml")); setMovementSpeedAttribute(0.6D); setHealthMultiplier(3D); 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..0abbdd6c2 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,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; import java.util.List; @@ -16,7 +14,7 @@ public WoodLeagueWave16Melee() { "16"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + 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..f06942cac 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 @@ -15,7 +15,7 @@ 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")); setDamageMultiplier(0.5D); 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..ec65d5e09 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,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; import java.util.Arrays; @@ -16,6 +14,6 @@ public WoodLeagueWave17Melee() { "17"); setFollowDistance(60); setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..652f7de39 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 @@ -15,7 +15,7 @@ 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")); } 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..cbadbb2dc 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 @@ -16,7 +16,7 @@ public WoodLeagueWave18Melee() { "18"); setFollowDistance(60); setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); - setHelmet(new ItemStack(Material.STICK)); + 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..73b21f52c 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 @@ -15,7 +15,7 @@ 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")); } 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/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/WoodLeagueWave3Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave3Melee.java index 0eba16db7..e1d251a87 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave3Melee() { "3"); setPowers(List.of("attack_fire.yml")); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + } } 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/WoodLeagueWave5Miniboss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave5Miniboss.java index 8cb3d863e..673843916 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,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; import java.util.Arrays; import java.util.List; @@ -21,6 +19,6 @@ public WoodLeagueWave5Miniboss() { 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..137a62dd0 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave7Melee() { "7"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..a70ee1936 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 @@ -15,7 +15,7 @@ public WoodLeagueWave7Ranged() { "$normalLevel Arena Crossbowman", "7"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(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..3148275c3 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,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; import java.util.List; @@ -16,6 +14,6 @@ public WoodLeagueWave8Melee() { "8"); setFollowDistance(60); setPowers(List.of("corpse.yml")); - setHelmet(new ItemStack(Material.STICK)); + } } 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..235add016 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 @@ -15,7 +15,7 @@ public WoodLeagueWave9Ranged() { "$normalLevel Arena Crossbowman", "9"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setMainHand(new ItemStack(Material.CROSSBOW)); setPowers(List.of("attack_vacuum.yml")); } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java index e8b703fac..b84b5c3f8 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -41,7 +41,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); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d53051303..ea46282de 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.0 +version: 9.1.1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -31,300 +31,172 @@ commands: 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 - default: true - elitemobs.shop.npc: - description: Allows players to interact with NPCs for dynamic shops - default: true - elitemobs.shop.command: - description: Allows players to open the dynamic shop menu through commands - default: true - elitemobs.customshop.npc: - description: Allows players to interact with NPCs for dynamic shops - default: true - elitemobs.customshop.command: - description: Allows players to open the dynamic shop menu through commands + elitemobs.adventurersguild.command: + description: Allows players to either teleport to the Adventurer's Guild or open the Adventurer's Guild menu default: true - elitemobs.currency.pay: - description: Allows players to run /elitemobs pay [username] [amount] + elitemobs.alt: + description: Allows players to switch menu styles default: true - elitemobs.currency.check: - description: Allows players to run /elitemobs wallet + elitemobs.arena.start: + description: Allows players to start an arena default: true - elitemobs.currency.check.others: - description: Allows players to run /elitemobs check [username] + elitemobs.debug: + description: Gives access to the debug command default: op - elitemobs.events: - description: Allows players to launch all events + elitemobs.discord.link: + description: Gives the link to EliteMobs' discord server default: true - elitemobs.checktier.others: - description: Allows players to run /elitemobs checktier [player] - default: op - elitemobs.gettier: - description: Allows players to run /elitemobs gettier [tier] + elitemobs.discord.message: + description: Allows sending debug messages to discord via DiscordSRV for testing purposes default: op - elitemobs.versionnotification: - description: Allows players to get notified about plugin updates + elitemobs.dismiss: + description: Allows admins to dismiss the initial setup message default: op - elitemobs.adventurersguild.teleport: - description: Allows players to teleport to the adventurer's guild hub using /ag - default: true - elitemobs.adventurersguild.command: - description: Allows players to rank menu using the /em adventurersguild command - default: true - elitemobs.rank.command: - description: Allows players to open the rank menu through /em rank - default: true - elitemobs.rank.npc: - description: Allows players to access the /em rank menu through NPCs - default: true - elitemobs.quest.command: - description: Allows players to take on quests via command - default: true - elitemobs.quest.npc: - description: Allows players to take on quests via EliteMobs NPC - default: true - elitemobs.dungeontp: - description: Allows players to teleport to an elitemobs-set location - default: true - elitemobs.spawntp: - description: Allows players to teleport to the default spawn location of the server. - default: true - elitemobs.back.npc: - description: Allows players to interact with an npc to go back to a previous location. - default: true - elitemobs.shareitem: - description: Shares a held Elite Item on chat. - default: true - elitemobs.scrap.npc: - description: Allows players to scrap items at an npc + elitemobs.dungeon.tp: + description: Allows players to teleport to a dungeon default: true - elitemobs.scrap.command: - description: Allows players to scrap items using a command - default: true - elitemobs.smelt.command: - description: Allows players to smelt items using a command - default: true - elitemobs.smelt.npc: - description: Allows players to smelt items using an npc - default: true - elitemobs.repair.command: - description: Allows players to use the repair command to open the menu for repairing elite items - default: true - elitemobs.repair.npc: - description: Allows players to interact with the NPC for repairing items - default: true - elitemobs.refiner.command: - description: Allows players to use the refiner command to open the menu for upgrading Elite Scrap - default: true - elitemobs.refiner.npc: - description: Allows players to interact with the NPC for upgrading Elite Scrap - default: true - elitemobs.enhancer.command: - description: Allows players to use the enhancer command to open the menu for upgrading Elite Items - default: true - elitemobs.enhancer.npc: - description: Allows players to interact with the NPC for upgrading Elite Items - default: true - elitemobs.unbind.command: - description: Allows players to use the unbind command to open the menu to unbind Elite Items - 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 - elitemobs.enchant.npc: - description: Allows players to interact with the enchanter NPC to enchant Elite Items + elitemobs.command: + description: Allows players to use the main command of the plugin default: true elitemobs.enchant.command: - description: Allows players to use the enchant command to enchant Elite Items - default: true - elitemobs.arena.menu: - description: Allows players to open the Arena menu and join an Arena. - default: true - elitemobs.debug: - description: Allows players to have access to the player/bosses debug command. - default: true - elitemobs.discord.link: - description: Allows players to have access to the Discord link command. + description: Allows players to use the enchant command default: true - elitemobs.discord.message: - description: Allows players to have access to the DiscordSRV message debug command. - default: op elitemobs.event.start: - description: Allows players to start specific events. + description: Allows admins to manually launch an event default: op elitemobs.fireball: - description: Allows players to shoot a fireball at the pointer's location. + description: Allows admins to fire an elite fireball for terrain destruction testing purposes default: op elitemobs.help: - description: Allows players to see all available EliteMobs commands. - default: op - elitemobs.kill.kill: - description: Allows players to kill all elites. - default: op - elitemobs.kill.radius: - description: Allows players to kill all elites in the specified radius. - default: op - elitemobs.kill.type: - description: Allows players to kill all elites of the specified type. - default: op - elitemobs.kill.type.radius: - description: Allows players to kill all elites of the specified type within the given radius. + description: Allows players to run the help command + default: true + elitemobs.kill.command: + description: Allows admins to run the kill commands to kill elites default: op elitemobs.language: - description: Allows players to set the language that the server will use for EliteMobs. + 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.loot.debug: - description: Allows players to equip themselves with a complete armor set, weapons set of the specified level, and food for testing purposes. - default: op - elitemobs.loot.give: - description: Allows players to give the specified loot to a specific player. - default: op - elitemobs.loot.menu: - description: Allows players to open the loot menu and select any loot they want. + description: Gives admins a set of gear of a specific level for testing purposes default: op - elitemobs.loot.random: - description: Allows players to get random loot of the specified level. - default: op - elitemobs.loot.simulate: - description: Allows players to get simulated loot drops for the specified level and player. - default: op - elitemobs.loot.simulate.times: - description: Allows players to get simulated loot drops for a specified number of times for the given level and player. + elitemobs.loot.admin: + description: Lets admins give or obtain EliteMobs loot via command default: op elitemobs.loot.stats: - description: Allows players to see EliteMobs stats for the currently held item. - default: true - elitemobs.loot.stats: - description: Allows players to see EliteMobs stats for the currently held item. - default: op - elitemobs.money.add.all: - description: Allows players to give every player on the server the specified amount of money. + description: Gives the elite stats of gear, for debugging purposes default: op - elitemobs.money.add.player: - description: Allows players to give the specified amount of money to the designated player. + elitemobs.money.admin: + description: Allows admins to manually manipulate player elite currency default: op elitemobs.money.check.self: - description: Allows players to check their EliteMobs currency. + description: Allows users to check their balance default: true - elitemobs.money.check.player: - description: Allows players to check the currency of the specified player. - default: op - elitemobs.money.remove: - description: Allows players to deduct the specified amount of currency from a player. - default: op - elitemobs.money.set: - description: Allows players to set the specified amount of currency for the specified player. - default: op - elitemobs.package: - description: Allows players to package an EliteMobs dungeon for distribution. - default: op - elitemobs.place.boss: - description: Allows players to add a spawn location for the specified boss at their current location. + elitemobs.money.check.others: + description: Allows users to check their balance default: op - elitemobs.place.npc: - description: Allows players to permanently add an NPC to the location the user is standing on. + elitemobs.dungeon.package: + description: Allows admins to package EliteMobs content for distribution default: op - elitemobs.place.treasure: - description: Allows players to permanently add a treasure chest to the location the user is standing on. - default: op - elitemobs.place.wormhole: - description: Allows players to permanently add a wormhole teleport at their current location. + elitemobs.money.pay: + description: Allows users to check their balance + default: true + 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.quest.bypass: - description: Allows players to bypass permission restrictions for elite quests. + description: Allows users to accept a quest default: op - elitemobs.quest.complete: - description: Allows players to force complete all of their currently active elite quests. For debugging use only. + 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 players to leave a quest. Used via menu, can't be directly used. - default: op + description: Allows users to leave a quest + default: true elitemobs.quest.reset.all: - description: Allows players to reset all quests for a specific player. + description: Allows admins to reset all quests for a specific player default: op - elitemobs.quest.reset.quest: - description: Allows players to reset a specific quest for a specific player. + 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.quit: + description: Allows players to quit instanced content + default: true + elitemobs.rank.command: + description: Allows players to join open the rank menu of EliteMobs + default: true elitemobs.rank.set: - description: Allows players to manually set a player's guild rank to a the prestige level and guild level specified. + description: Allows admins to set a specific EliteMobs rank for a specific player default: op elitemobs.reload: - description: Allows players to reload EliteMobs. + description: Allows admins to reload EliteMobs default: op elitemobs.remove: - description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. + description: Allows admins to use the remove command default: op - elitemobs.respawn: - description: Allows players to force respawn all regional bosses. - default: op - elitemobs.setup.main: - description: Allows players to have access to the main command for setting up EliteMobs. - default: op - elitemobs.setup.done: - description: Allows players to toggle whether the setup message will show up in the server chat. + 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.setup.toggle: - description: Allows players to toggle the installation of specified EliteMobs content. + 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: Allows players to use the share item command + default: true elitemobs.shop.custom: - description: Allows players to open the EliteMobs shop for custom items for the specified player. - default: op - elitemobs.shop.sell.player: - description: Allows players to open the EliteMobs shop for custom items for the specified player. - default: op - elitemobs.spawn.boss.at: - description: Allows players to spawn a custom boss at the specified location. - default: op - elitemobs.spawn.boss: - description: Allows players to spawn a custom boss at the location the player is looking at. - default: op - elitemobs.spawn.boss.at.level: - description: Allows players to spawn a custom boss at the specified location with the specified level. - default: op - elitemobs.spawn.boss.level: - description: Allows players to spawn a custom boss at the location the user is looking at with the specified level. - default: op - elitemobs.spawn.elite: - description: Allows players to spawn an elite of a specified type and level, optionally with specific powers, at the targeted location. - default: op - elitemobs.spawn.elite.at: - description: Allows players to spawn an elite of the specified type and level, optionally with specified powers, at the chosen location. - default: op - elitemobs.transitiveblocks.cancel: - description: Allows players to cancel transitive block registration. + description: Allows players to use custom shop command + default: true + elitemobs.shop.custom.other: + description: Allows admins to open the custom shop for other people default: op - elitemobs.transitiveblocks.edit.area: - description: Allows players to edit large transitive blocks areas for use by regional bosses. + elitemobs.shop.dynamic: + description: Allows players to use dynamic shop command + default: true + elitemobs.shop.dynamic.other: + description: Allows admins to open the dynamic shop for other people default: op - elitemobs.transitiveblocks.edit.edit: - description: Allows players to edit transitive blocks for use by regional bosses. + elitemobs.shop.sell.other: + description: Allows admins to open the sell shop for other people default: op - elitemobs.transitiveblocks.register.area: - description: Allows players to register large transitive blocks areas for use by regional bosses. + elitemobs.teleport.spawn: + description: Allows players to use the spawn teleport command + default: true + elitemobs.instance.start: + description: Allows players to use the start command in instances + default: true + elitemobs.stats: + description: Allows admins to get stats related to EliteMobs default: op - elitemobs.transitiveblocks.register.register: - description: Allows players to register transitive blocks for use by regional bosses. + elitemobs.boss.track: + description: Allows players to track trackable bosses + default: true + 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.unbind.force: - description: Allows players to forcefully unbind a held item. + description: Allows admins to force unbind a held item via command default: op elitemobs.version: - description: Allows players to check the server's EliteMobs plugin version. - default: op + description: Allows admins to check the plugin version of EliteMobs + default: op \ No newline at end of file From 943eb507985c991496ff14e5b7790a3de3f9b6a5 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 4 Aug 2024 22:36:03 +0100 Subject: [PATCH 46/78] EliteMobs 9.1.2: - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../elitemobs/dungeons/DungeonProtector.java | 14 +++ .../instanced/dungeons/DungeonInstance.java | 107 +++++++++++++----- .../elitemobs/npcs/NPCInteractions.java | 6 +- .../powers/meta/CustomSummonPower.java | 10 +- src/main/resources/plugin.yml | 39 ++++++- 6 files changed, 140 insertions(+), 38 deletions(-) diff --git a/build.gradle b/build.gradle index 916d080a4..5edfba4a0 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.1' +version '9.1.2' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 8a6e469be..950e208b0 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,6 +1,7 @@ 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; @@ -10,6 +11,9 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import java.util.Locale; public class DungeonProtector implements Listener { @@ -64,6 +68,7 @@ public void preventTntPrimeEvent(TNTPrimeEvent event) { @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); } @@ -113,5 +118,14 @@ public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { event.setCancelled(true); } + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventVanillaMobSpawning(PlayerInteractEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getPlayer().getWorld().getUID())) return; + if (event.getClickedBlock() == null) return; + Material material = event.getClickedBlock().getType(); + if (material.toString().toLowerCase(Locale.ROOT).endsWith("_door") || + material.toString().toLowerCase(Locale.ROOT).endsWith("_trapdoor")) + event.setCancelled(true); + } } 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 2c0007530..93d9e344c 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -72,14 +72,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, 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); - TreasureChest.initializeInstancedTreasureChests(dungeonPackagerConfigFields.getWorldName(), world); - } - }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); + new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -108,7 +101,7 @@ public static void setupInstancedDungeon(Player player, String instancedDungeonC new BukkitRunnable() { @Override public void run() { - initializeInstancedWorld(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); } }.runTask(MetadataHandler.PLUGIN); }); @@ -146,8 +139,6 @@ protected static DungeonInstance initializeInstancedWorld(DungeonPackagerConfigF 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()); @@ -206,14 +197,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 @@ -236,10 +220,6 @@ public void removeInstance() { 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); @@ -247,13 +227,7 @@ public void run() { Logger.warn("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 - //} + new RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } @@ -295,4 +269,77 @@ 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() { + WorldInstantiator.recursivelyDelete(instancedWorldFile); + } + }.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20L * 60 * 2); //wait 2 minutes after unloading world before removing files + } + } } diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java index e1e2756cf..e9723135c 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCInteractions.java @@ -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() { 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 90a4126bc..dcd160317 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/meta/CustomSummonPower.java @@ -425,12 +425,20 @@ private void processOldFormats(String powerString, String 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]; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ea46282de..16389f548 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.1 +version: 9.1.2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -33,7 +33,10 @@ permissions: description: Gives access to all elitemobs commands default: op elitemobs.adventurersguild.command: - description: Allows players to either teleport to the Adventurer's Guild or open the Adventurer's Guild menu + 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 @@ -131,6 +134,9 @@ permissions: elitemobs.quest.track: description: Allows players to track the objectives of a quest default: true + elitemobs.quest.npc: + description: Allows players to talk to quest npcs + default: true elitemobs.quit: description: Allows players to quit instanced content default: true @@ -199,4 +205,31 @@ permissions: default: op elitemobs.version: description: Allows admins to check the plugin version of EliteMobs - default: op \ No newline at end of file + default: op + elitemobs.rank.npc: + description: Allows players to talk to the rank npc + default: true + elitemobs.shop.dynamic.npc: + description: Allows players to talk to the dynamic shop npc + default: true + elitemobs.shop.custom.npc: + description: Allows players to talk to the custom shop npc + default: true + elitemobs.shop.sell.npc: + description: Allows players to talk to the sell shop npc + default: true + 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 talk to the unbind npc + default: true + elitemobs.enchant.npc: + description: Allows players to talk to the enchant npc + default: true \ No newline at end of file From 5e46588a6a4608c9eabeeafbc7026b21a16f4db4 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 8 Aug 2024 11:35:48 +0100 Subject: [PATCH 47/78] EliteMobs 9.1.3: - [New] Added the Dark Cathedral remake! - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [New] Added the scale setting to NPCs to allow for NPC scaling - [Fix] Fixed problem that was causing dungeon instantiation to not delete correctly and the recovery code on startup to not clear instanced dungeons on startup - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers - [Fix] Slimes and similar entities no longer constantly trigger the antiexploit - [Fix] Fixed the /em quest reset all by renaming it to /em quest resetAll Signed-off-by: MagmaGuy --- build.gradle | 4 +-- .../api/EliteMobDamagedByPlayerEvent.java | 2 ++ .../elitemobs/api/EliteMobDamagedEvent.java | 3 ++ .../PreventPathfindingExploit.java | 2 ++ .../elitemobs/commands/CommandHandler.java | 1 + .../commands/QuestResetAllCommand.java | 5 ++- ...thedralLair.off => DarkCathedralLair.java} | 23 +++++-------- .../config/npcs/NPCsConfigFields.java | 4 +++ .../WorldInstancedDungeonPackage.java | 16 +++++++++ .../dungeons/utility/DungeonUtils.java | 2 ++ .../instanced/dungeons/DungeonInstance.java | 33 +++++++------------ .../magmaguy/elitemobs/npcs/NPCEntity.java | 2 ++ src/main/resources/plugin.yml | 2 +- 13 files changed, 57 insertions(+), 42 deletions(-) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{DarkCathedralLair.off => DarkCathedralLair.java} (58%) diff --git a/build.gradle b/build.gradle index 5edfba4a0..8c5b4d6e0 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.2' +version '9.1.3' repositories { maven { @@ -50,7 +50,7 @@ repositories { //MagmaCore maven { - url = 'http://magmaguy.com:50001/releases' + url = 'https://repo.magmaguy.com/releases' allowInsecureProtocol = true } diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 8c0359157..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; @@ -255,6 +256,7 @@ 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) return; 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/combatsystem/antiexploit/PreventPathfindingExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java index 6380c0f63..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,7 @@ 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; @@ -16,6 +17,7 @@ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent 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/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 5f907c5d4..482ab6632 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -68,6 +68,7 @@ public static void registerCommands() { emCommand.registerCommand(new SpawnEliteAtCommand()); emCommand.registerCommand(new DiscordMessageCommand()); emCommand.registerCommand(new DiscordCommand()); + emCommand.registerCommand(new MoneyRemoveCommand()); //User commands // emCommand.registerCommand(new AdventurersGuildCommand()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java index 9f4915e63..18b968908 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -10,10 +10,9 @@ public class QuestResetAllCommand extends AdvancedCommand { public QuestResetAllCommand() { super(List.of("quest")); - addLiteral("reset"); - addLiteral("all"); + addLiteral("resetAll"); addArgument("player", new ArrayList<>()); - setUsage("/em quest reset all "); + setUsage("/em quest resetAll "); setPermission("elitemobs.quest.reset.all"); setDescription("Resets all quests for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java similarity index 58% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java index 88dd9a2ff..0b99ab3b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java @@ -2,11 +2,9 @@ import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; 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() { @@ -15,24 +13,21 @@ public DarkCathedralLair() { "&2[lvl 040] &8The Dark Cathedral", Arrays.asList("&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.NORMAL, 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); } } 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 377527794..ecbff418f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java @@ -75,6 +75,9 @@ public class NPCsConfigFields extends CustomConfigFields { @Getter @Setter private boolean instanced = false; + @Getter + @Setter + private double scale = 1; public NPCsConfigFields(String fileName, boolean isEnabled, @@ -143,6 +146,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) { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index c208a1f1c..40e6829f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -4,6 +4,9 @@ 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,19 @@ 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()){ + Logger.debug("world name: " + worldFile.getName()); + Logger.debug("current name: " + file.getName()); + 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/utility/DungeonUtils.java b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java index 9e63ac406..90504c1ad 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -69,9 +69,11 @@ public static World loadWorld(String worldName, World.Environment environment, D try { WorldCreator worldCreator = new WorldCreator(worldName); worldCreator.environment(environment); + worldCreator.keepSpawnInMemory(false); World world = Bukkit.createWorld(worldCreator); if (world != null) world.setKeepSpawnInMemory(false); world.setDifficulty(Difficulty.HARD); + world.setAutoSave(false); Bukkit.getLogger().setFilter(previousFilter); EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); 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 93d9e344c..94b26f0c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -21,6 +21,7 @@ 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; @@ -71,7 +72,6 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, this.difficultyName = difficultyName; setDifficulty(difficultyName); addNewPlayer(player); - DungeonInstance dungeonInstance = this; new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); @@ -98,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() { - new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); - } - }.runTask(MetadataHandler.PLUGIN); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); }); } @@ -217,19 +212,7 @@ public void removeInstance() { return; } world.getEntities().forEach(entity -> EntityTracker.unregister(entity, RemovalReason.WORLD_UNLOAD)); - new BukkitRunnable() { - @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 RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world - } - }.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) { @@ -276,7 +259,11 @@ private static class InitializeInstancedWorldTask extends BukkitRunnable { private final File file; private final String difficultyName; - public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, String instancedWorldName, Player player, File file, String difficultyName) { + public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, + String instancedWorldName, + Player player, + File file, + String difficultyName) { this.instancedDungeonsConfigFields = instancedDungeonsConfigFields; this.instancedWorldName = instancedWorldName; this.player = player; @@ -337,7 +324,9 @@ public void run() { new BukkitRunnable() { @Override public void run() { - WorldInstantiator.recursivelyDelete(instancedWorldFile); + 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/npcs/NPCEntity.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java index 372cc4f59..0b800b5a4 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java @@ -23,6 +23,7 @@ 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; @@ -170,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 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 16389f548..75c1f5688 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.2 +version: 9.1.3 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 73a56894f4a71dd2486d80ffea462961b91aedbd Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 11 Aug 2024 23:01:22 +0100 Subject: [PATCH 48/78] EliteMobs 9.1.3: - [New] Updated to Minecraft 1.21.1 - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [New] Added the scale setting to NPCs to allow for NPC scaling - [New] Now correctly preventing players from dumping buckets in elitemobs worlds - [New] Now correctly defaulting to allowing liquid flow in elitemobs worlds, can be configured per-dungeon package to allow or deny through the settings `allowLiquidFlow` in the dungeon packager config - [New] Added the ability to play songs in dungeon packager content using the `song` setting with the same method and syntax as the custom boss song system - [New] Added /em protection bypass command to bypass dungeon protections and edit the world - [Fix] Fixed problem that was causing dungeon instantiation to not delete correctly and the recovery code on startup to not clear instanced dungeons on startup - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers - [Fix] Slimes and similar entities no longer constantly trigger the antiexploit - [Fix] Fixed the /em quest reset all by renaming it to /em quest resetAll Signed-off-by: MagmaGuy --- build.gradle | 9 +- .../com/magmaguy/elitemobs/EliteMobs.java | 2 + .../magmaguy/elitemobs/EventsRegistrer.java | 3 + .../elitemobs/commands/CommandHandler.java | 1 + .../commands/ProtectionBypassCommand.java | 25 ++ .../DungeonPackagerConfigFields.java | 8 + .../premade/DarkCathedralLair.java | 3 +- .../elitemobs/dungeons/DungeonProtector.java | 35 ++- .../elitemobs/dungeons/EliteMobsWorld.java | 1 + .../WorldInstancedDungeonPackage.java | 2 - .../elitemobs/dungeons/WorldPackage.java | 5 + .../dungeons/utility/DungeonUtils.java | 50 +--- .../elitemobs/instanced/MatchInstance.java | 68 ++--- .../custombosses/BossMusic.java | 139 ---------- .../custombosses/CustomBossEntity.java | 4 +- .../custombosses/CustomMusic.java | 243 ++++++++++++++++++ .../custombosses/PhaseBossEntity.java | 11 +- .../elitemobs/powers/scripts/ScriptZone.java | 63 +++-- .../libsdisguises/DisguiseEntity.java | 2 +- src/main/resources/plugin.yml | 5 +- 20 files changed, 420 insertions(+), 259 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomMusic.java diff --git a/build.gradle b/build.gradle index 8c5b4d6e0..e7f928347 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,10 @@ repositories { //MagmaCore maven { url = 'https://repo.magmaguy.com/releases' - allowInsecureProtocol = true + } + //MagmaCore + maven { + url = 'https://repo.magmaguy.com/snapshots' } //Bstats API @@ -110,8 +113,8 @@ dependencies { 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.12.0' - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.8' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.13.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index a27940735..f5b6a62a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -38,6 +38,7 @@ 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.CustomMusic; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; @@ -337,6 +338,7 @@ public void onDisable() { Navigation.shutdown(); BossBarUtil.shutdown(); ScriptAction.shutdown(); + CustomMusic.shutdown(); Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); MagmaCore.shutdown(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 4eb7bc8b8..5f832fc28 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -325,6 +325,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()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 482ab6632..dfe83b9f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -69,6 +69,7 @@ public static void registerCommands() { emCommand.registerCommand(new DiscordMessageCommand()); emCommand.registerCommand(new DiscordCommand()); emCommand.registerCommand(new MoneyRemoveCommand()); + emCommand.registerCommand(new ProtectionBypassCommand()); //User commands // emCommand.registerCommand(new AdventurersGuildCommand()); 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/config/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index ec81efad7..e48e6b2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -102,6 +102,12 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @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); @@ -283,6 +289,8 @@ public void processConfigFields() { 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(); } 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 0b99ab3b6..bb967a2c7 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 @@ -17,7 +17,7 @@ public DarkCathedralLair() { DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_the_dark_cathedral", - World.Environment.NORMAL, + World.Environment.NETHER, true, "em_the_dark_cathedral,47.5,85.2,199.5,163,0", 0, @@ -29,5 +29,6 @@ public DarkCathedralLair() { "&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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 950e208b0..cb4e81cb9 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -11,21 +11,40 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerInteractEvent; +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); } @@ -38,6 +57,7 @@ public void preventBlockBurnDamage(BlockBurnEvent event) { @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); } @@ -75,12 +95,15 @@ public void preventBlockFadeEvent(BlockFadeEvent event) { @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); } @@ -93,6 +116,15 @@ public void preventBlockFire(BlockIgniteEvent event) { @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); } @@ -119,9 +151,10 @@ public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventVanillaMobSpawning(PlayerInteractEvent event) { + 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")) diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java index c746bd6f2..abac43260 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -9,6 +9,7 @@ public class EliteMobsWorld { private static final HashMap eliteMobsWorlds = new HashMap<>(); + @Getter private final DungeonPackagerConfigFields dungeonPackagerConfigFields; @Getter private final boolean allowExplosions; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index 40e6829f4..efee487af 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -31,8 +31,6 @@ public void baseInitialization() { } else { //This removes all instanced worlds not previously correctly removed for (File worldFile : Bukkit.getWorldContainer().listFiles()){ - Logger.debug("world name: " + worldFile.getName()); - Logger.debug("current name: " + file.getName()); if (worldFile.getName().contains(file.getName()) && worldFile.getName().matches(".*_\\d{1,2}$")) { try{ FileUtils.deleteDirectory(worldFile); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 8591340ff..dac8d1c87 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; import com.magmaguy.elitemobs.dungeons.utility.DungeonUtils; +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; @@ -54,6 +55,8 @@ 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,6 +69,8 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); + if (dungeonPackagerConfigFields.getSong() != null) + new CustomMusic(dungeonPackagerConfigFields.getSong(), dungeonPackagerConfigFields, world); // WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); for (Wormhole wormhole : Wormhole.getWormholes()) wormhole.onDungeonInstall(dungeonPackagerConfigFields.getFilename()); 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 90504c1ad..65069d565 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,19 +5,13 @@ import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.dungeons.WorldPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.magmacore.util.Logger; +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) { @@ -46,45 +40,9 @@ public static World loadWorld(WorldPackage worldPackage) { } public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { - if (Bukkit.getWorld(worldName) != null) { - EliteMobsWorld.create(Bukkit.getWorld(worldName).getUID(), dungeonPackagerConfigFields); - return Bukkit.getWorld(worldName); - } - - File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); - - if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { - Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); - return null; - } - - Logger.info("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); - worldCreator.keepSpawnInMemory(false); - World world = Bukkit.createWorld(worldCreator); - if (world != null) world.setKeepSpawnInMemory(false); - world.setDifficulty(Difficulty.HARD); - world.setAutoSave(false); - Bukkit.getLogger().setFilter(previousFilter); - - EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); - - return world; - } catch (Exception exception) { - Bukkit.getLogger().setFilter(previousFilter); - Logger.warn("Failed to load world " + worldName + " !"); - exception.printStackTrace(); - } - return null; + World world = WorldLoader.loadVoidTemporaryWorld(worldName, environment); + if (world != null) EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + return world; } public static boolean unloadWorld(WorldPackage worldPackage) { diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java index 2437e284d..a888875c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/MatchInstance.java @@ -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/mobconstructor/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java deleted file mode 100644 index 26ca95ece..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.magmacore.util.Logger; -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<>(); - private final CustomBossEntity customBossEntity; - @Getter - private String name; - @Getter - private int durationTicks; - @Getter - private String name2 = null; - @Getter - private int durationTicks2 = -1; - private BukkitTask bukkitTask = null; - - //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: - Logger.warn("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/CustomBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java index cb2556116..b2d479fdd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java @@ -92,7 +92,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; @@ -116,7 +116,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()); 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/PhaseBossEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java index 7f0d184b1..6bad14855 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/PhaseBossEntity.java @@ -66,7 +66,7 @@ private void switchPhase(BossPhase bossPhase, RemovalReason removalReason, doubl 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/powers/scripts/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index 2fea67379..e066f3348 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -56,32 +56,7 @@ public void startZoneListener(EliteEntity eliteEntity) { if (!zoneListener) return; entitiesInZone = new HashSet<>(); ScriptActionData scriptActionData = new ScriptActionData(eliteEntity, targets, this); - new BukkitRunnable() { - @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; - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + new ZoneListenerTask(eliteEntity, scriptActionData).runTaskTimer(MetadataHandler.PLUGIN, 0, 1); } public void ZoneEnterEvent(EliteEntity eliteEntity, LivingEntity livingEntity) { @@ -208,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 @@ -267,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/thirdparty/libsdisguises/DisguiseEntity.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java index de1970903..627ad13e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java @@ -65,7 +65,7 @@ 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(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 75c1f5688..214631d41 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -232,4 +232,7 @@ permissions: default: true elitemobs.enchant.npc: description: Allows players to talk to the enchant npc - default: true \ No newline at end of file + default: true + elitemobs.protection.bypass: + description: Allows players to run the bypass command to toggle bypassing dungeon protections + default: op \ No newline at end of file From 837b443f3770040014a256aa0780b63499baae5f Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 18 Jun 2024 10:28:21 +0100 Subject: [PATCH 49/78] - Updated all entities, potion effects and enchantments to work with Minecraft 1.21 - Removed Super Mobs - Fixed bug where push action would be cancelled if applied on the same tick a player is damaged by the boss Signed-off-by: MagmaGuy --- build.gradle | 110 +- .../com/magmaguy/elitemobs/EliteMobs.java | 161 +-- .../magmaguy/elitemobs/EventsRegistrer.java | 30 +- .../LightningImmunity.java | 4 +- .../elitemobs/commands/AdminCommands.java | 956 ++++++++++++++++++ .../commands/admin/GetTierCommand.java | 21 +- .../elitemobs/commands/admin/KillHandler.java | 2 +- .../premade/ChallengersBootsConfig.java | 2 +- .../premade/ChallengersChestplateConfig.java | 2 +- .../premade/ChallengersHelmetConfig.java | 2 +- .../premade/ChallengersLeggingsConfig.java | 2 +- .../premade/ChallengersSwordConfig.java | 2 +- .../premade/DepthsSeekerConfig.java | 2 +- .../premade/DwarvenGreedConfig.java | 2 +- .../premade/GoblinBallistaItem.java | 2 +- .../customitems/premade/GoblinBootsItem.java | 6 +- .../premade/GoblinChestplateItem.java | 7 +- .../premade/GoblinCleaverItem.java | 7 +- .../customitems/premade/GoblinHelmetItem.java | 7 +- .../premade/GoblinLeggingsItem.java | 7 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 7 +- .../premade/GruntsBootsConfig.java | 2 +- .../premade/GruntsChestplateConfig.java | 2 +- .../premade/GruntsHelmetConfig.java | 2 +- .../premade/GruntsLeggingsConfig.java | 2 +- .../premade/GruntsSwordConfig.java | 2 +- .../premade/InvictusBootsConfig.java | 7 +- .../premade/InvictusChestplateConfig.java | 7 +- .../premade/InvictusHelmetConfig.java | 7 +- .../premade/InvictusLeggingsConfig.java | 7 +- .../premade/InvictusPickaxeConfig.java | 7 +- .../premade/InvictusShovelConfig.java | 7 +- .../premade/InvictusSwordConfig.java | 7 +- .../premade/NovicesSwordConfig.java | 2 +- .../premade/RodOfTheDepthsConfig.java | 2 +- .../customitems/premade/TheFellerConfig.java | 2 +- .../customitems/premade/TheStingerConfig.java | 2 +- .../premade/VeteransBootsConfig.java | 2 +- .../premade/VeteransChestplateConfig.java | 2 +- .../premade/VeteransHelmetConfig.java | 2 +- .../premade/VeteransLeggingsConfig.java | 2 +- .../premade/VeteransSwordConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 4 +- .../itemconstructor/EnchantmentGenerator.java | 78 +- .../powers/scripts/ScriptParticles.java | 12 +- .../elitemobs/utils/DebugBlockLocation.java | 15 +- src/main/resources/plugin.yml | 263 ++--- 50 files changed, 1397 insertions(+), 399 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java diff --git a/build.gradle b/build.gradle index e7f928347..f93122c7f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,10 @@ +import org.apache.tools.ant.filters.ReplaceTokens + plugins { id 'java-library' id 'idea' id 'maven-publish' - id("io.github.goooler.shadow") version "8.1.8" + id "com.github.johnrengelman.shadow" version "7.0.0" id 'signing' } @@ -10,13 +12,7 @@ plugins { compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" -java { - toolchain { - languageVersion = JavaLanguageVersion.of(17) - } -} - -//Fixes issues with utf-8 in the translations files. +//Fixes issues with utf-8 in the translations files. Why? Don't know. processResources { def props = [version: version] inputs.properties props @@ -27,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.1.3' +version '9.0.0-SNAPSHOT' repositories { maven { @@ -46,16 +42,13 @@ 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" } - //MagmaCore - maven { - url = 'https://repo.magmaguy.com/releases' - } - //MagmaCore - maven { - url = 'https://repo.magmaguy.com/snapshots' - } + //FreeMinecraftModels + maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } //Bstats API maven { url = 'https://repo.codemc.org/repository/maven-public' } @@ -68,8 +61,10 @@ 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/' @@ -77,13 +72,26 @@ repositories { artifact() } } + } dependencies { //Spigot API compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" + //BStats API + implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //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' @@ -93,29 +101,34 @@ dependencies { //SQLite compileOnly group: 'org.xerial', name: 'sqlite-jdbc', version: '3.32.3' //MySQL - compileOnly 'mysql:mysql-connector-java:8.0.33' + implementation '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.34' - annotationProcessor 'org.projectlombok:lombok:1.18.34' + compileOnly 'org.projectlombok:lombok:1.18.24' + annotationProcessor 'org.projectlombok:lombok:1.18.24' + //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' - // 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' + //Advanced AI goals + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.11.2-SNAPSHOT' + // Mythic Mobs integration - currently only for arenas + compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } artifacts { // task 'build' runs generates uberjar @@ -132,22 +145,57 @@ 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 { - name = "EliteMobs" - url = "http://magmaguy.com:50001/releases" + 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 credentials { username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" } - allowInsecureProtocol = true } } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f5b6a62a6..eb42590a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -6,6 +6,7 @@ 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; @@ -25,28 +26,26 @@ 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.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.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; @@ -58,12 +57,12 @@ 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.BossBarUtil; +import com.magmaguy.elitemobs.utils.InfoMessage; 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; @@ -80,65 +79,72 @@ 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 - new DefaultConfig(); - new ItemSettingsConfig(); - new ProceduralItemGenerationSettingsConfig(); + DefaultConfig.initializeConfig(); + SchematicsFolderConfig.initializeConfigs(); + ResourcePackDataConfig.initializeConfig(); + ItemSettingsConfig.initializeConfig(); + ProceduralItemGenerationSettingsConfig.initializeConfig(); PotionEffectsConfig.initializeConfigs(); - new EconomySettingsConfig(); - new EventsConfig(); + EconomySettingsConfig.initializeConfig(); + EventsConfig.initializeConfig(); new EnchantmentsConfig(); - new AntiExploitConfig(); - new CombatTagConfig(); - new AntiExploitConfig(); - new AdventurersGuildConfig(); - new ValidWorldsConfig(); + AntiExploitConfig.initializeConfig(); + CombatTagConfig.initializeConfig(); + AntiExploitConfig.initializeConfig(); + AdventurersGuildConfig.initializeConfig(); + ValidWorldsConfig.initializeConfig(); new MenusConfig(); new PowersConfig(); MobPropertiesConfig.initializeConfigs(); CustomEnchantment.initializeCustomEnchantments(); - new MobCombatSettingsConfig(); + MobCombatSettingsConfig.initializeConfig(); CommandsConfig.initializeConfigs(); - new DiscordSRVConfig(); + DiscordSRVConfig.initializeConfig(); + ItemUpgradeSystemConfig.initializeConfig(); new CustomEventsConfig(); - new QuestsConfig(); - new WormholesConfig(); - new ArenasConfig(); + QuestsConfig.initializeConfig(); + WormholesConfig.initializeConfig(); + ArenasConfig.initializeConfig(); + //SoundsConfig.initializeConfig(); //ModelsConfig.initializeConfig(); - new DungeonsConfig(); - new SoundsConfig(); + DungeonsConfig.initializeConfig(); } public static void worldScanner() { for (World world : Bukkit.getWorlds()) - if (ValidWorldsConfig.getInstance().getFileConfiguration().getBoolean("Valid worlds." + world.getName())) { + if (ValidWorldsConfig.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); @@ -148,9 +154,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); - Logger.info("New default max health set correctly!"); + new InfoMessage("New default max health set correctly!"); } catch (IOException e) { - 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); + 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); } } @@ -169,14 +175,14 @@ public void onEnable() { //Reserves ModelEngine addresses if present ModelEngineReservedAddresses.reserve(); - if (worldGuardIsEnabled) Logger.info("WorldGuard compatibility is enabled!"); - else Logger.info("WorldGuard compatibility is not enabled!"); + if (worldGuardIsEnabled) Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is enabled!"); + else Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is not enabled!"); //Enable Vault try { VaultCompatibility.vaultSetup(); } catch (Exception e) { - 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."); + 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."); VaultCompatibility.VAULT_ENABLED = false; } @@ -184,7 +190,7 @@ public void onEnable() { EventsRegistrer.registerEvents(); //Launch the local data cache - new DatabaseConfig(); + DatabaseConfig.initializeConfig(); PlayerData.initializeDatabaseConnection(); ElitePlayerInventory.initialize(); @@ -222,8 +228,7 @@ public void onEnable() { new CustomCharts(); //Imports custom configurations and mindungeons from the import folder -// ConfigurationImporter.initializeConfigs(); - MagmaCore.initializeImporter(); + ConfigurationImporter.initializeConfigs(); ConfigurationExporter.initializeConfigs(); //Import custom items after potentially importing new items @@ -233,6 +238,17 @@ 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(); @@ -250,7 +266,7 @@ public void onEnable() { try { if (emPackage.isInstalled()) emPackage.initializeContent(); } catch (Exception exception) { - Logger.warn("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !"); + new WarningMessage("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !"); exception.printStackTrace(); } @@ -259,18 +275,17 @@ public void onEnable() { try { new CustomSpawnConfig(); } catch (Exception ex) { - 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" + + 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" + " you are running."); - 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 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)."); } new CustomQuestsConfig(); //Commands -// new CommandHandler(); - CommandHandler.registerCommands(); + new CommandHandler(); - new SpecialItemSystemsConfig(); + SpecialItemSystemsConfig.initializeConfig(); /* Check for new plugin version or for dungeon updates @@ -282,15 +297,11 @@ public void onEnable() { @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) { - 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."); + 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."); worldGuardIsEnabled = false; } if (!worldGuardIsEnabled) @@ -300,22 +311,43 @@ public void onLoad() { @Override public void onDisable() { - Logger.info("Starting EliteMobs shutdown sequence..."); + + new InfoMessage("Starting EliteMobs shutdown sequence..."); + + new InfoMessage("Regenerating exploded blocks..."); 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(); @@ -324,31 +356,42 @@ 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(); - EliteMobsWorld.shutdown(); - Navigation.shutdown(); - BossBarUtil.shutdown(); - ScriptAction.shutdown(); - CustomMusic.shutdown(); - Logger.info("Saving EliteMobs databases..."); + + //save cached data + Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); PlayerData.closeConnection(); - MagmaCore.shutdown(); - Logger.info("All done! Good night."); + Bukkit.getLogger().info("[EliteMobs] All done! Good night."); + } /* Repeating tasks that run as long as the server is on */ private void launchRunnables() { + if (!zoneBasedSpawningWorlds.isEmpty()) Grid.initializeGrid(); //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 5f832fc28..75a115e83 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -16,10 +16,11 @@ 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; @@ -88,6 +89,8 @@ public static void registerEvents() { register(new Navigation()); + register(new ResourcePackDataConfig.ResourcePackDataConfigEvents()); + register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener()); register(new VersionChecker.VersionCheckerEvents()); @@ -102,12 +105,9 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDisenchantment()) register(new ItemDisenchantPrevention()); - if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) - register(new PreventUpgradeDiamondToNetherite()); - - register(new FixPlayerOnLoginOrRespawn()); - register(new EnvironmentalDungeonDamage()); - register(new PlayerQuitCleanup()); + if (!VersionChecker.serverVersionOlderThan(15, 2)) + if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) + register(new PreventUpgradeDiamondToNetherite()); //Mob damage register(new EliteMobGenericDamagedHandler()); @@ -213,6 +213,7 @@ 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()); @@ -264,7 +265,8 @@ public static void registerEvents() { register(new LootMenu.LootMenuEvents()); //Minecraft behavior canceller - register(new PreventEliteBeeHiveEnter()); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + register(new PreventEliteBeeHiveEnter()); register(new EnderDragonUnstuck()); if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities()) register(new VanillaReinforcementsCanceller()); @@ -284,7 +286,9 @@ public static void registerEvents() { register(new PreventItemPickupByMobs()); if (AntiExploitConfig.isAmbientDamageExploit()) register(new AmbientDamageExploit()); - register(new HoneyBlockJumpExploit()); + if (!VersionChecker.serverVersionOlderThan(14, 0)) { + register(new HoneyBlockJumpExploit()); + } register(new EliteMobDamagedByPlayerAntiExploitListener()); if (AntiExploitConfig.isNoPathExploit()) register(new PreventPathfindingExploit()); @@ -325,9 +329,6 @@ 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()); @@ -356,7 +357,6 @@ public static void registerEvents() { register(new WorldGuardDungeonFlag()); register(new WorldGuardExplosionBlockDamageFlag()); } - register(new DungeonProtector()); register(new EntityTransformHandler()); register(new EliteBlazeWaterDamagePrevention()); @@ -367,6 +367,10 @@ 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/collateralminecraftchanges/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index a3566e5c7..fb9391902 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; public class LightningImmunity implements Listener { - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onLightningStrike(EntityDamageByEntityEvent event) { + @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; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java new file mode 100644 index 000000000..c87210ed9 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -0,0 +1,956 @@ +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 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 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/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index 8cbeb76d8..9b2619d06 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -9,6 +9,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.util.HashMap; + public class GetTierCommand { private GetTierCommand() { } @@ -55,24 +57,23 @@ public static void get(Player player, int tierLevel) { new EliteItemLore(bow, false); - player.getInventory().setHelmet(helmet); - player.getInventory().setChestplate(chestplate); - player.getInventory().setLeggings(leggings); - player.getInventory().setBoots(boots); + + player.getInventory().addItem(helmet); + player.getInventory().addItem(chestplate); + player.getInventory().addItem(leggings); + player.getInventory().addItem(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(); - itemMeta.addEnchant(Enchantment.UNBREAKING, 5, true); + HashMap enchantmentIntegerHashMap = new HashMap<>(); + enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); + ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); 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 fa37074fe..e5e0c4bcd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java @@ -1,10 +1,10 @@ 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.magmacore.util.ChatColorConverter; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; 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 722f4e7e8..ccfac6f38 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 @@ -9,7 +9,7 @@ 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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 af578aa61..36f4ced2f 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 @@ -9,7 +9,7 @@ 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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 e09906e3b..c5af48d8d 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 @@ -9,7 +9,7 @@ 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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 18192d44d..3d82b0ca9 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 @@ -9,7 +9,7 @@ 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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 a760313e7..1db6f4ca5 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 @@ -9,7 +9,7 @@ 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("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index f56ab5db4..66387929c 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 @@ -13,7 +13,7 @@ public DepthsSeekerConfig() { 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_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LURE,3", "LUCK,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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 cd672c0c7..418e667b8 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 @@ -13,7 +13,7 @@ public DwarvenGreedConfig() { 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("FORTUNE,4", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 051a010f0..5c7be6b92 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 @@ -14,7 +14,7 @@ public GoblinBallistaItem() { Material.CROSSBOW, "&8Goblin Ballista", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "QUICK_CHARGE,3", "MULTISHOT,1")); + setEnchantments(Arrays.asList("ARROW_DAMAGE,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 824e68316..f0ff0e047 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,6 +2,7 @@ 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; @@ -14,8 +15,9 @@ public GoblinBootsItem() { Material.GOLDEN_BOOTS, "&8Goblin Boots", List.of("&8A treasure among goblins!")); - setMaterial(Material.NETHERITE_BOOTS); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1")); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + setMaterial(Material.NETHERITE_BOOTS); + setEnchantments(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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 a6d88b11b..70aaec84d 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,6 +2,7 @@ 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; @@ -11,10 +12,12 @@ public class GoblinChestplateItem extends CustomItemsConfigFields { public GoblinChestplateItem() { super("goblin_chestplate", true, - Material.NETHERITE_CHESTPLATE, + Material.GOLDEN_CHESTPLATE, "&8Goblin Chestplate", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1")); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + setMaterial(Material.NETHERITE_CHESTPLATE); + setEnchantments(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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 8d25f4031..0538c35be 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,6 +2,7 @@ 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; @@ -11,10 +12,12 @@ public class GoblinCleaverItem extends CustomItemsConfigFields { public GoblinCleaverItem() { super("goblin_cleaver", true, - Material.NETHERITE_AXE, + Material.GOLDEN_AXE, "&8Goblin Cleaver", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,5")); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + setMaterial(Material.NETHERITE_AXE); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 0fdb800ea..1162ad080 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,6 +2,7 @@ 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; @@ -11,10 +12,12 @@ public class GoblinHelmetItem extends CustomItemsConfigFields { public GoblinHelmetItem() { super("goblin_helmet", true, - Material.NETHERITE_HELMET, + Material.GOLDEN_HELMET, "&8Goblin Helmet", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1")); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + setMaterial(Material.NETHERITE_HELMET); + setEnchantments(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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 c3e741248..897d3746b 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,6 +2,7 @@ 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; @@ -11,10 +12,12 @@ public class GoblinLeggingsItem extends CustomItemsConfigFields { public GoblinLeggingsItem() { super("goblin_leggings", true, - Material.NETHERITE_LEGGINGS, + Material.GOLDEN_LEGGINGS, "&8Goblin Leggings", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1")); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + setMaterial(Material.NETHERITE_LEGGINGS); + setEnchantments(Arrays.asList("PROTECTION,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,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 18f8f4c42..b526d6687 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 @@ -14,7 +14,7 @@ public GoblinPokerItem() { Material.TRIDENT, "&8Goblin Poker", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,5")); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 ab49b074a..24d535131 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "INFINITY,1", "FLAME,1")); + setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,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 b56592181..1fae1f440 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,6 +2,7 @@ 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; @@ -11,10 +12,12 @@ public class GoblinSlasherItem extends CustomItemsConfigFields { public GoblinSlasherItem() { super("goblin_slasher", true, - Material.NETHERITE_SWORD, + Material.GOLDEN_SWORD, "&8Goblin Slasher", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,5")); + if (!VersionChecker.serverVersionOlderThan(16, 0)) + setMaterial(Material.NETHERITE_SWORD); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 58bebb3fc..7fa585ec3 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,5", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 4b9e48791..98fb62745 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 9a9dd33b4..ac575075a 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 7439c8751..ee4d9ad47 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 111c8de7a..b74955375 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 @@ -9,7 +9,7 @@ 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("SHARPNESS,5", "KNOCKBACK,2", "SWEEPING_EDGE,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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 8ea25d6f4..5862f2613 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusBootsConfig extends CustomItemsConfigFields { public InvictusBootsConfig() { - super("invictus_boots", true, Material.NETHERITE_BOOTS, "&4Invictus Boots", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 cd9caded1..260a1c496 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusChestplateConfig extends CustomItemsConfigFields { public InvictusChestplateConfig() { - super("invictus_chestplate", true, Material.NETHERITE_CHESTPLATE, "&4Invictus Chestplate", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 12beeca3a..7d3c68654 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusHelmetConfig extends CustomItemsConfigFields { public InvictusHelmetConfig() { - super("invictus_helmet", true, Material.NETHERITE_HELMET, "&4Invictus Helmet", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 5d0f114e3..2d1efceec 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusLeggingsConfig extends CustomItemsConfigFields { public InvictusLeggingsConfig() { - super("invictus_leggings", true, Material.NETHERITE_LEGGINGS, "&4Invictus Leggings", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,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 7b43f3e85..8cc544edc 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusPickaxeConfig extends CustomItemsConfigFields { public InvictusPickaxeConfig() { - super("invictus_pickaxe", true, Material.NETHERITE_PICKAXE, "&4Invictus Pickaxe", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("EFFICIENCY,6", "DRILLING,3", "UNBREAKING,5")); + 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", "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 dab2b0359..ec619b4a5 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusShovelConfig extends CustomItemsConfigFields { public InvictusShovelConfig() { - super("invictus_shovel", true, Material.NETHERITE_SHOVEL, "&4Invictus Shovel", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("EFFICIENCY,6", "DRILLING,3", "UNBREAKING,5")); + 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", "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 72e8632ca..d2adb23c1 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,6 +2,7 @@ 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; @@ -9,8 +10,10 @@ public class InvictusSwordConfig extends CustomItemsConfigFields { public InvictusSwordConfig() { - super("invictus_sword", true, Material.NETHERITE_SWORD, "&4Invictus Sword", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "UNBREAKING,5")); + 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", "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/NovicesSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java index 08395d999..4b042a516 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 @@ -9,7 +9,7 @@ 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("SHARPNESS,5", "SWEEPING_EDGE,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("DAMAGE_ALL,5", "SWEEPING_EDGE,1", "UNBREAKING,5")); setItemType(CustomItem.ItemType.UNIQUE); setLevel(10); } 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 213325b25..49e59d461 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 @@ -13,7 +13,7 @@ public RodOfTheDepthsConfig() { 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_OF_THE_SEA,1", "UNBREAKING,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LURE,3", "LUCK,1", "UNBREAKING,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 956586568..870774e8c 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 @@ -13,7 +13,7 @@ public TheFellerConfig() { Material.DIAMOND_AXE, "&2The Feller", Arrays.asList("&aEven in your sleep,", "&ayou can feel this axe''s", "&asaplust")); - setEnchantments(Arrays.asList("FORTUNE,4", "SILK_TOUCH,1", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LOOT_BONUS_BLOCKS,4", "SILK_TOUCH,1", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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 8ddacaf59..7564e67c5 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 @@ -14,7 +14,7 @@ public TheStingerConfig() { Material.GOLDEN_SWORD, "&eThe Stinger", Arrays.asList("&aFloat like a butterfly,", "&asting like a bee!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "UNBREAKING,1", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index 8860d84b7..fa3e7ae30 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 9284f9720..213a0facb 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 bdb6b7cf0..a702eeac8 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 b9c51e254..f812d7d5b 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 @@ -9,7 +9,7 @@ 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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("PROTECTION,5", "PROTECTION_PROJECTILE,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 bfbadbfcd..436c6204e 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 @@ -9,7 +9,7 @@ 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("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "SWEEPING_EDGE,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("DAMAGE_ALL,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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 95736297d..ea50b9ea5 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOTING,5")); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); setPotionEffects(Arrays.asList("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 d8fd9b37c..87c897770 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 @@ -13,8 +13,8 @@ public ZombieKingsAxeConfig() { 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("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOTING,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); + setEnchantments(Arrays.asList("DAMAGE_ALL,1", "DAMAGE_UNDEAD,5", "DIG_SPEED,5", "UNBREAKING,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")); setItemType(CustomItem.ItemType.UNIQUE); } 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 725ce0426..48f41b6c8 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().getKey().getKey().toLowerCase(Locale.ROOT) + ".yml"); + EnchantmentsConfigFields enchantmentsConfigFields = EnchantmentsConfig.getEnchantment(entry.getKey().getName().toLowerCase(Locale.ROOT) + ".yml"); if (enchantmentsConfigFields == null || !enchantmentsConfigFields.isEnabled()) continue; if (enchantmentMap.get(entry.getKey()) > entry.getKey().getMaxLevel()) { if (EliteEnchantments.isPotentialEliteEnchantment(entry.getKey())) { @@ -71,28 +71,28 @@ public static HashMap generateEnchantments(double itemTier case IRON_SWORD: case STONE_SWORD: case WOODEN_SWORD: - validEnchantments.putAll(validateEnchantments("SHARPNESS")); - validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); - validEnchantments.putAll(validateEnchantments("SMITE")); + validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); + validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); - validEnchantments.putAll(validateEnchantments("LOOTING")); + validEnchantments.putAll(validateEnchantments("LOOT_BONUS_MOBS")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("SWEEPING_EDGE")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case BOW: - validEnchantments.putAll(validateEnchantments("POWER")); - validEnchantments.putAll(validateEnchantments("FLAME")); - validEnchantments.putAll(validateEnchantments("INFINITY")); - validEnchantments.putAll(validateEnchantments("PUNCH")); + validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); + validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); + validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); + validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case CROSSBOW: - validEnchantments.putAll(validateEnchantments("POWER")); + validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); validEnchantments.putAll(validateEnchantments("QUICK_CHARGE")); validEnchantments.putAll(validateEnchantments("MULTISHOT")); validEnchantments.putAll(validateEnchantments("PIERCING")); @@ -105,13 +105,13 @@ public static HashMap generateEnchantments(double itemTier case IRON_PICKAXE: case STONE_PICKAXE: case WOODEN_PICKAXE: - validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("DIG_SPEED")); 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("FORTUNE")); + validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); } 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("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("DIG_SPEED")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { - validEnchantments.putAll(validateEnchantments("FORTUNE")); + validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); } else { validEnchantments.putAll(validateEnchantments("SILK_TOUCH")); } @@ -137,13 +137,13 @@ public static HashMap generateEnchantments(double itemTier case STONE_HOE: case WOODEN_HOE: if (ItemSettingsConfig.isUseHoesAsWeapons()) - validEnchantments.putAll(validateEnchantments("SHARPNESS")); - validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); + validEnchantments.putAll(validateEnchantments("DIG_SPEED")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); if (ThreadLocalRandom.current().nextDouble() < 0.5) { - validEnchantments.putAll(validateEnchantments("FORTUNE")); + validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); } else { validEnchantments.putAll(validateEnchantments("SILK_TOUCH")); } @@ -158,14 +158,14 @@ public static HashMap generateEnchantments(double itemTier case IRON_AXE: case STONE_AXE: case WOODEN_AXE: - validEnchantments.putAll(validateEnchantments("SHARPNESS")); - validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); - validEnchantments.putAll(validateEnchantments("SMITE")); + validEnchantments.putAll(validateEnchantments("DAMAGE_ALL")); + validEnchantments.putAll(validateEnchantments("DAMAGE_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("DAMAGE_UNDEAD")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); - validEnchantments.putAll(validateEnchantments("EFFICIENCY")); - validEnchantments.putAll(validateEnchantments("FORTUNE")); + validEnchantments.putAll(validateEnchantments("DIG_SPEED")); + validEnchantments.putAll(validateEnchantments("LOOT_BONUS_BLOCKS")); break; case CHAINMAIL_HELMET: case DIAMOND_HELMET: @@ -177,13 +177,13 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("RESPIRATION")); - validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); - validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); - validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("OXYGEN")); + validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); + validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); + validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); - validEnchantments.putAll(validateEnchantments("AQUA_AFFINITY")); + validEnchantments.putAll(validateEnchantments("WATER_WORKER")); break; case CHAINMAIL_CHESTPLATE: case DIAMOND_CHESTPLATE: @@ -193,9 +193,9 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("PROTECTION")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); - validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); - validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); + validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); + validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -208,9 +208,9 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); - validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); - validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); + validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); + validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; @@ -223,10 +223,10 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("BLAST_PROTECTION")); - validEnchantments.putAll(validateEnchantments("FEATHER_FALLING")); - validEnchantments.putAll(validateEnchantments("FIRE_PROTECTION")); - validEnchantments.putAll(validateEnchantments("PROJECTILE_PROTECTION")); + validEnchantments.putAll(validateEnchantments("PROTECTION_EXPLOSIONS")); + validEnchantments.putAll(validateEnchantments("PROTECTION_FALL")); + validEnchantments.putAll(validateEnchantments("PROTECTION_FIRE")); + validEnchantments.putAll(validateEnchantments("PROTECTION_PROJECTILE")); validEnchantments.putAll(validateEnchantments("THORNS")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("DEPTH_STRIDER")); @@ -237,11 +237,11 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("MENDING")); - validEnchantments.putAll(validateEnchantments("LUCK_OF_THE_SEA")); + validEnchantments.putAll(validateEnchantments("LUCK")); validEnchantments.putAll(validateEnchantments("LURE")); break; case SHEARS: - validEnchantments.putAll(validateEnchantments("EFFICIENCY")); + validEnchantments.putAll(validateEnchantments("DIG_SPEED")); validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); validEnchantments.putAll(validateEnchantments("MENDING")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); 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 a8e35d721..23b26b065 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptParticles.java @@ -36,11 +36,11 @@ 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(); } @@ -79,7 +79,7 @@ else if (particleBlueprint.getParticle().equals(Particle.DUST_COLOR_TRANSITION)) particleBlueprint.getToBlue()), 1)); else if (particleBlueprint.getParticle().equals(Particle.WITCH) - //|| particleBlueprint.getParticle().equals(Particle.WITCH_AMBIENT) todo: 1.20.6 changed this name + //|| 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/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 5af9ea6b5..f63ce4e53 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,19 +1,18 @@ package com.magmaguy.elitemobs.utils; -import org.bukkit.Bukkit; +import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.Particle; +import org.bukkit.util.Vector; public class DebugBlockLocation { public DebugBlockLocation(Location location) { - location.getWorld().spawnParticle(Particle.BLOCK_MARKER, - location.getBlock().getX() + .5, - location.getBlock().getY() + .5, - location.getBlock().getZ() + .5, - 1, - Bukkit.createBlockData(Material.BARRIER)); + 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, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); + else + location.getWorld().spawnParticle(Particle.EXPLOSION, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 214631d41..f3798c721 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.3 +version: 9.0.0 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -11,6 +11,7 @@ softdepend: - HolographicDisplays - DiscordSRV - LibsDisguises +- WorldEdit - ModelEngine - Geyser-Spigot - MythicMobs @@ -18,221 +19,129 @@ 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.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 + elitemobs.stats: + description: Allows players to run /elitemobs stats + default: op + elitemobs.version: + description: Allows players to run /elitemobs version default: true - elitemobs.arena.start: - description: Allows players to start an arena + elitemobs.shop.npc: + description: Allows players to interact with NPCs for dynamic shops default: true - elitemobs.debug: - description: Gives access to the debug command - default: op - elitemobs.discord.link: - description: Gives the link to EliteMobs' discord server + elitemobs.shop.command: + description: Allows players to open the dynamic shop menu through commands default: true - 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 + elitemobs.customshop.npc: + description: Allows players to interact with NPCs for dynamic shops default: true - elitemobs.command: - description: Allows players to use the main command of the plugin + elitemobs.customshop.command: + description: Allows players to open the dynamic shop menu through commands default: true - elitemobs.enchant.command: - description: Allows players to use the enchant command + elitemobs.currency.pay: + description: Allows players to run /elitemobs pay [username] [amount] default: true - 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 + elitemobs.currency.check: + description: Allows players to run /elitemobs wallet default: true - elitemobs.kill.command: - description: Allows admins to run the kill commands to kill elites + elitemobs.currency.check.others: + description: Allows players to run /elitemobs check [username] default: op - 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 + elitemobs.events: + description: Allows players to launch all events default: true - elitemobs.loot.debug: - description: Gives admins a set of gear of a specific level for testing purposes - default: op - elitemobs.loot.admin: - description: Lets admins give or obtain EliteMobs loot via command + elitemobs.checktier.others: + description: Allows players to run /elitemobs checktier [player] default: op - elitemobs.loot.stats: - description: Gives the elite stats of gear, for debugging purposes + elitemobs.gettier: + description: Allows players to run /elitemobs gettier [tier] default: op - elitemobs.money.admin: - description: Allows admins to manually manipulate player elite currency + elitemobs.versionnotification: + description: Allows players to get notified about plugin updates default: op - elitemobs.money.check.self: - description: Allows users to check their balance - default: true - 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 + elitemobs.adventurersguild.teleport: + description: Allows players to teleport to the adventurer's guild hub using /ag default: true - 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 + elitemobs.adventurersguild.command: + description: Allows players to rank menu using the /em adventurersguild command default: true - 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 + elitemobs.rank.command: + description: Allows players to open the rank menu through /em rank default: true - elitemobs.quest.leave: - description: Allows users to leave a quest + elitemobs.rank.npc: + description: Allows players to access the /em rank menu through NPCs default: true - 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 + elitemobs.quest.command: + description: Allows players to take on quests via command default: true elitemobs.quest.npc: - description: Allows players to talk to quest npcs + description: Allows players to take on quests via EliteMobs NPC default: true - elitemobs.quit: - description: Allows players to quit instanced content + elitemobs.dungeontp: + description: Allows players to teleport to an elitemobs-set location default: true - elitemobs.rank.command: - description: Allows players to join open the rank menu of EliteMobs + elitemobs.spawntp: + description: Allows players to teleport to the default spawn location of the server. default: true - 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 + elitemobs.back.npc: + description: Allows players to interact with an npc to go back to a previous location. default: true - elitemobs.setup: - description: Allows admins to use the setup commands - default: op elitemobs.shareitem: - description: Allows players to use the share item command - default: true - elitemobs.shop.custom: - description: Allows players to use custom shop command + description: Shares a held Elite Item on chat. default: true - 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.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 + elitemobs.scrap.npc: + description: Allows players to scrap items at an npc default: true - elitemobs.instance.start: - description: Allows players to use the start command in instances + elitemobs.scrap.command: + description: Allows players to scrap items using a command default: true - elitemobs.stats: - description: Allows admins to get stats related to EliteMobs - default: op - elitemobs.boss.track: - description: Allows players to track trackable bosses + elitemobs.smelt.command: + description: Allows players to smelt items using a command default: true - 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) + elitemobs.smelt.npc: + description: Allows players to smelt items using an npc default: true - 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 + elitemobs.repair.command: + description: Allows players to use the repair command to open the menu for repairing elite items default: true - elitemobs.shop.dynamic.npc: - description: Allows players to talk to the dynamic shop npc + elitemobs.repair.npc: + description: Allows players to interact with the NPC for repairing items default: true - elitemobs.shop.custom.npc: - description: Allows players to talk to the custom shop npc + elitemobs.refiner.command: + description: Allows players to use the refiner command to open the menu for upgrading Elite Scrap default: true - elitemobs.shop.sell.npc: - description: Allows players to talk to the sell shop npc + elitemobs.refiner.npc: + description: Allows players to interact with the NPC for upgrading Elite Scrap default: true - elitemobs.back.npc: - description: Allows players to talk to the back teleport npc + elitemobs.enhancer.command: + description: Allows players to use the enhancer command to open the menu for upgrading Elite Items default: true - elitemobs.scrap.npc: - description: Allows players to talk to the scrap npc + elitemobs.enhancer.npc: + description: Allows players to interact with the NPC for upgrading Elite Items default: true - elitemobs.repair.npc: - description: Allows players to talk to the repair npc + elitemobs.unbind.command: + description: Allows players to use the unbind command to open the menu to unbind Elite Items default: true elitemobs.unbind.npc: - description: Allows players to talk to the unbind npc - default: true + 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 elitemobs.enchant.npc: - description: Allows players to talk to the enchant npc + description: Allows players to interact with the enchanter NPC to enchant Elite Items default: true - elitemobs.protection.bypass: - description: Allows players to run the bypass command to toggle bypassing dungeon protections - default: op \ No newline at end of file + elitemobs.enchant.command: + description: Allows players to use the enchant command to enchant Elite Items + default: true \ No newline at end of file From b1ac623df565b246d2d9ebd87fa96e8b5a9d3363 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Wed, 19 Jun 2024 14:05:52 +0100 Subject: [PATCH 50/78] - [New] 1.21 update! - [New] Added bossType field to custom bosses, to be used in the future for things like automatic boss bars - [New] Added Breach, Density and Wind Burst enchantments to EliteMobs - [New] Added Infested, Oozing, Raid Omen, Trial Omen, Weaving and Wind Charged potion effects to EliteMobs - [New] Added Bogged and Breeze entity types as valid elites and bosses - [New] All enchantments and potion effects now use the same names as in-game, instead of legacy API names - [New] Added compatibility layer that automatically converts legacy API names to the new equivalent, meaning it is not necessary to update the dungeons for them to keep working - [Removal] Removed Super Mobs - [Removal] Removed Schematic Dungeons, 100% of them will brought back as world-based dungeons. Use BetterStructures shrines as a replacement, they're much better. - [Removal] Removed all traces of WorldEdit as a requirement, since schematic dungeons are no longer a feature - [Removal] Removed the region leveling mode and the nightmare mode, they should either be improved or be their own plugin - [Removal] Removed all the code legacy code used to maintain multi-version support since this build will not be able to support anything before 1.21 - [Tweak] Default test boss no longer uses broadcast as a sample command and instead uses say - [Tweak] Fixed typo in stats page of the player em menu Signed-off-by: MagmaGuy --- build.gradle | 2 - .../elitemobs/ChatColorConverter.java | 29 ++ .../com/magmaguy/elitemobs/EliteMobs.java | 13 - .../magmaguy/elitemobs/EventsRegistrer.java | 19 +- .../api/EliteMobDamagedByPlayerEvent.java | 4 +- .../LightningImmunity.java | 4 +- .../PreventUpgradeDiamondToNetherite.java | 2 +- .../elitemobs/commands/AdminCommands.java | 24 -- .../elitemobs/commands/SpawnCommand.java | 16 +- .../commands/admin/GetTierCommand.java | 3 +- .../elitemobs/commands/setup/SetupMenu.java | 245 ++++++++--- .../elitemobs/config/ConfigurationEngine.java | 162 +++++++- .../config/ConfigurationExporter.java | 209 +++++++--- .../elitemobs/config/CustomConfig.java | 193 +++++++++ .../elitemobs/config/DefaultConfig.java | 56 +-- .../config/EconomySettingsConfig.java | 42 +- .../config/ItemUpgradeSystemConfig.java | 28 ++ .../config/LegacyValueConverter.java | 63 +-- .../elitemobs/config/ModelsConfig.java | 18 +- .../elitemobs/config/QuestsConfig.java | 176 ++++---- .../config/ResourcePackDataConfig.java | 102 +++++ .../config/SpecialItemSystemsConfig.java | 39 +- .../elitemobs/config/ValidWorldsConfig.java | 41 +- .../CustomBossesConfigFields.java | 39 +- .../premade/WoodLeagueWave15Miniboss.java | 4 +- .../customitems/CustomItemsConfigFields.java | 18 +- .../premade/ChallengersBootsConfig.java | 2 +- .../premade/ChallengersChestplateConfig.java | 2 +- .../premade/ChallengersHelmetConfig.java | 2 +- .../premade/ChallengersLeggingsConfig.java | 2 +- .../premade/ChallengersSwordConfig.java | 2 +- .../premade/DwarvenGreedConfig.java | 2 +- .../premade/GoblinBallistaItem.java | 2 +- .../customitems/premade/GoblinBootsItem.java | 6 +- .../premade/GoblinChestplateItem.java | 7 +- .../premade/GoblinCleaverItem.java | 7 +- .../customitems/premade/GoblinHelmetItem.java | 7 +- .../premade/GoblinLeggingsItem.java | 7 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 7 +- .../premade/GruntsBootsConfig.java | 2 +- .../premade/GruntsChestplateConfig.java | 2 +- .../premade/GruntsHelmetConfig.java | 2 +- .../premade/GruntsLeggingsConfig.java | 2 +- .../premade/GruntsSwordConfig.java | 2 +- .../premade/InvictusBootsConfig.java | 7 +- .../premade/InvictusChestplateConfig.java | 7 +- .../premade/InvictusHelmetConfig.java | 7 +- .../premade/InvictusLeggingsConfig.java | 7 +- .../premade/InvictusPickaxeConfig.java | 7 +- .../premade/InvictusShovelConfig.java | 7 +- .../premade/InvictusSwordConfig.java | 7 +- .../premade/NovicesSwordConfig.java | 2 +- .../customitems/premade/TheFellerConfig.java | 2 +- .../customitems/premade/TheStingerConfig.java | 2 +- .../premade/VeteransBootsConfig.java | 2 +- .../premade/VeteransChestplateConfig.java | 2 +- .../premade/VeteransHelmetConfig.java | 2 +- .../premade/VeteransLeggingsConfig.java | 2 +- .../premade/VeteransSwordConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 4 +- ...thedralLair.java => DarkCathedralLair.off} | 0 .../premade/KnightCastleLair.java | 6 +- ...dungeon.java => PirateShipMinidungeon.off} | 0 .../enchantments/EnchantmentsConfig.java | 13 +- .../config/menus/premade/ArenaMenuConfig.java | 2 +- .../menus/premade/PlayerStatusMenuConfig.java | 2 +- .../mobproperties/MobPropertiesConfig.java | 4 +- .../mobproperties/premade/EliteBreeze.java | 17 + .../elitemobs/dungeons/EMPackage.java | 27 +- .../elitemobs/events/ActionEvent.java | 8 +- .../instanced/arena/ArenaInstance.java | 22 +- .../instanced/dungeons/DungeonInstance.java | 147 +++---- .../CurrencyCustomLootEntry.java | 4 +- .../itemconstructor/EnchantmentGenerator.java | 68 ++-- .../potioneffects/ElitePotionEffect.java | 9 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 10 +- .../elitemobs/mobconstructor/BossType.java | 1 - .../elitemobs/mobconstructor/CustomSpawn.java | 30 +- .../elitemobs/mobconstructor/EliteEntity.java | 11 +- .../custombosses/BossMusic.java | 139 +++++++ .../custombosses/CustomBossTrail.java | 10 +- .../elitemobs/pathfinding/Navigation.java | 44 -- .../powers/scripts/ScriptAction.java | 99 ++--- .../powers/scripts/ScriptConditions.java | 2 +- .../powers/scripts/ScriptParticles.java | 12 +- .../caching/ScriptActionBlueprint.java | 13 +- .../caching/ScriptParticlesBlueprint.java | 6 +- .../ScriptRelativeVectorBlueprint.java | 5 +- .../worldguard/WorldGuardCompatibility.java | 379 +++++++++--------- .../treasurechest/TreasureChest.java | 72 +--- .../elitemobs/utils/DebugBlockLocation.java | 8 +- .../elitemobs/utils/shapes/Cuboid.java | 16 +- .../versionnotifier/VersionChecker.java | 29 +- src/main/resources/plugin.yml | 3 +- 97 files changed, 1748 insertions(+), 1161 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{DarkCathedralLair.java => DarkCathedralLair.off} (100%) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{PirateShipMinidungeon.java => PirateShipMinidungeon.off} (100%) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java create mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java diff --git a/build.gradle b/build.gradle index f93122c7f..512568176 100644 --- a/build.gradle +++ b/build.gradle @@ -82,8 +82,6 @@ dependencies { implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //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 diff --git a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java new file mode 100644 index 000000000..1916f0a58 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java @@ -0,0 +1,29 @@ +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 eb42590a0..f435ce4fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -32,8 +32,6 @@ 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; @@ -79,8 +77,6 @@ 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; @@ -123,12 +119,6 @@ public static void worldScanner() { for (World world : Bukkit.getWorlds()) if (ValidWorldsConfig.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); - } } } @@ -341,8 +331,6 @@ public void onDisable() { 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..."); @@ -391,7 +379,6 @@ public void onDisable() { Repeating tasks that run as long as the server is on */ private void launchRunnables() { - if (!zoneBasedSpawningWorlds.isEmpty()) Grid.initializeGrid(); //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 75a115e83..28ece61c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -19,8 +19,6 @@ 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; @@ -105,9 +103,8 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDisenchantment()) register(new ItemDisenchantPrevention()); - if (!VersionChecker.serverVersionOlderThan(15, 2)) - if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) - register(new PreventUpgradeDiamondToNetherite()); + if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) + register(new PreventUpgradeDiamondToNetherite()); //Mob damage register(new EliteMobGenericDamagedHandler()); @@ -213,7 +210,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()); @@ -265,8 +261,7 @@ public static void registerEvents() { register(new LootMenu.LootMenuEvents()); //Minecraft behavior canceller - if (!VersionChecker.serverVersionOlderThan(16, 0)) - register(new PreventEliteBeeHiveEnter()); + register(new PreventEliteBeeHiveEnter()); register(new EnderDragonUnstuck()); if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities()) register(new VanillaReinforcementsCanceller()); @@ -286,9 +281,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()); @@ -367,10 +360,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/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index a86da6566..2f8f5258b 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -6,7 +6,6 @@ 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; @@ -16,7 +15,7 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker; import com.magmaguy.elitemobs.utils.EntityFinder; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.magmacore.util.Round; +import com.magmaguy.elitemobs.utils.Round; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -256,7 +255,6 @@ 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) return; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java index fb9391902..a3566e5c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java @@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; public class LightningImmunity implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void onLightningStrike(EntityDamageByEntityEvent event){ + @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; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index 3de63fa7d..c25f8cdc5 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.collateralminecraftchanges; import com.magmaguy.elitemobs.items.ItemTagger; -import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index c87210ed9..43bce68e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -257,30 +257,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde 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)), diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java index 322e88eeb..9b4681e3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -1,5 +1,6 @@ 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; @@ -9,7 +10,6 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; 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; @@ -27,14 +27,13 @@ */ 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()) { - String[] powersArray = powers.get().split(" "); - HashSet mobPowers = getPowers(powersArray, player); + HashSet mobPowers = getPowers(powers.get(), player); eliteEntity.applyPowers(mobPowers); } else { eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity)); @@ -47,7 +46,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, @@ -64,17 +63,14 @@ 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()) { - String[] powersArray = powers.get().split(" "); - mobPowers = getPowers(powersArray, commandSender); - } + if (powers.isPresent()) mobPowers = getPowers(powers.get(), commandSender); EliteEntity eliteEntity = new EliteEntity(); eliteEntity.setLevel(level); eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM); 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 9b2619d06..58e975378 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -57,7 +57,6 @@ public static void get(Player player, int tierLevel) { new EliteItemLore(bow, false); - player.getInventory().addItem(helmet); player.getInventory().addItem(chestplate); player.getInventory().addItem(leggings); @@ -69,7 +68,7 @@ public static void get(Player player, int tierLevel) { } - private static void addDurability(ItemStack itemStack){ + private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); HashMap enchantmentIntegerHashMap = new HashMap<>(); enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); 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 b3fee7974..29e3b0689 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,10 +1,15 @@ 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.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.ItemStackGenerator; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; +import com.magmaguy.elitemobs.utils.*; +import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -22,18 +27,20 @@ public class SetupMenu { - private static final int nextIcon = 35; - private static final int infoIcon = 4; public static Map setupMenus = new HashMap<>(); - private static List emPackages = new ArrayList<>(); - private final int previousIcon = 27; + Inventory inventory; Player player; + private static final int nextIcon = 35; + private static final int infoIcon = 4; + 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; HashMap minidungeonHashMap = new HashMap<>(); @Getter private int currentPage = 1; + boolean adventurersGuildIsDownloaded = false; public SetupMenu(Player player) { this.inventory = Bukkit.createInventory(player, 54, "Setup menu"); @@ -49,43 +56,13 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup return; } - 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(); + 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")); } } @@ -96,6 +73,8 @@ 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 @@ -134,6 +113,90 @@ 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()) + 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(); + } + } + + 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; @@ -141,7 +204,7 @@ private void dungeonStatuses() { if (currentPage != 1) dungeonCounter = validSlots.size() * (currentPage - 1) - 2; else - inventoryLocationCounter = 1; + inventoryLocationCounter = 2; List rawEmPackages = EMPackage.getEmPackages().values().stream().toList(); List alphabeticalSort = new ArrayList<>(); rawEmPackages.forEach(iteratedPackage -> alphabeticalSort.add(ChatColor.stripColor(ChatColorConverter.convert(iteratedPackage.getDungeonPackagerConfigFields().getName())))); @@ -153,19 +216,34 @@ private void dungeonStatuses() { })); minidungeonHashMap.clear(); for (int i = dungeonCounter; i < emPackages.size(); i++) { - if (currentPage == 1 && minidungeonHashMap.size() > validSlots.size() - 2) break; + if (currentPage == 1 && minidungeonHashMap.size() > validSlots.size() - 3) break; if (inventoryLocationCounter >= validSlots.size()) break; EMPackage emPackage = emPackages.get(i); - addDungeonPackagerContent(emPackage, inventoryLocationCounter); - + 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; + } minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; inventoryLocationCounter++; } } - private void addDungeonPackagerContent(EMPackage emPackage, int counter) { + private void addWorldDungeon(EMPackage emPackage, int counter) { String itemName = emPackage.getDungeonPackagerConfigFields().getName(); List lore = new ArrayList<>(); @@ -177,9 +255,26 @@ private void addDungeonPackagerContent(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()) @@ -191,15 +286,17 @@ 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!"); @@ -220,10 +317,10 @@ private void customResourcePackStatus() { String state = "Custom resource pack is"; String lore; Material material; - boolean resourceState = Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager"); + boolean resourceState = ResourcePackDataConfig.isEliteMobsResourcePackEnabled(); if (!resourceState) { - material = Material.YELLOW_STAINED_GLASS_PANE; + material = Material.ORANGE_STAINED_GLASS_PANE; lore = ChatColor.RED + "Not enabled! Click to enable!"; } else { material = Material.GREEN_STAINED_GLASS_PANE; @@ -233,6 +330,29 @@ 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) { @@ -246,6 +366,11 @@ 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/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index c47c3692e..64093b316 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,20 +1,97 @@ 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.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.ItemStackGenerator; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.WarningMessage; 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 extends com.magmaguy.magmacore.config.ConfigurationEngine { +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) { + 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 static String setString(File file, FileConfiguration fileConfiguration, String key, String defaultValue, boolean translatable) { fileConfiguration.addDefault(key, defaultValue); @@ -30,6 +107,29 @@ 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) @@ -44,6 +144,39 @@ 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()) @@ -56,20 +189,20 @@ public static ItemStack setItemStack(File file, FileConfiguration fileConfigurat try { material = Material.valueOf(fileConfiguration.getString(key + ".material")); } catch (Exception ex) { - Logger.warn("Material type " + fileConfiguration.getString(key + ".material") + " is not valid! Correct it to make a valid item."); + new WarningMessage("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); } catch (Exception ex) { - Logger.warn("Item name " + fileConfiguration.getString(key + ".name") + " is not valid! Correct it to make a valid item."); + new WarningMessage("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); } catch (Exception ex) { - Logger.warn("Item lore " + fileConfiguration.getString(key + ".lore") + " is not valid! Correct it to make a valid item."); + 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) @@ -77,4 +210,19 @@ 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 d0fbb9990..22fbef2d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -1,89 +1,131 @@ package com.magmaguy.elitemobs.config; +import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.magmacore.util.Logger; -import org.bukkit.scheduler.BukkitRunnable; +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 java.io.*; -import java.net.HttpURLConnection; -import java.net.URL; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; 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() { - 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(); - } + 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(); } - }.runTaskAsynchronously(MetadataHandler.PLUGIN); - } + return; + } - 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); - } + 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!"); + } - // Opens input stream from the HTTP connection - InputStream inputStream = httpConn.getInputStream(); - String saveFilePathWithName = saveFilePath + File.separatorChar + fileName; + } - // Opens an output stream to save into file - FileOutputStream outputStream = new FileOutputStream(saveFilePathWithName); + 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; + } - int bytesRead = -1; - byte[] buffer = new byte[4096]; - while ((bytesRead = inputStream.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesRead); - } + 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")); + } - outputStream.close(); - inputStream.close(); + 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 { - Logger.warn("No file to download. Server replied HTTP code: " + responseCode); + 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)); + } + + } + + 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; + } + + + 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; + } + + 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; } - httpConn.disconnect(); + 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; + } + 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); } public static byte[] sha1CodeByteArray(File file) throws IOException, NoSuchAlgorithmException { @@ -95,4 +137,49 @@ 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/CustomConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java new file mode 100644 index 000000000..1848717fe --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java @@ -0,0 +1,193 @@ +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 validity 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() + " ! You should probably delete that file."); +// ex.printStackTrace(); + } + + } + +} diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index 6972a4ecf..bb73aa64f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -1,23 +1,23 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.commands.ReloadCommand; +import com.magmaguy.elitemobs.commands.admin.ReloadCommand; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.InfoMessage; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import java.io.File; import java.util.List; /** * Created by MagmaGuy on 08/06/2017. */ -public class DefaultConfig extends ConfigurationFile { - @Getter - public static DefaultConfig instance; +public class DefaultConfig { @Getter private static boolean alwaysShowNametags; @Getter @@ -74,35 +74,28 @@ public class DefaultConfig extends ConfigurationFile { private static String treasureChestNoDropMessage; @Getter private static String bossAlreadyGoneMessage; - @Getter - private static boolean resetPlayerScaleOnLogin; - @Getter - private static boolean forceMenuUnicode; - public DefaultConfig() { - super("config.yml"); - instance = this; + private static File file = null; + private static FileConfiguration fileConfiguration = null; + + private DefaultConfig() { } public static void toggleSetupDone() { setupDone = !setupDone; - instance.fileConfiguration.set("setupDoneV3", setupDone); + fileConfiguration.set("setupDoneV3", setupDone); save(); } public static void save() { - ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); + ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - public static void setLanguage(CommandSender commandSender, String filename) { - language = filename; - instance.fileConfiguration.set("language", filename); - ConfigurationEngine.fileSaverCustomValues(instance.fileConfiguration, instance.file); - ReloadCommand.reload(commandSender); - } - @Override - public void initializeValues() { + public static void initializeConfig() { + + file = ConfigurationEngine.fileCreator("config.yml"); + fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); //The language changes what data is loaded downstream language = ConfigurationEngine.setString( List.of("Sets the language file used by EliteMobs", "Do NOT change this manually! It is meant to be installed with the command '/em language '"), @@ -130,7 +123,7 @@ public void initializeValues() { fileConfiguration, "enableHighCompatibilityMode", false); if (Bukkit.getPluginManager().isPluginEnabled("MythicMobs") || Bukkit.getPluginManager().isPluginEnabled("LevelledMobs")) { - Logger.info("Other boss mob plugins have been detected, high compatibility mode will be used!"); + new InfoMessage("Other boss mob plugins have been detected, high compatibility mode will be used!"); doStrictSpawningRules = true; } nightmareWorldSpawnBonus = ConfigurationEngine.setDouble( @@ -155,7 +148,7 @@ public void initializeValues() { file, fileConfiguration, "defaultSpawnLocation", ConfigurationLocation.deserialize(Bukkit.getWorlds().get(0).getSpawnLocation()), false)); } catch (Exception ex) { - Logger.warn("There is an issue with your defaultSpawnLocation in the config.yml configuration file! Fix it!"); + new WarningMessage("There is an issue with your defaultSpawnLocation in the config.yml configuration file! Fix it!"); } doExplosionRegen = ConfigurationEngine.setBoolean( @@ -203,7 +196,16 @@ public void initializeValues() { 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); - 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); + + + ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); + } + + 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/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index 20a73bea6..9aef67a34 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,17 +1,17 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; -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 extends ConfigurationFile { +public class EconomySettingsConfig { @Getter private static boolean enableEconomy; @Getter @@ -82,26 +82,14 @@ public class EconomySettingsConfig extends ConfigurationFile { private static String shopBatchSellMessage; - public EconomySettingsConfig() { - super("EconomySettings.yml"); + private EconomySettingsConfig() { } - 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 void initializeConfig() { - public static double getMaterialWorth(Material material) { - try { - return thisConfiguration.getDouble("materialWorth." + material.name()); - } catch (Exception ex) { - return defaultMaterialWorth; - } - } + File file = ConfigurationEngine.fileCreator("EconomySettings.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - @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; @@ -276,5 +264,23 @@ public void initializeValues() { 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/ItemUpgradeSystemConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java new file mode 100644 index 000000000..53be17872 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java @@ -0,0 +1,28 @@ +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 index 3a0b9fcdd..d71f4b62e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -1,7 +1,5 @@ package com.magmaguy.elitemobs.config; -import org.bukkit.Particle; - import java.util.Locale; public class LegacyValueConverter { @@ -10,7 +8,7 @@ private LegacyValueConverter() { public static String parseEnchantment(String materialName) { switch (materialName.toUpperCase(Locale.ROOT)) { - case "ARROW_DAMAGE": + case "POWER": return "POWER"; case "ARROW_FIRE": return "FLAME"; @@ -18,15 +16,15 @@ public static String parseEnchantment(String materialName) { return "INFINITY"; case "ARROW_KNOCKBACK": return "PUNCH"; - case "DAMAGE_ARTHROPODS": + case "BANE_OF_ARTHROPODS": return "BANE_OF_ARTHROPODS"; - case "DAMAGE_UNDEAD": + case "SMITE": return "SMITE"; - case "DIG_SPEED": + case "EFFICIENCY": return "EFFICIENCY"; case "DURABILITY": return "UNBREAKING"; - case "LOOT_BONUS_BLOCKS": + case "FORTUNE": return "FORTUNE"; case "LOOT_BONUS_MOBS": return "LOOTING"; @@ -38,13 +36,13 @@ public static String parseEnchantment(String materialName) { return "PROTECTION"; case "BLAST_PROTECTION": return "BLAST_PROTECTION"; - case "PROTECTION_FALL": + case "FEATHER_FALLING": return "FEATHER_FALLING"; - case "PROTECTION_FIRE": + case "FIRE_PROTECTION": return "FIRE_PROTECTION"; - case "PROTECTION_PROJECTILE": + case "PROJECTILE_PROTECTION": return "PROJECTILE_PROTECTION"; - case "WATER_WORKER": + case "AQUA_AFFINITY": return "AQUA_AFFINITY"; default: return materialName; @@ -75,47 +73,4 @@ public static String parsePotionEffect(String potionEffectName) { 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/ModelsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java index 0114dfdaf..01b60cec2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -1,20 +1,24 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.magmacore.config.ConfigurationFile; +import org.bukkit.configuration.file.FileConfiguration; +import java.io.File; import java.util.List; -public class ModelsConfig extends ConfigurationFile { +public class ModelsConfig { + private ModelsConfig() { + } + public static String treasureChest; - public ModelsConfig() { - super("Models.yml"); - } + public static void initializeConfig() { + File file = ConfigurationEngine.fileCreator("Models.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - @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/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java index fa5a2824c..90a6d68a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -4,8 +4,7 @@ import com.magmaguy.elitemobs.quests.objectives.DialogObjective; import com.magmaguy.elitemobs.quests.objectives.KillObjective; import com.magmaguy.elitemobs.quests.objectives.Objective; -import com.magmaguy.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -16,7 +15,7 @@ import java.util.Arrays; import java.util.List; -public class QuestsConfig extends ConfigurationFile { +public class QuestsConfig { @Getter private static boolean requireQuestTurnIn; @@ -105,93 +104,12 @@ public class QuestsConfig extends ConfigurationFile { @Getter private static int itemEntryCharacterLimitBedrockMenu; - public QuestsConfig() { - super("Quests.yml"); + private QuestsConfig() { } - 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() - )); - - 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) { - 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() { + public static void initializeConfig() { + File file = ConfigurationEngine.fileCreator("Quests.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); requireQuestTurnIn = ConfigurationEngine.setBoolean( List.of("Sets if quests have to be returned to quest givers to complete the quest."), @@ -333,5 +251,87 @@ public void initializeValues() { 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() + )); + + 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 new file mode 100644 index 000000000..1a077e54a --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java @@ -0,0 +1,102 @@ +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/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index 536569ffa..2afad9dc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -1,15 +1,15 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.configuration.file.FileConfiguration; +import java.io.File; import java.util.HashMap; import java.util.List; -public class SpecialItemSystemsConfig extends ConfigurationFile { +public class SpecialItemSystemsConfig { @Getter private static final HashMap specialValues = new HashMap<>(); @@ -40,25 +40,12 @@ public class SpecialItemSystemsConfig extends ConfigurationFile { @Getter private static String challengeAnnouncement; - public SpecialItemSystemsConfig() { - super("SpecialItemSystems.yml"); - } - - 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() { + public static void initializeConfig() { specialValues.clear(); + File file = ConfigurationEngine.fileCreator("SpecialItemSystems.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + dropSpecialLoot = ConfigurationEngine.setBoolean( List.of("Sets if special loot will drop."), fileConfiguration, "dropSpecialLoot", true); @@ -165,5 +152,17 @@ public void initializeValues() { 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/ValidWorldsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java index fe1a8dc9e..e93f52dbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -1,37 +1,28 @@ 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 extends ConfigurationFile { +public class ValidWorldsConfig { @Getter private static final List validWorlds = new ArrayList<>(); @Getter - private static ValidWorldsConfig instance; + private static FileConfiguration fileConfiguration; + private static File file; - public ValidWorldsConfig() { - super("ValidWorlds.yml"); - instance = this; + private ValidWorldsConfig() { } - public static void addWorld(String worldName) { - if (instance.fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return; - - 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); - } - - @Override - public void initializeValues() { + public static void initializeConfig() { + file = ConfigurationEngine.fileCreator("ValidWorlds.yml"); + fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); for (World world : Bukkit.getWorlds()) ConfigurationEngine.setBoolean(fileConfiguration, "Valid worlds." + world.getName(), true); @@ -41,5 +32,19 @@ public void initializeValues() { for (String key : validWorldsSection.getKeys(false)) if (validWorldsSection.getBoolean(key)) validWorlds.add(key); + + 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/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index b0e1f3584..898bc3ae7 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,16 @@ 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.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.Material; @@ -19,7 +20,7 @@ import java.util.*; -public class CustomBossesConfigFields extends CustomConfigFields { +public class CustomBossesConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { @Getter private static final Map regionalElites = new HashMap<>(); @@ -216,8 +217,6 @@ public class CustomBossesConfigFields extends CustomConfigFields { 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. @@ -245,7 +244,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")) @@ -272,7 +271,7 @@ public int getLevel() { try { return Integer.valueOf(level); } catch (Exception ex) { - Logger.warn("Regional Elite Mob level for " + getFilename() + " is neither numeric nor dynamic. Fix the configuration for it."); + new WarningMessage("Regional Elite Mob level for " + getFilename() + " is neither numeric nor dynamic. Fix the configuration for it."); return 1; } } @@ -284,7 +283,7 @@ public void setOnSpawnBlockStates(List onSpawnBlockStates) { try { fileConfiguration.save(file); } catch (Exception ex) { - Logger.warn("Failed to save on spawn block states!", true); + new WarningMessage("Failed to save on spawn block states!", true); } } @@ -294,7 +293,7 @@ public void setOnRemoveBlockStates(List onRemoveBlockStates) { try { fileConfiguration.save(file); } catch (Exception ex) { - Logger.warn("Failed to save on remove block states!", true); + new WarningMessage("Failed to save on remove block states!", true); } } @@ -304,7 +303,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) { - Logger.warn("Failed to get plugin data for entity type " + entityType.toString() + " in file " + filename + " ! Defaulting to zombie."); + new WarningMessage("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); @@ -338,7 +337,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)) { - 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."); + 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."); this.mountedEntity = null; } this.customModelMountPointID = processString("customModelMountPointID", customModelMountPointID, null, false); @@ -391,10 +390,8 @@ public void processConfigFields() { 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!"); + new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); } - - this.scale = processDouble("scale", scale, 1, false); } public boolean isCustomModelExists() { @@ -419,16 +416,16 @@ private HashMap processDamageModifiers(String path, HashMap 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"); + new WarningMessage("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]); + 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"); + new WarningMessage("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(","); @@ -123,10 +126,5 @@ private void updatePostProcessor() { } } 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/ChallengersBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/ChallengersBootsConfig.java index ccfac6f38..722f4e7e8 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 36f4ced2f..af578aa61 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 c5af48d8d..e09906e3b 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 3d82b0ca9..18192d44d 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 1db6f4ca5..a760313e7 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/DwarvenGreedConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DwarvenGreedConfig.java index 418e667b8..cd672c0c7 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 @@ -13,7 +13,7 @@ public DwarvenGreedConfig() { 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", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("FORTUNE,4", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/GoblinBallistaItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinBallistaItem.java index 5c7be6b92..051a010f0 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 @@ -14,7 +14,7 @@ public GoblinBallistaItem() { Material.CROSSBOW, "&8Goblin Ballista", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "QUICK_CHARGE,3", "MULTISHOT,1")); + setEnchantments(Arrays.asList("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 f0ff0e047..824e68316 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,7 +2,6 @@ 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; @@ -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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setMaterial(Material.NETHERITE_BOOTS); + setEnchantments(Arrays.asList("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 70aaec84d..a6d88b11b 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 0538c35be..4634322c2 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 1162ad080..0fdb800ea 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 897d3746b..c3e741248 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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,1", "PROTECTION_EXPLOSIONS,1", "PROTECTION_PROJECTILE,1", "UNBREAKING,1")); + setEnchantments(Arrays.asList("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 b526d6687..1f909e5d8 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 @@ -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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 24d535131..1a6fb6613 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("ARROW_DAMAGE,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,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 1fae1f440..7e3eef251 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,7 +2,6 @@ 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; @@ -12,12 +11,10 @@ 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", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,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 7fa585ec3..58bebb3fc 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,5", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 98fb62745..4b9e48791 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 ac575075a..9a9dd33b4 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 ee4d9ad47..7439c8751 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 b74955375..111c8de7a 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 5862f2613..8ea25d6f4 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_boots", true, Material.NETHERITE_BOOTS, "&4Invictus Boots", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 260a1c496..cd9caded1 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_chestplate", true, Material.NETHERITE_CHESTPLATE, "&4Invictus Chestplate", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 7d3c68654..12beeca3a 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_helmet", true, Material.NETHERITE_HELMET, "&4Invictus Helmet", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 2d1efceec..5d0f114e3 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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,5", "PROTECTION_EXPLOSIONS,4", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + super("invictus_leggings", true, Material.NETHERITE_LEGGINGS, "&4Invictus Leggings", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 8cc544edc..7b43f3e85 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_pickaxe", true, Material.NETHERITE_PICKAXE, "&4Invictus Pickaxe", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 ec619b4a5..dab2b0359 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_shovel", true, Material.NETHERITE_SHOVEL, "&4Invictus Shovel", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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 d2adb23c1..72e8632ca 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,7 +2,6 @@ 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; @@ -10,10 +9,8 @@ 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", "UNBREAKING,5")); + super("invictus_sword", true, Material.NETHERITE_SWORD, "&4Invictus Sword", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); + setEnchantments(Arrays.asList("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/NovicesSwordConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/NovicesSwordConfig.java index 4b042a516..08395d999 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/TheFellerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/TheFellerConfig.java index 870774e8c..956586568 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 @@ -13,7 +13,7 @@ public TheFellerConfig() { 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", "UNBREAKING,6", "DIG_SPEED,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("FORTUNE,4", "SILK_TOUCH,1", "UNBREAKING,6", "EFFICIENCY,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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 7564e67c5..8ddacaf59 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 @@ -14,7 +14,7 @@ public TheStingerConfig() { Material.GOLDEN_SWORD, "&eThe Stinger", Arrays.asList("&aFloat like a butterfly,", "&asting like a bee!")); - setEnchantments(Arrays.asList("DAMAGE_ALL,1", "UNBREAKING,1", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("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/VeteransBootsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/VeteransBootsConfig.java index fa3e7ae30..8860d84b7 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 213a0facb..9284f9720 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 a702eeac8..bdb6b7cf0 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 f812d7d5b..b9c51e254 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 @@ -9,7 +9,7 @@ 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,5", "PROTECTION_PROJECTILE,4", "MENDING,1", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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 436c6204e..bfbadbfcd 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 @@ -9,7 +9,7 @@ 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", "UNBREAKING,5")); + setEnchantments(Arrays.asList("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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index ea50b9ea5..9fb072f1c 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); setPotionEffects(Arrays.asList("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 87c897770..cfc38d25e 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 @@ -13,8 +13,8 @@ public ZombieKingsAxeConfig() { 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", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "WATER_WORKER,5", "FLAMETHROWER,1")); + setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", + "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); setPotionEffects(Arrays.asList("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/dungeonpackager/premade/DarkCathedralLair.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off 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 015ea0546..2b2ed7af9 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 @@ -9,7 +9,7 @@ public class KnightCastleLair extends DungeonPackagerConfigFields { public KnightCastleLair() { super("knights_castle_lair", - true, + false, "&2[lvl 095] &fThe Knight's Castle", List.of("&fChallenge the knights of the castle!"), DiscordLinks.freeMinidungeons, @@ -24,7 +24,7 @@ public KnightCastleLair() { "&6Face an honorable duel!", "&fAssault the castle!", "&fNow leaving the castle!", - "the_knight_castle", - false); + "the_knight_castle" + ); } } 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.off similarity index 100% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off 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 737597ab8..16bd68c60 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java @@ -1,8 +1,7 @@ package com.magmaguy.elitemobs.config.enchantments; -import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.magmacore.config.CustomConfig; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -22,14 +21,12 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { - String newString = LegacyValueConverter.parseEnchantment(string.replace(".yml", "")) + ".yml"; - newString = newString.toLowerCase(Locale.ROOT); - EnchantmentsConfigFields test = enchantments.get(newString); + EnchantmentsConfigFields test = enchantments.get(string); if (test == null) { - Logger.warn("Failed to find enchant file " + newString); + new WarningMessage("Failed to find enchant file " + string); new Exception().printStackTrace(); } - return enchantments.get(newString); + return enchantments.get(string); } public static EnchantmentsConfigFields getEnchantment(Enchantment enchantment) { 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 05f5f9dd2..90c0f330b 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,7 +3,7 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; -import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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 078211799..bc487f6e2 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,7 +4,7 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.menus.MenusConfigFields; import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen; -import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; 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 a2016203e..487606694 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -56,8 +56,8 @@ public class MobPropertiesConfig { new EliteHoglinConfig(), new ElitePiglinBruteConfig(), new EliteBeeConfig(), - new EliteBreezeConfig(), - new EliteWitherConfig() + new EliteBreeze() + )); public static HashMap getMobProperties() { diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java new file mode 100644 index 000000000..e89c9d654 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.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 EliteBreeze extends MobPropertiesConfigFields { + public EliteBreeze() { + super("elite_breeze", + EntityType.BOGGED, + 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/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 28622a17f..49b1dd578 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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.entity.Player; @@ -72,17 +72,28 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - 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."); + new WarningMessage("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; + } + } 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 WarningMessage("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 */ @@ -115,7 +126,7 @@ public boolean install(Player player) { * @param player Player installing the content * @return Whether the content was installed correctly */ - public boolean install() { + public boolean install(Player player, boolean paste) { DungeonInstallEvent event = new DungeonInstallEvent(dungeonPackagerConfigFields); new EventCaller(event); if (!event.isCancelled()) isInstalled = true; diff --git a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 43dd58b52..7df8ac857 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -7,7 +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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -55,7 +55,9 @@ public static void initializeBlueprintEvents() { for (CustomEventsConfigFields customEventsConfigFields : CustomEventsConfig.getCustomEvents().values()) { if (customEventsConfigFields.isEnabled()) switch (customEventsConfigFields.getEventType()) { - case BREAK_BLOCK, FISH, TILL_SOIL: + case BREAK_BLOCK: + case FISH: + case TILL_SOIL: blueprintEvents.add(new ActionEvent(customEventsConfigFields)); break; default: @@ -90,7 +92,7 @@ public void instantiateEvent(Location location, Player player) { for (String filename : primaryCustomBossFilenames) { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(filename); if (customBossEntity == null) { - Logger.warn("Failed to generate custom boss " + filename + " ! This has cancelled action event " + customEventsConfigFields.getFilename() + " !"); + new WarningMessage("Failed to generate custom boss " + filename + " ! This has cancelled action event " + customEventsConfigFields.getFilename() + " !"); return; } customBossEntity.spawn(actionEvent.getEventStartLocation(), false); 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 467f217c5..d05ed83d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -1,5 +1,6 @@ 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; @@ -14,9 +15,8 @@ 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; @@ -113,14 +113,14 @@ public ArenaInstance(CustomArenasConfigFields customArenasConfigFields, Location try { wave = Integer.parseInt(finalString[1]); } catch (Exception ex) { - Logger.warn("Failed to parse wave for entry " + subString + " for arena " + customArenasConfigFields.getFilename()); + new WarningMessage("Failed to parse wave for entry " + subString + " for arena " + customArenasConfigFields.getFilename()); } break; case "message": message = finalString[1]; break; default: - Logger.warn("Failed to parse arena message entry " + subString + " for arena " + customArenasConfigFields.getFilename()); + new WarningMessage("Failed to parse arena message entry " + subString + " for arena " + customArenasConfigFields.getFilename()); } } if (!message.isEmpty() && wave > 0) waveMessage.put(wave, ChatColorConverter.convert(message)); @@ -135,11 +135,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) { - //Logger.warn("Failed to correctly initialize arena " + customArenasConfigFields.getFilename() + " due to invalid locations for corner1/corner2/startLocation/exitLocation"); + //new WarningMessage("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) { - //Logger.warn("Failed to correctly initialize arena " + customArenasConfigFields.getFilename() + " due to invalid world for corner1/corner2/startLocation/exitLocation"); + //new WarningMessage("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 +160,7 @@ public void addSpawnPoints(List rawSpawnPoints) { location = splitSubEntry[1]; break; default: - Logger.warn("Invalid entry for the spawn points of instanced content: " + splitSubEntry[0]); + new WarningMessage("Invalid entry for the spawn points of instanced content: " + splitSubEntry[0]); break; } } @@ -244,7 +244,7 @@ private void spawnBosses() { if (!arenaEntity.isMythicMob()) { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(arenaEntity.getBossfile()); if (customBossEntity == null) { - Logger.warn("Failed to generate custom boss " + arenaEntity.getBossfile() + " because the filename was not valid!"); + new WarningMessage("Failed to generate custom boss " + arenaEntity.getBossfile() + " because the filename was not valid!"); continue; } customBossEntity.setNormalizedCombat(); @@ -253,7 +253,7 @@ private void spawnBosses() { customBossEntity.setRandomLoot(false); customBossEntity.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), true); if (!customBossEntity.exists()) { - Logger.warn("Arena " + getCustomArenasConfigFields().getArenaName() + " failed to spawn boss " + customBossEntity.getCustomBossesConfigFields().getFilename()); + new WarningMessage("Arena " + getCustomArenasConfigFields().getArenaName() + " failed to spawn boss " + customBossEntity.getCustomBossesConfigFields().getFilename()); continue; } else customBosses.add(customBossEntity); @@ -263,9 +263,9 @@ private void spawnBosses() { Entity mythicMob = MythicMobsInterface.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), arenaEntity.getBossfile(), arenaEntity.getLevel()); if (mythicMob != null) nonEliteMobsEntities.add(mythicMob); 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!"); + 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) { - 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!"); + 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!"); } } } 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 94b26f0c1..bd09fa72a 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,14 +14,9 @@ import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; -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 com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; +import com.magmaguy.elitemobs.utils.*; import lombok.Getter; -import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -72,7 +67,14 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, this.difficultyName = difficultyName; setDifficulty(difficultyName); addNewPlayer(player); - new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); + 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); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -98,7 +100,12 @@ public static void setupInstancedDungeon(Player player, String instancedDungeonC cloneWorldFiles(instancedDungeonsConfigFields, instancedWorldName, player)); future.thenAccept(file -> { if (file == null) return; - new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); + new BukkitRunnable() { + @Override + public void run() { + initializeInstancedWorld(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName); + } + }.runTask(MetadataHandler.PLUGIN); }); } @@ -129,11 +136,13 @@ protected static DungeonInstance initializeInstancedWorld(DungeonPackagerConfigF Player player, File targetFile, String difficultyName) { - World world = DungeonUtils.loadWorld(instancedWordName, instancedDungeonsConfigFields.getEnvironment(), instancedDungeonsConfigFields); + World world = DungeonUtils.loadWorld(instancedWordName, instancedDungeonsConfigFields.getEnvironment()); 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()); @@ -192,7 +201,14 @@ public void endMatch() { return; } announce(DungeonsConfig.getInstancedDungeonCompleteMessage()); - new DestroyMatchTask().runTaskLater(MetadataHandler.PLUGIN, 2 * 60 * 20L); + 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); } @Override @@ -208,11 +224,33 @@ public void removeInstance() { instances.remove(this); DungeonInstance dungeonInstance = this; if (world == null) { - Logger.warn("Instanced dungeon's world was already unloaded before removing the entities in it! This shouldn't happen, but doesn't break anything."); + new WarningMessage("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 RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); + 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 } private void setDifficulty(String difficultyName) { @@ -227,7 +265,7 @@ private void setDifficulty(String difficultyName) { break; } if (difficulty == null) { - Logger.warn("Failed to set difficulty " + difficulty + " for instanced dungeon " + dungeonPackagerConfigFields.getFilename()); + new WarningMessage("Failed to set difficulty " + difficulty + " for instanced dungeon " + dungeonPackagerConfigFields.getFilename()); return; } @@ -235,7 +273,7 @@ private void setDifficulty(String difficultyName) { try { this.levelSync = MapListInterpreter.parseInteger("levelSync", difficulty.get("levelSync"), dungeonPackagerConfigFields.getFilename()); } catch (Exception exception) { - Logger.warn("Incorrect level sync entry for dungeon " + dungeonPackagerConfigFields.getFilename() + " ! Value: " + levelSync + " . No level sync will be applied!"); + new WarningMessage("Incorrect level sync entry for dungeon " + dungeonPackagerConfigFields.getFilename() + " ! Value: " + levelSync + " . No level sync will be applied!"); this.levelSync = 0; } } else @@ -252,83 +290,4 @@ 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/items/customloottable/CurrencyCustomLootEntry.java b/src/main/java/com/magmaguy/elitemobs/items/customloottable/CurrencyCustomLootEntry.java index ef49f86ae..4816fed96 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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -85,7 +85,7 @@ public CurrencyCustomLootEntry(List entries, Map configMa case "amount" -> setAmount(MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename)); case "currencyamount" -> currencyAmount = MapListInterpreter.parseInteger(key, mapEntry.getValue(), configFilename); - default -> Logger.warn("Failed to read custom loot option " + key + " in " + configFilename); + default -> new WarningMessage("Failed to read custom loot option " + key + " in " + configFilename); } } entries.add(this); 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 48f41b6c8..3af70a168 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,9 +71,9 @@ 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("SHARPNESS")); + validEnchantments.putAll(validateEnchantments("BANE_OF_ARTHROPODS")); + validEnchantments.putAll(validateEnchantments("SMITE")); validEnchantments.putAll(validateEnchantments("UNBREAKING")); validEnchantments.putAll(validateEnchantments("FIRE_ASPECT")); validEnchantments.putAll(validateEnchantments("KNOCKBACK")); @@ -83,7 +83,7 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("VANISHING_CURSE")); break; case BOW: - validEnchantments.putAll(validateEnchantments("ARROW_DAMAGE")); + validEnchantments.putAll(validateEnchantments("POWER")); validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); @@ -92,7 +92,7 @@ public static HashMap generateEnchantments(double itemTier 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")); @@ -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("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("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,13 +137,13 @@ 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("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")); } @@ -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("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: @@ -177,13 +177,13 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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: @@ -193,9 +193,9 @@ public static HashMap generateEnchantments(double itemTier 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; @@ -208,9 +208,9 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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; @@ -223,10 +223,10 @@ public static HashMap generateEnchantments(double itemTier validEnchantments.putAll(validateEnchantments("BINDING_CURSE")); 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")); @@ -241,7 +241,7 @@ public static HashMap generateEnchantments(double itemTier 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("UNBREAKING")); 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 268cd32ef..a591776c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -1,8 +1,7 @@ package com.magmaguy.elitemobs.items.potioneffects; -import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfig; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import org.bukkit.NamespacedKey; import org.bukkit.Registry; import org.bukkit.potion.PotionEffect; @@ -21,9 +20,9 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", stringObject[0].toLowerCase(Locale.ROOT))); if (potionEffectType == null) { - Logger.warn("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); + new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; } if (potionEffectType.equals(PotionEffectType.NIGHT_VISION)) @@ -51,7 +50,7 @@ public ElitePotionEffect(String string) { Integer.parseInt(stringObject[1])); } catch (Exception ex) { - Logger.warn("Detected invalid potion effect entry: " + string); + new WarningMessage("Detected invalid potion effect entry: " + string); ex.printStackTrace(); } } diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index 67d3dfef0..2fc5c4b40 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,7 +1,8 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.config.DefaultConfig; +import com.magmaguy.elitemobs.ChatColorConverter; 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; @@ -10,8 +11,7 @@ import com.magmaguy.elitemobs.items.ShareItem; import com.magmaguy.elitemobs.items.upgradesystem.EliteEnchantmentItems; import com.magmaguy.elitemobs.items.upgradesystem.UpgradeSystem; -import com.magmaguy.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Round; +import com.magmaguy.elitemobs.utils.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 (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) + if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) name = ChatColor.WHITE + "\uF801\uDB80\uDC2A\uF805 " + MENU_NAME; Inventory inventory = Bukkit.createInventory(player, 54, name); ItemEnchantMenuEvents.menus.add(inventory); @@ -212,7 +212,7 @@ 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 + //Make sure enchant books themselves can't be enchanted { } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java index 4009119dd..98bde5175 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -4,6 +4,5 @@ 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 2fcb4547a..54233739c 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -8,13 +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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.DebugMessage; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.*; @@ -58,14 +58,14 @@ public CustomSpawn(String customSpawnConfig, List customBossesFilenames, this.timedEvent = timedEvent; if (customSpawnConfigFields == null) { - Logger.warn("Invalid custom spawn detected for file " + customSpawnConfig + " in event " + timedEvent.getCustomEventsConfigFields().getFilename()); + new WarningMessage("Invalid custom spawn detected for file " + customSpawnConfig + " in event " + timedEvent.getCustomEventsConfigFields().getFilename()); return; } customBossesFilenames.forEach(bossString -> { CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(bossString); if (customBossesConfigFields == null) { - Logger.warn("Attempted to pass invalid boss into CustomSpawn: " + bossString); + new WarningMessage("Attempted to pass invalid boss into CustomSpawn: " + bossString); return; } CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields); @@ -77,7 +77,7 @@ public CustomSpawn(String customSpawnConfig, List customBossesFilenames, public CustomSpawn(String customSpawnConfig, CustomBossEntity customBossEntity) { this.customSpawnConfigFields = CustomSpawnConfig.getCustomEvent(customSpawnConfig); if (customSpawnConfigFields == null) { - Logger.warn("Invalid custom spawn detected for file " + customSpawnConfig); + new WarningMessage("Invalid custom spawn detected for file " + customSpawnConfig); return; } customBossEntities.add(customBossEntity); @@ -115,6 +115,7 @@ public void run() { }.runTaskAsynchronously(MetadataHandler.PLUGIN); else spawn(); + } private void spawn() { @@ -128,7 +129,7 @@ public void run() { return; } //One last check - //Last line of defense - spawn a test mob. If some unknown protection system prevents spawning it should prevent this + //Last line of defense - spawn a test mob. If some uknown protection system prevents spawning it should prevent this LivingEntity testEntity = spawnLocation.getWorld().spawn(spawnLocation, Zombie.class); if (!testEntity.isValid()) { spawnLocation = null; @@ -164,12 +165,13 @@ 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.getNextEventStartMinimum()) { + /* + if (timedEvent != null && System.currentTimeMillis() < TimedEvent.getNextEventTrigger()) { Bukkit.getScheduler().scheduleAsyncDelayedTask(MetadataHandler.PLUGIN, this::generateCustomSpawn, 20 * 60L); return; } + */ int maxTries = 100; int tries = 0; @@ -189,6 +191,8 @@ 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 { @@ -198,21 +202,22 @@ public void run() { })); } } else { + if (isEvent) new DebugMessage("Spawned bosses for event after " + allTries + " tries"); spawn(); } } public Location generateRandomSpawnLocation() { if (customSpawnConfigFields == null) { - Logger.warn("Something tried to spawn but has invalid custom spawn config fields! This isn't good.", true); - Logger.warn("Bosses: "); + new WarningMessage("Something tried to spawn but has invalid custom spawn config fields! This isn't good.", true); + new WarningMessage("Bosses: "); getCustomBossEntities().forEach((customBossEntity) -> { if (customBossEntity != null) if (customBossEntity.getName() != null) - Logger.warn(customBossEntity.getCustomBossesConfigFields().getName()); + new WarningMessage(customBossEntity.getCustomBossesConfigFields().getName()); }); if (timedEvent != null) { - Logger.warn("Event: " + timedEvent.getCustomEventsConfigFields().getFilename()); + new WarningMessage("Event: " + timedEvent.getCustomEventsConfigFields().getFilename()); timedEvent.end(); } return null; @@ -235,7 +240,6 @@ public Location generateRandomSpawnLocation() { Location playerLocation = player.getLocation(); if (!ValidWorldsConfig.getValidWorlds().contains(playerLocation.getWorld().getName())) 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()) diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index bb4e7e568..879e9c211 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -1,5 +1,6 @@ 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; @@ -21,8 +22,7 @@ import com.magmaguy.elitemobs.powerstances.MinorPowerPowerStance; import com.magmaguy.elitemobs.tagger.PersistentTagger; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -278,6 +278,7 @@ 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); @@ -289,10 +290,6 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR 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 @@ -496,7 +493,7 @@ public void applyPowers(HashSet configFields, int availableP else this.minorPowerCount++; } catch (Exception ex) { - Logger.warn("Failed to instance new power!"); + new WarningMessage("Failed to instance new power!"); } } diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java new file mode 100644 index 000000000..caefe80e1 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java @@ -0,0 +1,139 @@ +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/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 8bac40bfb..a18650c41 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -4,7 +4,7 @@ import com.magmaguy.elitemobs.api.internal.RemovalReason; import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.powerstances.VisualItemInitializer; -import com.magmaguy.magmacore.util.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; @@ -48,13 +48,7 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - 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)) + if (particle.equals(Particle.BLOCK_MARKER)) return; bukkitTasks.add(new BukkitRunnable() { @Override diff --git a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index f9599c613..178143ea8 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -3,26 +3,17 @@ 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 && @@ -60,41 +51,6 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .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) public void makeReturningBossesInvulnerable(WanderBackToPointStartEvent event) { if (!event.isHardObjective()) return; 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 dea4169e6..2de641a7a 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -1,5 +1,6 @@ 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; @@ -8,13 +9,11 @@ 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.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; @@ -22,7 +21,6 @@ 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.*; @@ -32,13 +30,14 @@ import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; 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,6 +48,7 @@ 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); @@ -60,9 +60,6 @@ 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 @@ -73,7 +70,7 @@ public static void shutdown() { */ public void runScript(EliteEntity eliteEntity, LivingEntity directTarget, Event event) { if (blueprint.getActionType() == null) { - 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."); + 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."); return; } @@ -91,7 +88,7 @@ public void runScript(EliteEntity eliteEntity, LivingEntity directTarget, Event */ public void runScript(ScriptActionData previousScriptActionData) { if (blueprint.getActionType() == null) { - 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."); + 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."); return; } @@ -215,10 +212,8 @@ 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 -> - Logger.warn("Failed to determine action type " + blueprint.getActionType() + " in script " + blueprint.getScriptName() + " for file " + blueprint.getScriptFilename()); + new WarningMessage("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)) @@ -242,7 +237,7 @@ protected Collection getLocationTargets(ScriptActionData scriptActionD private void runTeleport(ScriptActionData scriptActionData) { getTargets(scriptActionData).forEach(iteratedTarget -> { if (finalScriptTargets == null) { - Logger.warn("Failed to get teleport destination for script " + blueprint.getScriptName() + " because there is no set FinalTarget!"); + new WarningMessage("Failed to get teleport destination for script " + blueprint.getScriptName() + " because there is no set FinalTarget!"); return; } List destinationLocations = new ArrayList<>(finalScriptTargets.getTargetLocations(scriptActionData)); @@ -259,12 +254,12 @@ private void runMessage(ScriptActionData scriptActionData) { private void runTitleMessage(ScriptActionData scriptActionData) { if (blueprint.getTitle().isEmpty() && blueprint.getSubtitle().isEmpty()) { - Logger.warn("TITLE_MESSAGE action does not have any titles or subtitles for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + new WarningMessage("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)) { - Logger.warn("TITLE_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); + new WarningMessage("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()); @@ -273,12 +268,12 @@ private void runTitleMessage(ScriptActionData scriptActionData) { private void runActionBarMessage(ScriptActionData scriptActionData) { if (blueprint.getSValue().isEmpty()) { - Logger.warn("ACTION_BAR_MESSAGE action does not have a sValue for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + new WarningMessage("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)) { - Logger.warn("ACTION_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); + new WarningMessage("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())); @@ -287,13 +282,13 @@ private void runActionBarMessage(ScriptActionData scriptActionData) { private void runBossBarMessage(ScriptActionData scriptActionData) { if (blueprint.getSValue().isEmpty()) { - Logger.warn("BOSS_BAR_MESSAGE action does not have a valid sValue for script " + blueprint.getScriptFilename() + " in file " + blueprint.getScriptFilename()); + new WarningMessage("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)) { - Logger.warn("BOSS_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); + new WarningMessage("BOSS_BAR_MESSAGE actions must target players! Problematic script: " + blueprint.getScriptFilename() + " in " + blueprint.getScriptFilename()); return; } bossBar.addPlayer((Player) iteratedTarget); @@ -304,16 +299,13 @@ private void runBossBarMessage(ScriptActionData scriptActionData) { //Applies a potion effect to the target living entity private void runPotionEffect(ScriptActionData scriptActionData) { - getTargets(scriptActionData).forEach(iteratedTarget -> { - if (!(iteratedTarget.isValid())) return; - iteratedTarget.addPotionEffect(new PotionEffect(blueprint.getPotionEffectType(), blueprint.getDuration(), blueprint.getAmplifier())); - }); + getTargets(scriptActionData).forEach(iteratedTarget -> 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()) - Logger.warn("Did not find any scripts for action RUN_SCRIPT in script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + new WarningMessage("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) && @@ -327,7 +319,7 @@ private void runAdditionalScripts(ScriptActionData scriptActionData) { blueprint.getScripts().forEach(iteratedScriptName -> { EliteScript iteratedScript = eliteScriptMap.get(iteratedScriptName); if (iteratedScript == null) - Logger.warn("Failed to get script " + iteratedScriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + new WarningMessage("Failed to get script " + iteratedScriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); else { iteratedScript.check(scriptActionData.getEliteEntity(), scriptActionData.getDirectTarget(), scriptActionData); } @@ -336,7 +328,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) - Logger.warn("Failed to get script " + scriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); + new WarningMessage("Failed to get script " + scriptName + " for script " + blueprint.getScriptName() + " in file " + blueprint.getScriptFilename()); else randomizedScript.check(scriptActionData.getEliteEntity(), scriptActionData.getDirectTarget(), scriptActionData); } @@ -407,14 +399,7 @@ private void runStrikeLighting(ScriptActionData scriptActionData) { //Spawns a particle at the target location private void runSpawnParticle(ScriptActionData scriptActionData) { - 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)); + getLocationTargets(scriptActionData).forEach(targetLocation -> scriptParticles.visualize(scriptActionData, targetLocation, eliteScript)); } //Sets mob AI @@ -484,7 +469,7 @@ private void runSpawnFireworks(ScriptActionData scriptActionData) { FireworkMeta fireworkMeta = firework.getFireworkMeta(); if (blueprint.getFireworkEffects().isEmpty()) { - 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."); + 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."); return; } @@ -533,12 +518,6 @@ 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()); }); @@ -629,6 +608,7 @@ else if (blueprint.getVValue() != null) } private void runModifyDamage(ScriptActionData scriptActionData) { + if (scriptActionData.getEvent() instanceof EliteDamageEvent eliteDamageEvent) { eliteDamageEvent.setDamage(eliteDamageEvent.getDamage() * blueprint.getMultiplier()); } @@ -639,7 +619,7 @@ private void runSummonEntity(ScriptActionData scriptActionData) { try { entityType = EntityType.valueOf(blueprint.getSValue()); } catch (Exception ex) { - Logger.warn("Failed to get entity type for the projectile in the script " + getBlueprint().getScriptName() + " in the file " + blueprint.getScriptFilename()); + new WarningMessage("Failed to get entity type for the projectile in the script " + getBlueprint().getScriptName() + " in the file " + blueprint.getScriptFilename()); return; } @@ -682,33 +662,4 @@ 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/ScriptConditions.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java index 18a6b3fc1..b6688cadb 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 final EliteScript eliteScript; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; 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 23b26b065..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,11 +36,11 @@ 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(); } @@ -79,7 +79,7 @@ else if (particleBlueprint.getParticle().equals(Particle.DUST_COLOR_TRANSITION)) particleBlueprint.getToBlue()), 1)); else if (particleBlueprint.getParticle().equals(Particle.WITCH) - //|| particleBlueprint.getParticle().equals(Particle.WITCH_AMBIENT) todo: 1.20.6 changed this name + //|| 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/caching/ScriptActionBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionBlueprint.java index 4390f4ed8..783949501 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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.Color; import org.bukkit.FireworkEffect; @@ -107,10 +107,6 @@ public class ScriptActionBlueprint { private float volume = 1f; @Getter private float pitch = 1f; - @Getter - private float velocity = 1f; - @Getter - private double scale = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -143,7 +139,7 @@ protected void processKeyAndValue(String key, Object value) { try { potionEffectType = PotionEffectTypeUtil.getByKey(((String) value).toLowerCase(Locale.ROOT)); } catch (Exception ex) { - Logger.warn("Invalid potion effect type " + value + " in file " + scriptFilename + " for script " + scriptName + " !"); + new WarningMessage("Invalid potion effect type " + value + " in file " + scriptFilename + " for script " + scriptName + " !"); } } case "scripts" -> scripts = parseStringList(key, value, scriptName); @@ -196,9 +192,8 @@ protected void processKeyAndValue(String key, Object value) { scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, scriptFilename, (Map) value); case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); - case "velocity" -> velocity = parseFloat(key, value, scriptName); - case "scale" -> scale = parseFloat(key, value, scriptName); - default -> Logger.warn("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + default -> + new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } 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 5ed7d9066..a0a15f694 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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.Particle; @@ -28,7 +28,6 @@ public ScriptParticlesBlueprint() { public class ScriptParticleBlueprint { @Getter private final String scriptName; - private final String filename; @Getter private double x = 0.01; @Getter @@ -57,6 +56,7 @@ 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; @@ -89,7 +89,7 @@ private void processKeyAndValue(String key, Object value) { 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!"); + new WarningMessage("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 a38bfcb70..f8c1b3884 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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.configuration.MemorySection; import org.bukkit.util.Vector; @@ -55,7 +55,8 @@ 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 -> Logger.warn("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + default -> + new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } } } 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 2a7cee438..62b0b0f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,13 +1,26 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; +import com.magmaguy.elitemobs.utils.WarningMessage; +import com.sk89q.worldedit.bukkit.BukkitAdapter; 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.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 { @@ -40,90 +53,90 @@ public static boolean initialize() { if (Bukkit.getPluginManager().getPlugin("WorldGuard") == null) return false; - Logger.info(" WorldGuard detected."); + Bukkit.getLogger().info("[EliteMobs] WorldGuard detected."); FlagRegistry registry = null; try { registry = WorldGuard.getInstance().getFlagRegistry(); } catch (Exception ex) { - Logger.warn("Something went wrong while loading WorldGuard. Are you using the right WorldGuard version?"); + new WarningMessage("Something went wrong while loading WorldGuard. Are you using the right WorldGuard version?"); return false; } - Logger.info(" Enabling flags:"); + Bukkit.getLogger().info("[EliteMobs] Enabling flags:"); try { ELITEMOBS_SPAWN_FLAG = new StateFlag("elitemob-spawning", true); registry.register(ELITEMOBS_SPAWN_FLAG); - Logger.info(" - elitemob-spawning"); + Bukkit.getLogger().info("[EliteMobs] - elitemob-spawning"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn(" Warning: flag elitemob-spawning already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemob-only-spawning"); + Bukkit.getLogger().info("[EliteMobs] - elitemob-only-spawning"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn(" Warning: flag elitemob-only-spawning already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemobs-antiexploit"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-antiexploit"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn(" Warning: flag elitemob-antiexploit already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemobs-dungeon"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-dungeon"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn(" Warning: flag elitemob-dungeon already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemobs-events"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-events"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn("Warning: flag elitemob-events already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemobs-minimum-level"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-minimum-level"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn(" Warning: flag elitemob-minimum-level already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info("- elitemobs-maximum-level"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-maximum-level"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn("Warning: flag elitemob-maximum-level already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemobs-explosion-regen"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-explosion-regen"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn("Warning: flag elitemob-explosion-regen already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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); - Logger.info(" - elitemobs-explosion-block-damage"); + Bukkit.getLogger().info("[EliteMobs] - elitemobs-explosion-block-damage"); } catch (FlagConflictException | IllegalStateException e) { - Logger.warn(" Warning: flag elitemobs-explosion-block-damage already exists! This is normal if you've just now reloaded EliteMobs."); + Bukkit.getLogger().warning("[EliteMobs] 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"); } @@ -131,166 +144,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) { -// 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); -// } + 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); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index 122ef2245..ccdc6a0f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,10 +1,9 @@ package com.magmaguy.elitemobs.treasurechest; -import com.google.common.collect.ArrayListMultimap; +import com.magmaguy.elitemobs.ChatColorConverter; 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; @@ -12,10 +11,9 @@ 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; @@ -33,21 +31,15 @@ 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; @@ -69,35 +61,26 @@ public TreasureChest(CustomTreasureChestConfigFields customTreasureChestConfigFi if (customTreasureChestConfigFields.getChestMaterial() == null) return; - if (!customTreasureChestConfigFields.isInstanced()) { - initializeChest(); - new PersistentObjectHandler(this); - treasureChestHashMap.put(location, this); - } else - instancedTreasureChests.put(worldName, this); - } + initializeChest(); - 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); - }); + new PersistentObjectHandler(this); + + treasureChestHashMap.put(location, this); } 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) @@ -113,14 +96,14 @@ private void generateChest() { .getBlockAt(location).getType().equals(customTreasureChestConfigFields.getChestMaterial())) location.getWorld().getBlockAt(location).setType(customTreasureChestConfigFields.getChestMaterial()); } catch (Exception ex) { - Logger.warn("Custom Treasure Chest " + customTreasureChestConfigFields.getFilename() + " has an invalid location and can not be placed."); + new WarningMessage("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 { - Logger.warn("Treasure chest " + customTreasureChestConfigFields.getFilename() + + new WarningMessage("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?"); } @@ -131,8 +114,7 @@ public void doInteraction(Player player) { if (customTreasureChestConfigFields.getDropStyle().equals(DropStyle.GROUP)) if (playerIsInCooldown(player)) { - if (!customTreasureChestConfigFields.isInstanced()) - groupTimerCooldownMessage(player, getPlayerCooldown(player)); + groupTimerCooldownMessage(player, getPlayerCooldown(player)); return; } else if (restockTime > Instant.now().getEpochSecond()) return; @@ -140,20 +122,14 @@ public void doInteraction(Player player) { if (ThreadLocalRandom.current().nextDouble() < customTreasureChestConfigFields.getMimicChance()) doMimic(); else doTreasure(player); - player.playSound(player.getLocation(), SoundsConfig.treasureChestOpenSound, 1, 1); - if (customTreasureChestConfigFields.getDropStyle().equals(DropStyle.GROUP)) { - 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()); - } + 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; } @@ -162,8 +138,7 @@ public void run() { restockTime = cooldownTime(); customTreasureChestConfigFields.setRestockTime(location, restockTime); - if (!customTreasureChestConfigFields.isInstanced()) - Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, this::generateChest, 20L * 60 * customTreasureChestConfigFields.getRestockTimer()); + Bukkit.getScheduler().scheduleSyncDelayedTask(MetadataHandler.PLUGIN, this::generateChest, 20L * 60 * customTreasureChestConfigFields.getRestockTimer()); } @@ -200,9 +175,6 @@ 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/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index f63ce4e53..739884148 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.versionnotifier.VersionChecker; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.util.Vector; @@ -8,11 +7,8 @@ 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, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); - else - location.getWorld().spawnParticle(Particle.EXPLOSION, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); + //todo: restore barrier blocks here, block data was required for the snapshot version of this + location.getWorld().spawnParticle(Particle.BLOCK_MARKER, location.getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)), 1); } } 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 f3a352a97..e8530e76e 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( - 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())); + x / 2D + centerLocation.getBlockX(), y / 2D + centerLocation.getBlockY(), z / 2D + centerLocation.getBlockZ(), + -x / 2D + centerLocation.getBlockX(), centerLocation.getBlockY(), -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()) >= Math.floor(xBorder / 2d) || Math.abs(vector.getZ()) >= Math.floor(zBorder / 2d))) + (Math.abs(vector.getX()) >= xBorder / 2d || Math.abs(vector.getZ()) >= 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 = Math.floor(x / 2d); - double zHalf = Math.floor(z / 2d); + double xHalf = x / 2d; + double zHalf = 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/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index 01c35ca90..6c779e0b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -1,11 +1,12 @@ 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.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; -import com.magmaguy.magmacore.util.SpigotMessage; +import com.magmaguy.elitemobs.utils.InfoMessage; +import com.magmaguy.elitemobs.utils.SpigotMessage; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; @@ -22,9 +23,9 @@ public class VersionChecker { private static final List outdatedPackages = new ArrayList<>(); + private static boolean pluginIsUpToDate = true; @Getter private static final boolean SHA1Updated = false; - private static boolean pluginIsUpToDate = true; private VersionChecker() { } @@ -69,11 +70,11 @@ public void run() { String publicVersion = ""; try { - 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()); + 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()); publicVersion = VersionChecker.readStringFromURL("https://api.spigotmc.org/legacy/update.php?resource=40090"); } catch (IOException e) { - Logger.warn("Couldn't check latest version"); + Bukkit.getLogger().warning("[EliteMobs] Couldn't check latest version"); return; } @@ -98,9 +99,9 @@ public void run() { } if (!snapshot) - Logger.info("You are running the latest version!"); + Bukkit.getLogger().info("[EliteMobs] You are running the latest version!"); else - Logger.info("You are running a snapshot version! You can check for updates in the #releases channel on the EliteMobs Discord!"); + new InfoMessage("You are running a snapshot version! You can check for updates in the #releases channel on the EliteMobs Discord!"); pluginIsUpToDate = true; } @@ -119,10 +120,10 @@ private static void checkDungeonVersions() { if (emPackage.getDungeonPackagerConfigFields().getDungeonVersion() < releaseVersion) { emPackage.setOutOfDate(true); outdatedPackages.add(emPackage); - Logger.warn("Dungeon " + emPackage.getDungeonPackagerConfigFields().getName() + " is outdated! You should go download the updated version! Link: " + emPackage.getDungeonPackagerConfigFields().getDownloadLink()); + new WarningMessage("Dungeon " + emPackage.getDungeonPackagerConfigFields().getName() + " is outdated! You should go download the updated version! Link: " + emPackage.getDungeonPackagerConfigFields().getDownloadLink()); } } catch (Exception exception) { - 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!"); + 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!"); } } } @@ -141,7 +142,7 @@ private static String readStringFromURL(String url) throws IOException { private static void outOfDateHandler() { - Logger.warn("[EliteMobs] A newer version of this plugin is available for download!"); + new WarningMessage("[EliteMobs] A newer version of this plugin is available for download!"); pluginIsUpToDate = false; } @@ -162,10 +163,10 @@ public void onPlayerLogin(PlayerJoinEvent event) { public void run() { if (!event.getPlayer().isOnline()) return; if (!pluginIsUpToDate) - event.getPlayer().sendMessage(ChatColorConverter.convert("&cYour version of EliteMobs is outdated." + + event.getPlayer().sendMessage(ChatColorConverter.convert("&a[EliteMobs] &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("&cThe following dungeons are outdated:")); + event.getPlayer().sendMessage(ChatColorConverter.convert("&a[EliteMobs] &cThe following dungeons are outdated:")); for (EMPackage emPackage : outdatedPackages) event.getPlayer().sendMessage(ChatColorConverter.convert( "&c- " + emPackage.getDungeonPackagerConfigFields().getName())); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f3798c721..8d46b9225 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0 +version: 9.0.0-SNAPSHOT-1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -11,7 +11,6 @@ softdepend: - HolographicDisplays - DiscordSRV - LibsDisguises -- WorldEdit - ModelEngine - Geyser-Spigot - MythicMobs From 4eec955901a9a7081a0d1554299cac14d9afd47e Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 20 Jun 2024 16:01:32 +0100 Subject: [PATCH 51/78] EliteMobs 9.0.0-SNAPSHOT-2 - [New] Added Sounds.yml - [New] Quests, rank ups and opening treasure chests now have custom sounds in the resource pack - [New] Debug items now come with higher durability - [New] Dungeons all now install by default when imported, no longer requiring admins to run /em setup to install them - [New] Added compatibility layer to allow old transitive blocks to be interpreted correctly by their new minecraft values - [Fix] Fixed bug related to debug particles - [Removal] Removed dungeonLocationType from the dungeon packager, it was a legacy value - [Tweak] Minor refactors Signed-off-by: MagmaGuy --- .../com/magmaguy/elitemobs/EliteMobs.java | 4 + .../magmaguy/elitemobs/EventsRegistrer.java | 2 + .../GuildRankMenuHandler.java | 10 +- .../elitemobs/commands/AdminCommands.java | 32 +- .../elitemobs/commands/ArenaCommands.java | 12 + .../elitemobs/commands/SetupHandler.java | 17 + .../commands/admin/GetTierCommand.java | 6 +- .../elitemobs/commands/setup/SetupMenu.java | 135 +++---- .../elitemobs/config/AntiExploitConfig.java | 18 +- .../config/LegacyValueConverter.java | 6 + .../elitemobs/config/SoundsConfig.java | 19 +- .../CustomQuestsConfigFields.java | 20 +- .../DungeonPackagerConfigFields.java | 50 +-- .../premade/KnightCastleLair.java | 6 +- .../elitemobs/dungeons/DungeonProtector.java | 120 ++----- .../elitemobs/dungeons/EMPackage.java | 16 - .../elitemobs/dungeons/EliteMobsWorld.java | 1 - .../elitemobs/dungeons/WorldPackage.java | 15 +- .../dungeons/utility/DungeonUtils.java | 44 ++- .../elitemobs/events/ActionEvent.java | 4 +- .../instanced/dungeons/DungeonInstance.java | 7 +- .../transitiveblocks/TransitiveBlock.java | 4 +- .../worldguard/WorldGuardCompatibility.java | 335 +++++++++--------- .../treasurechest/TreasureChest.java | 3 + .../elitemobs/utils/DebugBlockLocation.java | 11 +- .../elitemobs/worlds/CustomWorldLoading.java | 60 ++++ src/main/resources/plugin.yml | 2 +- 27 files changed, 456 insertions(+), 503 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java create mode 100644 src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f435ce4fe..deb362c9c 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -26,6 +26,7 @@ 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; @@ -113,6 +114,7 @@ public static void initializeConfigs() { //SoundsConfig.initializeConfig(); //ModelsConfig.initializeConfig(); DungeonsConfig.initializeConfig(); + SoundsConfig.initializeConfig(); } public static void worldScanner() { @@ -368,6 +370,8 @@ public void onDisable() { ProceduralShopMenu.shutdown(); + EliteMobsWorld.shutdown(); + //save cached data Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); PlayerData.closeConnection(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 28ece61c1..d691fb16a 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -16,6 +16,7 @@ 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; @@ -350,6 +351,7 @@ public static void registerEvents() { register(new WorldGuardDungeonFlag()); register(new WorldGuardExplosionBlockDamageFlag()); } + register(new DungeonProtector()); register(new EntityTransformHandler()); register(new EliteBlazeWaterDamagePrevention()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index fd00f7ca7..913756e3a 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,13 +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; @@ -114,7 +114,7 @@ private static void selectPrestigeUnlock(Player player) { */ public static Inventory initializeGuildRankMenu(Player player) { String menuName = GuildRankMenuConfig.getMenuName(); - if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) + if (ResourcePackDataConfig.displayCustomMenuUnicodes) menuName = ChatColor.WHITE + "\uF801\uDA90\uDEFA\uF805 " + menuName; Inventory difficultyMenu = Bukkit.createInventory(player, 54, menuName); difficultyMenu = populateInventory(difficultyMenu, player); @@ -279,14 +279,14 @@ private static String healthBonusString(int prestigeLevel, int guildRank) { private static String critBonusString(int prestigeLevel, int guildRank) { if (!AdventurersGuildConfig.isAddMaxHealth()) return null; - if (prestigeLevel < 2) + if (prestigeLevel < 3) 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 < 3) + if (prestigeLevel < 4) return null; return GuildRankMenuConfig.getDodgeBonusMessage().replace("$amount", GuildRank.dodgeBonusValue(prestigeLevel, guildRank) + ""); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index 43bce68e8..fadb018cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -90,34 +90,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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); @@ -697,8 +669,8 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde .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()); + if (eliteEntity instanceof CustomBossEntity customBossEntity) { + customBossEntity.getBossTrace().postLog((Player) commandContext.getSender()); return; } })); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java new file mode 100644 index 000000000..5179f8289 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java @@ -0,0 +1,12 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.menus.ArenaMenu; +import org.bukkit.entity.Player; + +public class ArenaCommands { + private 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/SetupHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java new file mode 100644 index 000000000..0b5f635b7 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java @@ -0,0 +1,17 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.commands.setup.SetupMenu; +import com.magmaguy.elitemobs.dungeons.EMPackage; +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); + } +} 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 58e975378..a6309b02e 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() { } @@ -70,9 +68,7 @@ public static void get(Player player, int tierLevel) { private static void addDurability(ItemStack itemStack) { ItemMeta itemMeta = itemStack.getItemMeta(); - HashMap enchantmentIntegerHashMap = new HashMap<>(); - enchantmentIntegerHashMap.put(Enchantment.UNBREAKING, 5); - ItemTagger.registerEnchantments(itemMeta, enchantmentIntegerHashMap); + itemMeta.addEnchant(Enchantment.UNBREAKING, 5, true); itemStack.setItemMeta(itemMeta); } 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 29e3b0689..17cc70b34 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -7,8 +7,10 @@ import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; -import com.magmaguy.elitemobs.utils.*; +import com.magmaguy.elitemobs.utils.DiscordLinks; +import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.SpigotMessage; import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; @@ -27,20 +29,19 @@ 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<>(); + private final int previousIcon = 27; + Inventory inventory; + Player player; 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; HashMap minidungeonHashMap = new HashMap<>(); + boolean adventurersGuildIsDownloaded = false; @Getter private int currentPage = 1; - boolean adventurersGuildIsDownloaded = false; public SetupMenu(Player player) { this.inventory = Bukkit.createInventory(player, 54, "Setup menu"); @@ -66,53 +67,6 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup } } - private void redrawMenu(int page, Inventory inventory) { - currentPage = page; - setupMenus.remove(inventory); - this.inventory = inventory; - inventory.clear(); - //reserve resource pack status - customResourcePackStatus(); - //reserve adventurer's guild - adventurersGuildWorldStatus(); - //iterate through dungeons - dungeonStatuses(); - //Set icons - addNavigationElements(); - player.openInventory(inventory); - setupMenus.put(inventory, this); - } - - private void addNavigationElements() { - ItemStack infoButton = GetLootMenuConfig.infoItem; - List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:", - "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy", - "&62) &fPut content in the &2imports &ffolder of EliteMobs", - "&63) &fDo &2/em reload", - "&64) &fDo &2/em setup", - "&65) &fClick on &eyellow &ficons to install!", - "Click to get more info!")); - ItemMeta itemMeta = infoButton.getItemMeta(); - itemMeta.setLore(lore); - infoButton.setItemMeta(itemMeta); - inventory.setItem(infoIcon, infoButton); - - ItemStack previousButton = GetLootMenuConfig.previousLootItem; - ItemMeta previousButtonMeta = previousButton.getItemMeta(); - previousButtonMeta.setDisplayName("Previous page"); - previousButton.setItemMeta(previousButtonMeta); - if (currentPage > 1) - inventory.setItem(previousIcon, previousButton); - - ItemStack nextButton = GetLootMenuConfig.nextLootItem; - ItemMeta nextButtonMeta = nextButton.getItemMeta(); - nextButtonMeta.setDisplayName("Next page"); - nextButton.setItemMeta(nextButtonMeta); - int totalPages = (int) Math.ceil(emPackages.size() / 28d); - if (totalPages > 1 && currentPage < totalPages) - inventory.setItem(nextIcon, nextButton); - } - public static void forceResourcePack(Player player) { ResourcePackDataConfig.toggleForceResourcePack(true); player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); @@ -158,11 +112,6 @@ private static void adventurersGuildButtonInteraction(Player player, SetupMenu s 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()) @@ -197,6 +146,53 @@ private static void adventurersGuildButtonInteraction(Player player, SetupMenu s } } + private void redrawMenu(int page, Inventory inventory) { + currentPage = page; + setupMenus.remove(inventory); + this.inventory = inventory; + inventory.clear(); + //reserve resource pack status + customResourcePackStatus(); + //reserve adventurer's guild + adventurersGuildWorldStatus(); + //iterate through dungeons + dungeonStatuses(); + //Set icons + addNavigationElements(); + player.openInventory(inventory); + setupMenus.put(inventory, this); + } + + private void addNavigationElements() { + ItemStack infoButton = GetLootMenuConfig.infoItem; + List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:", + "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy", + "&62) &fPut content in the &2imports &ffolder of EliteMobs", + "&63) &fDo &2/em reload", + "&64) &fDo &2/em setup", + "&65) &fClick on &eyellow &ficons to install!", + "Click to get more info!")); + ItemMeta itemMeta = infoButton.getItemMeta(); + itemMeta.setLore(lore); + infoButton.setItemMeta(itemMeta); + inventory.setItem(infoIcon, infoButton); + + ItemStack previousButton = GetLootMenuConfig.previousLootItem; + ItemMeta previousButtonMeta = previousButton.getItemMeta(); + previousButtonMeta.setDisplayName("Previous page"); + previousButton.setItemMeta(previousButtonMeta); + if (currentPage > 1) + inventory.setItem(previousIcon, previousButton); + + ItemStack nextButton = GetLootMenuConfig.nextLootItem; + ItemMeta nextButtonMeta = nextButton.getItemMeta(); + nextButtonMeta.setDisplayName("Next page"); + nextButton.setItemMeta(nextButtonMeta); + int totalPages = (int) Math.ceil(emPackages.size() / 28d); + if (totalPages > 1 && currentPage < totalPages) + inventory.setItem(nextIcon, nextButton); + } + private void dungeonStatuses() { //Counter has to account for pages int dungeonCounter = 0; @@ -220,23 +216,8 @@ private void dungeonStatuses() { 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; - } + addWorldDungeon(emPackage, inventoryLocationCounter); + minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; inventoryLocationCounter++; diff --git a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java index 62988c78e..6b0641834 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java @@ -1,11 +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 extends ConfigurationFile { +public class AntiExploitConfig { 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; @@ -32,12 +33,13 @@ public class AntiExploitConfig extends ConfigurationFile { @Getter private static int antiExploitThreshold; - public AntiExploitConfig() { - super("AntiExploit.yml"); + private AntiExploitConfig() { } - @Override - public void initializeValues() { + public static void initializeConfig() { + File file = ConfigurationEngine.fileCreator("AntiExploit.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + antiExploitMessage = ConfigurationEngine.setString( List.of("Sets the message that shows up when the antiexploit is triggered."), file, fileConfiguration, "AntiExploit message", @@ -75,5 +77,9 @@ public void initializeValues() { 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/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index d71f4b62e..42fb1f950 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -73,4 +73,10 @@ public static String parsePotionEffect(String potionEffectName) { 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/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index 0e211c4fd..92fd4f3c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java @@ -1,10 +1,14 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.magmacore.config.ConfigurationFile; +import org.bukkit.configuration.file.FileConfiguration; +import java.io.File; import java.util.List; -public class SoundsConfig extends ConfigurationFile { +public class SoundsConfig { + private SoundsConfig() { + } + public static String treasureChestOpenSound; public static String guildRankUpSound; public static String guildPrestigeSound; @@ -13,12 +17,10 @@ public class SoundsConfig extends ConfigurationFile { public static String questAbandonSound; public static String questAcceptSound; - public SoundsConfig() { - super("Sounds.yml"); - } + public static void initializeConfig() { + File file = ConfigurationEngine.fileCreator("Sounds.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); - @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); @@ -46,5 +48,8 @@ public void initializeValues() { 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); } + } 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 e6e6a1223..7b52edd01 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customquests/CustomQuestsConfigFields.java @@ -1,18 +1,17 @@ package com.magmaguy.elitemobs.config.customquests; import com.magmaguy.elitemobs.config.CustomConfigFields; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.config.CustomConfigFieldsInterface; +import com.magmaguy.elitemobs.utils.InfoMessage; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.configuration.ConfigurationSection; import java.util.*; -public class CustomQuestsConfigFields extends CustomConfigFields { +public class CustomQuestsConfigFields extends CustomConfigFields implements CustomConfigFieldsInterface { - @Getter - @Setter - protected Map> customObjectives = new HashMap(); @Getter @Setter List temporaryPermissions = new ArrayList<>(); @@ -24,6 +23,9 @@ public class CustomQuestsConfigFields extends CustomConfigFields { private int questLevel = 0; @Getter @Setter + protected Map> customObjectives = new HashMap(); + @Getter + @Setter private List customRewardsList = new ArrayList<>(); @Getter @Setter @@ -139,13 +141,13 @@ private void updateOldStringFormat(List oldList) { key = "objectiveType"; } default -> - Logger.warn("Failed to correctly parse key " + key + " in " + filename + " while updating the old quest configuration format!"); + new WarningMessage("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); - Logger.info("Converted quest old entry to " + key + ": " + value); + new InfoMessage("Converted quest old entry to " + key + ": " + value); } parsedObjectives.put("Objective" + counter, parsedEntry); } @@ -154,7 +156,7 @@ private void updateOldStringFormat(List oldList) { try { fileConfiguration.save(file); } catch (Exception ex) { - Logger.warn("Failed to save new custom objective format!"); + new WarningMessage("Failed to save new custom objective format!"); } } @@ -182,7 +184,7 @@ private Map> processQuestObjectives() { rawMap = fileConfiguration.getConfigurationSection("customObjectives").getValues(false); if (rawMap == null) { - Logger.warn("Failed to parse custom objectives for " + filename); + new WarningMessage("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/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index e48e6b2b4..a78c176c3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -99,15 +99,6 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @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); @@ -208,40 +199,6 @@ public DungeonPackagerConfigFields(String filename, defaultDungeon = true; } - //For the adventurer's guild hub - public DungeonPackagerConfigFields(String filename, - boolean isEnabled, - String name, - List customInfo, - String downloadLink, - String worldName, - World.Environment environment, - Boolean protect, - String teleportLocationString, - int dungeonVersion, - String playerInfo, - String regionEnterMessage, - String regionLeaveMessage, - String dungeonConfigFolderName, - boolean allowExplosions) { - super(filename, isEnabled); - this.contentType = ContentType.HUB; - this.name = name; - this.customInfo = customInfo; - this.downloadLink = downloadLink; - this.worldName = worldName; - this.environment = environment; - this.protect = protect; - this.teleportLocationString = teleportLocationString; - this.dungeonVersion = dungeonVersion; - this.playerInfo = playerInfo; - this.regionEnterMessage = regionEnterMessage; - this.regionLeaveMessage = regionLeaveMessage; - this.dungeonConfigFolderName = dungeonConfigFolderName; - this.allowExplosions = allowExplosions; - defaultDungeon = true; - } - @Override public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, false, true); @@ -252,7 +209,7 @@ public void processConfigFields() { this.downloadLink = processString("downloadLink", downloadLink, null, false); this.dungeonSizeCategory = processEnum("dungeonSizeCategory", dungeonSizeCategory, null, DungeonSizeCategory.class, false); if (dungeonSizeCategory == null) { - Logger.warn("File " + filename + " does not have a valid dungeonSizeCategory!"); + new WarningMessage("File " + filename + " does not have a valid dungeonSizeCategory!"); this.fileConfiguration = null; return; } @@ -288,9 +245,6 @@ public void processConfigFields() { 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(); } 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 2b2ed7af9..015ea0546 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 @@ -9,7 +9,7 @@ public class KnightCastleLair extends DungeonPackagerConfigFields { public KnightCastleLair() { super("knights_castle_lair", - false, + true, "&2[lvl 095] &fThe Knight's Castle", List.of("&fChallenge the knights of the castle!"), DiscordLinks.freeMinidungeons, @@ -24,7 +24,7 @@ public KnightCastleLair() { "&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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index cb4e81cb9..c6098d3e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,164 +1,96 @@ 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.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerBucketEmptyEvent; -import org.bukkit.event.player.PlayerInteractEvent; - -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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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) { + @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 preventLeafDecay(LeavesDecayEvent event) { + @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); - } } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 49b1dd578..28da1c75f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -75,22 +75,6 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WarningMessage("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; } - } 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 WarningMessage("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; - } } } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java index abac43260..c746bd6f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -9,7 +9,6 @@ public class EliteMobsWorld { private static final HashMap eliteMobsWorlds = new HashMap<>(); - @Getter private final DungeonPackagerConfigFields dungeonPackagerConfigFields; @Getter private final boolean allowExplosions; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index dac8d1c87..9a117376a 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -1,11 +1,10 @@ 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.mobconstructor.custombosses.CustomMusic; +import com.magmaguy.elitemobs.utils.WarningMessage; 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 +28,7 @@ public void baseInitialization() { super.baseInitialization(); if (dungeonPackagerConfigFields.getWorldName() == null || dungeonPackagerConfigFields.getWorldName().isEmpty()) { this.isDownloaded = this.isInstalled = false; - Logger.warn("Packaged content " + dungeonPackagerConfigFields.getFilename() + " does not have a valid world name in the dungeon packager!"); + new WarningMessage("Packaged content " + dungeonPackagerConfigFields.getFilename() + " does not have a valid world name in the dungeon packager!"); return; } @@ -42,7 +41,6 @@ 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; } @@ -55,10 +53,8 @@ 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; + } } @@ -69,8 +65,6 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); - if (dungeonPackagerConfigFields.getSong() != null) - new CustomMusic(dungeonPackagerConfigFields.getSong(), dungeonPackagerConfigFields, world); // WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); for (Wormhole wormhole : Wormhole.getWormholes()) wormhole.onDungeonInstall(dungeonPackagerConfigFields.getFilename()); @@ -91,5 +85,4 @@ 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 65069d565..cf47ac349 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,13 +5,20 @@ import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.dungeons.WorldPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.magmacore.util.WorldLoader; +import com.magmaguy.elitemobs.utils.InfoMessage; +import com.magmaguy.elitemobs.utils.WarningMessage; 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) { @@ -40,9 +47,38 @@ public static World loadWorld(WorldPackage worldPackage) { } 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; + 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); + + EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + + return world; + } catch (Exception exception) { + Bukkit.getLogger().setFilter(previousFilter); + new WarningMessage("Failed to load world " + worldName + " !"); + exception.printStackTrace(); + } + return null; } public static boolean unloadWorld(WorldPackage worldPackage) { diff --git a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 7df8ac857..9b1fba505 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -55,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: 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 bd09fa72a..a201a3df6 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,7 +14,6 @@ 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 lombok.Getter; import org.bukkit.Bukkit; @@ -136,13 +135,13 @@ 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); +// 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()); 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 f51a2ff88..046654fc2 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,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -39,7 +39,7 @@ public static List serializeTransitiveBlocks(List deser BlockData blockData = Bukkit.getServer().createBlockData(LegacyValueConverter.parseDeserializedBlocks(elements[1])); transitiveBlocks.add(new TransitiveBlock(blockData, new Vector(x, y, z))); } catch (Exception ex) { - Logger.warn("Failed to serialize Transitive Block! Issue with entry " + deserializedString + " in file " + filename); + new WarningMessage("Failed to serialize Transitive Block! Issue with entry " + deserializedString + " in file " + filename); } } return transitiveBlocks; 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 62b0b0f7e..f1c4aeca3 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java @@ -1,26 +1,13 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.utils.WarningMessage; -import com.sk89q.worldedit.bukkit.BukkitAdapter; 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.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 { @@ -144,166 +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); - } +// 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); +// } } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index ccdc6a0f0..a3baa5901 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -4,6 +4,7 @@ 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; @@ -122,6 +123,8 @@ public void doInteraction(Player player) { 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() { diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 739884148..1f21941eb 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -1,14 +1,19 @@ package com.magmaguy.elitemobs.utils; +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) { - //todo: restore barrier blocks here, block data was required for the snapshot version of this - location.getWorld().spawnParticle(Particle.BLOCK_MARKER, 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.LIGHT)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java new file mode 100644 index 000000000..b0ace1e1c --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java @@ -0,0 +1,60 @@ +package com.magmaguy.elitemobs.worlds; + +import com.magmaguy.elitemobs.config.AdventurersGuildConfig; +import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; +import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; +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!"); + EliteMobsWorld.create(worldCreator.createWorld().getUID(), DungeonPackagerConfig.getDungeonPackages().get("adventurers_guild.yml")); + } 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/resources/plugin.yml b/src/main/resources/plugin.yml index 8d46b9225..20d85e1ac 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0-SNAPSHOT-1 +version: 9.0.0-SNAPSHOT-2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From f4e041f9def5636a1b2d1b418276a49d849a0ad5 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sat, 22 Jun 2024 18:05:58 +0100 Subject: [PATCH 52/78] EliteMobs 9.0.0-SNAPSHOT-3 - [New] Outdated dungeons are now highlighted in orange in the em setup menu - [New] Items will no longer be dropped when they have no durability left, instead they will simply be deactivated and players will be warned that the items won't work until they are repaired again - [New] Damage indicators and dialogue now use text displays instead of armor stands - [Fix] Changed debug block look to barrier instead of light bulb - [Fix] Fixed problem that all would allow vanilla mobs to spawn in dungeons - [Fix] Fixed problem that would allow elite events to happen in worlds - [Fix] Fixed issue where projectile-caused explosions would sometimes not regenerate correctly even though the configuration was set to regenerate them - [Removal] Removed default schematics folder Signed-off-by: MagmaGuy --- .../com/magmaguy/elitemobs/EliteMobs.java | 14 -- .../GuildRankMenuHandler.java | 4 +- .../elitemobs/api/PlayerTeleportEvent.java | 21 +- .../AlternativeDurabilityLoss.java | 2 +- .../combatsystem/displays/PopupDisplay.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 136 ++---------- .../config/AdventurersGuildConfig.java | 189 +++++++++-------- .../config/ConfigurationImporter.java | 199 ++++++++++++++++++ .../DungeonPackagerConfigFields.java | 34 +++ .../elitemobs/dungeons/DungeonProtector.java | 7 + .../elitemobs/dungeons/EMPackage.java | 5 + .../elitemobs/dungeons/WorldPackage.java | 1 + .../elitemobs/explosionregen/Explosion.java | 3 +- .../instanced/InstanceDeathLocation.java | 2 +- .../instanced/dungeons/DungeonInstance.java | 2 +- .../SoulbindEnchantment.java | 2 +- .../elitemobs/playerdata/PlayerItem.java | 18 +- .../elitemobs/utils/DebugBlockLocation.java | 2 +- .../elitemobs/utils/VisualDisplay.java | 2 +- .../elitemobs/worlds/CustomWorldLoading.java | 60 ------ 20 files changed, 390 insertions(+), 315 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index deb362c9c..f06a343d5 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; @@ -60,7 +59,6 @@ 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 org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; @@ -84,7 +82,6 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations DefaultConfig.initializeConfig(); - SchematicsFolderConfig.initializeConfigs(); ResourcePackDataConfig.initializeConfig(); ItemSettingsConfig.initializeConfig(); ProceduralItemGenerationSettingsConfig.initializeConfig(); @@ -230,17 +227,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(); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 913756e3a..51ae8477a 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -279,14 +279,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/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index 05177dd22..f579167be 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,12 +1,15 @@ package com.magmaguy.elitemobs.api; -import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; +import com.magmaguy.elitemobs.dungeons.EMPackage; +import com.magmaguy.elitemobs.dungeons.WorldPackage; 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(); @@ -64,10 +67,20 @@ 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; + + EMPackage adventurersGuildPackage = EMPackage.getContent("adventurers_guild_hub"); + if (adventurersGuildPackage == null || !adventurersGuildPackage.isInstalled() || + adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation() == null || + Objects.equals(adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation().getWorld(), originalLocation.getWorld())) + return; + + PlayerData.setBackTeleportLocation(player, originalLocation); } public static class PlayerTeleportEventExecutor implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 24c42aa45..275500332 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -79,7 +79,7 @@ public void onPlayerDeath(PlayerDeathEvent event) { } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerShoot(EntityShootBowEvent event) { + public void onPlayerShoot(EntityShootBowEvent event){ if (!EliteItemManager.isEliteMobsItem(event.getBow())) return; if (isOnLastDamage(event.getBow())) event.setCancelled(true); } 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 2426f38f3..8b1a2cf6b 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java @@ -10,8 +10,8 @@ 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.VisualDisplay; -import com.magmaguy.magmacore.util.Round; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; 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 17cc70b34..ea17b69f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,17 +1,11 @@ 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.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.EventCaller; import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.elitemobs.worlds.CustomWorldLoading; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -39,7 +33,6 @@ public class SetupMenu { 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)); HashMap minidungeonHashMap = new HashMap<>(); - boolean adventurersGuildIsDownloaded = false; @Getter private int currentPage = 1; @@ -94,58 +87,6 @@ else if (!emPackage.uninstall(player)) { } } - 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(); - 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 redrawMenu(int page, Inventory inventory) { currentPage = page; setupMenus.remove(inventory); @@ -153,8 +94,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 @@ -200,7 +139,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())))); @@ -212,11 +151,11 @@ 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); - addWorldDungeon(emPackage, inventoryLocationCounter); + addDungeonPackagerContent(emPackage, inventoryLocationCounter); minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage); dungeonCounter++; @@ -224,7 +163,7 @@ private void dungeonStatuses() { } } - private void addWorldDungeon(EMPackage emPackage, int counter) { + private void addDungeonPackagerContent(EMPackage emPackage, int counter) { String itemName = emPackage.getDungeonPackagerConfigFields().getName(); List lore = new ArrayList<>(); @@ -236,26 +175,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()) @@ -267,17 +189,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!"); @@ -301,7 +221,7 @@ private void customResourcePackStatus() { boolean resourceState = ResourcePackDataConfig.isEliteMobsResourcePackEnabled(); 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; @@ -311,29 +231,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) { @@ -347,11 +244,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 ad1be7cba..7aaf10e90 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,14 +1,15 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.elitemobs.ChatColorConverter; import lombok.Getter; +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 extends ConfigurationFile { +public class AdventurersGuildConfig { @Getter private static final String[][] rankNames = new String[11][21]; @Getter @@ -66,96 +67,19 @@ public class AdventurersGuildConfig extends ConfigurationFile { @Getter private static boolean disableCommonerRank; - public AdventurersGuildConfig() { - super("AdventurersGuild.yml"); - } - - public static String getRankName(int prestigeTier, int rankTier) { - return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]); - } + private static File file; + private static FileConfiguration fileConfiguration; - 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 AdventurersGuildConfig() { } - 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"; - } + public static void save() { + ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - @Override - public void initializeValues() { + public static void initializeConfig() { + file = ConfigurationEngine.fileCreator("AdventurersGuild.yml"); + fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); 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); @@ -476,7 +400,7 @@ public void initializeValues() { 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); - baseKillsForRankUp = ConfigurationEngine.setInt( + 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); @@ -501,5 +425,92 @@ public void initializeValues() { 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/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java new file mode 100644 index 000000000..1642611ba --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java @@ -0,0 +1,199 @@ +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": + new WarningMessage("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); + 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/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index a78c176c3..fd96a24ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -199,6 +199,40 @@ public DungeonPackagerConfigFields(String filename, defaultDungeon = true; } + //For the adventurer's guild hub + public DungeonPackagerConfigFields(String filename, + boolean isEnabled, + String name, + List customInfo, + String downloadLink, + String worldName, + World.Environment environment, + Boolean protect, + String teleportLocationString, + int dungeonVersion, + String playerInfo, + String regionEnterMessage, + String regionLeaveMessage, + String dungeonConfigFolderName, + boolean allowExplosions) { + super(filename, isEnabled); + this.contentType = ContentType.HUB; + this.name = name; + this.customInfo = customInfo; + this.downloadLink = downloadLink; + this.worldName = worldName; + this.environment = environment; + this.protect = protect; + this.teleportLocationString = teleportLocationString; + this.dungeonVersion = dungeonVersion; + this.playerInfo = playerInfo; + this.regionEnterMessage = regionEnterMessage; + this.regionLeaveMessage = regionLeaveMessage; + this.dungeonConfigFolderName = dungeonConfigFolderName; + this.allowExplosions = allowExplosions; + defaultDungeon = true; + } + @Override public void processConfigFields() { this.isEnabled = processBoolean("isEnabled", isEnabled, false, true); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index c6098d3e0..d059fb8cf 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -4,6 +4,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.*; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityExplodeEvent; public class DungeonProtector implements Listener { @@ -92,5 +93,11 @@ public void preventLeafDecay(LeavesDecayEvent event){ 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); + } } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index 28da1c75f..f0d748779 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java @@ -37,6 +37,11 @@ public class EMPackage { protected List treasureChestList = new ArrayList<>(); protected List npcEntities = new ArrayList<>(); + public boolean isOutOfDate() { + if (!isInstalled) return false; + return outOfDate; + } + public EMPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; emPackages.put(dungeonPackagerConfigFields.getFilename(), this); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 9a117376a..1fe07038f 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -85,4 +85,5 @@ public boolean uninstall(Player player) { world = null; return true; } + } diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index 848fe63e0..4625ad1f1 100644 --- a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java +++ b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java @@ -321,8 +321,7 @@ public static class ExplosionEvent implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void entityExplodeEvent(EntityExplodeEvent event) { Entity entity = event.getEntity(); - if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) - entity = shooter; + if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) entity = shooter; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity); if (eliteEntity != null) { generateExplosion(event); diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index 696e75ff1..eb9658198 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -1,10 +1,10 @@ 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.VisualDisplay; -import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; 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 a201a3df6..45420aca4 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -200,7 +200,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."); +// announce("MagmaGuy's note: This is still a work in progress, please be patient! Hope you enjoyed your run."); new BukkitRunnable() { @Override 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 cf24b7dba..7b43e90fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java +++ b/src/main/java/com/magmaguy/elitemobs/items/customenchantments/SoulbindEnchantment.java @@ -1,5 +1,6 @@ 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,7 +9,6 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.items.EliteItemLore; import com.magmaguy.elitemobs.utils.VisualDisplay; -import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index dfcd53f2b..d4f10cb6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.playerdata; +import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.ItemSettingsConfig; @@ -9,8 +10,6 @@ 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; @@ -42,8 +41,6 @@ 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 @@ -78,20 +75,11 @@ private boolean fullUpdate(ItemStack itemStack) { 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()))); + 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; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java index 1f21941eb..5af9ea6b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/DebugBlockLocation.java @@ -13,7 +13,7 @@ public DebugBlockLocation(Location location) { location.getBlock().getY() + .5, location.getBlock().getZ() + .5, 1, - Bukkit.createBlockData(Material.LIGHT)); + Bukkit.createBlockData(Material.BARRIER)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java index 4f935b9dd..0f139d7d2 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.utils; +import com.magmaguy.elitemobs.ChatColorConverter; 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; 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 b0ace1e1c..000000000 --- a/src/main/java/com/magmaguy/elitemobs/worlds/CustomWorldLoading.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.magmaguy.elitemobs.worlds; - -import com.magmaguy.elitemobs.config.AdventurersGuildConfig; -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig; -import com.magmaguy.elitemobs.dungeons.EliteMobsWorld; -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!"); - EliteMobsWorld.create(worldCreator.createWorld().getUID(), DungeonPackagerConfig.getDungeonPackages().get("adventurers_guild.yml")); - } 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; - } - -} From cb54de487dd00ecdbbb1ef88d5425c77b10fc0d9 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 27 Jun 2024 16:49:48 +0100 Subject: [PATCH 53/78] EliteMobs 9.0.1 - [New] Added option to disable pvp in dungeons, defaulting to not allow pvp, to dungeons.yml - [New] Plugin will no longer try to load for unsupported Minecraft versions (versions older than Minecraft 1.21) - [Tweak] Changed several plugin defaults to be natively written for Minecraft 1.21 - [Fix] Fixed bug where reloading EliteMobs would remove the world protections for already loaded worlds - [Fix] Fixed error associated with trying to read potion effects - [Fix] Improved the compatibility layer to better take old enchantments and potion effects into account, reenabling effects on items generated before 9.0 - [Fix] Fixed error spam related to custom boss trails Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../com/magmaguy/elitemobs/EliteMobs.java | 6 ++ .../elitemobs/config/DungeonsConfig.java | 38 ++++------- .../config/LegacyValueConverter.java | 18 ++--- .../premade/DepthsSeekerConfig.java | 4 +- .../premade/GoblinCleaverItem.java | 2 +- .../customitems/premade/GoblinPokerItem.java | 2 +- .../premade/GoblinShooterItem.java | 2 +- .../premade/GoblinSlasherItem.java | 2 +- .../premade/LuckyCharmsConfig.java | 2 +- .../premade/RodOfTheDepthsConfig.java | 2 +- .../customitems/premade/WolfsbaneItem.java | 2 +- .../premade/ZombieKingsAxeConfig.java | 2 +- .../enchantments/EnchantmentsConfig.java | 9 ++- .../elitemobs/dungeons/DungeonProtector.java | 68 +++++++++++-------- .../elitemobs/dungeons/WorldPackage.java | 1 + .../dungeons/utility/DungeonUtils.java | 5 ++ .../itemconstructor/EnchantmentGenerator.java | 10 +-- .../potioneffects/ElitePotionEffect.java | 3 +- .../custombosses/CustomBossTrail.java | 8 ++- src/main/resources/plugin.yml | 2 +- 21 files changed, 107 insertions(+), 83 deletions(-) diff --git a/build.gradle b/build.gradle index 512568176..76a2bbd37 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.0-SNAPSHOT' +version '9.0.1-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f06a343d5..d6ff23ffe 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -134,6 +134,12 @@ public void onEnable() { MetadataHandler.PLUGIN = this; Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion()); + if (VersionChecker.serverVersionOlderThan(21,0)){ + new WarningMessage("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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index 12944c718..d0105bdd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -1,11 +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 DungeonsConfig extends ConfigurationFile { +public class DungeonsConfig { @Getter private static String instancedDungeonTitle; @@ -27,19 +28,13 @@ public class DungeonsConfig extends ConfigurationFile { private static String instancedDungeonClosingInstanceMessage; @Getter private static boolean friendlyFireInDungeons; - @Getter - private static double fireDamageMultiplier; - @Getter - private static double poisonDamageMultiplier; - @Getter - private static double witherDamageMultiplier; - public DungeonsConfig() { - super("dungeons.yml"); + private DungeonsConfig() { } - @Override - public void initializeValues() { + public static void initializeConfig() { + File file = ConfigurationEngine.fileCreator("dungeons.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); dungeonRezInstructions = ConfigurationEngine.setString( List.of("Sets the text that appears over resurrection banners in dungeons"), @@ -78,20 +73,13 @@ public void initializeValues() { List.of("Sets the message that appears when an instanced dungeon closing"), file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); + 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); + fileConfiguration, "friendlyFireInDungeons", false + ); + + 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 index 42fb1f950..c03efc4ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -8,7 +8,7 @@ private LegacyValueConverter() { public static String parseEnchantment(String materialName) { switch (materialName.toUpperCase(Locale.ROOT)) { - case "POWER": + case "ARROW_DAMAGE": return "POWER"; case "ARROW_FIRE": return "FLAME"; @@ -16,15 +16,15 @@ public static String parseEnchantment(String materialName) { return "INFINITY"; case "ARROW_KNOCKBACK": return "PUNCH"; - case "BANE_OF_ARTHROPODS": + case "DAMAGE_ARTHROPODS": return "BANE_OF_ARTHROPODS"; - case "SMITE": + case "DAMAGE_UNDEAD": return "SMITE"; - case "EFFICIENCY": + case "DIG_SPEED": return "EFFICIENCY"; case "DURABILITY": return "UNBREAKING"; - case "FORTUNE": + case "LOOT_BONUS_BLOCKS": return "FORTUNE"; case "LOOT_BONUS_MOBS": return "LOOTING"; @@ -36,13 +36,13 @@ public static String parseEnchantment(String materialName) { return "PROTECTION"; case "BLAST_PROTECTION": return "BLAST_PROTECTION"; - case "FEATHER_FALLING": + case "PROTECTION_FALL": return "FEATHER_FALLING"; - case "FIRE_PROTECTION": + case "PROTECTION_FIRE": return "FIRE_PROTECTION"; - case "PROJECTILE_PROTECTION": + case "PROTECTION_PROJECTILE": return "PROJECTILE_PROTECTION"; - case "AQUA_AFFINITY": + case "WATER_WORKER": return "AQUA_AFFINITY"; default: return materialName; 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 66387929c..f4135e948 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 @@ -13,8 +13,8 @@ public DepthsSeekerConfig() { 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", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK,0,self,continuous")); + setEnchantments(Arrays.asList("LURE,3", "LUCK_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); + setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK_OF_THE_SEA,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 4634322c2..8d25f4031 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 @@ -14,7 +14,7 @@ public GoblinCleaverItem() { Material.NETHERITE_AXE, "&8Goblin Cleaver", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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/GoblinPokerItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/GoblinPokerItem.java index 1f909e5d8..18f8f4c42 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 @@ -14,7 +14,7 @@ public GoblinPokerItem() { Material.TRIDENT, "&8Goblin Poker", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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 1a6fb6613..ab49b074a 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 @@ -14,7 +14,7 @@ public GoblinShooterItem() { Material.BOW, "&8Goblin Shooter", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("POWER,1", "UNBREAKING,1", "ARROW_INFINITE,1", "ARROW_FIRE,1")); + setEnchantments(Arrays.asList("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 7e3eef251..b56592181 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 @@ -14,7 +14,7 @@ public GoblinSlasherItem() { Material.NETHERITE_SWORD, "&8Goblin Slasher", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("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/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 3cbcfa73c..4f251360b 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 @@ -14,7 +14,7 @@ public LuckyCharmsConfig() { "&bLucky Charms", Arrays.asList("&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")); + setPotionEffects(List.of("LUCK_OF_THE_SEA,0,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 49e59d461..213325b25 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 @@ -13,7 +13,7 @@ public RodOfTheDepthsConfig() { 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", "UNBREAKING,6", "VANISHING_CURSE,1")); + setEnchantments(Arrays.asList("LURE,3", "LUCK_OF_THE_SEA,1", "UNBREAKING,6", "VANISHING_CURSE,1")); setPotionEffects(Arrays.asList("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/WolfsbaneItem.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/WolfsbaneItem.java index 9fb072f1c..95736297d 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 @@ -13,7 +13,7 @@ public WolfsbaneItem() { 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("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOT_BONUS_MOBS,5")); + setEnchantments(Arrays.asList("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOTING,5")); setPotionEffects(Arrays.asList("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 cfc38d25e..d8fd9b37c 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 @@ -14,7 +14,7 @@ public ZombieKingsAxeConfig() { "&4Zombie King's Axe", Arrays.asList("The axe of the one Zombies", "call their king.", "The bloodlust is palpable.")); setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOT_BONUS_MOBS,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); + "FIRE_ASPECT,4", "LOOTING,5", "AQUA_AFFINITY,5", "FLAMETHROWER,1")); setPotionEffects(Arrays.asList("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/enchantments/EnchantmentsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/enchantments/EnchantmentsConfig.java index 16bd68c60..26fa661df 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,7 @@ package com.magmaguy.elitemobs.config.enchantments; import com.magmaguy.elitemobs.config.CustomConfig; +import com.magmaguy.elitemobs.config.LegacyValueConverter; import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -21,12 +22,14 @@ public EnchantmentsConfig() { } public static EnchantmentsConfigFields getEnchantment(String string) { - EnchantmentsConfigFields test = enchantments.get(string); + String newString = LegacyValueConverter.parseEnchantment(string.replace(".yml", "")) + ".yml"; + newString = newString.toLowerCase(Locale.ROOT); + EnchantmentsConfigFields test = enchantments.get(newString); if (test == null) { - new WarningMessage("Failed to find enchant file " + string); + new WarningMessage("Failed to find enchant file " + newString); new Exception().printStackTrace(); } - return enchantments.get(string); + return enchantments.get(newString); } public static EnchantmentsConfigFields getEnchantment(Enchantment enchantment) { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index d059fb8cf..8a6e469be 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,103 +1,117 @@ package com.magmaguy.elitemobs.dungeons; +import com.magmaguy.elitemobs.config.DungeonsConfig; +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.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; public class DungeonProtector implements Listener { - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventPlayerBlockDamage(BlockDamageEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockDamage(BlockDamageEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventPlayerBlockBreak(BlockBreakEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockBreak(BlockBreakEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockBurnDamage(BlockBurnEvent event){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventPlayerBlockPlace(BlockCanBuildEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setBuildable(false); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockExplosionEvent(BlockExplodeEvent event){ + @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){ + @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){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockFadeEvent(BlockFadeEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBonemeal(BlockFertilizeEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBonemeal(BlockFertilizeEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventLiquidFlow(BlockFromToEvent event){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventLiquidFlow(BlockFromToEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventBlockFire(BlockIgniteEvent event){ + @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){ + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventBlockPlace(BlockPlaceEvent event) { if (!EliteMobsWorld.isEliteMobsWorld(event.getBlock().getWorld().getUID())) return; event.setCancelled(true); } - @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventLeafDecay(LeavesDecayEvent event){ + @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){ + 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); + } + + } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 1fe07038f..0f964427e 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -41,6 +41,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; } 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 cf47ac349..02d206bbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -47,6 +47,11 @@ public static World loadWorld(WorldPackage worldPackage) { } public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { + if (Bukkit.getWorld(worldName) != null) { + EliteMobsWorld.create(Bukkit.getWorld(worldName).getUID(), dungeonPackagerConfigFields); + return Bukkit.getWorld(worldName); + } + File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { 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 3af70a168..725ce0426 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/EnchantmentGenerator.java @@ -77,16 +77,16 @@ public static HashMap generateEnchantments(double itemTier 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("POWER")); - validEnchantments.putAll(validateEnchantments("ARROW_FIRE")); - validEnchantments.putAll(validateEnchantments("ARROW_INFINITE")); - validEnchantments.putAll(validateEnchantments("ARROW_KNOCKBACK")); + 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")); @@ -237,7 +237,7 @@ public static HashMap generateEnchantments(double itemTier 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: 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 a591776c2..e3da5dddb 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -1,5 +1,6 @@ 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 org.bukkit.NamespacedKey; @@ -20,7 +21,7 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", stringObject[0].toLowerCase(Locale.ROOT))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0].toLowerCase(Locale.ROOT)))); if (potionEffectType == null) { new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; 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 a18650c41..65404b752 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java @@ -48,7 +48,13 @@ private void startBossTrails() { } private void doParticleTrail(Particle particle) { - if (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/resources/plugin.yml b/src/main/resources/plugin.yml index 20d85e1ac..8f39796ff 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.0-SNAPSHOT-2 +version: 9.0.1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From cbd7431261c1c05805f48070cf3cf9dae5ca394e Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 2 Jul 2024 13:19:53 +0100 Subject: [PATCH 54/78] EliteMobs 9.0.2 - [New] Added the NAVIGATE script action, which makes a mob navigate to the given block, with a maximum navigation time, an optional teleport failsafe and a velocity option - [New] Added ZoneEnterEvent and ZoneLeaveEvent for elite scripts. This allows scripters to trigger actions based on entities entering and leaving zones set in scripts. The DIRECT_TARGET of ZoneEnterEvent and ZoneLeaveEvent is the entity that entered or left, and due to how the internal logic works only absolute points (specific coordinates) and points relative to the boss can be used for scanning entering and leaving. - [New] No durability left messages for elite items now appear in the boss bar instead of spamming chat - [New] Treasure Chests can now be added to dungeon instances by using "instanced: true" in their configuration files and adding the locations the same way it is done with regional bosses - [New] Added minimum event cooldown for timed events, defaulted to 4 minutes, to prevent multiple events to happen all at once when players join worlds with queued events - [New] Added warning for items using INSTANT_DAMAGE/HARM potion effects due to the tendency of making players/admins not understand why they're healing undead mobs. We will be redoing all default/officially distributed loot that uses these potion effects, which shouldn't be more than a few cases. - [New] Added listedInTeleports option for dungeon packager that can prevent certain dungeons from being listed in the teleports page of the EM menu - [New] Added fireDamageMultiplier, poisonDamageMultiplier, witherDamageMultiplier to dungeons.yml which modify how much damage those damage sources deal inside of EliteMobs dungeon worlds to better balance combat - [New] Added safeguard in case a script gives players god mode (never recommended to do this) to remove god mode when they log off or the server shuts down - [Fix] Fixed issue where players would get permanently slowed down due to a Minecraft bug - [Fix] Fixed Zombie Necronomicon power now accounting for zombies potentially turnining into drowned - [Fix] Fixed maven repo readme - [Fix] Updated sonatype access to be token-based to reenable publishing the API - [Fix] Fixed an issue that caused EliteMobDamagedByEliteMobEvent scripts not to work correctly - [Fix] Fixed issue that caused quests to show the wrong level for the bosses in kill quests - [Fix] Fixed bug where teleports page could contain currently not installed content Signed-off-by: MagmaGuy --- build.gradle | 12 +-- .../com/magmaguy/elitemobs/EliteMobs.java | 6 ++ .../magmaguy/elitemobs/EventsRegistrer.java | 4 + .../FixPlayerSpeedOnRespawn.java | 14 ++++ .../PlayerQuitCleanup.java | 2 +- .../elitemobs/config/DungeonsConfig.java | 22 +++++- .../elitemobs/config/EventsConfig.java | 18 +++-- .../CustomBossesConfigFields.java | 2 +- .../customitems/CustomItemsConfigFields.java | 9 ++- .../CustomTreasureChestConfigFields.java | 9 ++- .../DungeonPackagerConfigFields.java | 4 + .../elitemobs/dungeons/WorldPackage.java | 2 +- .../instanced/dungeons/DungeonInstance.java | 2 + .../potioneffects/ElitePotionEffect.java | 2 +- .../elitemobs/mobconstructor/CustomSpawn.java | 10 +-- .../elitemobs/pathfinding/Navigation.java | 44 +++++++++++ .../elitemobs/playerdata/PlayerItem.java | 28 +++++-- .../elitemobs/powers/ZombieNecronomicon.java | 10 +-- .../powers/scripts/ScriptAction.java | 40 ++++++++-- .../powers/scripts/ScriptListener.java | 4 +- .../elitemobs/powers/scripts/ScriptZone.java | 75 ++++++++----------- .../caching/ScriptActionBlueprint.java | 3 + .../powers/scripts/enums/ActionType.java | 3 +- .../treasurechest/TreasureChest.java | 70 +++++++++++------ .../utils/ConfigurationLocation.java | 13 ++-- src/main/resources/plugin.yml | 2 +- 26 files changed, 285 insertions(+), 125 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java diff --git a/build.gradle b/build.gradle index 76a2bbd37..f27628f29 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.1-SNAPSHOT' +version '9.0.2-SNAPSHOT' repositories { maven { @@ -182,14 +182,16 @@ artifacts { archives javadocJar, sourcesJar } -ext.isReleaseVersion = !version.contains("SNAPSHOT") +//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 +// 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 = "https://s01.oss.sonatype.org/content/repositories/snapshots/"; credentials { username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user" password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password" diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index d6ff23ffe..8c3becb3a 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -42,8 +42,10 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; 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; @@ -55,6 +57,7 @@ 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.BossBarUtil; import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ServerTime; import com.magmaguy.elitemobs.utils.WarningMessage; @@ -363,6 +366,9 @@ public void onDisable() { ProceduralShopMenu.shutdown(); EliteMobsWorld.shutdown(); + Navigation.shutdown(); + BossBarUtil.shutdown(); + ScriptAction.shutdown(); //save cached data Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index d691fb16a..a2ac40314 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -107,6 +107,10 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) register(new PreventUpgradeDiamondToNetherite()); + register(new FixPlayerSpeedOnRespawn()); + register(new EnvironmentalDungeonDamage()); + register(new PlayerQuitCleanup()); + //Mob damage register(new EliteMobGenericDamagedHandler()); register(new EliteMobDamagedByEliteMobHandler()); diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java new file mode 100644 index 000000000..ea5f4de1b --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java @@ -0,0 +1,14 @@ +package com.magmaguy.elitemobs.collateralminecraftchanges; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class FixPlayerSpeedOnRespawn implements Listener { + @EventHandler + public void onPlayerRespawn(PlayerRespawnEvent event) { + event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0)); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java index 3a88714f5..cf7069ae3 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java @@ -7,7 +7,7 @@ public class PlayerQuitCleanup implements Listener { @EventHandler - public void onPlayerQuit(PlayerQuitEvent event) { + public void onPlayerQuit(PlayerQuitEvent event){ if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer())) event.getPlayer().setInvulnerable(false); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index d0105bdd2..8ec9e8c08 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java @@ -28,6 +28,12 @@ public class DungeonsConfig { 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() { } @@ -73,11 +79,21 @@ public static void initializeConfig() { List.of("Sets the message that appears when an instanced dungeon closing"), file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!", true); - friendlyFireInDungeons = ConfigurationEngine.setBoolean( List.of("Sets if PvP will be allowed in dungeons"), - fileConfiguration, "friendlyFireInDungeons", false - ); + 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); ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java index 2d72be5c4..37d2b3339 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java @@ -1,11 +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 EventsConfig extends ConfigurationFile { +public class EventsConfig { @Getter private static boolean announcementBroadcastWorldOnly; @Getter @@ -17,12 +18,13 @@ public class EventsConfig extends ConfigurationFile { @Getter private static boolean timedEventsEnabled; - public EventsConfig() { - super("events.yml"); + private EventsConfig() { } - @Override - public void initializeValues() { + public static void initializeConfig() { + File file = ConfigurationEngine.fileCreator("events.yml"); + FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + 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); @@ -31,7 +33,7 @@ public void initializeValues() { fileConfiguration, "actionEventMinimumCooldownMinutes", 4); timedEventMinimumCooldown = ConfigurationEngine.setInt( List.of("Sets the minimum cooldown, in minutes, between timed events"), - fileConfiguration, "actionEventMinimumCooldownMinutes", 4); + 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"), @@ -41,5 +43,7 @@ public void initializeValues() { "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/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index 898bc3ae7..e3d98fa33 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -244,7 +244,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")) 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 2ceac6f6d..1a0184059 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/customitems/CustomItemsConfigFields.java @@ -98,9 +98,7 @@ private void updatePostProcessor() { String[] split = enchantment.split(","); String result = LegacyValueConverter.parseEnchantment(split[0]); if (result.equals(split[0])) newEnchantments.add(enchantment); - else { - newEnchantments.add(result + "," + split[1]); - } + else newEnchantments.add(result + "," + split[1]); } enchantments = newEnchantments; @@ -126,5 +124,10 @@ private void updatePostProcessor() { } } potionEffects = newPotionEffects; + + potionEffects.forEach(potionEffect->{ + if (potionEffect.contains("INSTANT_DAMAGE")) + new WarningMessage("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/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index 8f81d59aa..2f78f13f5 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,10 @@ import com.magmaguy.elitemobs.items.customloottable.CustomLootTable; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import lombok.Getter; import lombok.Setter; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -122,12 +123,12 @@ else if (locationsString != null) try { timestamp = Long.parseLong(strings[1]); } catch (Exception exception) { - Logger.warn("Bad unix timestamp in locations for " + filename + " . Entry: " + strings[0]); + new WarningMessage("Bad unix timestamp in locations for " + filename + " . Entry: " + strings[0]); } } new TreasureChest(this, strings[0], timestamp); } - else Logger.warn("No locations found for chest " + filename); + else new WarningMessage("No locations found for chest " + filename); } /** @@ -172,7 +173,7 @@ public void setRestockTime(Location location, long newRestockTime) { try { fileConfiguration.save(file); } catch (Exception ex) { - Logger.warn("Attempted to update restock time for a custom treasure chest and failed, did you delete it during runtime?"); + Bukkit.getLogger().warning("[EliteMobs] 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/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index fd96a24ed..3db03e8fb 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -99,6 +99,9 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @Getter @Setter private boolean allowExplosions; + @Getter + @Setter + private boolean listedInTeleports = true; public DungeonPackagerConfigFields(String fileName, boolean isEnabled) { super(fileName, isEnabled); @@ -279,6 +282,7 @@ public void processConfigFields() { 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); processAdditionalFields(); } diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 0f964427e..c8c3cf4fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -55,7 +55,7 @@ public void baseInitialization() { if (isDownloaded && isInstalled) { world = DungeonUtils.loadWorld(this); dungeonPackagerConfigFields.initializeWorld(); - } + } else isInstalled = false; } 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 45420aca4..b85806480 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -14,6 +14,7 @@ import com.magmaguy.elitemobs.instanced.MatchInstance; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; +import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.*; import lombok.Getter; import org.bukkit.Bukkit; @@ -72,6 +73,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, 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); } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); 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 e3da5dddb..aa65beda9 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -21,7 +21,7 @@ public ElitePotionEffect(String string) { try { String[] stringObject = string.split(","); int duration = 2 * 20; - PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0].toLowerCase(Locale.ROOT)))); + PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); if (potionEffectType == null) { new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java index 54233739c..a3ac05e2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -8,6 +8,7 @@ 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; @@ -115,7 +116,6 @@ public void run() { }.runTaskAsynchronously(MetadataHandler.PLUGIN); else spawn(); - } private void spawn() { @@ -129,7 +129,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; @@ -165,13 +165,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; @@ -240,6 +239,7 @@ public Location generateRandomSpawnLocation() { Location playerLocation = player.getLocation(); if (!ValidWorldsConfig.getValidWorlds().contains(playerLocation.getWorld().getName())) 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()) diff --git a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index 178143ea8..410287c9e 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 HashMap currentlyNavigating = new HashMap(); + public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; if (regionalBossEntity.getUnsyncedLivingEntity() != null && @@ -51,6 +60,41 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .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) public void makeReturningBossesInvulnerable(WanderBackToPointStartEvent event) { if (!event.isHardObjective()) return; diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index d4f10cb6d..f544a4fae 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -10,6 +10,7 @@ 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 org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -41,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 @@ -75,22 +78,31 @@ private boolean fullUpdate(ItemStack itemStack) { return fillNullItem(); if (isOnLastDamage(itemStack)) { - player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getNoItemDurabilityMessage().replace( - "$item", !itemStack.getItemMeta().hasDisplayName() ? itemStack.getType().toString() : itemStack.getItemMeta().getDisplayName()))); + 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; - if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { - if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { - player.getWorld().dropItem(player.getLocation(), itemStack); - itemStack.setAmount(0); - itemStack = new ItemStack(Material.AIR); + if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { + if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { + player.getWorld().dropItem(player.getLocation(), itemStack); + itemStack.setAmount(0); + itemStack = new ItemStack(Material.AIR); + } } - } //Neither offhand nor armor contribute to baseline damage outside of the enchants, so we reset the damage before anything this.eliteDamage = 0; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java index 058503d28..266003f8f 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java @@ -11,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.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -28,7 +28,7 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; -import static com.magmaguy.magmacore.util.ChatColorConverter.convert; +import static com.magmaguy.elitemobs.ChatColorConverter.convert; /** * Created by MagmaGuy on 18/05/2017. @@ -36,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - private final ArrayList entityList = new ArrayList<>(); + private ArrayList entityList = new ArrayList<>(); public ZombieNecronomicon() { super(PowersConfig.getPower("zombie_necronomicon.yml")); @@ -209,7 +209,7 @@ public void run() { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity("necronomicon_zombie.yml"); if (customBossEntity == null) { - Logger.warn("necronomicon_zombie.yml is not valid!"); + new WarningMessage("necronomicon_zombie.yml is not valid!"); return; } customBossEntity.spawn(targetter.getLocation(), eliteEntity.getLevel(), false); @@ -233,7 +233,7 @@ public void run() { CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity("necronomicon_skeleton.yml"); if (customBossEntity == null) { - Logger.warn("necronomicon_skeleton.yml is not valid!"); + new WarningMessage("necronomicon_skeleton.yml is not valid!"); targetter.setAI(true); cancel(); return; 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 2de641a7a..969f57725 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -9,6 +9,7 @@ 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; @@ -30,14 +31,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; @@ -48,6 +48,10 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; + public static void shutdown(){ + invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); + } + public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; @@ -212,6 +216,7 @@ 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); default -> new WarningMessage("Failed to determine action type " + blueprint.getActionType() + " in script " + blueprint.getScriptName() + " for file " + blueprint.getScriptFilename()); } @@ -299,7 +304,10 @@ 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 @@ -518,6 +526,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()); }); @@ -662,4 +676,20 @@ 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) { + new WarningMessage("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()); + }); + } } \ No newline at end of file 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 a2967870b..b510405b3 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptListener.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.api.*; import com.magmaguy.elitemobs.mobconstructor.EliteEntity; import com.magmaguy.elitemobs.powers.meta.ElitePower; -import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.elitemobs.utils.WarningMessage; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; @@ -25,7 +25,7 @@ public static void runEvent(FallingEntityDataPair fallingEntityDataPair, Locatio 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!"); + new WarningMessage("Elite script " + string + " does not exist for landing scripts!"); return; } iteratedScript.check(landingLocation, fallingEntityDataPair.getScriptActionData()); 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 e066f3348..98c9c625e 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -11,8 +11,8 @@ import com.magmaguy.elitemobs.powers.scripts.caching.ScriptZoneBlueprint; import com.magmaguy.elitemobs.powers.scripts.enums.TargetType; import com.magmaguy.elitemobs.utils.EventCaller; +import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.*; -import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -56,7 +56,32 @@ 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); + new BukkitRunnable() { + @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; + } + }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); } public void ZoneEnterEvent(EliteEntity eliteEntity, LivingEntity livingEntity) { @@ -76,7 +101,7 @@ protected Collection getZoneEntities(ScriptActionData scriptAction case INHERIT_SCRIPT_ZONE_FULL, INHERIT_SCRIPT_ZONE_BORDER: return getEntitiesInArea(generateShapes(scriptActionData.getInheritedScriptActionData(), false), blueprintFromRequestingTarget.getTargetType()); default: { - Logger.warn("Couldn't parse target " + targets.getTargetBlueprint().getTargetType() + " in script "); + new WarningMessage("Couldn't parse target " + targets.getTargetBlueprint().getTargetType() + " in script "); return new ArrayList<>(); } } @@ -112,7 +137,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for try { return scriptActionData.getShapesChachedByTarget(); } catch (Exception ex) { - Logger.warn("Failed to get list of shapes!"); + new WarningMessage("Failed to get list of shapes!"); return new ArrayList<>(); } } @@ -134,7 +159,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for break; case STATIC_RAY: if (targets2 == null) { - Logger.warn("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); + new WarningMessage("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); break; } for (Location location : targets2.getTargetLocations(scriptActionData)) @@ -143,7 +168,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for break; case ROTATING_RAY: if (targets2 == null) { - Logger.warn("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); + new WarningMessage("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); break; } for (Location target2Location : targets2.getTargetLocations(scriptActionData)) @@ -152,7 +177,7 @@ public List generateShapes(ScriptActionData scriptActionData, boolean for break; case TRANSLATING_RAY: if (targets2 == null) { - Logger.warn("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); + new WarningMessage("Script for boss " + scriptActionData.getEliteEntity().getName() + " has a static ray but no set target2 for the ray!"); break; } Location targetLocationEnd = null; @@ -183,6 +208,7 @@ 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 @@ -241,39 +267,4 @@ 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/ScriptActionBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptActionBlueprint.java index 783949501..cd0d776f4 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 @@ -107,6 +107,8 @@ public class ScriptActionBlueprint { private float volume = 1f; @Getter private float pitch = 1f; + @Getter + private float velocity = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -192,6 +194,7 @@ protected void processKeyAndValue(String key, Object value) { scriptRelativeVectorBlueprint = new ScriptRelativeVectorBlueprint(scriptName, scriptFilename, (Map) value); case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); + case "velocity" -> velocity = parseFloat(key, value, scriptName); default -> new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); } 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 475a59a82..16314c860 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 @@ -33,8 +33,7 @@ public enum ActionType { SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), SUMMON_ENTITY(false), - NAVIGATE(false), - SCALE(false); + NAVIGATE(false); @Getter private final boolean requiresLivingEntity; diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index a3baa5901..4f3c0d143 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,5 +1,6 @@ package com.magmaguy.elitemobs.treasurechest; +import com.google.common.collect.ArrayListMultimap; import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; @@ -11,10 +12,7 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; 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.elitemobs.utils.*; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -32,15 +30,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; @@ -62,26 +66,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) @@ -115,7 +128,8 @@ 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; @@ -123,16 +137,20 @@ public void doInteraction(Player player) { if (ThreadLocalRandom.current().nextDouble() < customTreasureChestConfigFields.getMimicChance()) doMimic(); else doTreasure(player); - player.playSound(player.getLocation(), SoundsConfig.treasureChestOpenSound,1,1); + 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; } @@ -141,7 +159,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()); } @@ -178,6 +197,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; @@ -256,9 +278,13 @@ public enum DropStyle { public static class TreasureChestEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { + Developer.message("0"); if (event.getClickedBlock() == null) return; + Developer.message("1"); TreasureChest treasureChest = getTreasureChest(event.getClickedBlock().getLocation()); + Developer.message("2"); if (treasureChest == null) return; + Developer.message("3"); event.setCancelled(true); if (GuildRank.getMaxGuildRank(event.getPlayer()) < treasureChest.customTreasureChestConfigFields.getChestTier()) treasureChest.lowRankMessage(event.getPlayer()); diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java index 9e757f94f..a6e454582 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -75,9 +74,9 @@ public static Location serialize(String locationString, boolean silent) { } 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); + 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); return null; } return new Location(world, x, y, z, yaw, pitch); @@ -125,9 +124,9 @@ public static Location serializeWithInstance(World instancedWorld, String locati } 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); + 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); return null; } return new Location(instancedWorld, x, y, z, yaw, pitch); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8f39796ff..ae83b8987 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.1 +version: 9.0.2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From cd02705ce5853bf4a970440c7a8a90656145f0ba Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 7 Jul 2024 13:21:26 +0100 Subject: [PATCH 55/78] EliteMobs 9.0.3 - [New] The Nether Bell Sanctum - the last story mode sanctum is out! - [New] Withers can now be used as valid elites - [Fix] Updated the villager profession code to fit the new Spigot 1.21 API - [Fix] Fixed Breezes and Bogged not working correctly as elites - [Fix] Fixed Minecraft bug that caused speed potion effects to last forever under certain circumstances - [Tweak] Minor improvement to configuration generation Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../FixPlayerSpeedOnRespawn.java | 1 + .../elitemobs/config/ConfigurationEngine.java | 7 ++++++- .../mobproperties/MobPropertiesConfig.java | 4 ++-- .../mobproperties/premade/EliteBreeze.java | 17 ----------------- .../elitemobs/mobconstructor/EliteEntity.java | 5 ++++- .../elitemobs/treasurechest/TreasureChest.java | 9 ++++----- src/main/resources/plugin.yml | 2 +- 8 files changed, 19 insertions(+), 28 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java diff --git a/build.gradle b/build.gradle index f27628f29..9cf1a7dd0 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.2-SNAPSHOT' +version '9.0.3-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java index ea5f4de1b..5b1defcd0 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java @@ -10,5 +10,6 @@ public class FixPlayerSpeedOnRespawn 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)); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 64093b316..6e89a7855 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -83,7 +83,12 @@ private static void setComments(FileConfiguration fileConfiguration, String key, } public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - fileConfiguration.addDefault(key, defaultValue); + try { + fileConfiguration.addDefault(key, defaultValue); + } catch (Exception e) { + new WarningMessage("Attempted to write key " + key + " with value " + defaultValue + " to " + fileConfiguration.getName() + " and that contained an illegal argument!"); + e.printStackTrace(); + } return fileConfiguration.getBoolean(key); } 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 487606694..a2016203e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -56,8 +56,8 @@ public class MobPropertiesConfig { new EliteHoglinConfig(), new ElitePiglinBruteConfig(), new EliteBeeConfig(), - new EliteBreeze() - + new EliteBreezeConfig(), + new EliteWitherConfig() )); public static HashMap getMobProperties() { diff --git a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java deleted file mode 100644 index e89c9d654..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteBreeze.java +++ /dev/null @@ -1,17 +0,0 @@ -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 EliteBreeze extends MobPropertiesConfigFields { - public EliteBreeze() { - super("elite_breeze", - EntityType.BOGGED, - 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/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index 879e9c211..12a20aa66 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java @@ -278,7 +278,6 @@ 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); @@ -290,6 +289,10 @@ public void setLivingEntity(LivingEntity livingEntity, CreatureSpawnEvent.SpawnR 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 diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index 4f3c0d143..f34961cf0 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -12,7 +12,10 @@ import com.magmaguy.elitemobs.mobconstructor.PersistentObject; import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.elitemobs.utils.*; +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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -278,13 +281,9 @@ public enum DropStyle { public static class TreasureChestEvents implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { - Developer.message("0"); if (event.getClickedBlock() == null) return; - Developer.message("1"); TreasureChest treasureChest = getTreasureChest(event.getClickedBlock().getLocation()); - Developer.message("2"); if (treasureChest == null) return; - Developer.message("3"); event.setCancelled(true); if (GuildRank.getMaxGuildRank(event.getPlayer()) < treasureChest.customTreasureChestConfigFields.getChestTier()) treasureChest.lowRankMessage(event.getPlayer()); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ae83b8987..541022761 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.2 +version: 9.0.3 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From b0c1a50dd77a08e3a96e3568d566b1274e93a0da Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Wed, 17 Jul 2024 04:32:48 +0100 Subject: [PATCH 56/78] EliteMobs 9.0.4 - [New] The official EliteMobs resource packs is now automatically placed in the exports folder of EliteMobs to be used by my new plugin, ResourcePackManager, which can automatically merge and host resource packs! - [New] Added the scale setting to custom bosses, allowing them to be larger or smaller - [Fix] Fixed issue where the back teleported would not work correctly - [Removal] Removed /em generateresourcepack command, now replaced with the much better ResourcePackManager plugin that does it automatically Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../elitemobs/api/PlayerTeleportEvent.java | 21 +- .../elitemobs/commands/AdminCommands.java | 8 - .../config/ConfigurationExporter.java | 207 +++++------------- .../CustomBossesConfigFields.java | 4 + src/main/resources/plugin.yml | 2 +- 6 files changed, 70 insertions(+), 174 deletions(-) diff --git a/build.gradle b/build.gradle index 9cf1a7dd0..c3ab731e3 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ processResources { } group 'com.magmaguy' -version '9.0.3-SNAPSHOT' +version '9.0.4-SNAPSHOT' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java index f579167be..05177dd22 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java @@ -1,15 +1,12 @@ package com.magmaguy.elitemobs.api; -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(); @@ -67,20 +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; - - EMPackage adventurersGuildPackage = EMPackage.getContent("adventurers_guild_hub"); - if (adventurersGuildPackage == null || !adventurersGuildPackage.isInstalled() || - adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation() == null || - Objects.equals(adventurersGuildPackage.getDungeonPackagerConfigFields().getTeleportLocation().getWorld(), originalLocation.getWorld())) - return; - - PlayerData.setBackTeleportLocation(player, originalLocation); } public static class PlayerTeleportEventExecutor implements Listener { diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java index fadb018cb..003ce635a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java @@ -12,7 +12,6 @@ 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; @@ -692,13 +691,6 @@ public AdminCommands(BukkitCommandManager manager, Command.Builde } })); - // /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") diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java index 22fbef2d0..2e9526b60 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 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) { + new WarningMessage("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) { + new WarningMessage("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 { + new WarningMessage("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/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index e3d98fa33..11f3afb7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -217,6 +217,8 @@ public class CustomBossesConfigFields extends CustomConfigFields implements Cust 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. @@ -392,6 +394,8 @@ public void processConfigFields() { } catch (Exception e) { new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); } + + this.scale = processDouble("scale", scale, 1, false); } public boolean isCustomModelExists() { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 541022761..05e08f7c5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.3 +version: 9.0.4 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 714336d180224a22e790cb861b6cca051fa2ac66 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 25 Jul 2024 09:11:19 +0100 Subject: [PATCH 57/78] EliteMobs 9.0.5 - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Almost all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 63 +- .../elitemobs/ChatColorConverter.java | 29 - .../com/magmaguy/elitemobs/EliteMobs.java | 124 +-- .../magmaguy/elitemobs/EventsRegistrer.java | 2 +- .../GuildRankMenuHandler.java | 2 +- .../AlternativeDurabilityLoss.java | 2 +- .../FixPlayerOnLoginOrRespawn.java | 4 +- .../FixPlayerSpeedOnRespawn.java | 15 - .../PlayerQuitCleanup.java | 2 +- .../elitemobs/commands/AdminCommands.java | 896 ------------------ .../commands/AdventurersGuildCommand.java | 9 +- .../elitemobs/commands/AltCommand.java | 8 +- .../elitemobs/commands/ArenaCommand.java | 9 +- .../elitemobs/commands/ArenaCommands.java | 4 +- .../elitemobs/commands/CommandHandler.java | 106 --- .../elitemobs/commands/CommandManager.java | 96 ++ .../commands/CurrencyCommandsHandler.java | 2 +- .../elitemobs/commands/DebugCommand.java | 9 +- .../elitemobs/commands/DiscordCommand.java | 11 +- .../commands/DiscordMessageCommand.java | 11 +- .../elitemobs/commands/DismissCommand.java | 6 +- .../commands/DungeonTeleportCommand.java | 7 +- .../elitemobs/commands/EliteMobsCommand.java | 10 +- .../elitemobs/commands/EnchantCommand.java | 7 +- .../elitemobs/commands/EventCommand.java | 7 +- .../elitemobs/commands/FireballCommand.java | 11 +- .../elitemobs/commands/HelpCommand.java | 26 +- .../elitemobs/commands/KillCommand.java | 7 +- .../elitemobs/commands/KillRadiusCommand.java | 7 +- .../elitemobs/commands/KillTypeCommand.java | 11 +- .../commands/KillTypeRadiusCommand.java | 15 +- .../elitemobs/commands/LanguageCommand.java | 15 +- .../elitemobs/commands/LootCommand.java | 7 +- .../elitemobs/commands/LootDebugCommand.java | 14 +- .../elitemobs/commands/LootGiveCommand.java | 13 +- .../elitemobs/commands/LootMenuCommand.java | 7 +- .../elitemobs/commands/LootRandomCommand.java | 15 +- .../commands/LootSimulateCommand.java | 15 +- .../commands/LootSimulateMultipleCommand.java | 15 +- .../elitemobs/commands/LootStats.java | 7 +- .../commands/MoneyAddAllCommand.java | 21 +- .../elitemobs/commands/MoneyAddCommand.java | 17 +- .../elitemobs/commands/MoneyCheckCommand.java | 11 +- .../commands/MoneyCheckPlayerCommand.java | 15 +- .../commands/MoneyRemoveCommand.java | 11 +- .../elitemobs/commands/MoneySetCommand.java | 13 +- .../commands/PackageDungeonCommand.java | 9 +- .../elitemobs/commands/PayCommand.java | 10 +- .../elitemobs/commands/PlaceBossCommand.java | 19 +- .../elitemobs/commands/PlaceNPCCommand.java | 7 +- .../commands/PlaceTreasureChestCommand.java | 7 +- .../commands/PlaceWormholeCommand.java | 21 +- .../commands/QuestAcceptCommand.java | 7 +- .../commands/QuestBypassCommand.java | 15 +- .../commands/QuestCompleteCommand.java | 7 +- .../elitemobs/commands/QuestLeaveCommand.java | 7 +- .../commands/QuestResetAllCommand.java | 14 +- .../elitemobs/commands/QuestResetCommand.java | 9 +- .../elitemobs/commands/QuestTrackCommand.java | 7 +- .../elitemobs/commands/QuitCommand.java | 7 +- .../elitemobs/commands/RankCommand.java | 9 +- .../elitemobs/commands/RankSetCommand.java | 13 +- .../elitemobs/commands/ReloadCommand.java | 7 +- .../elitemobs/commands/RemoveCommand.java | 7 +- .../elitemobs/commands/RepairCommand.java | 9 +- .../elitemobs/commands/RespawnAllCommand.java | 5 +- .../elitemobs/commands/ScrapCommand.java | 9 +- .../elitemobs/commands/SetupCommand.java | 7 +- .../elitemobs/commands/SetupDoneCommand.java | 11 +- .../elitemobs/commands/SetupHandler.java | 17 - .../commands/SetupToggleCommand.java | 22 +- .../elitemobs/commands/ShareItemCommand.java | 7 +- .../elitemobs/commands/ShopCustomCommand.java | 9 +- .../commands/ShopCustomOtherCommand.java | 11 +- .../commands/ShopDynamicCommand.java | 11 +- .../commands/ShopProceduralOtherCommand.java | 7 +- .../commands/ShopSellOtherCommand.java | 13 +- .../commands/SpawnBossAtCommand.java | 23 +- .../elitemobs/commands/SpawnBossCommand.java | 11 +- .../commands/SpawnBossLevelAtCommand.java | 25 +- .../commands/SpawnBossLevelCommand.java | 15 +- .../elitemobs/commands/SpawnCommand.java | 16 +- .../elitemobs/commands/SpawnElite.java | 13 +- .../commands/SpawnEliteAtCommand.java | 25 +- .../commands/SpawnTeleportCommand.java | 7 +- .../elitemobs/commands/StartCommand.java | 8 +- .../elitemobs/commands/StatsCommand.java | 7 +- .../elitemobs/commands/TrackBossCommand.java | 12 +- .../TransitiveBlocksCancelCommand.java | 9 +- .../TransitiveBlocksEditAreaCommand.java | 16 +- .../commands/TransitiveBlocksEditCommand.java | 17 +- .../TransitiveBlocksRegisterAreaCommand.java | 16 +- .../TransitiveBlocksRegisterCommand.java | 16 +- .../elitemobs/commands/UnbindCommand.java | 9 +- .../commands/UnbindForceCommand.java | 7 +- .../elitemobs/commands/VersionCommand.java | 9 +- .../elitemobs/commands/admin/DebugScreen.java | 2 +- .../commands/admin/GetTierCommand.java | 12 +- .../elitemobs/commands/admin/KillHandler.java | 2 +- .../commands/admin/StatsCommand.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 10 +- .../config/AdventurersGuildConfig.java | 187 ++-- .../elitemobs/config/AntiExploitConfig.java | 18 +- .../elitemobs/config/ConfigurationEngine.java | 165 +--- .../config/ConfigurationExporter.java | 10 +- .../config/ConfigurationImporter.java | 40 +- .../elitemobs/config/CustomConfig.java | 193 ---- .../elitemobs/config/DefaultConfig.java | 52 +- .../elitemobs/config/DungeonsConfig.java | 16 +- .../config/EconomySettingsConfig.java | 42 +- .../elitemobs/config/EventsConfig.java | 18 +- .../config/ItemUpgradeSystemConfig.java | 28 - .../config/LegacyValueConverter.java | 21 + .../elitemobs/config/ModelsConfig.java | 18 +- ...roceduralItemGenerationSettingsConfig.java | 3 +- .../elitemobs/config/QuestsConfig.java | 176 ++-- .../config/ResourcePackDataConfig.java | 48 +- .../elitemobs/config/SoundsConfig.java | 19 +- .../config/SpecialItemSystemsConfig.java | 39 +- .../elitemobs/config/ValidWorldsConfig.java | 41 +- .../CustomBossesConfigFields.java | 33 +- .../customitems/CustomItemsConfigFields.java | 13 +- .../premade/DepthsSeekerConfig.java | 2 +- .../premade/LuckyCharmsConfig.java | 2 +- .../CustomQuestsConfigFields.java | 20 +- .../CustomTreasureChestConfigFields.java | 9 +- .../DungeonPackagerConfigFields.java | 4 +- .../enchantments/EnchantmentsConfig.java | 6 +- .../elitemobs/dungeons/EMPackage.java | 16 +- .../WorldInstancedDungeonPackage.java | 14 - .../elitemobs/dungeons/WorldPackage.java | 6 +- .../dungeons/utility/DungeonUtils.java | 9 +- .../elitemobs/events/ActionEvent.java | 4 +- .../elitemobs/explosionregen/Explosion.java | 3 +- .../instanced/InstanceDeathLocation.java | 2 +- .../instanced/arena/ArenaInstance.java | 22 +- .../instanced/dungeons/DungeonInstance.java | 14 +- .../elitemobs/items/EliteItemLore.java | 2 +- .../elitemobs/items/ItemLootShower.java | 4 +- .../SoulbindEnchantment.java | 2 +- .../CurrencyCustomLootEntry.java | 4 +- .../itemconstructor/ItemConstructor.java | 2 +- .../potioneffects/ElitePotionEffect.java | 6 +- .../menus/InstancedDungeonBrowser.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 4 +- .../magmaguy/elitemobs/menus/LootMenu.java | 2 +- .../elitemobs/menus/ScrapperMenu.java | 7 +- .../magmaguy/elitemobs/menus/SellMenu.java | 7 +- .../elitemobs/mobconstructor/BossType.java | 1 + .../elitemobs/mobconstructor/CustomSpawn.java | 20 +- .../elitemobs/mobconstructor/EliteEntity.java | 6 +- .../custombosses/BossMusic.java | 6 +- .../custombosses/CustomBossBossBar.java | 4 +- .../custombosses/CustomBossDeath.java | 2 +- .../transitiveblocks/TransitiveBlock.java | 4 +- .../elitemobs/pathfinding/Navigation.java | 4 +- .../elitemobs/playerdata/PlayerItem.java | 16 +- .../statusscreen/BossTrackingPage.java | 4 +- .../statusscreen/TeleportsPage.java | 2 +- .../elitemobs/powers/ZombieNecronomicon.java | 10 +- .../powers/scripts/ScriptAction.java | 60 +- .../powers/scripts/ScriptConditions.java | 2 +- .../powers/scripts/ScriptListener.java | 4 +- .../elitemobs/powers/scripts/ScriptZone.java | 12 +- .../caching/ScriptActionBlueprint.java | 10 +- .../caching/ScriptParticlesBlueprint.java | 6 +- .../ScriptRelativeVectorBlueprint.java | 5 +- .../powers/scripts/enums/ActionType.java | 3 +- .../elitemobs/quests/QuestTracking.java | 2 +- .../quests/menus/QuestInventoryMenu.java | 2 +- .../elitemobs/quests/menus/QuestMenu.java | 2 +- .../worldguard/WorldGuardCompatibility.java | 52 +- .../treasurechest/TreasureChest.java | 8 +- .../utils/ConfigurationLocation.java | 13 +- .../elitemobs/utils/ItemStackGenerator.java | 76 ++ .../elitemobs/utils/ItemStackSerializer.java | 1 - .../elitemobs/utils/SpigotMessage.java | 32 + .../elitemobs/utils/VisualDisplay.java | 2 +- .../elitemobs/utils/shapes/Cuboid.java | 6 +- .../versionnotifier/VersionChecker.java | 27 +- src/main/resources/plugin.yml | 8 +- 181 files changed, 1340 insertions(+), 2750 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/CustomConfig.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java create mode 100644 src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java create mode 100644 src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java diff --git a/build.gradle b/build.gradle index c3ab731e3..7e99f3d7f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ 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,6 +12,17 @@ plugins { compileJava.options.encoding = "UTF-8" compileTestJava.options.encoding = "UTF-8" +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + options.release = 21 +} + //Fixes issues with utf-8 in the translations files. Why? Don't know. processResources { def props = [version: version] @@ -23,7 +34,7 @@ processResources { } group 'com.magmaguy' -version '9.0.4-SNAPSHOT' +version '9.0.5' repositories { maven { @@ -42,13 +53,18 @@ repositories { mavenLocal() //Spigot API & CloudCommands - maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } +// 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 = 'http://magmaguy.com:50001/releases' + allowInsecureProtocol = true + } //Bstats API maven { url = 'https://repo.codemc.org/repository/maven-public' } @@ -72,7 +88,6 @@ repositories { artifact() } } - } dependencies { @@ -82,14 +97,6 @@ dependencies { implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' - //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' @@ -99,7 +106,7 @@ 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' @@ -113,8 +120,8 @@ dependencies { 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" @@ -125,6 +132,9 @@ dependencies { //Advanced AI goals implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.11.2-SNAPSHOT' + //Advanced AI goals + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' + // Mythic Mobs integration - currently only for arenas compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } @@ -143,9 +153,6 @@ 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) @@ -167,35 +174,19 @@ 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 = "https://s01.oss.sonatype.org/content/repositories/snapshots/"; + 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/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java deleted file mode 100644 index 1916f0a58..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 8c3becb3a..1f33f06be 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -5,7 +5,7 @@ */ import com.magmaguy.easyminecraftgoals.NMSManager; -import com.magmaguy.elitemobs.commands.CommandHandler; +import com.magmaguy.elitemobs.commands.CommandManager; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -58,11 +58,11 @@ import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility; import com.magmaguy.elitemobs.treasurechest.TreasureChest; import com.magmaguy.elitemobs.utils.BossBarUtil; -import com.magmaguy.elitemobs.utils.InfoMessage; import com.magmaguy.elitemobs.utils.ServerTime; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.versionnotifier.VersionChecker; 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; @@ -84,42 +84,40 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations - DefaultConfig.initializeConfig(); - ResourcePackDataConfig.initializeConfig(); - ItemSettingsConfig.initializeConfig(); - ProceduralItemGenerationSettingsConfig.initializeConfig(); + new DefaultConfig(); + new ResourcePackDataConfig(); + 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(); - SoundsConfig.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); } @@ -127,18 +125,16 @@ public static void worldScanner() { @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)){ - new WarningMessage("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."); + 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; } @@ -152,9 +148,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); } } @@ -173,14 +169,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; } @@ -188,7 +184,7 @@ public void onEnable() { EventsRegistrer.registerEvents(); //Launch the local data cache - DatabaseConfig.initializeConfig(); + new DatabaseConfig(); PlayerData.initializeDatabaseConnection(); ElitePlayerInventory.initialize(); @@ -253,7 +249,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(); } @@ -262,17 +258,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(); + new CommandManager(); - SpecialItemSystemsConfig.initializeConfig(); + new SpecialItemSystemsConfig(); /* Check for new plugin version or for dungeon updates @@ -284,11 +281,15 @@ public void onEnable() { @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) @@ -298,41 +299,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 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(); @@ -341,40 +323,24 @@ 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(); - EliteMobsWorld.shutdown(); Navigation.shutdown(); BossBarUtil.shutdown(); ScriptAction.shutdown(); - - //save cached data - Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases..."); + Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); - Bukkit.getLogger().info("[EliteMobs] All done! Good night."); - + MagmaCore.shutdown(); + Logger.info("All done! Good night."); } /* diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index a2ac40314..e127f438e 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -107,7 +107,7 @@ public static void registerEvents() { if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade()) register(new PreventUpgradeDiamondToNetherite()); - register(new FixPlayerSpeedOnRespawn()); + register(new FixPlayerOnLoginOrRespawn()); register(new EnvironmentalDungeonDamage()); register(new PlayerQuitCleanup()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 51ae8477a..0a3986fe2 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.adventurersguild; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.AdventurersGuildConfig; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; @@ -8,6 +7,7 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 275500332..24c42aa45 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -79,7 +79,7 @@ public void onPlayerDeath(PlayerDeathEvent event) { } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerShoot(EntityShootBowEvent event){ + public void onPlayerShoot(EntityShootBowEvent event) { if (!EliteItemManager.isEliteMobsItem(event.getBow())) return; if (isOnLastDamage(event.getBow())) event.setCancelled(true); } diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java index 7293e3822..fa6bf49a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java @@ -4,7 +4,7 @@ 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.PlayerLoginEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -19,7 +19,7 @@ public void onPlayerRespawn(PlayerRespawnEvent event) { } @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) { + public void onPlayerRespawn(PlayerLoginEvent event) { event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0)); event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0)); if (DefaultConfig.isResetPlayerScaleOnLogin()) diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java deleted file mode 100644 index 5b1defcd0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerSpeedOnRespawn.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.magmaguy.elitemobs.collateralminecraftchanges; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -public class FixPlayerSpeedOnRespawn 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)); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java index cf7069ae3..3a88714f5 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java @@ -7,7 +7,7 @@ public class PlayerQuitCleanup implements Listener { @EventHandler - public void onPlayerQuit(PlayerQuitEvent event){ + public void onPlayerQuit(PlayerQuitEvent event) { if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer())) event.getPlayer().setInvulnerable(false); } 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 003ce635a..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java +++ /dev/null @@ -1,896 +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.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")))); - - 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 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 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 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) { - customBossEntity.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 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/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 1c6f75897..1ec601fb5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -1,14 +1,13 @@ 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 AdventurersGuildCommand extends AdvancedCommand { public AdventurersGuildCommand() { - super(new ArrayList<>()); + super(List.of("adventurersguild", "ag")); setUsage("/em adventurersguild"); setPermission("elitemobs.adventurersguild.command"); setSenderType(SenderType.PLAYER); @@ -16,7 +15,7 @@ public AdventurersGuildCommand() { } @Override - public void execute(CommandData commandData) { - com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender()); + public void execute() { + com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); } } \ 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 index 4a6f18b00..01b258753 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -3,7 +3,6 @@ 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; @@ -14,13 +13,12 @@ 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()); + public void execute() { + PlayerData.setUseBookMenus(getCurrentPlayerSender(), !PlayerData.getUseBookMenus(getCurrentPlayerSender().getUniqueId())); + Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getSwitchEMStyleMessage()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index 9c97bb5ab..030c1908c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -1,8 +1,6 @@ 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; @@ -13,13 +11,12 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setPermission("elitemobs.arena.start"); - setDescription("Open the Arena menu."); + setDescription("When in instanced content, makes the player start the instance."); setSenderType(SenderType.PLAYER); } @Override - public void execute(CommandData commandData) { - new ArenaMenu().constructArenaMenu(commandData.getPlayerSender(), commandData.getStringArgument("arenaID")); + public void execute() { + ArenaCommands.openArenaMenu(getCurrentPlayerSender(), getStringArgument("arenaID")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java index 5179f8289..50d8010f0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java @@ -4,7 +4,9 @@ import org.bukkit.entity.Player; public class ArenaCommands { - private ArenaCommands(){} + private 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 deleted file mode 100644 index dfe83b9f2..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.magmacore.command.CommandManager; - -public class CommandHandler { - private static CommandManager emCommand; - private static CommandManager adventurersGuildCommand; - private CommandHandler() { - } - - 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/CommandManager.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java new file mode 100644 index 000000000..1acb36c11 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java @@ -0,0 +1,96 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; + +public class CommandManager extends com.magmaguy.magmacore.command.CommandManager { + public CommandManager() { + super(MetadataHandler.PLUGIN, "elitemobs"); + } + + @Override + public void registerCommands() { + //Admin commands + registerCommand(new SetupCommand()); + registerCommand(new SetupDoneCommand()); + registerCommand(new SetupToggleCommand()); + registerCommand(new SpawnBossCommand()); + registerCommand(new SpawnBossLevelCommand()); + registerCommand(new SpawnBossAtCommand()); + registerCommand(new SpawnBossLevelAtCommand()); + registerCommand(new PlaceBossCommand()); + registerCommand(new PlaceTreasureChestCommand()); + registerCommand(new PlaceNPCCommand()); + registerCommand(new RemoveCommand()); + registerCommand(new DebugCommand()); + registerCommand(new EventCommand()); + registerCommand(new StatsCommand()); + registerCommand(new LootMenuCommand()); + registerCommand(new LootGiveCommand()); + registerCommand(new LootRandomCommand()); + registerCommand(new LootSimulateMultipleCommand()); + registerCommand(new LootSimulateCommand()); + registerCommand(new VersionCommand()); + registerCommand(new ReloadCommand()); + registerCommand(new KillCommand()); + registerCommand(new KillRadiusCommand()); + registerCommand(new KillTypeCommand()); + registerCommand(new KillTypeRadiusCommand()); + registerCommand(new LootDebugCommand()); + registerCommand(new MoneyAddCommand()); + registerCommand(new MoneyAddAllCommand()); + registerCommand(new MoneySetCommand()); + registerCommand(new MoneyCheckPlayerCommand()); + registerCommand(new UnbindForceCommand()); + registerCommand(new FireballCommand()); + registerCommand(new RespawnAllCommand()); + registerCommand(new PackageDungeonCommand()); + registerCommand(new LanguageCommand()); + registerCommand(new PlaceWormholeCommand()); + registerCommand(new LootStats()); + registerCommand(new ShopProceduralOtherCommand()); + registerCommand(new ShopCustomOtherCommand()); + registerCommand(new ShopSellOtherCommand()); + registerCommand(new QuestBypassCommand()); + registerCommand(new QuestCompleteCommand()); + registerCommand(new QuestResetCommand()); + registerCommand(new QuestResetAllCommand()); + registerCommand(new TransitiveBlocksCancelCommand()); + registerCommand(new TransitiveBlocksRegisterCommand()); + registerCommand(new TransitiveBlocksEditCommand()); + registerCommand(new TransitiveBlocksRegisterAreaCommand()); + registerCommand(new TransitiveBlocksEditAreaCommand()); + registerCommand(new RankSetCommand()); + registerCommand(new SpawnElite()); + registerCommand(new SpawnEliteAtCommand()); + registerCommand(new DiscordMessageCommand()); + registerCommand(new DiscordCommand()); + + //User commands + registerCommand(new AdventurersGuildCommand()); + registerCommand(new ShareItemCommand()); + registerCommand(new ShopDynamicCommand()); + registerCommand(new ShopCustomCommand()); + registerCommand(new RepairCommand()); + registerCommand(new EnchantCommand()); + registerCommand(new ScrapCommand()); + registerCommand(new UnbindCommand()); + registerCommand(new MoneyCheckCommand()); + registerCommand(new QuestAcceptCommand()); + registerCommand(new QuestTrackCommand()); + registerCommand(new QuestLeaveCommand()); + registerCommand(new RankCommand()); + registerCommand(new LootCommand()); + registerCommand(new QuitCommand()); + registerCommand(new StartCommand()); + registerCommand(new ArenaCommand()); + registerCommand(new DismissCommand()); + registerCommand(new AltCommand()); + registerCommand(new SpawnTeleportCommand()); + registerCommand(new DungeonTeleportCommand()); + registerCommand(new TrackBossCommand()); + registerCommand(new PayCommand()); + + registerCommand(new EliteMobsCommand()); + registerCommand(new HelpCommand()); + } +} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index e11cdfd9e..e6de39500 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java @@ -2,8 +2,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index 34f06fa3b..4eed4aad6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -3,7 +3,6 @@ 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; @@ -14,13 +13,13 @@ public DebugCommand() { super(List.of("debug")); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em debug "); - setPermission("elitemobs.debug"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Debug bosses or players."); + setDescription("Toggles whether the setup message will show up."); } @Override - public void execute(CommandData commandData) { - DebugScreen.open(commandData.getPlayerSender(), commandData.getStringArgument("filename")); + public void execute() { + DebugScreen.open(getCurrentPlayerSender(), getStringArgument("filename")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java index b06eb76f3..4ea9e1ac4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -2,7 +2,6 @@ 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; @@ -10,13 +9,13 @@ public class DiscordCommand extends AdvancedCommand { public DiscordCommand() { super(List.of("discord")); - setUsage("/em discord"); - setPermission("elitemobs.discord.link"); + setUsage("/em discord "); + setPermission("elitemobs.*"); setDescription("Links to the EliteMobs discord."); } @Override - public void execute(CommandData commandData) { - Logger.sendMessage(commandData.getPlayerSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + public void execute() { + Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); } -} +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java index 64988902c..97c796060 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -2,7 +2,6 @@ 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; @@ -13,13 +12,13 @@ public DiscordMessageCommand() { super(List.of("discord")); addArgument("message", new ArrayList<>()); setUsage("/em discord "); - setPermission("elitemobs.discord.message"); + setPermission("elitemobs.*"); 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!"); + public void execute() { + new DiscordSRVAnnouncement(getStringSequenceArgument("message")); + Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); } -} +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java index bb1b02fd4..0af89d79c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,12 +11,11 @@ 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())); + public void execute() { + PlayerData.setDismissEMStatusScreenMessage(getCurrentPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(getCurrentPlayerSender().getUniqueId())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index 5c71e0f63..c50bc0416 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -1,7 +1,6 @@ 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; @@ -11,14 +10,14 @@ public class DungeonTeleportCommand extends AdvancedCommand { public DungeonTeleportCommand() { super(List.of("dungeontp")); addArgument("dungeonID", new ArrayList<>()); - setPermission("elitemobs.dungeon.tp"); + setPermission("elitemobs.dungeontp"); 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")); + public void execute() { + DungeonCommands.teleport(getCurrentPlayerSender(), getStringArgument("dungeonID")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java index c41a1a6b2..a07eb3d2f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -3,23 +3,21 @@ 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; +import java.util.List; public class EliteMobsCommand extends AdvancedCommand { public EliteMobsCommand() { - super(new ArrayList<>()); + super(List.of("em", "elitemobs")); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); - setPermission("elitemobs.command"); setSenderType(SenderType.PLAYER); } @Override - public void execute(CommandData commandData) { + public void execute() { if (DefaultConfig.isEmLeadsToStatusMenu()) - new PlayerStatusScreen(commandData.getPlayerSender()); + new PlayerStatusScreen(getCurrentPlayerSender()); } } \ 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 index 1e7bfa81c..c2766a35e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -3,7 +3,6 @@ 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; @@ -18,8 +17,8 @@ public EnchantCommand() { } @Override - public void execute(CommandData commandData) { - if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) - new ItemEnchantmentMenu(commandData.getPlayerSender()); + public void execute() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + new ItemEnchantmentMenu(getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java index 61a496b6d..489fe0ef5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,13 +11,13 @@ public EventCommand() { super(List.of("event")); addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList()); setUsage("/em event "); - setPermission("elitemobs.event.start"); + setPermission("elitemobs.*"); 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")); + public void execute() { + com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(getCurrentCommandSender(), getStringArgument("filename")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java index f15b47354..c1a8cb366 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,15 +11,15 @@ public class FireballCommand extends AdvancedCommand { public FireballCommand() { super(List.of("fireball")); setUsage("/em fireball"); - setPermission("elitemobs.fireball"); + setPermission("elitemobs.*"); 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()); + public void execute() { + Fireball fireball = (Fireball) getCurrentPlayerSender().getWorld().spawnEntity(getCurrentPlayerSender().getLocation(), EntityType.FIREBALL); + fireball.setDirection(getCurrentPlayerSender().getLocation().getDirection().normalize()); + fireball.setShooter(getCurrentPlayerSender()); fireball.setYield(3F); EntityTracker.registerProjectileEntity(fireball); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index c2b49187d..4cdca44e4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -1,8 +1,6 @@ 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; @@ -12,22 +10,20 @@ public class HelpCommand extends AdvancedCommand { public HelpCommand() { super(List.of("help")); setUsage("/em help"); - setPermission("elitemobs.help"); + setPermission("elitemobs.*"); 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()); - } - }); - } + public void execute() { + Logger.sendMessage(getCurrentCommandSender(), "Commands:"); + CommandManager.getInstance().commands.forEach(command -> { + if (getCurrentCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.usage, command.description)); + } else { + Logger.sendSimpleMessage(getCurrentCommandSender(), command.usage); + Logger.sendSimpleMessage(getCurrentCommandSender(), command.description); + } + }); } } \ 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 index 70c740edd..a8b97ca43 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -10,12 +9,12 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.kill.command"); + setPermission("elitemobs.*"); setDescription("Kills all elites."); } @Override - public void execute(CommandData commandData) { - KillHandler.killAggressiveMobs(commandData.getCommandSender()); + public void execute() { + KillHandler.killAggressiveMobs(getCurrentCommandSender()); } } \ 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 index 978c494a7..ee0629fa8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -2,7 +2,6 @@ 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; @@ -13,13 +12,13 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.kill.command"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } @Override - public void execute(CommandData commandData) { - KillHandler.radiusKillAggressiveMobs(commandData.getPlayerSender(), commandData.getIntegerArgument("radius")); + public void execute() { + KillHandler.radiusKillAggressiveMobs(getCurrentPlayerSender(), 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 index 03b0ffdc6..15d6e8ee7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -2,7 +2,7 @@ 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; @@ -13,13 +13,14 @@ public KillTypeCommand() { super(List.of("kill")); addLiteral("type"); addArgument("type", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.kill.command"); + setUsage("/em kill type "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } @Override - public void execute(CommandData commandData) { - KillHandler.killEntityType(commandData.getCommandSender(), EntityType.valueOf(commandData.getStringArgument("type"))); + public void execute() { + KillHandler.killEntityType(getCurrentPlayerSender(), EntityType.valueOf(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 index 33cd0d2e8..0d412be6f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -2,7 +2,6 @@ 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; @@ -15,16 +14,16 @@ public KillTypeRadiusCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.kill.command"); + setUsage("/em kill type "); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Kills all elites of the specified type within the specified radius."); + setDescription("Kills all elites of the specified type."); } @Override - public void execute(CommandData commandData) { - KillHandler.radiusKillSpecificMobs(commandData.getPlayerSender(), - EntityType.valueOf(commandData.getStringArgument("type")), - commandData.getIntegerArgument("range")); + public void execute() { + KillHandler.radiusKillSpecificMobs(getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("type")), + 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 index 27574baf1..99c1ab744 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -3,7 +3,6 @@ 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.List; @@ -13,20 +12,20 @@ public LanguageCommand() { super(List.of("language")); addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); setUsage("/em language "); - setPermission("elitemobs.language"); + setPermission("elitemobs.*"); 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"); + public void execute() { + String language = getStringArgument("language"); if (!TranslationsConfig.getTranslationConfigs().containsKey(language)) { - Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:"); - TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key)); + Logger.sendMessage(getCurrentCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(getCurrentCommandSender(), key)); return; } - DefaultConfig.setLanguage(commandData.getCommandSender(), language); - Logger.sendMessage(commandData.getCommandSender(), "&2Language set to " + language + + DefaultConfig.setLanguage(getCurrentCommandSender(), language); + Logger.sendMessage(getCurrentCommandSender(), "&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 index d1035a41f..53b255fdc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -2,7 +2,6 @@ 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; @@ -16,7 +15,7 @@ public LootCommand() { } @Override - public void execute(CommandData commandData) { - LootMenu.openMenu(commandData.getPlayerSender()); + public void execute() { + LootMenu.openMenu(getCurrentPlayerSender()); } -} \ 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 index ada2a14e9..82a55be01 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.elitemobs.commands.admin.GetTierCommand; +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; @@ -12,15 +12,15 @@ 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"); + addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em loot test "); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes."); + setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } @Override - public void execute(CommandData commandData) { - GetTierCommand.get(commandData.getPlayerSender(), commandData.getIntegerArgument("level")); + public void execute() { + GetTierCommand.get(getCurrentPlayerSender(), 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 index 5938e9cfb..9159eaed2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -3,7 +3,7 @@ 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 com.magmaguy.magmacore.command.SenderType; import java.util.ArrayList; import java.util.List; @@ -14,13 +14,14 @@ public LootGiveCommand() { 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."); + setUsage("/em loot give "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Gives loot to a player."); } @Override - public void execute(CommandData commandData) { - LootCommand.give(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getStringArgument("filename")); + public void execute() { + LootCommand.give(getCurrentCommandSender(), getStringArgument("playerName"), 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 index 9126a677b..2ff145bbc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,13 +11,13 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.loot.admin"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } @Override - public void execute(CommandData commandData) { - new GetLootMenu(commandData.getPlayerSender()); + public void execute() { + new GetLootMenu(getCurrentPlayerSender()); } } \ 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 index 60c979976..5bff2f261 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -3,7 +3,7 @@ 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; @@ -12,15 +12,16 @@ public class LootRandomCommand extends AdvancedCommand { public LootRandomCommand() { super(List.of("loot")); addLiteral("random"); - addArgument("level", new ArrayList<>()); - addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); - setPermission("elitemobs.loot.admin"); - setDescription("Gives the player random loot of the specified level."); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Gives loot to a player."); } @Override - public void execute(CommandData commandData) { - SimLootCommand.forcePositiveLoot(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getIntegerArgument("level")); + public void execute() { + SimLootCommand.forcePositiveLoot(getCurrentCommandSender(), getStringArgument("playerName"), 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 index 9dbd97527..5986986de 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -3,7 +3,6 @@ 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; @@ -13,19 +12,19 @@ public class LootSimulateCommand extends AdvancedCommand { public LootSimulateCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>()); - addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.admin"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } @Override - public void execute(CommandData commandData) { + public void execute() { SimLootCommand.run( - commandData.getPlayerSender(), - commandData.getIntegerArgument("level"), - commandData.getStringArgument("playerName")); + getCurrentPlayerSender(), + getIntegerArgument("level"), + getStringArgument("playerName")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index a38e117cb..4f8988bc2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -3,7 +3,6 @@ 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; @@ -13,21 +12,21 @@ public class LootSimulateMultipleCommand extends AdvancedCommand { public LootSimulateMultipleCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>()); + addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.admin"); + setPermission("elitemobs.*"); 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) { + public void execute() { SimLootCommand.runMultipleTimes( - commandData.getPlayerSender(), - commandData.getIntegerArgument("level"), - commandData.getIntegerArgument("times"), - commandData.getStringArgument("playerName")); + getCurrentPlayerSender(), + getIntegerArgument("level"), + getIntegerArgument("times"), + 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 index 9e81fb2f6..4dc8c73f9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -2,7 +2,6 @@ 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; @@ -14,14 +13,14 @@ public LootStats() { super(List.of("loot")); addLiteral("stats"); setUsage("/em loot stats"); - setPermission("elitemobs.loot.stats"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("Provides EliteMobs stats for the currently held item."); } @Override - public void execute(CommandData commandData) { - Player player = commandData.getPlayerSender(); + public void execute() { + Player player = getCurrentPlayerSender(); ItemStack item = player.getInventory().getItemInMainHand(); double attackSpeed = EliteItemManager.getAttackSpeed(item); double damage = EliteItemManager.getBaseDamage(item); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 176e7f042..8d13578c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -1,7 +1,8 @@ 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 com.magmaguy.magmacore.command.SenderType; import java.util.ArrayList; import java.util.List; @@ -9,17 +10,19 @@ 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."); + addLiteral("add"); + addLiteral("all"); + addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + setUsage("/em money add all "); + setPermission("elitemobs.*"); + 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) { + public void execute() { CurrencyCommandsHandler.addAllCommand( - commandData.getCommandSender(), - commandData.getDoubleArgument("amount")); + getCurrentCommandSender(), + 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 index e7089faa2..08328ad15 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -2,7 +2,7 @@ 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; @@ -11,18 +11,19 @@ public class MoneyAddCommand extends AdvancedCommand { public MoneyAddCommand() { super(List.of("money")); addLiteral("add"); - addArgument("player", new ArrayList<>()); + addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); 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."); + setPermission("elitemobs.*"); + 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) { + public void execute() { CurrencyCommandsHandler.addCommand( - commandData.getCommandSender(), - commandData.getStringArgument("player"), - commandData.getDoubleArgument("amount")); + getCurrentCommandSender(), + getStringArgument("player"), + 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 index 14cee4268..d2e35b5d6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -3,7 +3,6 @@ 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; @@ -13,16 +12,16 @@ public MoneyCheckCommand() { super(List.of("money")); addLiteral("check"); setUsage("/em money check"); - setPermission("elitemobs.money.check.self"); + setPermission("elitemobs.money.check"); setSenderType(SenderType.PLAYER); - setDescription("Checks your EliteMobs currency."); + setDescription("Checks the EliteMobs currency"); } @Override - public void execute(CommandData commandData) { + public void execute() { if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) - new PlayerStatusScreen(commandData.getPlayerSender()); + new PlayerStatusScreen(getCurrentPlayerSender()); else - CurrencyCommandsHandler.walletCommand(commandData.getPlayerSender()); + CurrencyCommandsHandler.walletCommand(getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index a73f8def9..01f299276 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -1,7 +1,6 @@ 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; @@ -11,15 +10,15 @@ 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."); + setUsage("/em check "); + setPermission("elitemobs.*"); + setDescription("Checks how much currency you have."); } @Override - public void execute(CommandData commandData) { + public void execute() { CurrencyCommandsHandler.checkCommand( - commandData.getCommandSender(), - commandData.getStringArgument("player")); + getCurrentCommandSender(), + getStringArgument("player")); } -} +} \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index 3bb188cd2..e99856ac9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -2,7 +2,7 @@ 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; @@ -14,14 +14,15 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.money.admin"); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } @Override - public void execute(CommandData commandData) { + public void execute() { CurrencyCommandsHandler.subtractCommand( - commandData.getStringArgument("player"), - commandData.getDoubleArgument("amount")); + getStringArgument("player"), + 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 index 5a1c9802d..517ab97a5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,15 +13,15 @@ public MoneySetCommand() { 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."); + setPermission("elitemobs.*"); + setDescription("Sets the specified amount of currency to a player."); } @Override - public void execute(CommandData commandData) { + public void execute() { CurrencyCommandsHandler.setCommand( - commandData.getCommandSender(), - commandData.getStringArgument("player"), - commandData.getDoubleArgument("amount")); + getCurrentCommandSender(), + getStringArgument("player"), + getDoubleArgument("amount")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index 1e867ea92..d9ba2bac9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -1,7 +1,6 @@ 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; @@ -12,14 +11,12 @@ public PackageDungeonCommand() { addArgument("dungeonName", new ArrayList<>()); addArgument("version", new ArrayList<>()); setUsage("/em package "); - setPermission("elitemobs.package"); + setPermission("elitemobs.*"); setDescription("Packages an EliteMobs dungeon for distribution."); } @Override - public void execute(CommandData commandData) { - new PackageCommand(commandData.getCommandSender(), - commandData.getStringArgument("dungeonName"), - commandData.getStringArgument("version")); + public void execute() { + new PackageCommand(getCurrentCommandSender(), getStringArgument("dungeonName"), 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 index fdd48e0a0..98f778fed 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -1,7 +1,6 @@ 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; @@ -14,15 +13,14 @@ public PayCommand() { 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) { + public void execute() { CurrencyCommandsHandler.payCommand( - commandData.getPlayerSender(), - commandData.getStringArgument("player"), - commandData.getDoubleArgument("amount")); + getCurrentPlayerSender(), + getStringArgument("player"), + 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 index 2a65ae715..a80c2017e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -1,32 +1,25 @@ 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"); + addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + setUsage("/em addSpawn boss "); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Add a spawn location for the specified boss at your current location."); + setDescription("Toggles whether the setup message will show up."); } @Override - public void execute(CommandData commandData) { - CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender()); + public void execute() { + CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); } } \ 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 index c1f31c9cd..d093d367a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -3,7 +3,6 @@ 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; @@ -15,13 +14,13 @@ public PlaceNPCCommand() { addLiteral("npc"); addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet())); setUsage("/em place npc "); - setPermission("elitemobs.place.npc"); + setPermission("elitemobs.*"); 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")); + public void execute() { + NPCCommands.set(getCurrentPlayerSender(), 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 index b47ae3621..ad8ee1d5a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,13 +13,13 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.place.admin"); + setPermission("elitemobs.*"); 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")); + public void execute() { + CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); } } \ 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 index 04cb8aa06..9ff0df62e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -3,7 +3,6 @@ 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; @@ -16,27 +15,27 @@ public PlaceWormholeCommand() { 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"); + setUsage("/em wormhole <1/2>"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Place a wormhole teleport at your current location."); + 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) { + public void execute() { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename"))) - switch (commandData.getStringArgument("wormholeOption")) { + if (wormhole.getWormholeConfigFields().getFilename().equals(getStringArgument("wormholeFilename"))) + switch (getStringArgument("wormholeOption")) { case "1": - wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); + wormhole.getWormholeEntry1().updateLocation(getCurrentPlayerSender()); return; case "2": - wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender()); + wormhole.getWormholeEntry2().updateLocation(getCurrentPlayerSender()); return; default: - Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + Logger.sendMessage(getCurrentCommandSender(), "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."); + Logger.sendMessage(getCurrentCommandSender(), "Failed to set location for this wormhole."); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index e5526ea69..9b10521ed 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,13 +13,13 @@ public QuestAcceptCommand() { addLiteral("accept"); addArgument("questID", new ArrayList<>()); setUsage("/em quest accept "); - setPermission("elitemobs.quest.accept"); + setPermission("elitemobs.quest.command"); 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()); + public void execute() { + QuestCommand.joinQuest(getStringArgument("questID"), getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 83619bbae..413fbdbe6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -1,11 +1,7 @@ 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; @@ -14,17 +10,12 @@ public QuestBypassCommand() { super(List.of("quest")); addLiteral("bypass"); setUsage("/em quest bypass"); - setPermission("elitemobs.quest.bypass"); - setSenderType(SenderType.PLAYER); + setPermission("elitemobs.*"); 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!"); + public void execute() { + QuestCommand.bypassQuestRequirements(getCurrentPlayerSender()); } } \ 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 index 232fb266a..bd98d8b1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,13 +11,13 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.quest.complete.force"); + setPermission("elitemobs.*"); 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()); + public void execute() { + QuestCommand.completeQuest(getCurrentPlayerSender()); } } \ 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 index 306478b72..1ea94da6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,13 +11,13 @@ public QuestLeaveCommand() { super(List.of("quest")); addLiteral("leave"); setUsage("/em quest leave"); - setPermission("elitemobs.quest.leave"); + setPermission("elitemobs.*"); 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")); + public void execute() { + QuestCommand.leaveQuest(getCurrentPlayerSender(), 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 index 18b968908..c000e8877 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -1,8 +1,8 @@ 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 java.util.ArrayList; import java.util.List; @@ -10,15 +10,17 @@ public class QuestResetAllCommand extends AdvancedCommand { public QuestResetAllCommand() { super(List.of("quest")); - addLiteral("resetAll"); + addLiteral("reset"); + addLiteral("all"); addArgument("player", new ArrayList<>()); - setUsage("/em quest resetAll "); - setPermission("elitemobs.quest.reset.all"); + addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); + setUsage("/em quest reset "); + setPermission("elitemobs.*"); setDescription("Resets all quests for a specific player."); } @Override - public void execute(CommandData commandData) { - QuestCommand.resetQuests(commandData.getCommandSender(), commandData.getStringArgument("player")); + public void execute() { + QuestCommand.resetQuests(getCurrentCommandSender(), 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 index f57951bbd..e80d057fb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -3,8 +3,6 @@ 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; @@ -16,13 +14,12 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.quest.reset"); + setPermission("elitemobs.*"); 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")); + public void execute() { + QuestCommand.resetQuest(getCurrentCommandSender(), getStringArgument("player"), 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 index 207a34243..06802a94f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,13 +13,13 @@ public QuestTrackCommand() { addLiteral("track"); addArgument("questID", new ArrayList<>()); setUsage("/em quest track "); - setPermission("elitemobs.quest.track"); + setPermission("elitemobs.quest.command"); 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()); + public void execute() { + QuestCommand.trackQuest(getStringArgument("questID"), getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java index 148b2b2bf..d543f3016 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -2,7 +2,6 @@ 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; @@ -16,9 +15,9 @@ public QuitCommand() { } @Override - public void execute(CommandData commandData) { - MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender()); + public void execute() { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(getCurrentPlayerSender()); if (matchInstance != null) - matchInstance.removeAnyKind(commandData.getPlayerSender()); + matchInstance.removeAnyKind(getCurrentPlayerSender()); } } \ 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 index b85485726..cacf7c07d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -2,7 +2,6 @@ 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; @@ -11,13 +10,13 @@ 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."); + setDescription("Opens the EliteMobs rank menu."); setSenderType(SenderType.PLAYER); } @Override - public void execute(CommandData commandData) { - if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) - AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender()); + public void execute() { + if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); } } \ 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 index b4730d04b..a1012bc61 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -1,7 +1,6 @@ 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; @@ -13,15 +12,15 @@ public RankSetCommand() { addArgument("prestigeLevel", new ArrayList<>()); addArgument("guildLevel", new ArrayList<>()); setUsage("/em rank "); - setPermission("elitemobs.rank.set"); + setPermission("elitemobs.*"); 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")); + public void execute() { + GuildRankCommands.setGuildRank(getCurrentCommandSender(), + getStringArgument("player"), + getIntegerArgument("prestigeLevel"), + 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 index efc3774b9..46a469de3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -2,7 +2,6 @@ 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; @@ -12,7 +11,7 @@ public class ReloadCommand extends AdvancedCommand { public ReloadCommand() { super(List.of("reload")); setUsage("/em reload"); - setPermission("elitemobs.reload"); + setPermission("elitemobs.*"); setDescription("Reloads EliteMobs."); } @@ -24,7 +23,7 @@ public static void reload(CommandSender commandSender) { } @Override - public void execute(CommandData commandData) { - reload(commandData.getCommandSender()); + public void execute() { + reload(getCurrentCommandSender()); } } \ 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 index 2110beb14..350acdf31 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -1,7 +1,6 @@ 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; @@ -10,13 +9,13 @@ public class RemoveCommand extends AdvancedCommand { public RemoveCommand() { super(List.of("remove")); setUsage("/em remove"); - setPermission("elitemobs.remove"); + setPermission("elitemobs.*"); 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()); + public void execute() { + com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(getCurrentPlayerSender()); } } \ 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 index a1d6adeab..55f0209b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -3,7 +3,6 @@ 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; @@ -14,14 +13,14 @@ public RepairCommand() { 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."); + 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())) { + public void execute() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { RepairMenu repairMenu = new RepairMenu(); - repairMenu.constructRepairMenu(commandData.getPlayerSender()); + repairMenu.constructRepairMenu(getCurrentPlayerSender()); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index 63766ad2d..4536c0d31 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -2,7 +2,6 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -11,12 +10,12 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.respawn.force"); + setPermission("elitemobs.*"); setDescription("Forces all regional bosses to respawn."); } @Override - public void execute(CommandData commandData) { + public void execute() { RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> { if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn(); }); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index 534216f7e..f1bd65d76 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -3,7 +3,6 @@ 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; @@ -14,14 +13,14 @@ public ScrapCommand() { 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."); + 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())) { + public void execute() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { ScrapperMenu scrapperMenu = new ScrapperMenu(); - scrapperMenu.constructScrapMenu(commandData.getPlayerSender()); + scrapperMenu.constructScrapMenu(getCurrentPlayerSender()); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index 743545e32..e23b0ce2e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -2,7 +2,6 @@ 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; @@ -10,14 +9,14 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.setup"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); } @Override - public void execute(CommandData commandData) { - new SetupMenu(commandData.getPlayerSender()); + public void execute() { + new SetupMenu(getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index c94084e30..5091430a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -2,7 +2,6 @@ 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; @@ -11,17 +10,17 @@ public class SetupDoneCommand extends AdvancedCommand { public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); - setUsage("/em setup done"); - setPermission("elitemobs.setup"); + setUsage("/setup done"); + setPermission("elitemobs.*"); setDescription("Toggles whether the setup message will show up."); } @Override - public void execute(CommandData commandData) { + public void execute() { 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."); + Logger.sendMessage(getCurrentCommandSender(), "&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."); + Logger.sendMessage(getCurrentCommandSender(), "&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 0b5f635b7..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.commands.setup.SetupMenu; -import com.magmaguy.elitemobs.dungeons.EMPackage; -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); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 89082a29f..78e6e3b35 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -2,7 +2,6 @@ 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; @@ -11,25 +10,20 @@ public class SetupToggleCommand extends AdvancedCommand { public SetupToggleCommand() { super(List.of("setup")); + setPermission("elitemobs.*"); + setDescription("Sets up EliteMobs content!"); + setUsage("/em setup toggle"); 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"); + public void execute() { + String dungeon = getStringArgument("empackages"); if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) - Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!"); + Logger.sendMessage(getCurrentCommandSender(), "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!"); - - } + if (emPackage.install()) + Logger.sendMessage(getCurrentCommandSender(), "Successfully installed 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 index 46b26dea2..1189648ac 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -2,7 +2,6 @@ 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; @@ -13,11 +12,11 @@ public ShareItemCommand() { setUsage("/em shareItem"); setPermission("elitemobs.shareitem"); setSenderType(SenderType.PLAYER); - setDescription("Shares the stats of the currently held EliteMobs item in chat."); + setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); } @Override - public void execute(CommandData commandData) { - ShareItem.showOnChat(commandData.getPlayerSender()); + public void execute() { + ShareItem.showOnChat(getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java index 51d1ee9db..3907223a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -3,7 +3,6 @@ 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; @@ -15,12 +14,12 @@ public ShopCustomCommand() { 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."); + 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()); + public void execute() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + CustomShopMenu.customShopInitializer(getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 2d005cc46..be44f5a22 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -2,7 +2,6 @@ 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; @@ -15,16 +14,16 @@ public ShopCustomOtherCommand() { 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."); + setPermission("elitemobs.*"); + setDescription("Opens the EliteMobs shop for custom items."); } @Override - public void execute(CommandData commandData) { + public void execute() { try { - CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!"); + Logger.sendMessage(getCurrentCommandSender(), "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 index a4c047071..b13ccf3f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -3,7 +3,6 @@ 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; @@ -13,14 +12,14 @@ public ShopDynamicCommand() { super(List.of("shop")); addLiteral("dynamic"); setUsage("/em shop dynamic"); - setPermission("elitemobs.shop.dynamic"); + setPermission("elitemobs.shop.command"); setSenderType(SenderType.PLAYER); - setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); + 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()); + public void execute() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) + ProceduralShopMenu.shopInitializer(getCurrentPlayerSender()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java index 5984710df..67b331977 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -2,7 +2,6 @@ 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; @@ -20,11 +19,11 @@ public ShopProceduralOtherCommand() { } @Override - public void execute(CommandData commandData) { + public void execute() { try { - ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!"); + Logger.sendMessage(getCurrentCommandSender(), "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 index f4af0c02d..d3847eed2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,18 +13,18 @@ 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."); + setUsage("/em shop custom "); + setPermission("elitemobs.*"); + setDescription("Opens the EliteMobs shop for custom items."); } @Override - public void execute(CommandData commandData) { + public void execute() { SellMenu sellMenu = new SellMenu(); try { - sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player"))); + sellMenu.constructSellMenu(Bukkit.getPlayer(getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!"); + Logger.sendMessage(getCurrentCommandSender(), "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 index 8f2871d95..8e3d72342 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -2,7 +2,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -20,20 +20,21 @@ public SpawnBossAtCommand() { 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."); + setUsage("/setup spawnAt boss "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute(CommandData commandData) { + public void execute() { SpawnCommand.spawnCustomBossCommand( - commandData.getCommandSender(), - commandData.getStringArgument("filename"), - commandData.getStringArgument("worldName"), + getCurrentPlayerSender(), + getStringArgument("filename"), + getStringArgument("worldName"), new Vector( - commandData.getDoubleArgument("x"), - commandData.getDoubleArgument("y"), - commandData.getDoubleArgument("z"))); + getDoubleArgument("x"), + getDoubleArgument("y"), + getDoubleArgument("z"))); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index 2deb74068..de21fe16b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -2,7 +2,6 @@ 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; @@ -13,16 +12,16 @@ public SpawnBossCommand() { super(List.of("spawn")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/em spawn boss "); - setPermission("elitemobs.place.admin"); + setUsage("/setup spawn boss "); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute(CommandData commandData) { + public void execute() { SpawnCommand.spawnCustomBossCommand( - commandData.getPlayerSender(), - commandData.getStringArgument("filename")); + getCurrentPlayerSender(), + getStringArgument("filename")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index 1fe0eecfc..0c21ed5f9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -2,7 +2,7 @@ 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 org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -21,21 +21,22 @@ public SpawnBossLevelAtCommand() { 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."); + setUsage("/setup spawn bossAt "); + setPermission("elitemobs.*"); + setSenderType(SenderType.PLAYER); + setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute(CommandData commandData) { + public void execute() { SpawnCommand.spawnCustomBossCommand( - commandData.getCommandSender(), - commandData.getStringArgument("filename"), - commandData.getStringArgument("worldName"), + getCurrentPlayerSender(), + getStringArgument("filename"), + getStringArgument("worldName"), new Vector( - commandData.getDoubleArgument("x"), - commandData.getDoubleArgument("y"), - commandData.getDoubleArgument("z")), - commandData.getIntegerArgument("level")); + getDoubleArgument("x"), + getDoubleArgument("y"), + getDoubleArgument("z")), + getIntegerArgument("level")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3ccbe9497..986f72362 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,17 +13,17 @@ public SpawnBossLevelCommand() { 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"); + setUsage("/setup spawn boss "); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); + setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute(CommandData commandData) { + public void execute() { SpawnCommand.spawnCustomBossCommand( - commandData.getPlayerSender(), - commandData.getStringArgument("filename"), - commandData.getIntegerArgument("level")); + getCurrentPlayerSender(), + getStringArgument("filename"), + 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 9b4681e3e..322e88eeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java @@ -1,6 +1,5 @@ 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; @@ -10,6 +9,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties; 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; @@ -27,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); + String[] powersArray = powers.get().split(" "); + HashSet mobPowers = getPowers(powersArray, player); eliteEntity.applyPowers(mobPowers); } else { eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity)); @@ -46,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, @@ -63,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); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 4823c0c5e..4ad1e71c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -2,7 +2,6 @@ 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; @@ -18,17 +17,17 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.place.admin"); + setPermission("elitemobs.*"); 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) { + public void execute() { SpawnCommand.spawnEliteEntityTypeCommand( - commandData.getPlayerSender(), - EntityType.valueOf(commandData.getStringArgument("entityType")), - commandData.getIntegerArgument("level"), - Optional.of(commandData.getStringSequenceArgument("powers"))); + getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("entityType")), + getIntegerArgument("level"), + Optional.of(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 index 502bb1811..fef05b732 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -2,7 +2,6 @@ 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; @@ -22,23 +21,23 @@ public SpawnEliteAtCommand() { addArgument("entityType", new ArrayList<>()); addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); - setUsage("/em spawn eliteAt <...>"); - setPermission("elitemobs.place.admin"); + setUsage("/em spawn elite <...>"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); - setDescription("Spawns an elite of the specified type and level, optionally with specified powers, at the chosen location."); + setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); } @Override - public void execute(CommandData commandData) { + public void execute() { SpawnCommand.spawnEliteEntityTypeCommand( - commandData.getPlayerSender(), - EntityType.valueOf(commandData.getStringArgument("entityType")), - commandData.getStringArgument("world"), + getCurrentPlayerSender(), + EntityType.valueOf(getStringArgument("entityType")), + getStringArgument("world"), new Vector( - commandData.getIntegerArgument("x"), - commandData.getIntegerArgument("y"), - commandData.getIntegerArgument("z")), - commandData.getIntegerArgument("level"), - Optional.of(commandData.getStringSequenceArgument("powers"))); + getIntegerArgument("x"), + getIntegerArgument("y"), + getIntegerArgument("z")), + getIntegerArgument("level"), + Optional.of(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 index d0e40f1d6..4d3029a8b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -3,7 +3,6 @@ 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; @@ -11,15 +10,15 @@ public class SpawnTeleportCommand extends AdvancedCommand { public SpawnTeleportCommand() { super(List.of("spawntp")); - setPermission("elitemobs.teleport.spawn"); + setPermission("elitemobs.spawntp"); setUsage("/em spawntp"); setDescription("Teleports players to the server spawn."); setSenderType(SenderType.PLAYER); } @Override - public void execute(CommandData commandData) { + public void execute() { if (DefaultConfig.getDefaultSpawnLocation() != null) - PlayerPreTeleportEvent.teleportPlayer(commandData.getPlayerSender(), DefaultConfig.getDefaultSpawnLocation()); + PlayerPreTeleportEvent.teleportPlayer(getCurrentPlayerSender(), DefaultConfig.getDefaultSpawnLocation()); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java index 35f3162fe..82447a712 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -2,7 +2,6 @@ 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; @@ -14,15 +13,14 @@ public StartCommand() { 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()); + public void execute() { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(getCurrentPlayerSender()); if (matchInstance != null) { matchInstance.countdownMatch(); } else - Logger.sendMessage(commandData.getCommandSender(), "You are not queued for instanced content!"); + Logger.sendMessage(getCurrentCommandSender(), "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 index db5660270..db0e4764f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -1,7 +1,6 @@ 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; @@ -10,13 +9,13 @@ public class StatsCommand extends AdvancedCommand { public StatsCommand() { super(List.of("stats")); setUsage("/em stats"); - setPermission("elitemobs.stats"); + setPermission("elitemobs.*"); setSenderType(SenderType.PLAYER); setDescription("Displays EliteMobs server stats."); } @Override - public void execute(CommandData commandData) { - com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(commandData.getCommandSender()); + public void execute() { + com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(getCurrentPlayerSender()); } } \ 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 index 02a58b06b..cac58c1e4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -3,7 +3,6 @@ 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; @@ -19,21 +18,20 @@ public TrackBossCommand() { setDescription("Tracks a Custom Boss."); setUsage("/em track boss "); setSenderType(SenderType.PLAYER); - setPermission("elitemobs.boss.track"); } @Override - public void execute(CommandData commandData) { + public void execute() { try { for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) - if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandData.getStringArgument("id")))) { - customBossEntity.getCustomBossBossBar().addTrackingPlayer(commandData.getPlayerSender()); + if (customBossEntity.getEliteUUID().equals(UUID.fromString(getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(getCurrentPlayerSender()); return; } - Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + Logger.sendMessage(getCurrentCommandSender(), 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()); + Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 5a321f703..9c5f99c25 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -2,8 +2,6 @@ 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; @@ -12,13 +10,12 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); - setSenderType(SenderType.PLAYER); - setPermission("elitemobs.transitiveblocks"); } @Override - public void execute(CommandData commandData) { - TransitiveBlockCommand.processCommand(commandData.getPlayerSender()); + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender()); } } \ 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 index d1a14a2b8..8ae26b164 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -3,8 +3,6 @@ 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; @@ -14,19 +12,13 @@ public TransitiveBlocksEditAreaCommand() { addLiteral("editArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks editArea "); - setPermission("elitemobs.transitiveblocks"); + setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); 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); + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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 index db6a54c7f..936f496e2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -3,8 +3,6 @@ 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; @@ -14,18 +12,13 @@ public TransitiveBlocksEditCommand() { 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"); + setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); } @Override - public void execute(CommandData commandData) { - TransitiveBlockCommand.processCommand( - commandData.getPlayerSender(), - commandData.getStringArgument("filename"), - commandData.getStringArgument("type"), - true); + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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 index c68cb1115..a16414ca1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -3,8 +3,6 @@ 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; @@ -14,19 +12,13 @@ public TransitiveBlocksRegisterAreaCommand() { addLiteral("registerArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks registerArea "); + setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); 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); + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), 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 index 22504ebed..66c304a25 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -3,8 +3,6 @@ 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; @@ -14,17 +12,13 @@ public TransitiveBlocksRegisterCommand() { 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"); + setUsage("/em transitiveBlocks cancel"); + setPermission("elitemobs.*"); + setDescription("Cancels transitive block registration."); } @Override - public void execute(CommandData commandData) { - TransitiveBlockCommand.processCommand( - commandData.getPlayerSender(), - commandData.getStringArgument("filename"), - commandData.getStringArgument("type"), false); + public void execute() { + TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index 742eb9385..7c4e19c93 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -3,7 +3,6 @@ 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; @@ -14,14 +13,14 @@ public UnbindCommand() { 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."); + 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())) { + public void execute() { + if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { UnbindMenu unbindMenu = new UnbindMenu(); - unbindMenu.constructUnbinderMenu(commandData.getPlayerSender()); + unbindMenu.constructUnbinderMenu(getCurrentPlayerSender()); } } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java index f853fa85b..ca1237a23 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -3,7 +3,6 @@ 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; @@ -15,13 +14,13 @@ public UnbindForceCommand() { addLiteral("force"); setUsage("/em unbind force"); setSenderType(SenderType.PLAYER); - setPermission("elitemobs.unbind.force"); + setPermission("elitemobs.*"); setDescription("Forcefully unbinds a held item."); } @Override - public void execute(CommandData commandData) { - ItemStack itemStack = commandData.getPlayerSender().getInventory().getItemInMainHand(); + public void execute() { + ItemStack itemStack = getCurrentPlayerSender().getInventory().getItemInMainHand(); if (ItemTagger.isEliteItem(itemStack)) SoulbindEnchantment.removeEnchantment(itemStack); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index 3a7669ba6..765e84ddb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -2,7 +2,6 @@ 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; @@ -13,14 +12,14 @@ 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."); + setPermission("elitemobs.*"); + setDescription("Checks the server's plugin version."); } @Override - public void execute(CommandData commandData) { + public void execute() { Logger.sendMessage( - commandData.getCommandSender(), + getCurrentCommandSender(), 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/DebugScreen.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java index e39885c30..7cb25431c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -6,8 +6,8 @@ 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/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java index a6309b02e..8cbeb76d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java @@ -55,14 +55,18 @@ 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)); } 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 e5e0c4bcd..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,10 +1,10 @@ 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.magmacore.util.ChatColorConverter; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; 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 d3c5bd302..aff87c328 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -6,8 +6,8 @@ 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; 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 ea17b69f2..05bf15fc1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.ItemStackGenerator; import com.magmaguy.elitemobs.utils.SpigotMessage; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -60,10 +60,10 @@ private static void resourcePackButtonInteraction(Player player, SetupMenu setup } } - public static void forceResourcePack(Player player) { - ResourcePackDataConfig.toggleForceResourcePack(true); - player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!"); - } +// 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 diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index 7aaf10e90..96882a5f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -1,15 +1,14 @@ 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.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 @@ -67,19 +66,96 @@ public class AdventurersGuildConfig { @Getter private static boolean disableCommonerRank; - private static File file; - private static FileConfiguration fileConfiguration; + public AdventurersGuildConfig() { + super("AdventurersGuild.yml"); + } + + public static String getRankName(int prestigeTier, int rankTier) { + return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]); + } - private AdventurersGuildConfig() { + 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"; + } } - public static void save() { - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, 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"; + } } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("AdventurersGuild.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @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); @@ -425,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 6b0641834..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,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 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; @@ -33,13 +32,12 @@ 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", @@ -77,9 +75,5 @@ public static void initializeConfig() { 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/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 6e89a7855..778e82472 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,102 +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.magmacore.util.ChatColorConverter; +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) { - fileConfiguration.setComments(key, comments); - } - - public static Boolean setBoolean(FileConfiguration fileConfiguration, String key, boolean defaultValue) { - try { - fileConfiguration.addDefault(key, defaultValue); - } catch (Exception e) { - new WarningMessage("Attempted to write key " + key + " with value " + defaultValue + " to " + fileConfiguration.getName() + " and that contained an illegal argument!"); - e.printStackTrace(); - } - 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); @@ -112,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) @@ -149,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()) @@ -194,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); } 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); } 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) @@ -215,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 2e9526b60..d0fbb9990 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import org.bukkit.scheduler.BukkitRunnable; import java.io.*; @@ -27,7 +27,7 @@ public void run() { try { Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports")); } catch (Exception exception) { - new WarningMessage("Failed to create exports directory! Tell the dev!"); + Logger.warn("Failed to create exports directory! Tell the dev!"); exception.printStackTrace(); } } @@ -36,7 +36,7 @@ public void run() { 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) { - new WarningMessage("Failed to download official resource pack! Tell the dev!"); + Logger.warn("Failed to download official resource pack! Tell the dev!"); e.printStackTrace(); } } @@ -66,7 +66,7 @@ public static void downloadFile(String fileURL, String saveFilePath) throws IOEx // Opens input stream from the HTTP connection InputStream inputStream = httpConn.getInputStream(); - String saveFilePathWithName = saveFilePath + File.separatorChar+ fileName; + String saveFilePathWithName = saveFilePath + File.separatorChar + fileName; // Opens an output stream to save into file FileOutputStream outputStream = new FileOutputStream(saveFilePathWithName); @@ -81,7 +81,7 @@ public static void downloadFile(String fileURL, String saveFilePath) throws IOEx inputStream.close(); } else { - new WarningMessage("No file to download. Server replied HTTP code: " + responseCode); + Logger.warn("No file to download. Server replied HTTP code: " + responseCode); } httpConn.disconnect(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java index 1642611ba..2ec691a57 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java @@ -1,12 +1,11 @@ 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 com.magmaguy.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; +import com.magmaguy.magmacore.util.ZipFile; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -27,7 +26,7 @@ public static void initializeConfigs() { try { Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "imports")); } catch (Exception exception) { - new WarningMessage("Failed to create import directory! Tell the dev!"); + Logger.warn("Failed to create import directory! Tell the dev!"); exception.printStackTrace(); } return; @@ -37,7 +36,7 @@ public static void initializeConfigs() { 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!"); + Logger.warn("Failed to get imports folder! Report this to the dev!"); return; } @@ -47,10 +46,11 @@ public static void initializeConfigs() { for (File zippedFile : importsFile.listFiles()) { File unzippedFile; try { - if (zippedFile.getName().contains(".zip")) unzippedFile = ZipFile.unzip(zippedFile.getName()); + if (zippedFile.getName().contains(".zip")) + unzippedFile = ZipFile.unzip(zippedFile, new File(zippedFile.getAbsolutePath().replace(".zip", ""))); else unzippedFile = zippedFile; } catch (Exception e) { - new WarningMessage("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); + Logger.warn("Failed to unzip config file " + zippedFile.getName() + " ! Tell the dev!"); e.printStackTrace(); continue; } @@ -105,18 +105,18 @@ public static void initializeConfigs() { if (CustomModel.customModelsEnabled()) { importedModels = true; } else - new WarningMessage("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); + Logger.warn("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); break; case "schematics": - new WarningMessage("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); + Logger.warn("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); 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?"); + Logger.warn("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!"); + Logger.warn("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); e.printStackTrace(); continue; } @@ -124,7 +124,7 @@ public static void initializeConfigs() { unzippedFile.delete(); zippedFile.delete(); } catch (Exception ex) { - new WarningMessage("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); + Logger.warn("Failed to delete zipped file " + zippedFile.getName() + "! Tell the dev!"); ex.printStackTrace(); } } @@ -142,7 +142,7 @@ 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()); + Logger.info("Cleaning up " + file.getPath()); file.delete(); } @@ -151,16 +151,16 @@ private static void moveWorlds(File worldcontainerFile) { 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()); + Logger.info("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!"); + Logger.warn("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!"); + Logger.warn("Failed to move worlds for " + file.getName() + "! Tell the dev!"); exception.printStackTrace(); } } @@ -168,10 +168,10 @@ private static void moveWorlds(File worldcontainerFile) { private static void moveDirectory(File unzippedDirectory, Path targetPath, boolean force) { for (File file : unzippedDirectory.listFiles()) try { - new InfoMessage("Adding " + file.getCanonicalPath()); + Logger.info("Adding " + file.getCanonicalPath()); moveFile(file, targetPath, force); } catch (Exception exception) { - new WarningMessage("Failed to move directories for " + file.getName() + "! Tell the dev!"); + Logger.warn("Failed to move directories for " + file.getName() + "! Tell the dev!"); exception.printStackTrace(); } } @@ -191,7 +191,7 @@ private static void moveFile(File file, Path targetPath, boolean force) { 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!"); + Logger.warn("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 1848717fe..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 validity 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() + " ! You should probably delete that file."); -// ex.printStackTrace(); - } - - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index bb73aa64f..3cc651db0 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -1,23 +1,23 @@ package com.magmaguy.elitemobs.config; -import com.magmaguy.elitemobs.commands.admin.ReloadCommand; +import com.magmaguy.elitemobs.commands.ReloadCommand; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; import com.magmaguy.elitemobs.utils.ConfigurationLocation; -import com.magmaguy.elitemobs.utils.InfoMessage; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import java.io.File; import java.util.List; /** * Created by MagmaGuy on 08/06/2017. */ -public class DefaultConfig { +public class DefaultConfig extends ConfigurationFile { + @Getter + public static DefaultConfig instance; @Getter private static boolean alwaysShowNametags; @Getter @@ -74,28 +74,33 @@ public class DefaultConfig { private static String treasureChestNoDropMessage; @Getter private static String bossAlreadyGoneMessage; + @Getter + private static boolean resetPlayerScaleOnLogin; - private static File file = null; - private static FileConfiguration fileConfiguration = null; - - private DefaultConfig() { + public DefaultConfig() { + super("config.yml"); + instance = this; } public static void toggleSetupDone() { setupDone = !setupDone; - fileConfiguration.set("setupDoneV3", setupDone); + instance.fileConfiguration.set("setupDoneV3", setupDone); save(); } public static void save() { - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); + ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); } + public static void setLanguage(CommandSender commandSender, String filename) { + language = filename; + instance.fileConfiguration.set("language", filename); + ConfigurationEngine.fileSaverCustomValues(instance.fileConfiguration, instance.file); + ReloadCommand.reload(commandSender); + } - public static void initializeConfig() { - - file = ConfigurationEngine.fileCreator("config.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + @Override + public void initializeValues() { //The language changes what data is loaded downstream language = ConfigurationEngine.setString( List.of("Sets the language file used by EliteMobs", "Do NOT change this manually! It is meant to be installed with the command '/em language '"), @@ -123,7 +128,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 +153,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( @@ -196,16 +201,7 @@ public static void initializeConfig() { 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); + 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); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - - 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/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java index 8ec9e8c08..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; @@ -35,12 +34,12 @@ public class DungeonsConfig { @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"), @@ -94,8 +93,5 @@ public static void initializeConfig() { 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); - - ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java index 9aef67a34..20a73bea6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java @@ -1,17 +1,17 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.combatsystem.CombatSystem; +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 @@ -82,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; @@ -264,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 37d2b3339..2d72be5c4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.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 EventsConfig { +public class EventsConfig extends ConfigurationFile { @Getter private static boolean announcementBroadcastWorldOnly; @Getter @@ -18,13 +17,12 @@ public class EventsConfig { @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); @@ -33,7 +31,7 @@ public static void initializeConfig() { fileConfiguration, "actionEventMinimumCooldownMinutes", 4); timedEventMinimumCooldown = ConfigurationEngine.setInt( List.of("Sets the minimum cooldown, in minutes, between timed events"), - fileConfiguration, "actionEventMinimumCooldownMinutes", 4); + 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"), @@ -43,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/ItemUpgradeSystemConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java deleted file mode 100644 index 53be17872..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemUpgradeSystemConfig.java +++ /dev/null @@ -1,28 +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 index c03efc4ed..e72f2a185 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -1,5 +1,7 @@ package com.magmaguy.elitemobs.config; +import org.bukkit.Particle; + import java.util.Locale; public class LegacyValueConverter { @@ -74,6 +76,25 @@ public static String parsePotionEffect(String 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(); + default: + return potionEffectName; + } + } + public static String parseDeserializedBlocks(String originalDeserializedBlock) { if (originalDeserializedBlock.endsWith("grass")) return originalDeserializedBlock.replace("grass", "grass_block[snowy=false]"); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java index 01b60cec2..0114dfdaf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java @@ -1,24 +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 33ba488b6..ecec2451e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -62,6 +62,7 @@ public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile { public ProceduralItemGenerationSettingsConfig() { super("ProceduralItemGenerationSettings.yml"); + instance = this; } private void addMaterial(Material material) { @@ -78,8 +79,6 @@ public void cacheMaterials() { @Override public void initializeValues() { - instance = this; - doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); diff --git a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java index 90a6d68a1..fa5a2824c 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -4,7 +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.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -15,7 +16,7 @@ import java.util.Arrays; import java.util.List; -public class QuestsConfig { +public class QuestsConfig extends ConfigurationFile { @Getter private static boolean requireQuestTurnIn; @@ -104,12 +105,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<>(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() + )); + + 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) { + 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."), @@ -251,87 +333,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() - )); - - 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 index 1a077e54a..01ba3e076 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java @@ -1,11 +1,11 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.ConfigurationFile; +import com.magmaguy.magmacore.util.Logger; 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; @@ -17,7 +17,7 @@ import java.io.IOException; import java.net.URL; -public class ResourcePackDataConfig { +public class ResourcePackDataConfig extends ConfigurationFile { @Getter public static boolean eliteMobsResourcePackEnabled; @@ -31,23 +31,11 @@ public class ResourcePackDataConfig { public static String resourcePackLink; @Getter public static byte[] SHA1 = null; - private static File file; - private static FileConfiguration fileConfiguration; + public static ResourcePackDataConfig instance; - 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 ResourcePackDataConfig() { + super("resource_pack_config.yml"); + instance = this; } public static void updateSHA1() { @@ -59,21 +47,21 @@ public void run() { 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)"); + Logger.warn("[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."); + Logger.warn("[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); + instance.fileConfiguration.set("eliteMobsResourcePackEnabled", status); + ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); eliteMobsResourcePackEnabled = status; displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; if (status) { @@ -83,7 +71,7 @@ public static void toggleEliteMobsResourcePackStatus(boolean status) { } public static void toggleForceResourcePack(boolean status) { - fileConfiguration.set("forceResourcePack", status); + instance.fileConfiguration.set("forceResourcePack", status); forceResourcePack = status; } @@ -91,6 +79,18 @@ public static void sendResourcePack(Player player) { player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); } + @Override + public void initializeValues() { + 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; + } + public static class ResourcePackDataConfigEvents implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLogin(PlayerJoinEvent event) { diff --git a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java index 92fd4f3c4..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,10 +13,12 @@ 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); @@ -48,8 +46,5 @@ public static void initializeConfig() { 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); } - } diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java index 2afad9dc1..536569ffa 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java @@ -1,15 +1,15 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.items.customitems.CustomItem; -import com.magmaguy.elitemobs.utils.WarningMessage; +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<>(); @@ -40,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."), @@ -152,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/ValidWorldsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java index e93f52dbd..fe1a8dc9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java @@ -1,28 +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 FileConfiguration fileConfiguration; - private static File file; + private static ValidWorldsConfig instance; - private ValidWorldsConfig() { + public ValidWorldsConfig() { + super("ValidWorlds.yml"); + instance = this; } - public static void initializeConfig() { - file = ConfigurationEngine.fileCreator("ValidWorlds.yml"); - fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file); + public static void addWorld(String worldName) { + if (instance.fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return; + + 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); + } + + @Override + public void initializeValues() { for (World world : Bukkit.getWorlds()) ConfigurationEngine.setBoolean(fileConfiguration, "Valid worlds." + world.getName(), true); @@ -32,19 +41,5 @@ public static void initializeConfig() { for (String key : validWorldsSection.getKeys(false)) if (validWorldsSection.getBoolean(key)) validWorlds.add(key); - - 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/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index 11f3afb7e..b0e1f3584 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -1,16 +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; @@ -20,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<>(); @@ -273,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; } } @@ -285,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); } } @@ -295,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); } } @@ -305,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); @@ -339,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); @@ -392,7 +391,7 @@ public void processConfigFields() { try { this.bossType = BossType.valueOf(bossTypeString.toUpperCase(Locale.ROOT)); } catch (Exception e) { - new WarningMessage("Boss type for boss " + filename + " is not a valid boss type!"); + Logger.warn("Boss type for boss " + filename + " is not a valid boss type!"); } this.scale = processDouble("scale", scale, 1, false); @@ -420,16 +419,16 @@ private HashMap processDamageModifiers(String path, HashMap newEnchantments = new ArrayList<>(); for (String enchantment : enchantments) { if (!enchantment.contains(",")) { - new WarningMessage("Invalid format for enchantment in file " + filename + " for enchantment " + enchantment + " : missing ',' for valid level after the enchantment name"); + 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(","); @@ -105,7 +104,7 @@ private void updatePostProcessor() { List newPotionEffects = new ArrayList<>(); for (String potionEffect : potionEffects) { if (!potionEffect.contains(",")) { - new WarningMessage("Invalid format for potion effect in file " + filename + " for potion effect " + potionEffect + " : missing ',' for valid level after the potion effect name"); + 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(","); @@ -125,9 +124,9 @@ private void updatePostProcessor() { } potionEffects = newPotionEffects; - potionEffects.forEach(potionEffect->{ + potionEffects.forEach(potionEffect -> { if (potionEffect.contains("INSTANT_DAMAGE")) - new WarningMessage("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."); + 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/DepthsSeekerConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/DepthsSeekerConfig.java index f4135e948..f56ab5db4 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 @@ -14,7 +14,7 @@ public DepthsSeekerConfig() { "&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_OF_THE_SEA,3", "UNBREAKING,10", "FIRE_ASPECT,1", "VANISHING_CURSE,1")); - setPotionEffects(Arrays.asList("WATER_BREATHING,0,self,continuous", "LUCK_OF_THE_SEA,0,self,continuous")); + setPotionEffects(Arrays.asList("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/LuckyCharmsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customitems/premade/LuckyCharmsConfig.java index 4f251360b..3cbcfa73c 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 @@ -14,7 +14,7 @@ public LuckyCharmsConfig() { "&bLucky Charms", Arrays.asList("&aPart of a complete breakfast!", "&cNote: Absolutely not a part of", "&ca complete breakfast.")); setEnchantments(List.of("VANISHING_CURSE,1")); - setPotionEffects(List.of("LUCK_OF_THE_SEA,0,self,continuous")); + setPotionEffects(List.of("LUCK,0,self,continuous")); setDropWeight("1"); } } 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 7b52edd01..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<>(); @@ -23,9 +24,6 @@ public class CustomQuestsConfigFields extends CustomConfigFields implements Cust private int questLevel = 0; @Getter @Setter - protected Map> customObjectives = new HashMap(); - @Getter - @Setter private List customRewardsList = new ArrayList<>(); @Getter @Setter @@ -141,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); } @@ -156,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!"); } } @@ -184,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/customtreasurechests/CustomTreasureChestConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customtreasurechests/CustomTreasureChestConfigFields.java index 2f78f13f5..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,10 +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 lombok.Setter; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; @@ -123,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); } /** @@ -173,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/dungeonpackager/DungeonPackagerConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java index 3db03e8fb..ec81efad7 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -3,7 +3,7 @@ import com.magmaguy.elitemobs.config.ConfigurationEngine; import com.magmaguy.elitemobs.config.CustomConfigFields; 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; @@ -246,7 +246,7 @@ public void processConfigFields() { 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; } 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 26fa661df..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,8 +1,8 @@ package com.magmaguy.elitemobs.config.enchantments; -import com.magmaguy.elitemobs.config.CustomConfig; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.config.CustomConfig; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.enchantments.Enchantment; @@ -26,7 +26,7 @@ public static EnchantmentsConfigFields getEnchantment(String string) { newString = newString.toLowerCase(Locale.ROOT); EnchantmentsConfigFields test = enchantments.get(newString); if (test == null) { - new WarningMessage("Failed to find enchant file " + newString); + Logger.warn("Failed to find enchant file " + newString); new Exception().printStackTrace(); } return enchantments.get(newString); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EMPackage.java index f0d748779..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; @@ -37,11 +37,6 @@ public class EMPackage { protected List treasureChestList = new ArrayList<>(); protected List npcEntities = new ArrayList<>(); - public boolean isOutOfDate() { - if (!isInstalled) return false; - return outOfDate; - } - public EMPackage(DungeonPackagerConfigFields dungeonPackagerConfigFields) { this.dungeonPackagerConfigFields = dungeonPackagerConfigFields; emPackages.put(dungeonPackagerConfigFields.getFilename(), this); @@ -77,12 +72,17 @@ public static void initialize(DungeonPackagerConfigFields dungeonPackagerConfigF new WorldPackage(dungeonPackagerConfigFields); break; case SCHEMATIC_DUNGEON: - new WarningMessage("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."); + 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 */ @@ -115,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/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index efee487af..c208a1f1c 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -4,9 +4,6 @@ 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; @@ -28,17 +25,6 @@ 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 c8c3cf4fa..8591340ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -1,10 +1,10 @@ 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.utils.WarningMessage; 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; @@ -28,7 +28,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; } 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 02d206bbe..9e63ac406 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,8 +5,7 @@ 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.Logger; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Difficulty; @@ -55,11 +54,11 @@ public static World loadWorld(String worldName, World.Environment environment, D 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!"); + Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); return null; } - new InfoMessage("Loading world " + worldName + " !"); + Logger.info("Loading world " + worldName + " !"); Filter filter = newFilter -> false; @@ -80,7 +79,7 @@ public static World loadWorld(String worldName, World.Environment environment, D return world; } catch (Exception exception) { Bukkit.getLogger().setFilter(previousFilter); - new WarningMessage("Failed to load world " + worldName + " !"); + Logger.warn("Failed to load world " + worldName + " !"); exception.printStackTrace(); } return null; diff --git a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java index 9b1fba505..43dd58b52 100644 --- a/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/events/ActionEvent.java @@ -7,7 +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.magmacore.util.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -90,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); diff --git a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java index 4625ad1f1..848fe63e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java +++ b/src/main/java/com/magmaguy/elitemobs/explosionregen/Explosion.java @@ -321,7 +321,8 @@ public static class ExplosionEvent implements Listener { @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) public void entityExplodeEvent(EntityExplodeEvent event) { Entity entity = event.getEntity(); - if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) entity = shooter; + if (entity instanceof Projectile projectile && projectile.getShooter() instanceof LivingEntity shooter) + entity = shooter; EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity); if (eliteEntity != null) { generateExplosion(event); diff --git a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java index eb9658198..696e75ff1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/InstanceDeathLocation.java @@ -1,10 +1,10 @@ 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.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; import org.bukkit.Location; import org.bukkit.Material; 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 d05ed83d0..467f217c5 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -1,6 +1,5 @@ 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; @@ -15,8 +14,9 @@ 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; @@ -113,14 +113,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 +135,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 +160,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; } } @@ -244,7 +244,7 @@ private void spawnBosses() { 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(); @@ -253,7 +253,7 @@ private void spawnBosses() { customBossEntity.setRandomLoot(false); customBossEntity.spawn(spawnPoints.get(arenaEntity.getSpawnPointName()), true); 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); @@ -263,9 +263,9 @@ private void spawnBosses() { 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!"); + 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) { - 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!"); + 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!"); } } } 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 b85806480..2c0007530 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -15,7 +15,11 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.npcs.NPCEntity; import com.magmaguy.elitemobs.treasurechest.TreasureChest; -import com.magmaguy.elitemobs.utils.*; +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.bukkit.Bukkit; import org.bukkit.Location; @@ -225,7 +229,7 @@ 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)); @@ -240,7 +244,7 @@ public void run() { dungeonInstances.remove(dungeonInstance); if (!Bukkit.unloadWorld(world, false)) { - new WarningMessage("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); + Logger.warn("Failed to unload world " + instancedWorldName + " ! This is bad, report this to the developer!"); return; } new BukkitRunnable() { @@ -266,7 +270,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; } @@ -274,7 +278,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 diff --git a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 3edba4109..3e5d8eecb 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -10,9 +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.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; diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index 4fbd06cf8..e0d720677 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -8,10 +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.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; 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 7b43e90fc..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; @@ -9,6 +8,7 @@ import com.magmaguy.elitemobs.entitytracker.EntityTracker; import com.magmaguy.elitemobs.items.EliteItemLore; import com.magmaguy.elitemobs.utils.VisualDisplay; +import com.magmaguy.magmacore.util.ChatColorConverter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.NamespacedKey; 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 4816fed96..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; @@ -85,7 +85,7 @@ public CurrencyCustomLootEntry(List entries, Map configMa 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); + 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/itemconstructor/ItemConstructor.java b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java index 71a2cc1c7..e967da277 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java @@ -7,8 +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/potioneffects/ElitePotionEffect.java b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java index aa65beda9..268cd32ef 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java +++ b/src/main/java/com/magmaguy/elitemobs/items/potioneffects/ElitePotionEffect.java @@ -2,7 +2,7 @@ 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; @@ -23,7 +23,7 @@ public ElitePotionEffect(String string) { int duration = 2 * 20; PotionEffectType potionEffectType = Registry.EFFECT.get(new NamespacedKey("minecraft", LegacyValueConverter.parsePotionEffect(stringObject[0]).toLowerCase(Locale.ROOT))); if (potionEffectType == null) { - new WarningMessage("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); + Logger.warn("Failed to get valid potion effect for " + stringObject[0].toLowerCase(Locale.ROOT)); return; } if (potionEffectType.equals(PotionEffectType.NIGHT_VISION)) @@ -51,7 +51,7 @@ public ElitePotionEffect(String string) { 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/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index e9bdefa43..f884985fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -5,8 +5,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index 2fc5c4b40..d6f39502a 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.menus; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.config.EconomySettingsConfig; import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.SpecialItemSystemsConfig; @@ -12,6 +11,7 @@ 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 net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; @@ -212,7 +212,7 @@ 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 + //Make sure enchant books themselves can't be enchanted { } } else if (EliteEnchantmentItems.isEliteLuckyTicket(event.getCurrentItem()) && diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 6f12a408c..25202dc8d 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.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/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 55c881ab7..42c4e12d7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -5,11 +5,12 @@ 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; @@ -41,7 +42,7 @@ public class ScrapperMenu extends EliteMenu { public void constructScrapMenu(Player player) { String menuName = ScrapperMenuConfig.shopName; - if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) + if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC2B\uF805 " + menuName; Inventory scrapInventory = Bukkit.createInventory(player, 54, menuName); @@ -50,7 +51,7 @@ public void constructScrapMenu(Player player) { if (i == ScrapperMenuConfig.infoSlot) { ItemStack infoButton = ScrapperMenuConfig.infoButton; - if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) { + if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) { 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 653e6e536..1d20fa872 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -3,13 +3,14 @@ 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; @@ -66,7 +67,7 @@ private static ItemStack updateConfirmButton(double itemWorth) { public void constructSellMenu(Player player) { String menuName = SellMenuConfig.shopName; - if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager")) + if (ResourcePackDataConfig.isDisplayCustomMenuUnicodes()) menuName = ChatColor.WHITE + "\uF801\uDB80\uDC5B\uF805 " + menuName; Inventory sellInventory = Bukkit.createInventory(player, 54, menuName); diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java index 98bde5175..4009119dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/BossType.java @@ -4,5 +4,6 @@ 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 a3ac05e2a..2fcb4547a 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/CustomSpawn.java @@ -14,8 +14,7 @@ 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.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); @@ -190,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 { @@ -201,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; diff --git a/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/EliteEntity.java index 12a20aa66..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,7 +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.magmacore.util.ChatColorConverter; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -496,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/custombosses/BossMusic.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java index caefe80e1..26ca95ece 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses; import com.magmaguy.elitemobs.MetadataHandler; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import org.bukkit.Location; import org.bukkit.entity.EntityType; @@ -15,6 +15,7 @@ public class BossMusic { private final HashMap players = new HashMap<>(); + private final CustomBossEntity customBossEntity; @Getter private String name; @Getter @@ -24,7 +25,6 @@ public class BossMusic { @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) { @@ -55,7 +55,7 @@ private void parse(String rawString, int entryNumber) { } break; default: - new WarningMessage("Failed to get value for boss music!"); + Logger.warn("Failed to get value for boss music!"); } } } 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 51655d24e..0eebe530e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -3,9 +3,9 @@ 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.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; @@ -43,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 track boss " + customBossEntity.getEliteUUID())); + interactiveMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/elitemobs trackcustomboss " + customBossEntity.getEliteUUID())); interactiveMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(DefaultConfig.getTrackMessage().replace("$name", customBossEntity.getName())).create())); player.spigot().sendMessage(interactiveMessage); } 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 d4654b4fc..a86c13599 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java @@ -4,8 +4,8 @@ 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/transitiveblocks/TransitiveBlock.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/transitiveblocks/TransitiveBlock.java index 046654fc2..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,7 +1,7 @@ package com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks; import com.magmaguy.elitemobs.config.LegacyValueConverter; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -39,7 +39,7 @@ public static List serializeTransitiveBlocks(List deser 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/pathfinding/Navigation.java b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java index 410287c9e..f9599c613 100644 --- a/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java +++ b/src/main/java/com/magmaguy/elitemobs/pathfinding/Navigation.java @@ -21,7 +21,7 @@ public class Navigation implements Listener { - private static HashMap currentlyNavigating = new HashMap(); + private static final HashMap currentlyNavigating = new HashMap(); public static void addSoftLeashAI(RegionalBossEntity regionalBossEntity) { if (NMSManager.getAdapter() == null) return; @@ -60,7 +60,7 @@ public static void addHardLeashAI(RegionalBossEntity regionalBossEntity) { .register(); } - public static void shutdown(){ + public static void shutdown() { currentlyNavigating.values().forEach(BukkitTask::cancel); currentlyNavigating.clear(); } diff --git a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java index f544a4fae..dfcd53f2b 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/PlayerItem.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.playerdata; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.api.utils.EliteItemManager; import com.magmaguy.elitemobs.config.ItemSettingsConfig; @@ -11,6 +10,7 @@ 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; @@ -87,7 +87,7 @@ private boolean fullUpdate(ItemStack itemStack) { return fillNullItem(); } - if (displayingAsBroken){ + if (displayingAsBroken) { BossBarUtil.HideBrokenItemBossBar(equipmentSlot, player); displayingAsBroken = false; } @@ -96,13 +96,13 @@ private boolean fullUpdate(ItemStack itemStack) { // if (itemStack.isSimilar(this.itemStack)) // return false; - if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { - if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { - player.getWorld().dropItem(player.getLocation(), itemStack); - itemStack.setAmount(0); - itemStack = new ItemStack(Material.AIR); - } + if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled()) { + if (!SoulbindEnchantment.isValidSoulbindUser(itemStack.getItemMeta(), player)) { + player.getWorld().dropItem(player.getLocation(), itemStack); + itemStack.setAmount(0); + itemStack = new ItemStack(Material.AIR); } + } //Neither offhand nor armor contribute to baseline damage outside of the enchants, so we reset the damage before anything this.eliteDamage = 0; 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 de32c0cb9..5c6cabd04 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.magmacore.util.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.ItemStackGenerator; +import com.magmaguy.elitemobs.utils.SpigotMessage; 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; 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 65d12c34a..c64a0655c 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -4,8 +4,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java index 266003f8f..058503d28 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/ZombieNecronomicon.java @@ -11,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; @@ -28,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. @@ -36,7 +36,7 @@ public class ZombieNecronomicon extends MajorPower implements Listener { private int chantIndex = 0; - private ArrayList entityList = new ArrayList<>(); + private final ArrayList entityList = new ArrayList<>(); public ZombieNecronomicon() { super(PowersConfig.getPower("zombie_necronomicon.yml")); @@ -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); @@ -233,7 +233,7 @@ public void run() { 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; 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 969f57725..64bdee8e1 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; @@ -14,7 +13,8 @@ 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.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.*; @@ -48,11 +49,6 @@ public class ScriptAction { private final EliteScript eliteScript; private ScriptTargets finalScriptTargets = null; - public static void shutdown(){ - invulnerablePlayers.forEach(player -> player.setInvulnerable(false)); - } - - public ScriptAction(ScriptActionBlueprint blueprint, Map eliteScriptMap, EliteScript eliteScript) { this.blueprint = blueprint; this.scriptTargets = new ScriptTargets(blueprint.getScriptTargets(), eliteScript); @@ -64,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 @@ -74,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; } @@ -92,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; } @@ -217,8 +216,9 @@ private void runActions(ScriptActionData 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)) @@ -242,7 +242,7 @@ 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)); @@ -259,12 +259,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()); @@ -273,12 +273,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())); @@ -287,13 +287,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); @@ -313,7 +313,7 @@ private void runPotionEffect(ScriptActionData scriptActionData) { //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) && @@ -327,7 +327,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); } @@ -336,7 +336,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); } @@ -477,7 +477,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; } @@ -622,7 +622,6 @@ else if (blueprint.getVValue() != null) } private void runModifyDamage(ScriptActionData scriptActionData) { - if (scriptActionData.getEvent() instanceof EliteDamageEvent eliteDamageEvent) { eliteDamageEvent.setDamage(eliteDamageEvent.getDamage() * blueprint.getMultiplier()); } @@ -633,7 +632,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; } @@ -683,7 +682,7 @@ private void runNavigate(ScriptActionData scriptActionData) { if (!(eliteEntity instanceof CustomBossEntity customBossEntity)) return; 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; } @@ -692,4 +691,17 @@ private void runNavigate(ScriptActionData scriptActionData) { 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/ScriptConditions.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptConditions.java index b6688cadb..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 ScriptTargets scriptTargets = null; private final EliteScript eliteScript; + private ScriptTargets scriptTargets = null; public ScriptConditions(ScriptConditionsBlueprint scriptConditionsBlueprint, EliteScript eliteScript, boolean actionCondition) { this.conditionsBlueprint = scriptConditionsBlueprint; 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 b510405b3..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,7 +3,7 @@ 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; @@ -25,7 +25,7 @@ public static void runEvent(FallingEntityDataPair fallingEntityDataPair, Locatio 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!"); + Logger.warn("Elite script " + string + " does not exist for landing scripts!"); return; } iteratedScript.check(landingLocation, fallingEntityDataPair.getScriptActionData()); 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 98c9c625e..2fea67379 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -11,8 +11,8 @@ import com.magmaguy.elitemobs.powers.scripts.caching.ScriptZoneBlueprint; import com.magmaguy.elitemobs.powers.scripts.enums.TargetType; import com.magmaguy.elitemobs.utils.EventCaller; -import com.magmaguy.elitemobs.utils.WarningMessage; import com.magmaguy.elitemobs.utils.shapes.*; +import com.magmaguy.magmacore.util.Logger; import lombok.Getter; import lombok.Setter; import org.bukkit.Location; @@ -101,7 +101,7 @@ protected Collection getZoneEntities(ScriptActionData scriptAction 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<>(); } } @@ -137,7 +137,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<>(); } } @@ -159,7 +159,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)) @@ -168,7 +168,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)) @@ -177,7 +177,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; 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 cd0d776f4..4390f4ed8 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; @@ -109,6 +109,8 @@ public class ScriptActionBlueprint { private float pitch = 1f; @Getter private float velocity = 1f; + @Getter + private double scale = 1f; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -141,7 +143,7 @@ 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); @@ -195,8 +197,8 @@ protected void processKeyAndValue(String key, Object value) { case "pitch" -> pitch = parseFloat(key, value, scriptName); case "volume" -> volume = parseFloat(key, value, scriptName); case "velocity" -> velocity = parseFloat(key, value, scriptName); - default -> - new WarningMessage("Failed to read key " + key + " for script " + scriptName + " in " + scriptFilename); + case "scale" -> scale = parseFloat(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/ScriptParticlesBlueprint.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/caching/ScriptParticlesBlueprint.java index a0a15f694..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; @@ -89,7 +89,7 @@ private void processKeyAndValue(String key, Object value) { 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!"); + 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 f8c1b3884..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,8 +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/enums/ActionType.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/enums/ActionType.java index 16314c860..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 @@ -33,7 +33,8 @@ public enum ActionType { SPAWN_FALLING_BLOCK(false), MODIFY_DAMAGE(true), SUMMON_ENTITY(false), - NAVIGATE(false); + NAVIGATE(false), + SCALE(false); @Getter private final boolean requiresLivingEntity; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index 2b350027d..de0bbcaa2 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -13,9 +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; 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 e1cee7b08..e91bb23ce 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java @@ -5,8 +5,8 @@ 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; 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 642964af8..c09e4d2c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java @@ -16,8 +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/thirdparty/worldguard/WorldGuardCompatibility.java b/src/main/java/com/magmaguy/elitemobs/thirdparty/worldguard/WorldGuardCompatibility.java index f1c4aeca3..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,6 +1,6 @@ package com.magmaguy.elitemobs.thirdparty.worldguard; -import com.magmaguy.elitemobs.utils.WarningMessage; +import com.magmaguy.magmacore.util.Logger; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.flags.IntegerFlag; import com.sk89q.worldguard.protection.flags.StateFlag; @@ -40,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"); } @@ -148,7 +148,7 @@ public static boolean initialize() { // members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); // global.setOwners(members); // } catch (Exception ex) { -// new WarningMessage("Failed to protect minidungeon world area!"); +// Logger.warn("Failed to protect minidungeon world area!"); // } // } // @@ -169,7 +169,7 @@ public static boolean initialize() { // members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7")); // global.setOwners(members); // } catch (Exception ex) { -// new WarningMessage("Failed to protect minidungeon world area!"); +// Logger.warn("Failed to protect minidungeon world area!"); // } // } // @@ -233,13 +233,13 @@ public static boolean initialize() { // 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!"); +// Logger.warn("The region name picked did not exist!"); // return false; // } // protectMinidungeonArea(protectedRegion); // return true; // } catch (Exception ex) { -// new WarningMessage("Failed to protect region " + regionName + " !"); +// Logger.warn("Failed to protect region " + regionName + " !"); // return false; // } // } diff --git a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index f34961cf0..acf28eb97 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.treasurechest; import com.google.common.collect.ArrayListMultimap; -import com.magmaguy.elitemobs.ChatColorConverter; import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.adventurersguild.GuildRank; import com.magmaguy.elitemobs.config.DefaultConfig; @@ -14,8 +13,9 @@ 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 lombok.Getter; import lombok.Setter; import org.bukkit.Bukkit; @@ -113,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?"); } diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java b/src/main/java/com/magmaguy/elitemobs/utils/ConfigurationLocation.java index a6e454582..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; @@ -74,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); @@ -124,9 +125,9 @@ public static Location serializeWithInstance(World instancedWorld, String locati } 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(instancedWorld, x, y, z, yaw, pitch); diff --git a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java new file mode 100644 index 000000000..8e46e37a6 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java @@ -0,0 +1,76 @@ +package com.magmaguy.elitemobs.utils; + +import com.magmaguy.magmacore.util.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 f2e404f6d..7f53a21b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/ItemStackSerializer.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.utils; 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; diff --git a/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java new file mode 100644 index 000000000..080b80cfc --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java @@ -0,0 +1,32 @@ +package com.magmaguy.elitemobs.utils; + +import com.magmaguy.magmacore.util.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/VisualDisplay.java b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java index 0f139d7d2..4f935b9dd 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/VisualDisplay.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.utils; -import com.magmaguy.elitemobs.ChatColorConverter; 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; 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 e8530e76e..edae9f180 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; diff --git a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index 6c779e0b9..47c2564dd 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 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 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/resources/plugin.yml b/src/main/resources/plugin.yml index 05e08f7c5..ccf8aaa7a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.4 +version: 9.0.5 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -18,6 +18,12 @@ softdepend: - InfernalMobs - FreeMinecraftModels +commands: + elitemobs: + description: Main command + aliases: + - em + permissions: elitemobs.*: description: Gives access to all elitemobs commands From 317fc89159a7c232c0f8ebb89415ed62a4bb0986 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:30:54 +0200 Subject: [PATCH 58/78] Update DiscordCommand.java --- .../com/magmaguy/elitemobs/commands/DiscordCommand.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java index 4ea9e1ac4..19bd0b56a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -9,8 +9,8 @@ public class DiscordCommand extends AdvancedCommand { public DiscordCommand() { super(List.of("discord")); - setUsage("/em discord "); - setPermission("elitemobs.*"); + setUsage("/em discord"); + setPermission("elitemobs.discord.link"); setDescription("Links to the EliteMobs discord."); } @@ -18,4 +18,4 @@ public DiscordCommand() { public void execute() { Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); } -} \ No newline at end of file +} From 3b86278d884b4401ed105caf9d49d5c47726e819 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:36:32 +0200 Subject: [PATCH 59/78] Update DiscordMessageCommand.java --- .../magmaguy/elitemobs/commands/DiscordMessageCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java index 97c796060..5f6d4750f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -12,7 +12,7 @@ public DiscordMessageCommand() { super(List.of("discord")); addArgument("message", new ArrayList<>()); setUsage("/em discord "); - setPermission("elitemobs.*"); + setPermission("elitemobs.discord.message"); setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes"); } @@ -21,4 +21,4 @@ public void execute() { new DiscordSRVAnnouncement(getStringSequenceArgument("message")); Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); } -} \ No newline at end of file +} From 1f0d2141b5fb48ffa3e1d1f8b069261f8f1fcc99 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:58:57 +0200 Subject: [PATCH 60/78] Command updates --- .../elitemobs/commands/ArenaCommand.java | 3 +- .../elitemobs/commands/DebugCommand.java | 4 +- .../elitemobs/commands/EventCommand.java | 2 +- .../elitemobs/commands/FireballCommand.java | 2 +- .../elitemobs/commands/HelpCommand.java | 2 +- .../elitemobs/commands/KillCommand.java | 2 +- .../elitemobs/commands/KillRadiusCommand.java | 2 +- .../elitemobs/commands/KillTypeCommand.java | 4 +- .../commands/KillTypeRadiusCommand.java | 6 +- .../elitemobs/commands/LanguageCommand.java | 2 +- .../elitemobs/commands/LootCommand.java | 2 +- .../elitemobs/commands/LootDebugCommand.java | 6 +- .../elitemobs/commands/LootGiveCommand.java | 4 +- .../elitemobs/commands/LootMenuCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 4 +- .../commands/LootSimulateCommand.java | 2 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../elitemobs/commands/LootStats.java | 2 +- .../commands/MoneyAddAllCommand.java | 4 +- .../elitemobs/commands/MoneyAddCommand.java | 4 +- .../elitemobs/commands/MoneyCheckCommand.java | 4 +- .../commands/MoneyCheckPlayerCommand.java | 4 +- .../commands/MoneyRemoveCommand.java | 2 +- .../elitemobs/commands/MoneySetCommand.java | 4 +- .../commands/PackageDungeonCommand.java | 2 +- .../elitemobs/commands/PlaceBossCommand.java | 6 +- .../elitemobs/commands/PlaceNPCCommand.java | 2 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 4 +- .../commands/QuestBypassCommand.java | 2 +- .../commands/QuestCompleteCommand.java | 2 +- .../elitemobs/commands/QuestLeaveCommand.java | 2 +- .../commands/QuestResetAllCommand.java | 5 +- .../elitemobs/commands/QuestResetCommand.java | 2 +- .../elitemobs/commands/RankSetCommand.java | 2 +- .../elitemobs/commands/ReloadCommand.java | 2 +- .../elitemobs/commands/RemoveCommand.java | 2 +- src/main/resources/plugin.yml | 119 +++++++++++++++++- 38 files changed, 173 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index 030c1908c..af2d710d3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -11,7 +11,8 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setDescription("When in instanced content, makes the player start the instance."); + setPermission("elitemobs.event.start"); + setDescription("Open the Arena menu."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index 4eed4aad6..ce7c82e5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -13,9 +13,9 @@ public DebugCommand() { super(List.of("debug")); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em debug "); - setPermission("elitemobs.*"); + setPermission("elitemobs.debug"); setSenderType(SenderType.PLAYER); - setDescription("Toggles whether the setup message will show up."); + setDescription("Debug bosses or players."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java index 489fe0ef5..b04d02cbc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -11,7 +11,7 @@ public EventCommand() { super(List.of("event")); addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList()); setUsage("/em event "); - setPermission("elitemobs.*"); + setPermission("elitemobs.event.start"); setSenderType(SenderType.PLAYER); setDescription("Triggers a timed event to start at the next available time and place."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java index c1a8cb366..ff4ae49db 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -11,7 +11,7 @@ public class FireballCommand extends AdvancedCommand { public FireballCommand() { super(List.of("fireball")); setUsage("/em fireball"); - setPermission("elitemobs.*"); + setPermission("elitemobs.fireball"); setDescription("Shoots a fireball, to test terrain protections and explosion regeneration."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index 4cdca44e4..af4408e1e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -10,7 +10,7 @@ public class HelpCommand extends AdvancedCommand { public HelpCommand() { super(List.of("help")); setUsage("/em help"); - setPermission("elitemobs.*"); + setPermission("elitemobs.help"); setDescription("Lists all commands."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index a8b97ca43..263e4b123 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -9,7 +9,7 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.*"); + setPermission("elitemobs.kill.kill"); setDescription("Kills all elites."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java index ee0629fa8..a408e4477 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -12,7 +12,7 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.*"); + setPermission("elitemobs.kill.radius"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java index 15d6e8ee7..e060bcb84 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -13,8 +13,8 @@ public KillTypeCommand() { super(List.of("kill")); addLiteral("type"); addArgument("type", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.*"); + setUsage("/em kill type "); + setPermission("elitemobs.kill.type"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java index 0d412be6f..90d86f7be 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -14,10 +14,10 @@ public KillTypeRadiusCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); - setUsage("/em kill type "); - setPermission("elitemobs.*"); + setUsage("/em kill type "); + setPermission("elitemobs.kill.type.radius"); setSenderType(SenderType.PLAYER); - setDescription("Kills all elites of the specified type."); + setDescription("Kills all elites of the specified type within the specified radius."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java index 99c1ab744..0b6f9e2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -12,7 +12,7 @@ public LanguageCommand() { super(List.of("language")); addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); setUsage("/em language "); - setPermission("elitemobs.*"); + setPermission("elitemobs.language"); setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java index 53b255fdc..36c241e2f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -18,4 +18,4 @@ public LootCommand() { public void execute() { LootMenu.openMenu(getCurrentPlayerSender()); } -} +} \ 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 index 82a55be01..34478b53c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -13,10 +13,10 @@ public LootDebugCommand() { super(List.of("loot")); addLiteral("debug"); addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - setUsage("/em loot test "); - setPermission("elitemobs.*"); + setUsage("/em loot debug "); + setPermission("elitemobs.loot.debug"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 9159eaed2..9fccf132c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -15,9 +15,9 @@ public LootGiveCommand() { addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.give"); setSenderType(SenderType.PLAYER); - setDescription("Gives loot to a player."); + setDescription("Gives the specified loot to a specific player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java index 2ff145bbc..7c99be803 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -11,7 +11,7 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.menu"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 5bff2f261..0f8a0f0ee 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -15,9 +15,9 @@ public LootRandomCommand() { addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.random"); setSenderType(SenderType.PLAYER); - setDescription("Gives loot to a player."); + setDescription("Gives the player random loot of the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 5986986de..c166db304 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -15,7 +15,7 @@ public LootSimulateCommand() { addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.simulate"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index 4f8988bc2..730bb8db7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -16,7 +16,7 @@ public LootSimulateMultipleCommand() { addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.simulate.times"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java index 4dc8c73f9..ab6430518 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -13,7 +13,7 @@ public LootStats() { super(List.of("loot")); addLiteral("stats"); setUsage("/em loot stats"); - setPermission("elitemobs.*"); + setPermission("elitemobs.loot.stats"); setSenderType(SenderType.PLAYER); setDescription("Provides EliteMobs stats for the currently held item."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 8d13578c1..f5cc69e87 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -14,9 +14,9 @@ public MoneyAddAllCommand() { addLiteral("all"); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add all "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.add.all"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Gives every player on the server the specified amount of money."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 08328ad15..d83f008d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -14,9 +14,9 @@ public MoneyAddCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.add.player"); setSenderType(SenderType.PLAYER); - setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); + setDescription("Gives the specified amount of money to the designated player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java index d2e35b5d6..33e655a4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -12,9 +12,9 @@ public MoneyCheckCommand() { super(List.of("money")); addLiteral("check"); setUsage("/em money check"); - setPermission("elitemobs.money.check"); + setPermission("elitemobs.money.check.self"); setSenderType(SenderType.PLAYER); - setDescription("Checks the EliteMobs currency"); + setDescription("Checks your EliteMobs currency."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 01f299276..e17d33f5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -11,8 +11,8 @@ public MoneyCheckPlayerCommand() { addLiteral("check"); addArgument("player", new ArrayList<>()); setUsage("/em check "); - setPermission("elitemobs.*"); - setDescription("Checks how much currency you have."); + setPermission("elitemobs.money.check.player"); + setDescription("Checks the currency of the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index e99856ac9..a05b654dc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -14,7 +14,7 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.*"); + setPermission("elitemobs.money.remove"); setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java index 517ab97a5..d4a8db4c9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -13,8 +13,8 @@ public MoneySetCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money set "); - setPermission("elitemobs.*"); - setDescription("Sets the specified amount of currency to a player."); + setPermission("elitemobs.money.set"); + setDescription("Sets the specified amount of currency for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index d9ba2bac9..44bb71c85 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -11,7 +11,7 @@ public PackageDungeonCommand() { addArgument("dungeonName", new ArrayList<>()); addArgument("version", new ArrayList<>()); setUsage("/em package "); - setPermission("elitemobs.*"); + setPermission("elitemobs.package"); setDescription("Packages an EliteMobs dungeon for distribution."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index a80c2017e..00074c33c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -12,10 +12,10 @@ public PlaceBossCommand() { super(List.of("place")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/em addSpawn boss "); - setPermission("elitemobs.*"); + setUsage("/em place boss "); + setPermission("elitemobs.place.boss"); setSenderType(SenderType.PLAYER); - setDescription("Toggles whether the setup message will show up."); + setDescription("Add a spawn location for the specified boss at your current location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java index d093d367a..537d52c62 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -14,7 +14,7 @@ public PlaceNPCCommand() { addLiteral("npc"); addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet())); setUsage("/em place npc "); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.npc"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds an npc to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index ad8ee1d5a..e5bd38b37 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -13,7 +13,7 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.treasure"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds a treasure chest to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 9ff0df62e..2612668e1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -16,9 +16,9 @@ public PlaceWormholeCommand() { addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); setUsage("/em wormhole <1/2>"); - setPermission("elitemobs.*"); + setPermission("elitemobs.place.wormhole"); setSenderType(SenderType.PLAYER); - setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files."); + setDescription("Place a wormhole teleport at your current location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 413fbdbe6..63b0f4411 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -10,7 +10,7 @@ public QuestBypassCommand() { super(List.of("quest")); addLiteral("bypass"); setUsage("/em quest bypass"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.bypass"); setDescription("Bypasses permission restrictions for elite quests."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java index bd98d8b1c..c23f2557c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -11,7 +11,7 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.complete"); setSenderType(SenderType.PLAYER); setDescription("Forces all of your currently active elite quests to be completed. For debugging use only."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 1ea94da6d..933c12cc2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -11,7 +11,7 @@ public QuestLeaveCommand() { super(List.of("quest")); addLiteral("leave"); setUsage("/em quest leave"); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.leave"); setSenderType(SenderType.PLAYER); setDescription("Leaves a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java index c000e8877..b87c868b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -13,9 +13,8 @@ public QuestResetAllCommand() { addLiteral("reset"); addLiteral("all"); addArgument("player", new ArrayList<>()); - addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); - setUsage("/em quest reset "); - setPermission("elitemobs.*"); + setUsage("/em quest reset all "); + setPermission("elitemobs.quest.reset.all"); setDescription("Resets all quests for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java index e80d057fb..890d5a680 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -14,7 +14,7 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.*"); + setPermission("elitemobs.quest.reset.quest"); setDescription("Resets a specific quest for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java index a1012bc61..b2c2c5c46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -12,7 +12,7 @@ public RankSetCommand() { addArgument("prestigeLevel", new ArrayList<>()); addArgument("guildLevel", new ArrayList<>()); setUsage("/em rank "); - setPermission("elitemobs.*"); + setPermission("elitemobs.rank.set"); setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java index 46a469de3..1cfdc72a5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -11,7 +11,7 @@ public class ReloadCommand extends AdvancedCommand { public ReloadCommand() { super(List.of("reload")); setUsage("/em reload"); - setPermission("elitemobs.*"); + setPermission("elitemobs.reload"); setDescription("Reloads EliteMobs."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java index 350acdf31..f8e33fcf4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -9,7 +9,7 @@ public class RemoveCommand extends AdvancedCommand { public RemoveCommand() { super(List.of("remove")); setUsage("/em remove"); - setPermission("elitemobs.*"); + setPermission("elitemobs.remove"); setSenderType(SenderType.PLAYER); setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content."); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ccf8aaa7a..d192b08f7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -149,4 +149,121 @@ permissions: 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 + default: true + elitemobs.arena.menu: + description: Allows players to open the Arena menu and join an Arena. + default: true + elitemobs.debug: + description: Allows players to have access to the player/bosses debug command. + default: true + elitemobs.discord.link: + description: Allows players to have access to the Discord link command. + default: true + elitemobs.discord.message: + description: Allows players to have access to the DiscordSRV message debug command. + default: op + elitemobs.event.start: + description: Allows players to start specific events. + default: op + elitemobs.fireball: + description: Allows players to shoot a fireball at the pointer's location. + default: op + elitemobs.help: + description: Allows players to see all available EliteMobs commands. + default: op + elitemobs.kill.kill: + description: Allows players to kill all elites. + default: op + elitemobs.kill.radius: + description: Allows players to kill all elites in the specified radius. + default: op + elitemobs.kill.type: + description: Allows players to kill all elites of the specified type. + default: op + elitemobs.kill.type.radius: + description: Allows players to kill all elites of the specified type within the given radius. + default: op + elitemobs.language: + description: Allows players to set the language that the server will use for EliteMobs. + default: op + elitemobs.loot.debug: + description: Allows players to equip themselves with a complete armor set, weapons set of the specified level, and food for testing purposes. + default: op + elitemobs.loot.give: + description: Allows players to give the specified loot to a specific player. + default: op + elitemobs.loot.menu: + description: Allows players to open the loot menu and select any loot they want. + default: op + elitemobs.loot.random: + description: Allows players to get random loot of the specified level. + default: op + elitemobs.loot.simulate: + description: Allows players to get simulated loot drops for the specified level and player. + default: op + elitemobs.loot.simulate.times: + description: Allows players to get simulated loot drops for a specified number of times for the given level and player. + default: op + elitemobs.loot.stats: + description: Allows players to see EliteMobs stats for the currently held item. + default: true + elitemobs.loot.stats: + description: Allows players to see EliteMobs stats for the currently held item. + default: op + elitemobs.money.add.all: + description: Allows players to give every player on the server the specified amount of money. + default: op + elitemobs.money.add.player: + description: Allows players to give the specified amount of money to the designated player. + default: op + elitemobs.money.check.self: + description: Allows players to check their EliteMobs currency. + default: true + elitemobs.money.check.player: + description: Allows players to check the currency of the specified player. + default: op + elitemobs.money.remove: + description: Allows players to deduct the specified amount of currency from a player. + default: op + elitemobs.money.set: + description: Allows players to set the specified amount of currency for the specified player. + default: op + elitemobs.package: + description: Allows players to package an EliteMobs dungeon for distribution. + default: op + elitemobs.place.boss: + description: Allows players to add a spawn location for the specified boss at their current location. + default: op + elitemobs.place.npc: + description: Allows players to permanently add an NPC to the location the user is standing on. + default: op + elitemobs.place.treasure: + description: Allows players to permanently add a treasure chest to the location the user is standing on. + default: op + elitemobs.place.wormhole: + description: Allows players to permanently add a wormhole teleport at their current location. + default: op + elitemobs.quest.bypass: + description: Allows players to bypass permission restrictions for elite quests. + default: op + elitemobs.quest.complete: + description: Allows players to force complete all of their currently active elite quests. For debugging use only. + default: op + elitemobs.quest.leave: + description: Allows players to leave a quest. Used via menu, can't be directly used. + default: op + elitemobs.quest.reset.all: + description: Allows players to reset all quests for a specific player. + default: op + elitemobs.quest.reset.quest: + description: Allows players to reset a specific quest for a specific player. + default: op + elitemobs.rank.set: + description: Allows players to manually set a player's guild rank to a the prestige level and guild level specified. + default: op + elitemobs.reload: + description: Allows players to reload EliteMobs. + default: op + elitemobs.remove: + description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. + default: op \ No newline at end of file From f347e4e0ce47a98dcc4f24d7baadbe8fe7564ec1 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 26 Jul 2024 08:45:19 +0100 Subject: [PATCH 61/78] EliteMobs 9.0.5 - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Almost all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 6 +++--- .../commands/AdventurersGuildCommand.java | 5 +++-- .../elitemobs/commands/AltCommand.java | 7 ++++--- .../elitemobs/commands/ArenaCommand.java | 6 ++++-- .../elitemobs/commands/ArenaCommands.java | 14 -------------- .../elitemobs/commands/DebugCommand.java | 5 +++-- .../elitemobs/commands/DiscordCommand.java | 5 +++-- .../commands/DiscordMessageCommand.java | 7 ++++--- .../elitemobs/commands/DismissCommand.java | 5 +++-- .../commands/DungeonTeleportCommand.java | 5 +++-- .../elitemobs/commands/EliteMobsCommand.java | 9 +++++---- .../elitemobs/commands/EnchantCommand.java | 7 ++++--- .../elitemobs/commands/EventCommand.java | 5 +++-- .../elitemobs/commands/FireballCommand.java | 9 +++++---- .../elitemobs/commands/HelpCommand.java | 13 +++++++------ .../elitemobs/commands/KillCommand.java | 5 +++-- .../elitemobs/commands/KillRadiusCommand.java | 5 +++-- .../elitemobs/commands/KillTypeCommand.java | 7 +++---- .../commands/KillTypeRadiusCommand.java | 9 +++++---- .../elitemobs/commands/LanguageCommand.java | 13 +++++++------ .../elitemobs/commands/LootCommand.java | 5 +++-- .../elitemobs/commands/LootDebugCommand.java | 5 +++-- .../elitemobs/commands/LootGiveCommand.java | 7 +++---- .../elitemobs/commands/LootMenuCommand.java | 5 +++-- .../elitemobs/commands/LootRandomCommand.java | 7 +++---- .../commands/LootSimulateCommand.java | 9 +++++---- .../commands/LootSimulateMultipleCommand.java | 11 ++++++----- .../elitemobs/commands/LootStats.java | 5 +++-- .../commands/MoneyAddAllCommand.java | 9 ++++----- .../elitemobs/commands/MoneyAddCommand.java | 11 +++++------ .../elitemobs/commands/MoneyCheckCommand.java | 7 ++++--- .../commands/MoneyCheckPlayerCommand.java | 7 ++++--- .../commands/MoneyRemoveCommand.java | 9 ++++----- .../elitemobs/commands/MoneySetCommand.java | 9 +++++---- .../commands/PackageDungeonCommand.java | 7 +++++-- .../elitemobs/commands/PayCommand.java | 9 +++++---- .../elitemobs/commands/PlaceBossCommand.java | 5 +++-- .../elitemobs/commands/PlaceNPCCommand.java | 5 +++-- .../commands/PlaceTreasureChestCommand.java | 5 +++-- .../commands/PlaceWormholeCommand.java | 15 ++++++++------- .../commands/QuestAcceptCommand.java | 5 +++-- .../commands/QuestBypassCommand.java | 7 +++++-- .../commands/QuestCompleteCommand.java | 5 +++-- .../elitemobs/commands/QuestLeaveCommand.java | 5 +++-- .../commands/QuestResetAllCommand.java | 6 +++--- .../elitemobs/commands/QuestResetCommand.java | 7 +++++-- .../elitemobs/commands/QuestTrackCommand.java | 5 +++-- .../elitemobs/commands/QuitCommand.java | 7 ++++--- .../elitemobs/commands/RankCommand.java | 7 ++++--- .../elitemobs/commands/RankSetCommand.java | 11 ++++++----- .../elitemobs/commands/ReloadCommand.java | 5 +++-- .../elitemobs/commands/RemoveCommand.java | 5 +++-- .../elitemobs/commands/RepairCommand.java | 7 ++++--- .../elitemobs/commands/RespawnAllCommand.java | 3 ++- .../elitemobs/commands/ScrapCommand.java | 7 ++++--- .../elitemobs/commands/SetupCommand.java | 5 +++-- .../elitemobs/commands/SetupDoneCommand.java | 7 ++++--- .../commands/SetupToggleCommand.java | 9 +++++---- .../elitemobs/commands/ShareItemCommand.java | 5 +++-- .../elitemobs/commands/ShopCustomCommand.java | 7 ++++--- .../commands/ShopCustomOtherCommand.java | 7 ++++--- .../commands/ShopDynamicCommand.java | 7 ++++--- .../commands/ShopProceduralOtherCommand.java | 7 ++++--- .../commands/ShopSellOtherCommand.java | 7 ++++--- .../commands/SpawnBossAtCommand.java | 17 ++++++++--------- .../elitemobs/commands/SpawnBossCommand.java | 7 ++++--- .../commands/SpawnBossLevelAtCommand.java | 19 +++++++++---------- .../commands/SpawnBossLevelCommand.java | 9 +++++---- .../elitemobs/commands/SpawnElite.java | 11 ++++++----- .../commands/SpawnEliteAtCommand.java | 19 ++++++++++--------- .../commands/SpawnTeleportCommand.java | 5 +++-- .../elitemobs/commands/StartCommand.java | 7 ++++--- .../elitemobs/commands/StatsCommand.java | 5 +++-- .../elitemobs/commands/TrackBossCommand.java | 11 ++++++----- .../TransitiveBlocksCancelCommand.java | 7 +++++-- .../TransitiveBlocksEditAreaCommand.java | 12 ++++++++++-- .../commands/TransitiveBlocksEditCommand.java | 11 +++++++++-- .../TransitiveBlocksRegisterAreaCommand.java | 12 ++++++++++-- .../TransitiveBlocksRegisterCommand.java | 10 ++++++++-- .../elitemobs/commands/UnbindCommand.java | 7 ++++--- .../commands/UnbindForceCommand.java | 5 +++-- .../elitemobs/commands/VersionCommand.java | 5 +++-- 82 files changed, 357 insertions(+), 274 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java diff --git a/build.gradle b/build.gradle index 7e99f3d7f..1b0db9183 100644 --- a/build.gradle +++ b/build.gradle @@ -116,8 +116,8 @@ dependencies { 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' +// //reflections - used for config initialization +// implementation group: 'org.reflections', name: 'reflections', version: '0.10.2' //lombok compileOnly 'org.projectlombok:lombok:1.18.34' @@ -153,7 +153,7 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') - relocate('org.reflections', packagePath + '.reflections') +// relocate('org.reflections', packagePath + '.reflections') } archiveClassifier.set(null) archiveFileName.set(project.name + ".jar") diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 1ec601fb5..9c7dbbe5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public AdventurersGuildCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + 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 index 01b258753..b78d4e5bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public AltCommand() { } @Override - public void execute() { - PlayerData.setUseBookMenus(getCurrentPlayerSender(), !PlayerData.getUseBookMenus(getCurrentPlayerSender().getUniqueId())); - Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getSwitchEMStyleMessage()); + 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 index af2d710d3..c66063126 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -1,6 +1,8 @@ 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; @@ -17,7 +19,7 @@ public ArenaCommand() { } @Override - public void execute() { - ArenaCommands.openArenaMenu(getCurrentPlayerSender(), getStringArgument("arenaID")); + 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 50d8010f0..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.menus.ArenaMenu; -import org.bukkit.entity.Player; - -public class ArenaCommands { - private 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/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java index ce7c82e5e..34f06fa3b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java @@ -3,6 +3,7 @@ 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; @@ -19,7 +20,7 @@ public DebugCommand() { } @Override - public void execute() { - DebugScreen.open(getCurrentPlayerSender(), getStringArgument("filename")); + 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 index 19bd0b56a..b06eb76f3 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public DiscordCommand() { } @Override - public void execute() { - Logger.sendMessage(getCurrentCommandSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink); + 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 index 5f6d4750f..64988902c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,8 +18,8 @@ public DiscordMessageCommand() { } @Override - public void execute() { - new DiscordSRVAnnouncement(getStringSequenceArgument("message")); - Logger.sendMessage(getCurrentCommandSender(), "&aAttempted to send a message to Discord!"); + 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 index 0af89d79c..500607785 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public DismissCommand() { } @Override - public void execute() { - PlayerData.setDismissEMStatusScreenMessage(getCurrentPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(getCurrentPlayerSender().getUniqueId())); + public void execute(CommandData commandData) { + PlayerData.setDismissEMStatusScreenMessage(commandData.getPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(commandData.getPlayerSender().getUniqueId())); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index c50bc0416..f0fb2b029 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,7 +18,7 @@ public DungeonTeleportCommand() { } @Override - public void execute() { - DungeonCommands.teleport(getCurrentPlayerSender(), getStringArgument("dungeonID")); + 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 index a07eb3d2f..82b5e1e2a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -3,21 +3,22 @@ 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; +import java.util.ArrayList; public class EliteMobsCommand extends AdvancedCommand { public EliteMobsCommand() { - super(List.of("em", "elitemobs")); + super(new ArrayList<>()); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); setSenderType(SenderType.PLAYER); } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.isEmLeadsToStatusMenu()) - new PlayerStatusScreen(getCurrentPlayerSender()); + 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 index c2766a35e..1e7bfa81c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public EnchantCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - new ItemEnchantmentMenu(getCurrentPlayerSender()); + 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 index b04d02cbc..61a496b6d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public EventCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(getCurrentCommandSender(), getStringArgument("filename")); + 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 index ff4ae49db..f15b47354 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,10 +17,10 @@ public FireballCommand() { } @Override - public void execute() { - Fireball fireball = (Fireball) getCurrentPlayerSender().getWorld().spawnEntity(getCurrentPlayerSender().getLocation(), EntityType.FIREBALL); - fireball.setDirection(getCurrentPlayerSender().getLocation().getDirection().normalize()); - fireball.setShooter(getCurrentPlayerSender()); + 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); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index af4408e1e..792b9e523 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -1,6 +1,7 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import com.magmaguy.magmacore.util.Logger; import org.bukkit.entity.Player; @@ -15,14 +16,14 @@ public HelpCommand() { } @Override - public void execute() { - Logger.sendMessage(getCurrentCommandSender(), "Commands:"); + public void execute(CommandData commandData) { + Logger.sendMessage(commandData.getCommandSender(), "Commands:"); CommandManager.getInstance().commands.forEach(command -> { - if (getCurrentCommandSender() instanceof Player player) { - player.spigot().sendMessage(Logger.hoverMessage(command.usage, command.description)); + if (commandData.getCommandSender() instanceof Player player) { + player.spigot().sendMessage(Logger.hoverMessage(command.getUsage(), command.getDescription())); } else { - Logger.sendSimpleMessage(getCurrentCommandSender(), command.usage); - Logger.sendSimpleMessage(getCurrentCommandSender(), command.description); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getUsage()); + Logger.sendSimpleMessage(commandData.getCommandSender(), command.getDescription()); } }); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index 263e4b123..ca0f27243 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -14,7 +15,7 @@ public KillCommand() { } @Override - public void execute() { - KillHandler.killAggressiveMobs(getCurrentCommandSender()); + 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 index a408e4477..d4e84cd57 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,7 +19,7 @@ public KillRadiusCommand() { } @Override - public void execute() { - KillHandler.radiusKillAggressiveMobs(getCurrentPlayerSender(), getIntegerArgument("radius")); + 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 index e060bcb84..6cec36a67 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.commands.admin.KillHandler; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.entity.EntityType; import java.util.ArrayList; @@ -15,12 +15,11 @@ public KillTypeCommand() { addArgument("type", new ArrayList<>()); setUsage("/em kill type "); setPermission("elitemobs.kill.type"); - setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type."); } @Override - public void execute() { - KillHandler.killEntityType(getCurrentPlayerSender(), EntityType.valueOf(getStringArgument("type"))); + 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 index 90d86f7be..a76c7b2d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -2,6 +2,7 @@ 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; @@ -21,9 +22,9 @@ public KillTypeRadiusCommand() { } @Override - public void execute() { - KillHandler.radiusKillSpecificMobs(getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("type")), - getIntegerArgument("range")); + 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 index 0b6f9e2b4..27574baf1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -3,6 +3,7 @@ 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.List; @@ -17,15 +18,15 @@ public LanguageCommand() { } @Override - public void execute() { - String language = getStringArgument("language"); + public void execute(CommandData commandData) { + String language = commandData.getStringArgument("language"); if (!TranslationsConfig.getTranslationConfigs().containsKey(language)) { - Logger.sendMessage(getCurrentCommandSender(), "Language not found. Valid languages:"); - TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(getCurrentCommandSender(), key)); + Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:"); + TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key)); return; } - DefaultConfig.setLanguage(getCurrentCommandSender(), language); - Logger.sendMessage(getCurrentCommandSender(), "&2Language set to " + language + + 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 index 36c241e2f..d1035a41f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,7 +16,7 @@ public LootCommand() { } @Override - public void execute() { - LootMenu.openMenu(getCurrentPlayerSender()); + 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 index 34478b53c..f6217a661 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -3,6 +3,7 @@ import com.magmaguy.elitemobs.commands.admin.GetTierCommand; 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; @@ -20,7 +21,7 @@ public LootDebugCommand() { } @Override - public void execute() { - GetTierCommand.get(getCurrentPlayerSender(), getIntegerArgument("level")); + 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 index 9fccf132c..166ffeebb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -3,7 +3,7 @@ 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.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,11 @@ public LootGiveCommand() { addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); setPermission("elitemobs.loot.give"); - setSenderType(SenderType.PLAYER); setDescription("Gives the specified loot to a specific player."); } @Override - public void execute() { - LootCommand.give(getCurrentCommandSender(), getStringArgument("playerName"), getStringArgument("filename")); + 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 index 7c99be803..28b92ffa8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public LootMenuCommand() { } @Override - public void execute() { - new GetLootMenu(getCurrentPlayerSender()); + 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 index 0f8a0f0ee..04f6fcedb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -3,7 +3,7 @@ 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.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -16,12 +16,11 @@ public LootRandomCommand() { addArgument("playerName", new ArrayList<>()); setUsage("/em loot random "); setPermission("elitemobs.loot.random"); - setSenderType(SenderType.PLAYER); setDescription("Gives the player random loot of the specified level."); } @Override - public void execute() { - SimLootCommand.forcePositiveLoot(getCurrentCommandSender(), getStringArgument("playerName"), getIntegerArgument("level")); + 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 index c166db304..752a7b82b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -3,6 +3,7 @@ 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; @@ -21,10 +22,10 @@ public LootSimulateCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SimLootCommand.run( - getCurrentPlayerSender(), - getIntegerArgument("level"), - getStringArgument("playerName")); + 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 index 730bb8db7..ca0236728 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -3,6 +3,7 @@ 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; @@ -22,11 +23,11 @@ public LootSimulateMultipleCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SimLootCommand.runMultipleTimes( - getCurrentPlayerSender(), - getIntegerArgument("level"), - getIntegerArgument("times"), - getStringArgument("playerName")); + 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 index ab6430518..9e81fb2f6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java @@ -2,6 +2,7 @@ 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; @@ -19,8 +20,8 @@ public LootStats() { } @Override - public void execute() { - Player player = getCurrentPlayerSender(); + public void execute(CommandData commandData) { + Player player = commandData.getPlayerSender(); ItemStack item = player.getInventory().getItemInMainHand(); double attackSpeed = EliteItemManager.getAttackSpeed(item); double damage = EliteItemManager.getBaseDamage(item); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index f5cc69e87..69a41cdd6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,14 +15,13 @@ public MoneyAddAllCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add all "); setPermission("elitemobs.money.add.all"); - setSenderType(SenderType.PLAYER); setDescription("Gives every player on the server the specified amount of money."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.addAllCommand( - getCurrentCommandSender(), - getDoubleArgument("amount")); + 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 index d83f008d0..62480a03a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,15 +15,14 @@ public MoneyAddCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); setPermission("elitemobs.money.add.player"); - setSenderType(SenderType.PLAYER); setDescription("Gives the specified amount of money to the designated player."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.addCommand( - getCurrentCommandSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index 33e655a4a..14cee4268 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,10 +19,10 @@ public MoneyCheckCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu()) - new PlayerStatusScreen(getCurrentPlayerSender()); + new PlayerStatusScreen(commandData.getPlayerSender()); else - CurrencyCommandsHandler.walletCommand(getCurrentPlayerSender()); + 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 index e17d33f5c..29a6736e7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -1,6 +1,7 @@ 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; @@ -16,9 +17,9 @@ public MoneyCheckPlayerCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.checkCommand( - getCurrentCommandSender(), - getStringArgument("player")); + commandData.getCommandSender(), + commandData.getStringArgument("player")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index a05b654dc..a2d17c061 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import java.util.ArrayList; import java.util.List; @@ -15,14 +15,13 @@ public MoneyRemoveCommand() { addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); setPermission("elitemobs.money.remove"); - setSenderType(SenderType.PLAYER); setDescription("Deducts the specified amount of currency from a player."); } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.subtractCommand( - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index d4a8db4c9..9de1d06e0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,10 +19,10 @@ public MoneySetCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.setCommand( - getCurrentCommandSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + commandData.getCommandSender(), + commandData.getStringArgument("player"), + commandData.getDoubleArgument("amount")); } } \ No newline at end of file diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java index 44bb71c85..1e867ea92 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java @@ -1,6 +1,7 @@ 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; @@ -16,7 +17,9 @@ public PackageDungeonCommand() { } @Override - public void execute() { - new PackageCommand(getCurrentCommandSender(), getStringArgument("dungeonName"), getStringArgument("version")); + 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 index 98f778fed..3a7961030 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,10 +18,10 @@ public PayCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { CurrencyCommandsHandler.payCommand( - getCurrentPlayerSender(), - getStringArgument("player"), - getDoubleArgument("amount")); + 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 index 00074c33c..21ca47b73 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public PlaceBossCommand() { } @Override - public void execute() { - CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + 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 index 537d52c62..c1f31c9cd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java @@ -3,6 +3,7 @@ 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; @@ -20,7 +21,7 @@ public PlaceNPCCommand() { } @Override - public void execute() { - NPCCommands.set(getCurrentPlayerSender(), getStringArgument("filename")); + 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 index e5bd38b37..2753aed75 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public PlaceTreasureChestCommand() { } @Override - public void execute() { - CustomBossCommandHandler.addSpawnLocation(getStringArgument("filename"), getCurrentPlayerSender()); + 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/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 2612668e1..186e4dcf5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -3,6 +3,7 @@ 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; @@ -22,20 +23,20 @@ public PlaceWormholeCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(getStringArgument("wormholeFilename"))) - switch (getStringArgument("wormholeOption")) { + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("wormholeFilename"))) + switch (commandData.getStringArgument("wormholeOption")) { case "1": - wormhole.getWormholeEntry1().updateLocation(getCurrentPlayerSender()); + wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); return; case "2": - wormhole.getWormholeEntry2().updateLocation(getCurrentPlayerSender()); + wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender()); return; default: - Logger.sendMessage(getCurrentCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); + Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole."); } } - Logger.sendMessage(getCurrentCommandSender(), "Failed to set location for this 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/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index 9b10521ed..29a552ad2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public QuestAcceptCommand() { } @Override - public void execute() { - QuestCommand.joinQuest(getStringArgument("questID"), getCurrentPlayerSender()); + 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 index 63b0f4411..2854671a1 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -2,6 +2,8 @@ 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; @@ -11,11 +13,12 @@ public QuestBypassCommand() { addLiteral("bypass"); setUsage("/em quest bypass"); setPermission("elitemobs.quest.bypass"); + setSenderType(SenderType.PLAYER); setDescription("Bypasses permission restrictions for elite quests."); } @Override - public void execute() { - QuestCommand.bypassQuestRequirements(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + QuestCommand.bypassQuestRequirements(commandData.getPlayerSender()); } } \ 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 index c23f2557c..63831dcdc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public QuestCompleteCommand() { } @Override - public void execute() { - QuestCommand.completeQuest(getCurrentPlayerSender()); + 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/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 933c12cc2..306478b72 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,7 +18,7 @@ public QuestLeaveCommand() { } @Override - public void execute() { - QuestCommand.leaveQuest(getCurrentPlayerSender(), getStringArgument("questID")); + 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 index b87c868b9..9f4915e63 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -1,8 +1,8 @@ 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 java.util.ArrayList; import java.util.List; @@ -19,7 +19,7 @@ public QuestResetAllCommand() { } @Override - public void execute() { - QuestCommand.resetQuests(getCurrentCommandSender(), getStringArgument("player")); + 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 index 890d5a680..46d9e5586 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -3,6 +3,8 @@ 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; @@ -16,10 +18,11 @@ public QuestResetCommand() { setUsage("/em quest reset "); setPermission("elitemobs.quest.reset.quest"); setDescription("Resets a specific quest for a specific player."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - QuestCommand.resetQuest(getCurrentCommandSender(), getStringArgument("player"), getStringArgument("questName")); + 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 index 06802a94f..8629cc3a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,7 +20,7 @@ public QuestTrackCommand() { } @Override - public void execute() { - QuestCommand.trackQuest(getStringArgument("questID"), getCurrentPlayerSender()); + 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 index d543f3016..148b2b2bf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,9 +16,9 @@ public QuitCommand() { } @Override - public void execute() { - MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender()); if (matchInstance != null) - matchInstance.removeAnyKind(getCurrentPlayerSender()); + 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 index cacf7c07d..39a4bdcbe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -2,6 +2,7 @@ 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; @@ -15,8 +16,8 @@ public RankCommand() { } @Override - public void execute() { - if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - AdventurersGuildCommand.adventurersGuildCommand(getCurrentPlayerSender()); + 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 index b2c2c5c46..b4730d04b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java @@ -1,6 +1,7 @@ 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; @@ -17,10 +18,10 @@ public RankSetCommand() { } @Override - public void execute() { - GuildRankCommands.setGuildRank(getCurrentCommandSender(), - getStringArgument("player"), - getIntegerArgument("prestigeLevel"), - getIntegerArgument("guildLevel")); + 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 index 1cfdc72a5..efc3774b9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java @@ -2,6 +2,7 @@ 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; @@ -23,7 +24,7 @@ public static void reload(CommandSender commandSender) { } @Override - public void execute() { - reload(getCurrentCommandSender()); + 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 index f8e33fcf4..2110beb14 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public RemoveCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(getCurrentPlayerSender()); + 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 index 55f0209b5..2dca59643 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public RepairCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { RepairMenu repairMenu = new RepairMenu(); - repairMenu.constructRepairMenu(getCurrentPlayerSender()); + 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 index 4536c0d31..bd845d9df 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.magmacore.command.AdvancedCommand; +import com.magmaguy.magmacore.command.CommandData; import java.util.List; @@ -15,7 +16,7 @@ public RespawnAllCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> { if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn(); }); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index f1bd65d76..ea92414cc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public ScrapCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { ScrapperMenu scrapperMenu = new ScrapperMenu(); - scrapperMenu.constructScrapMenu(getCurrentPlayerSender()); + 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 index e23b0ce2e..d31265acf 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,7 +17,7 @@ public SetupCommand() { } @Override - public void execute() { - new SetupMenu(getCurrentPlayerSender()); + 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 index 5091430a6..c8186bdc7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,11 +17,11 @@ public SetupDoneCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { DefaultConfig.toggleSetupDone(); if (DefaultConfig.isSetupDone()) - Logger.sendMessage(getCurrentCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this."); + 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(getCurrentCommandSender(), "&aEliteMobs will once again send messages on login. You can do [/em setup done] again to revert this."); + 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/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 78e6e3b35..3d5ade5d0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,12 +19,12 @@ public SetupToggleCommand() { } @Override - public void execute() { - String dungeon = getStringArgument("empackages"); + public void execute(CommandData commandData) { + String dungeon = commandData.getStringArgument("empackages"); if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null) - Logger.sendMessage(getCurrentCommandSender(), "Not a valid em package!"); + Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!"); EMPackage emPackage = EMPackage.getEmPackages().get(dungeon); if (emPackage.install()) - Logger.sendMessage(getCurrentCommandSender(), "Successfully installed content!"); + Logger.sendMessage(commandData.getCommandSender(), "Successfully installed 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 index 1189648ac..415c820b5 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,7 +17,7 @@ public ShareItemCommand() { } @Override - public void execute() { - ShareItem.showOnChat(getCurrentPlayerSender()); + 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 index 3907223a9..587dcdc7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,8 +19,8 @@ public ShopCustomCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - CustomShopMenu.customShopInitializer(getCurrentPlayerSender()); + 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 index be44f5a22..4973844da 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,11 +20,11 @@ public ShopCustomOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { - CustomShopMenu.customShopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index b13ccf3f4..993484c24 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -3,6 +3,7 @@ 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; @@ -18,8 +19,8 @@ public ShopDynamicCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) - ProceduralShopMenu.shopInitializer(getCurrentPlayerSender()); + 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 index 67b331977..5984710df 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,11 +20,11 @@ public ShopProceduralOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { - ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(getStringArgument("player"))); + ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index d3847eed2..237f811a9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,12 +20,12 @@ public ShopSellOtherCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SellMenu sellMenu = new SellMenu(); try { - sellMenu.constructSellMenu(Bukkit.getPlayer(getStringArgument("player"))); + sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player"))); } catch (Exception ex) { - Logger.sendMessage(getCurrentCommandSender(), "Failed to get player with that username!"); + 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 index 8e3d72342..08ce864f7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -22,19 +22,18 @@ public SpawnBossAtCommand() { addArgument("z", new ArrayList<>()); setUsage("/setup spawnAt boss "); setPermission("elitemobs.*"); - setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getStringArgument("worldName"), + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), new Vector( - getDoubleArgument("x"), - getDoubleArgument("y"), - getDoubleArgument("z"))); + 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 index de21fe16b..e64ecad12 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -2,6 +2,7 @@ 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; @@ -19,9 +20,9 @@ public SpawnBossCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename")); + 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 index 0c21ed5f9..f8629dd5d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -2,7 +2,7 @@ import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig; import com.magmaguy.magmacore.command.AdvancedCommand; -import com.magmaguy.magmacore.command.SenderType; +import com.magmaguy.magmacore.command.CommandData; import org.bukkit.Bukkit; import org.bukkit.generator.WorldInfo; import org.bukkit.util.Vector; @@ -23,20 +23,19 @@ public SpawnBossLevelAtCommand() { addArgument("level", new ArrayList<>()); setUsage("/setup spawn bossAt "); setPermission("elitemobs.*"); - setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getStringArgument("worldName"), + commandData.getCommandSender(), + commandData.getStringArgument("filename"), + commandData.getStringArgument("worldName"), new Vector( - getDoubleArgument("x"), - getDoubleArgument("y"), - getDoubleArgument("z")), - getIntegerArgument("level")); + 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 index 986f72362..3eab1fadb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -2,6 +2,7 @@ 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; @@ -20,10 +21,10 @@ public SpawnBossLevelCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnCustomBossCommand( - getCurrentPlayerSender(), - getStringArgument("filename"), - getIntegerArgument("level")); + commandData.getPlayerSender(), + commandData.getStringArgument("filename"), + commandData.getIntegerArgument("level")); } } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 4ad1e71c4..b93daf058 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -2,6 +2,7 @@ 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; @@ -23,11 +24,11 @@ public SpawnElite() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnEliteEntityTypeCommand( - getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("entityType")), - getIntegerArgument("level"), - Optional.of(getStringSequenceArgument("powers"))); + 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 index fef05b732..9d8478165 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -2,6 +2,7 @@ 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; @@ -28,16 +29,16 @@ public SpawnEliteAtCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { SpawnCommand.spawnEliteEntityTypeCommand( - getCurrentPlayerSender(), - EntityType.valueOf(getStringArgument("entityType")), - getStringArgument("world"), + commandData.getPlayerSender(), + EntityType.valueOf(commandData.getStringArgument("entityType")), + commandData.getStringArgument("world"), new Vector( - getIntegerArgument("x"), - getIntegerArgument("y"), - getIntegerArgument("z")), - getIntegerArgument("level"), - Optional.of(getStringSequenceArgument("powers"))); + 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 index 4d3029a8b..514a88788 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,8 +18,8 @@ public SpawnTeleportCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { if (DefaultConfig.getDefaultSpawnLocation() != null) - PlayerPreTeleportEvent.teleportPlayer(getCurrentPlayerSender(), DefaultConfig.getDefaultSpawnLocation()); + 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 index 82447a712..c99e1152a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -2,6 +2,7 @@ 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; @@ -16,11 +17,11 @@ public StartCommand() { } @Override - public void execute() { - MatchInstance matchInstance = MatchInstance.getPlayerInstance(getCurrentPlayerSender()); + public void execute(CommandData commandData) { + MatchInstance matchInstance = MatchInstance.getPlayerInstance(commandData.getPlayerSender()); if (matchInstance != null) { matchInstance.countdownMatch(); } else - Logger.sendMessage(getCurrentCommandSender(), "You are not queued for instanced content!"); + 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 index db0e4764f..27c1d144e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -1,6 +1,7 @@ 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; @@ -15,7 +16,7 @@ public StatsCommand() { } @Override - public void execute() { - com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(getCurrentPlayerSender()); + 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 index cac58c1e4..832f2fecc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -3,6 +3,7 @@ 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; @@ -21,17 +22,17 @@ public TrackBossCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { try { for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses()) - if (customBossEntity.getEliteUUID().equals(UUID.fromString(getStringArgument("id")))) { - customBossEntity.getCustomBossBossBar().addTrackingPlayer(getCurrentPlayerSender()); + if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandData.getStringArgument("id")))) { + customBossEntity.getCustomBossBossBar().addTrackingPlayer(commandData.getPlayerSender()); return; } - Logger.sendMessage(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + 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(getCurrentCommandSender(), DefaultConfig.getBossAlreadyGoneMessage()); + 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 index 9c5f99c25..1bd6ed1af 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -2,6 +2,8 @@ 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; @@ -12,10 +14,11 @@ public TransitiveBlocksCancelCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender()); + 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 index 8ae26b164..753b51b7b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,16 @@ public TransitiveBlocksEditAreaCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Edits large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), true, true); + 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 index 936f496e2..24e386a4a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,15 @@ public TransitiveBlocksEditCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), true); + 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 index a16414ca1..4a18e7785 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,16 @@ public TransitiveBlocksRegisterAreaCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Registers large transitive blocks areas for use by regional bosses."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false, true); + 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 index 66c304a25..5bdb76b5c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -3,6 +3,8 @@ 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; @@ -15,10 +17,14 @@ public TransitiveBlocksRegisterCommand() { setUsage("/em transitiveBlocks cancel"); setPermission("elitemobs.*"); setDescription("Cancels transitive block registration."); + setSenderType(SenderType.PLAYER); } @Override - public void execute() { - TransitiveBlockCommand.processCommand(getCurrentPlayerSender(), getStringArgument("filename"), getStringArgument("type"), false); + 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/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index 7c4e19c93..d3b038b46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -3,6 +3,7 @@ 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; @@ -17,10 +18,10 @@ public UnbindCommand() { } @Override - public void execute() { - if (!AdventurersGuildCommand.adventurersGuildTeleport(getCurrentPlayerSender())) { + public void execute(CommandData commandData) { + if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) { UnbindMenu unbindMenu = new UnbindMenu(); - unbindMenu.constructUnbinderMenu(getCurrentPlayerSender()); + 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 index ca1237a23..ad957e55b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -3,6 +3,7 @@ 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; @@ -19,8 +20,8 @@ public UnbindForceCommand() { } @Override - public void execute() { - ItemStack itemStack = getCurrentPlayerSender().getInventory().getItemInMainHand(); + public void execute(CommandData commandData) { + ItemStack itemStack = commandData.getPlayerSender().getInventory().getItemInMainHand(); if (ItemTagger.isEliteItem(itemStack)) SoulbindEnchantment.removeEnchantment(itemStack); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index 765e84ddb..cae741a0f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -2,6 +2,7 @@ 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; @@ -17,9 +18,9 @@ public VersionCommand() { } @Override - public void execute() { + public void execute(CommandData commandData) { Logger.sendMessage( - getCurrentCommandSender(), + commandData.getCommandSender(), ChatColor.WHITE + " version " + ChatColor.GREEN + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion()); } } \ No newline at end of file From 34df33fca119f99bf21c385040062ca5191857e0 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:05:49 +0200 Subject: [PATCH 62/78] Finished going through commands --- .../java/com/magmaguy/elitemobs/commands/RepairCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/RespawnAllCommand.java | 2 +- .../java/com/magmaguy/elitemobs/commands/ScrapCommand.java | 2 +- .../java/com/magmaguy/elitemobs/commands/SetupCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/SetupDoneCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/SetupToggleCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/ShareItemCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/ShopCustomCommand.java | 2 +- .../magmaguy/elitemobs/commands/ShopCustomOtherCommand.java | 4 ++-- .../com/magmaguy/elitemobs/commands/ShopDynamicCommand.java | 2 +- .../magmaguy/elitemobs/commands/ShopSellOtherCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java | 6 +++--- .../com/magmaguy/elitemobs/commands/SpawnBossCommand.java | 4 ++-- .../elitemobs/commands/SpawnBossLevelAtCommand.java | 6 +++--- .../magmaguy/elitemobs/commands/SpawnBossLevelCommand.java | 6 +++--- .../java/com/magmaguy/elitemobs/commands/SpawnElite.java | 2 +- .../magmaguy/elitemobs/commands/SpawnEliteAtCommand.java | 6 +++--- .../elitemobs/commands/TransitiveBlocksCancelCommand.java | 2 +- .../elitemobs/commands/TransitiveBlocksEditAreaCommand.java | 4 ++-- .../elitemobs/commands/TransitiveBlocksEditCommand.java | 6 +++--- .../commands/TransitiveBlocksRegisterAreaCommand.java | 4 ++-- .../elitemobs/commands/TransitiveBlocksRegisterCommand.java | 6 +++--- .../java/com/magmaguy/elitemobs/commands/UnbindCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/UnbindForceCommand.java | 2 +- .../com/magmaguy/elitemobs/commands/VersionCommand.java | 4 ++-- 25 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java index 2dca59643..a1d6adeab 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java @@ -14,7 +14,7 @@ public RepairCommand() { 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"); + setDescription("Opens the repair item menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index bd845d9df..0d344b743 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -11,7 +11,7 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.*"); + setPermission("elitemobs.respawn"); setDescription("Forces all regional bosses to respawn."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java index ea92414cc..534216f7e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java @@ -14,7 +14,7 @@ public ScrapCommand() { 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"); + setDescription("Opens the scrap menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index d31265acf..a7a604090 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -10,7 +10,7 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.*"); + setPermission("elitemobs.setup.main"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index c8186bdc7..509091122 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -12,7 +12,7 @@ public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); setUsage("/setup done"); - setPermission("elitemobs.*"); + setPermission("elitemobs.setup.done"); setDescription("Toggles whether the setup message will show up."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index 3d5ade5d0..cbfb4e4eb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -11,11 +11,11 @@ public class SetupToggleCommand extends AdvancedCommand { public SetupToggleCommand() { super(List.of("setup")); - setPermission("elitemobs.*"); - setDescription("Sets up EliteMobs content!"); - setUsage("/em setup toggle"); addLiteral("toggle"); addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); + setUsage("/em setup toggle "); + setPermission("elitemobs.setup.toggle"); + setDescription("Allows you to toggle the installation of specified EliteMobs content."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java index 415c820b5..46b26dea2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java @@ -13,7 +13,7 @@ public ShareItemCommand() { setUsage("/em shareItem"); setPermission("elitemobs.shareitem"); setSenderType(SenderType.PLAYER); - setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu."); + setDescription("Shares the stats of the currently held EliteMobs item in chat."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java index 587dcdc7b..51d1ee9db 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java @@ -15,7 +15,7 @@ public ShopCustomCommand() { 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"); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 4973844da..2d5d0bd9b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -15,8 +15,8 @@ public ShopCustomOtherCommand() { addLiteral("custom"); addArgument("player", new ArrayList<>()); setUsage("/em shop custom "); - setPermission("elitemobs.*"); - setDescription("Opens the EliteMobs shop for custom items."); + setPermission("elitemobs.shop.custom.player"); + setDescription("Opens the EliteMobs shop for custom items for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java index 993484c24..b6e84d237 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -15,7 +15,7 @@ public ShopDynamicCommand() { setUsage("/em shop dynamic"); setPermission("elitemobs.shop.command"); setSenderType(SenderType.PLAYER); - setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub"); + setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java index 237f811a9..eed677e82 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -14,9 +14,9 @@ public ShopSellOtherCommand() { super(List.of("shop")); addLiteral("sell"); addArgument("player", new ArrayList<>()); - setUsage("/em shop custom "); - setPermission("elitemobs.*"); - setDescription("Opens the EliteMobs shop for custom items."); + setUsage("/em shop sell "); + setPermission("elitemobs.shop.sell.player"); + setDescription("Opens the EliteMobs shop sell menu for the specified player."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java index 08ce864f7..b183dc2fa 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -20,9 +20,9 @@ public SpawnBossAtCommand() { addArgument("x", new ArrayList<>()); addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); - setUsage("/setup spawnAt boss "); - setPermission("elitemobs.*"); - setDescription("Spawns a custom boss at the location the user is looking at."); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.spawn.boss.at"); + setDescription("Spawns a custom boss at the specified location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index e64ecad12..2d0560276 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -13,8 +13,8 @@ public SpawnBossCommand() { super(List.of("spawn")); addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); - setUsage("/setup spawn boss "); - setPermission("elitemobs.*"); + setUsage("/em spawn boss "); + setPermission("elitemobs.spawn.boss"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index f8629dd5d..8d6955a6e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -21,9 +21,9 @@ public SpawnBossLevelAtCommand() { addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); addArgument("level", new ArrayList<>()); - setUsage("/setup spawn bossAt "); - setPermission("elitemobs.*"); - setDescription("Spawns a custom boss at the location the user is looking at."); + setUsage("/em spawn bossAt "); + setPermission("elitemobs.spawn.boss.at.level"); + setDescription("Spawns a custom boss at the specified location with the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3eab1fadb..3d06e9055 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -14,10 +14,10 @@ public SpawnBossLevelCommand() { 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("/setup spawn boss "); - setPermission("elitemobs.*"); + setUsage("/em spawn boss "); + setPermission("elitemobs.spawn.boss.level"); setSenderType(SenderType.PLAYER); - setDescription("Spawns a custom boss at the location the user is looking at."); + setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index b93daf058..8346397de 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -18,7 +18,7 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.*"); + setPermission("elitemobs.spawn.elite"); setSenderType(SenderType.PLAYER); setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java index 9d8478165..bcf53598e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -22,10 +22,10 @@ public SpawnEliteAtCommand() { addArgument("entityType", new ArrayList<>()); addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); - setUsage("/em spawn elite <...>"); - setPermission("elitemobs.*"); + setUsage("/em spawn eliteAt <...>"); + setPermission("elitemobs.spawn.elite.at"); setSenderType(SenderType.PLAYER); - setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers."); + setDescription("Spawns an elite of the specified type and level, optionally with specified powers, at the chosen location."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 1bd6ed1af..8673dfaeb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -12,7 +12,7 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setPermission("elitemobs.transitiveblocks.cancel"); setDescription("Cancels transitive block registration."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java index 753b51b7b..2c4d4acd6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -14,8 +14,8 @@ public TransitiveBlocksEditAreaCommand() { addLiteral("editArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setUsage("/em transitiveBlocks editArea "); + setPermission("elitemobs.transitiveblocks.edit.area"); setDescription("Edits large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java index 24e386a4a..a7274abe6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -14,9 +14,9 @@ public TransitiveBlocksEditCommand() { addLiteral("edit"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); - setDescription("Cancels transitive block registration."); + setUsage("/em transitiveBlocks edit "); + setPermission("elitemobs.transitiveblocks.edit.edit"); + setDescription("Edits transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java index 4a18e7785..b869df481 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -14,8 +14,8 @@ public TransitiveBlocksRegisterAreaCommand() { addLiteral("registerArea"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); + setUsage("/em transitiveBlocks registerArea "); + setPermission("elitemobs.transitiveblocks.register.area"); setDescription("Registers large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java index 5bdb76b5c..4af68f83f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -14,9 +14,9 @@ public TransitiveBlocksRegisterCommand() { addLiteral("register"); addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); - setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.*"); - setDescription("Cancels transitive block registration."); + setUsage("/em transitiveBlocks register "); + setPermission("elitemobs.transitiveblocks.register.register"); + setDescription("Registers transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java index d3b038b46..742eb9385 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java @@ -14,7 +14,7 @@ public UnbindCommand() { 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"); + setDescription("Opens the unbind menu or teleports the player to the Adventurer's Guild Hub."); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java index ad957e55b..f853fa85b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java @@ -15,7 +15,7 @@ public UnbindForceCommand() { addLiteral("force"); setUsage("/em unbind force"); setSenderType(SenderType.PLAYER); - setPermission("elitemobs.*"); + setPermission("elitemobs.unbind.force"); setDescription("Forcefully unbinds a held item."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java index cae741a0f..3a7669ba6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java @@ -13,8 +13,8 @@ public class VersionCommand extends AdvancedCommand { public VersionCommand() { super(List.of("version")); setUsage("/em version"); - setPermission("elitemobs.*"); - setDescription("Checks the server's plugin version."); + setPermission("elitemobs.version"); + setDescription("Checks the server's EliteMobs plugin version."); } @Override From ef19f3c69aeda562dcc575dd3da4834d33cbcd14 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:06:18 +0200 Subject: [PATCH 63/78] Updated plugin.yml with the rest of permissions --- src/main/resources/plugin.yml | 59 ++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d192b08f7..7862ba231 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -266,4 +266,61 @@ permissions: default: op elitemobs.remove: description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. - default: op \ No newline at end of file + default: op + elitemobs.respawn: + description: Allows players to force respawn all regional bosses. + default: op + elitemobs.setup.main: + description: Allows players to have access to the main command for setting up EliteMobs. + default: op + elitemobs.setup.done: + description: Allows players to toggle whether the setup message will show up in the server chat. + default: op + elitemobs.setup.toggle: + description: Allows players to toggle the installation of specified EliteMobs content. + default: op + elitemobs.shop.custom: + description: Allows players to open the EliteMobs shop for custom items for the specified player. + default: op + elitemobs.shop.sell.player: + description: Allows players to open the EliteMobs shop for custom items for the specified player. + default: op + elitemobs.spawn.boss.at: + description: Allows players to spawn a custom boss at the specified location. + default: op + elitemobs.spawn.boss: + description: Allows players to spawn a custom boss at the location the player is looking at. + default: op + elitemobs.spawn.boss.at.level: + description: Allows players to spawn a custom boss at the specified location with the specified level. + default: op + elitemobs.spawn.boss.level: + description: Allows players to spawn a custom boss at the location the user is looking at with the specified level. + default: op + elitemobs.spawn.elite: + description: Allows players to spawn an elite of a specified type and level, optionally with specific powers, at the targeted location. + default: op + elitemobs.spawn.elite.at: + description: Allows players to spawn an elite of the specified type and level, optionally with specified powers, at the chosen location. + default: op + elitemobs.transitiveblocks.cancel: + description: Allows players to cancel transitive block registration. + default: op + elitemobs.transitiveblocks.edit.area: + description: Allows players to edit large transitive blocks areas for use by regional bosses. + default: op + elitemobs.transitiveblocks.edit.edit: + description: Allows players to edit transitive blocks for use by regional bosses. + default: op + elitemobs.transitiveblocks.register.area: + description: Allows players to register large transitive blocks areas for use by regional bosses. + default: op + elitemobs.transitiveblocks.register.register: + description: Allows players to register transitive blocks for use by regional bosses. + default: op + elitemobs.unbind.force: + description: Allows players to forcefully unbind a held item. + default: op + elitemobs.version: + description: Allows players to check the server's EliteMobs plugin version. + default: op From 5e5ad31f46631eac790b02fc2edd079b293887c2 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:13:05 +0200 Subject: [PATCH 64/78] Updated SetupDoneCommand.java fixed help text for SetupDoneCommand --- .../java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index 509091122..7222579ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -11,7 +11,7 @@ public class SetupDoneCommand extends AdvancedCommand { public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); - setUsage("/setup done"); + setUsage("/em setup done"); setPermission("elitemobs.setup.done"); setDescription("Toggles whether the setup message will show up."); } From 425ec9c4a3f9712467033b80d9645b6a5845b961 Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:49:26 +0200 Subject: [PATCH 65/78] Updated MoneyCheckPlayerCommand.java fixed setusage for MoneyCheckPlayer --- .../magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 29a6736e7..62bb4caff 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -11,7 +11,7 @@ public MoneyCheckPlayerCommand() { super(List.of("money")); addLiteral("check"); addArgument("player", new ArrayList<>()); - setUsage("/em check "); + setUsage("/em money check "); setPermission("elitemobs.money.check.player"); setDescription("Checks the currency of the specified player."); } @@ -22,4 +22,4 @@ public void execute(CommandData commandData) { commandData.getCommandSender(), commandData.getStringArgument("player")); } -} \ No newline at end of file +} From e97db49f490ddaab961b8c470c33eba1f68fa50b Mon Sep 17 00:00:00 2001 From: FrostCone <143012927+frostcone@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:44:43 +0200 Subject: [PATCH 66/78] Some minor edits to commands --- .../com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java | 2 +- src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 186e4dcf5..3b326e924 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -16,7 +16,7 @@ public PlaceWormholeCommand() { addLiteral("wormhole"); addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); - setUsage("/em wormhole <1/2>"); + setUsage("/em place wormhole <1/2>"); setPermission("elitemobs.place.wormhole"); setSenderType(SenderType.PLAYER); setDescription("Place a wormhole teleport at your current location."); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java index 39a4bdcbe..b85485726 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java @@ -11,7 +11,7 @@ public class RankCommand extends AdvancedCommand { public RankCommand() { super(List.of("rank")); setUsage("/em rank"); - setDescription("Opens the EliteMobs rank menu."); + setDescription("Opens the EliteMobs rank menu or teleports you to the Adventurer's Guild."); setSenderType(SenderType.PLAYER); } From 11689bcd5432b01e3d2a7ffe88abc5ee6e61d703 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Mon, 29 Jul 2024 16:17:08 +0100 Subject: [PATCH 67/78] EliteMobs 9.1.0 SNAPSHOT: - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Nearly all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [New] All content imports are now handled by MagmaCore. This update now also allows content to be installed incorrectly - meaning packs from other plugins can be correctly imported in EliteMobs and moved to the right place, content for plugins not yet installed in the server will prepare the content ahead of time if the server installs those plugins in the future - [New] The pirate ship minidungeon has been readded to the plugin defaults as it has now been updated out of being a schematic dungeon - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [New] Resource pack option in the em setup menu has been tweaked to recommend the Resource Pack Manager plugin instead, this will be further tweaked after public release - [New] Importing content with models will now automatically and immediately host the content if FMM and RSPM are installed, meaning dungeons with models will now work after a single EliteMobs reload to install if from the imports - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Fix] Elite projectiles can no longer survive chunk unloads - [Removal] Removed trace system from custom bosses Signed-off-by: MagmaGuy --- build.gradle | 62 +----- .../com/magmaguy/elitemobs/EliteMobs.java | 7 +- .../api/EliteMobDamagedByPlayerEvent.java | 2 +- .../FixPlayerOnLoginOrRespawn.java | 4 +- .../PreventUpgradeDiamondToNetherite.java | 2 +- .../combatsystem/displays/PopupDisplay.java | 2 +- .../elitemobs/commands/CommandHandler.java | 102 +++++++++ .../elitemobs/commands/CommandManager.java | 96 --------- .../commands/CurrencyCommandsHandler.java | 2 +- .../elitemobs/commands/HelpCommand.java | 19 +- .../elitemobs/commands/LootDebugCommand.java | 3 +- .../elitemobs/commands/LootGiveCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 4 +- .../commands/LootSimulateCommand.java | 4 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../commands/MoneyAddAllCommand.java | 8 +- .../elitemobs/commands/MoneyAddCommand.java | 2 +- .../elitemobs/commands/PlaceBossCommand.java | 8 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 2 +- .../commands/QuestBypassCommand.java | 6 + .../commands/SetupToggleCommand.java | 9 +- .../elitemobs/commands/admin/DebugScreen.java | 2 +- .../commands/admin/StatsCommand.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 23 +- .../elitemobs/config/ConfigurationEngine.java | 2 +- .../config/ConfigurationImporter.java | 199 ------------------ .../config/LegacyValueConverter.java | 8 + ...roceduralItemGenerationSettingsConfig.java | 3 +- ...dungeon.off => PirateShipMinidungeon.java} | 2 +- .../config/menus/premade/ArenaMenuConfig.java | 2 +- .../menus/premade/PlayerStatusMenuConfig.java | 2 +- .../elitemobs/items/EliteItemLore.java | 2 +- .../elitemobs/items/ItemLootShower.java | 4 +- .../itemconstructor/ItemConstructor.java | 2 +- .../menus/InstancedDungeonBrowser.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 2 +- .../magmaguy/elitemobs/menus/LootMenu.java | 2 +- .../elitemobs/menus/ScrapperMenu.java | 2 +- .../magmaguy/elitemobs/menus/SellMenu.java | 4 +- .../custombosses/CustomBossBossBar.java | 2 +- .../custombosses/CustomBossDeath.java | 2 +- .../custombosses/CustomBossTrail.java | 2 +- .../statusscreen/BossTrackingPage.java | 4 +- .../statusscreen/TeleportsPage.java | 2 +- .../elitemobs/quests/QuestTracking.java | 2 +- .../quests/menus/QuestInventoryMenu.java | 2 +- .../elitemobs/quests/menus/QuestMenu.java | 2 +- .../treasurechest/TreasureChest.java | 2 +- .../elitemobs/utils/ItemStackGenerator.java | 76 ------- .../elitemobs/utils/ItemStackSerializer.java | 1 + .../elitemobs/utils/SpigotMessage.java | 32 --- .../versionnotifier/VersionChecker.java | 2 +- src/main/resources/plugin.yml | 6 +- 54 files changed, 222 insertions(+), 530 deletions(-) create mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ConfigurationImporter.java rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{PirateShipMinidungeon.off => PirateShipMinidungeon.java} (97%) delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/ItemStackGenerator.java delete mode 100644 src/main/java/com/magmaguy/elitemobs/utils/SpigotMessage.java diff --git a/build.gradle b/build.gradle index 1b0db9183..d22f97548 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import org.apache.tools.ant.filters.ReplaceTokens - plugins { id 'java-library' id 'idea' @@ -14,16 +12,11 @@ compileTestJava.options.encoding = "UTF-8" java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(17) } } -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' - options.release = 21 -} - -//Fixes issues with utf-8 in the translations files. Why? Don't know. +//Fixes issues with utf-8 in the translations files. processResources { def props = [version: version] inputs.properties props @@ -34,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.0.5' +version '9.1.0' repositories { maven { @@ -53,13 +46,8 @@ 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 = 'http://magmaguy.com:50001/releases' @@ -77,10 +65,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/' @@ -93,8 +79,6 @@ repositories { dependencies { //Spigot API compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT" - //BStats API - implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1' //WorldGuard API compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7' //Vault @@ -112,31 +96,23 @@ dependencies { 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.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' + // Mythic Mobs integration - currently only for arenas + compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' - //Advanced AI goals + ///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.11.2-SNAPSHOT' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0' - //Advanced AI goals - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' - - // Mythic Mobs integration - currently only for arenas - compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5' } artifacts { // task 'build' runs generates uberjar @@ -153,30 +129,12 @@ String packagePath = 'com.magmaguy.shaded' shadowJar { dependencies { relocate('org.bstats', packagePath + '.bstats') -// 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 -} - - -//ext.isReleaseVersion = !version.contains("SNAPSHOT") - publishing { repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 1f33f06be..502a143c2 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -5,7 +5,7 @@ */ import com.magmaguy.easyminecraftgoals.NMSManager; -import com.magmaguy.elitemobs.commands.CommandManager; +import com.magmaguy.elitemobs.commands.CommandHandler; import com.magmaguy.elitemobs.config.*; import com.magmaguy.elitemobs.config.commands.CommandsConfig; import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig; @@ -222,7 +222,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 @@ -267,7 +268,7 @@ public void onEnable() { //Commands // new CommandHandler(); - new CommandManager(); + CommandHandler.registerCommands(); new SpecialItemSystemsConfig(); diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 2f8f5258b..8c0359157 100644 --- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java +++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java @@ -15,7 +15,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.magmacore.util.Round; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java index fa6bf49a6..7293e3822 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java @@ -4,7 +4,7 @@ import org.bukkit.attribute.Attribute; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -19,7 +19,7 @@ public void onPlayerRespawn(PlayerRespawnEvent event) { } @EventHandler - public void onPlayerRespawn(PlayerLoginEvent event) { + 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()) diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java index c25f8cdc5..3de63fa7d 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.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.Listener; 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 8b1a2cf6b..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,8 +10,8 @@ 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.VisualDisplay; +import com.magmaguy.magmacore.util.Round; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java new file mode 100644 index 000000000..97d1734f0 --- /dev/null +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -0,0 +1,102 @@ +package com.magmaguy.elitemobs.commands; + +import com.magmaguy.elitemobs.MetadataHandler; +import com.magmaguy.magmacore.command.CommandManager; + +public class CommandHandler { + private static CommandManager emCommand; + private static CommandManager adventurersGuildCommand; + private CommandHandler() { + } + + 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 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()); + + //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 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/CommandManager.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java deleted file mode 100644 index 1acb36c11..000000000 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandManager.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.magmaguy.elitemobs.commands; - -import com.magmaguy.elitemobs.MetadataHandler; - -public class CommandManager extends com.magmaguy.magmacore.command.CommandManager { - public CommandManager() { - super(MetadataHandler.PLUGIN, "elitemobs"); - } - - @Override - public void registerCommands() { - //Admin commands - registerCommand(new SetupCommand()); - registerCommand(new SetupDoneCommand()); - registerCommand(new SetupToggleCommand()); - registerCommand(new SpawnBossCommand()); - registerCommand(new SpawnBossLevelCommand()); - registerCommand(new SpawnBossAtCommand()); - registerCommand(new SpawnBossLevelAtCommand()); - registerCommand(new PlaceBossCommand()); - registerCommand(new PlaceTreasureChestCommand()); - registerCommand(new PlaceNPCCommand()); - registerCommand(new RemoveCommand()); - registerCommand(new DebugCommand()); - registerCommand(new EventCommand()); - registerCommand(new StatsCommand()); - registerCommand(new LootMenuCommand()); - registerCommand(new LootGiveCommand()); - registerCommand(new LootRandomCommand()); - registerCommand(new LootSimulateMultipleCommand()); - registerCommand(new LootSimulateCommand()); - registerCommand(new VersionCommand()); - registerCommand(new ReloadCommand()); - registerCommand(new KillCommand()); - registerCommand(new KillRadiusCommand()); - registerCommand(new KillTypeCommand()); - registerCommand(new KillTypeRadiusCommand()); - registerCommand(new LootDebugCommand()); - registerCommand(new MoneyAddCommand()); - registerCommand(new MoneyAddAllCommand()); - registerCommand(new MoneySetCommand()); - registerCommand(new MoneyCheckPlayerCommand()); - registerCommand(new UnbindForceCommand()); - registerCommand(new FireballCommand()); - registerCommand(new RespawnAllCommand()); - registerCommand(new PackageDungeonCommand()); - registerCommand(new LanguageCommand()); - registerCommand(new PlaceWormholeCommand()); - registerCommand(new LootStats()); - registerCommand(new ShopProceduralOtherCommand()); - registerCommand(new ShopCustomOtherCommand()); - registerCommand(new ShopSellOtherCommand()); - registerCommand(new QuestBypassCommand()); - registerCommand(new QuestCompleteCommand()); - registerCommand(new QuestResetCommand()); - registerCommand(new QuestResetAllCommand()); - registerCommand(new TransitiveBlocksCancelCommand()); - registerCommand(new TransitiveBlocksRegisterCommand()); - registerCommand(new TransitiveBlocksEditCommand()); - registerCommand(new TransitiveBlocksRegisterAreaCommand()); - registerCommand(new TransitiveBlocksEditAreaCommand()); - registerCommand(new RankSetCommand()); - registerCommand(new SpawnElite()); - registerCommand(new SpawnEliteAtCommand()); - registerCommand(new DiscordMessageCommand()); - registerCommand(new DiscordCommand()); - - //User commands - registerCommand(new AdventurersGuildCommand()); - registerCommand(new ShareItemCommand()); - registerCommand(new ShopDynamicCommand()); - registerCommand(new ShopCustomCommand()); - registerCommand(new RepairCommand()); - registerCommand(new EnchantCommand()); - registerCommand(new ScrapCommand()); - registerCommand(new UnbindCommand()); - registerCommand(new MoneyCheckCommand()); - registerCommand(new QuestAcceptCommand()); - registerCommand(new QuestTrackCommand()); - registerCommand(new QuestLeaveCommand()); - registerCommand(new RankCommand()); - registerCommand(new LootCommand()); - registerCommand(new QuitCommand()); - registerCommand(new StartCommand()); - registerCommand(new ArenaCommand()); - registerCommand(new DismissCommand()); - registerCommand(new AltCommand()); - registerCommand(new SpawnTeleportCommand()); - registerCommand(new DungeonTeleportCommand()); - registerCommand(new TrackBossCommand()); - registerCommand(new PayCommand()); - - registerCommand(new EliteMobsCommand()); - registerCommand(new HelpCommand()); - } -} diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java index e6de39500..e11cdfd9e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java @@ -2,8 +2,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java index 792b9e523..c2b49187d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java @@ -2,6 +2,7 @@ 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; @@ -18,13 +19,15 @@ public HelpCommand() { @Override public void execute(CommandData commandData) { Logger.sendMessage(commandData.getCommandSender(), "Commands:"); - CommandManager.getInstance().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()); - } - }); + 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/LootDebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java index f6217a661..ada2a14e9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java @@ -1,7 +1,6 @@ package com.magmaguy.elitemobs.commands; import com.magmaguy.elitemobs.commands.admin.GetTierCommand; -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; @@ -13,7 +12,7 @@ public class LootDebugCommand extends AdvancedCommand { public LootDebugCommand() { super(List.of("loot")); addLiteral("debug"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>()); setUsage("/em loot debug "); setPermission("elitemobs.loot.debug"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 166ffeebb..0014a9663 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -14,7 +14,7 @@ public LootGiveCommand() { addLiteral("give"); addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); - setUsage("/em loot give "); + setUsage("/em loot give "); setPermission("elitemobs.loot.give"); setDescription("Gives the specified loot to a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 04f6fcedb..7ae31801d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -12,8 +12,8 @@ public class LootRandomCommand extends AdvancedCommand { public LootRandomCommand() { super(List.of("loot")); addLiteral("random"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - addArgument("playerName", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot random "); setPermission("elitemobs.loot.random"); setDescription("Gives the player random loot of the specified level."); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 752a7b82b..5284dc1e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -13,8 +13,8 @@ public class LootSimulateCommand extends AdvancedCommand { public LootSimulateCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - addArgument("playerName", new ArrayList<>()); + addArgument("level", new ArrayList<>()); + addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot simulate "); setPermission("elitemobs.loot.simulate"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index ca0236728..cf7eba055 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -13,7 +13,7 @@ public class LootSimulateMultipleCommand extends AdvancedCommand { public LootSimulateMultipleCommand() { super(List.of("loot")); addLiteral("simulate"); - addArgument("level", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("level", new ArrayList<>()); addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index 69a41cdd6..d751e4547 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.commands; -import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig; import com.magmaguy.magmacore.command.AdvancedCommand; import com.magmaguy.magmacore.command.CommandData; @@ -10,10 +9,9 @@ public class MoneyAddAllCommand extends AdvancedCommand { public MoneyAddAllCommand() { super(List.of("money")); - addLiteral("add"); - addLiteral("all"); - addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); - setUsage("/em money add all "); + addLiteral("addAll"); + addArgument("amount", new ArrayList<>()); + setUsage("/em money addAll "); setPermission("elitemobs.money.add.all"); setDescription("Gives every player on the server the specified amount of money."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 62480a03a..31d4d871c 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -11,7 +11,7 @@ public class MoneyAddCommand extends AdvancedCommand { public MoneyAddCommand() { super(List.of("money")); addLiteral("add"); - addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); + addArgument("player", new ArrayList<>()); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); setPermission("elitemobs.money.add.player"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index 21ca47b73..9e6093dec 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -1,18 +1,24 @@ 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"); - addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); + 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.boss"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index 2753aed75..fb1b012ca 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -21,6 +21,6 @@ public PlaceTreasureChestCommand() { @Override public void execute(CommandData commandData) { - CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender()); + 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 index 3b326e924..261fa79d9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -25,7 +25,7 @@ public PlaceWormholeCommand() { @Override public void execute(CommandData commandData) { for (Wormhole wormhole : Wormhole.getWormholes()) { - if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("wormholeFilename"))) + if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename"))) switch (commandData.getStringArgument("wormholeOption")) { case "1": wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java index 2854671a1..83619bbae 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java @@ -1,9 +1,11 @@ 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; @@ -20,5 +22,9 @@ public QuestBypassCommand() { @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/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index cbfb4e4eb..f523de7d8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -24,7 +24,12 @@ public void execute(CommandData commandData) { 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()) - Logger.sendMessage(commandData.getCommandSender(), "Successfully installed content!"); + 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/admin/DebugScreen.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java index 7cb25431c..e39885c30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java @@ -6,8 +6,8 @@ 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/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java index aff87c328..d3c5bd302 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java @@ -6,8 +6,8 @@ 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; 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 05bf15fc1..a2baef37f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; -import com.magmaguy.elitemobs.utils.SpigotMessage; 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; @@ -50,14 +50,17 @@ 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) { diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java index 778e82472..c47c3692e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.config; import com.magmaguy.elitemobs.config.translations.TranslationsConfig; -import com.magmaguy.elitemobs.utils.ItemStackGenerator; 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; 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 2ec691a57..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.MetadataHandler; -import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel; -import com.magmaguy.elitemobs.utils.SpigotMessage; -import com.magmaguy.magmacore.util.ChatColorConverter; -import com.magmaguy.magmacore.util.Logger; -import com.magmaguy.magmacore.util.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) { - Logger.warn("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) { - Logger.warn("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, new File(zippedFile.getAbsolutePath().replace(".zip", ""))); - else unzippedFile = zippedFile; - } catch (Exception e) { - Logger.warn("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 - Logger.warn("You need FreeMinecraftModels or ModelEngine (ModelEngine R3 specifically, R4+ won't work) to use custom models!"); - break; - case "schematics": - Logger.warn("You just tried to import legacy content! Schematic dungeons no longer exist as of EliteMobs 9.0, use BetterStructures shrines instead!"); - break; - default: - Logger.warn("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) { - Logger.warn("Failed to move files from " + zippedFile.getName() + " ! Tell the dev!"); - e.printStackTrace(); - continue; - } - try { - unzippedFile.delete(); - zippedFile.delete(); - } catch (Exception ex) { - Logger.warn("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); - Logger.info("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()) { - Logger.info("Overriding existing directory " + destinationFile.getPath()); - if (Bukkit.getWorld(file.getName()) != null) { - Bukkit.unloadWorld(file.getName(), false); - Logger.warn("Unloaded world " + file.getName() + " for safe replacement!"); - } - deleteDirectory(destinationFile); - } - FileUtils.moveDirectory(file, destinationFile); - } catch (Exception exception) { - Logger.warn("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 { - Logger.info("Adding " + file.getCanonicalPath()); - moveFile(file, targetPath, force); - } catch (Exception exception) { - Logger.warn("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) { - Logger.warn("Failed to move directories for " + file.getName() + "! Tell the dev!"); - exception.printStackTrace(); - } - } - -} diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index e72f2a185..a05612a0f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -90,6 +90,14 @@ public static String parseParticle(String potionEffectName) { 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(); default: return potionEffectName; } diff --git a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java index ecec2451e..33ba488b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -62,7 +62,6 @@ public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile { public ProceduralItemGenerationSettingsConfig() { super("ProceduralItemGenerationSettings.yml"); - instance = this; } private void addMaterial(Material material) { @@ -79,6 +78,8 @@ public void cacheMaterials() { @Override public void initializeValues() { + instance = this; + doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true); customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5); diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java similarity index 97% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java index 18a471e88..f9aaa7e5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java @@ -17,7 +17,7 @@ public PirateShipMinidungeon() { "&6Credits: MagmaGuy & Realm of Lotheridon"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, - "em_the_pirate_ship", + "em_pirate_ship", World.Environment.NORMAL, true, "em_the_pirate_ship,-85,63,243.5,-150,0", 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 90c0f330b..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,7 +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.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; 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 bc487f6e2..078211799 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,7 +4,7 @@ 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.magmacore.util.ItemStackGenerator; import lombok.Getter; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; diff --git a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java index 3e5d8eecb..3edba4109 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java +++ b/src/main/java/com/magmaguy/elitemobs/items/EliteItemLore.java @@ -10,9 +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.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; diff --git a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index e0d720677..4fbd06cf8 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -8,10 +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.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; 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 e967da277..71a2cc1c7 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java +++ b/src/main/java/com/magmaguy/elitemobs/items/itemconstructor/ItemConstructor.java @@ -7,8 +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/menus/InstancedDungeonBrowser.java b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java index f884985fc..e9bdefa43 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/InstancedDungeonBrowser.java @@ -5,8 +5,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index d6f39502a..d9a77bd98 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -10,8 +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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/LootMenu.java index 25202dc8d..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.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/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index 42c4e12d7..ee4246745 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -9,8 +9,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java index 1d20fa872..3e59aec15 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -8,9 +8,9 @@ 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; 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 0eebe530e..fe43e4b3e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -3,9 +3,9 @@ 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.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; 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 a86c13599..d4654b4fc 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossDeath.java @@ -4,8 +4,8 @@ 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/CustomBossTrail.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossTrail.java index 65404b752..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,7 +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.magmacore.util.ItemStackGenerator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; 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 5c6cabd04..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.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; 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 c64a0655c..65d12c34a 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/statusscreen/TeleportsPage.java @@ -4,8 +4,8 @@ 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; diff --git a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java index de0bbcaa2..2b350027d 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/QuestTracking.java @@ -13,9 +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; 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 e91bb23ce..e1cee7b08 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java @@ -5,8 +5,8 @@ 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; 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 c09e4d2c2..642964af8 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestMenu.java @@ -16,8 +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/treasurechest/TreasureChest.java b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java index acf28eb97..122ef2245 100644 --- a/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java +++ b/src/main/java/com/magmaguy/elitemobs/treasurechest/TreasureChest.java @@ -12,10 +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.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; 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 8e46e37a6..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.magmacore.util.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 7f53a21b4..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,7 @@ package com.magmaguy.elitemobs.utils; 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; 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 080b80cfc..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.magmacore.util.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/versionnotifier/VersionChecker.java b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java index 47c2564dd..01c35ca90 100644 --- a/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java +++ b/src/main/java/com/magmaguy/elitemobs/versionnotifier/VersionChecker.java @@ -3,9 +3,9 @@ import com.magmaguy.elitemobs.MetadataHandler; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.elitemobs.utils.DiscordLinks; -import com.magmaguy.elitemobs.utils.SpigotMessage; 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; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7862ba231..84686f0dd 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.0.5 +version: 9.1.0-SNAPSHOT author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -23,6 +23,10 @@ commands: description: Main command aliases: - em + adventurersguild: + description: Main command + aliases: + - ag permissions: elitemobs.*: From f2027dc9ba48de2c2c68c2b83b901fb2dfcdcd97 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 2 Aug 2024 12:49:20 +0100 Subject: [PATCH 68/78] EliteMobs 9.1.0: - [New] Now using MagmaCore, replacing, improving and synchronizing many core systems. MagmaCore is shaded in, and thus requires no setup from admins. - [New] New system for commands, making EliteMobs safe to reload and able to autosuggest content added during reloads. Nearly all commands have also been renamed to follow a planned and predictable structure, and some legacy commands have been dropped - [New] All message logging is now handled by MagmaCore - [New] All configurations are now handled by MagmaCore - [New] Many utility methods are now handled by MagmaCore - [New] All content imports are now handled by MagmaCore. This update now also allows content to be installed incorrectly - meaning packs from other plugins can be correctly imported in EliteMobs and moved to the right place, content for plugins not yet installed in the server will prepare the content ahead of time if the server installs those plugins in the future - [New] The pirate ship minidungeon has been readded to the plugin defaults as it has now been updated out of being a schematic dungeon - [Fix] Fixed issue where wormholes would sometimes be placed in incorrect locations - [Fix] Fixed error where scripts would complain about outdated particles, added automatic particle enum conversion - [New] Unlisted dungeons inside of adventures from the teleports page, those should be accessed through the adventure instead. - [New] Added scale script action, which allows scripters to resize entities. Uses duration to reset the scale to 1, and "scale" for the argument - [New] Resource pack option in the em setup menu has been tweaked to recommend the Resource Pack Manager plugin instead, this will be further tweaked after public release - [New] Importing content with models will now automatically and immediately host the content if FMM and RSPM are installed, meaning dungeons with models will now work after a single EliteMobs reload to install if from the imports - [Fix] Fixed luck potion effects for default items being incorrectly set to be luck of the sea instead - [Fix] Elite projectiles can no longer survive chunk unloads - [Removal] Removed trace system from custom bosses - [Removal] Removed the resource pack data config, now handled by ResourcePackManager Signed-off-by: MagmaGuy --- build.gradle | 4 +- .../com/magmaguy/elitemobs/EliteMobs.java | 1 - .../magmaguy/elitemobs/EventsRegistrer.java | 2 - .../GuildRankMenuHandler.java | 4 +- .../commands/AdventurersGuildCommand.java | 4 +- .../elitemobs/commands/CommandHandler.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 3 +- .../elitemobs/config/DefaultConfig.java | 4 +- .../config/LegacyValueConverter.java | 10 ++ .../config/ResourcePackDataConfig.java | 102 ------------------ .../premade/PirateShipMinidungeon.java | 2 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 4 +- .../elitemobs/menus/ScrapperMenu.java | 5 +- .../magmaguy/elitemobs/menus/SellMenu.java | 3 +- .../custombosses/CustomBossBossBar.java | 2 +- .../powers/scripts/ScriptAction.java | 9 +- .../elitemobs/utils/shapes/Cuboid.java | 10 +- src/main/resources/plugin.yml | 2 +- 18 files changed, 42 insertions(+), 131 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/ResourcePackDataConfig.java diff --git a/build.gradle b/build.gradle index d22f97548..4051736de 100644 --- a/build.gradle +++ b/build.gradle @@ -110,8 +110,8 @@ dependencies { 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.11.2-SNAPSHOT' - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.12.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.8' } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index 502a143c2..a27940735 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -85,7 +85,6 @@ public class EliteMobs extends JavaPlugin { public static void initializeConfigs() { //Initialized translations new DefaultConfig(); - new ResourcePackDataConfig(); new ItemSettingsConfig(); new ProceduralItemGenerationSettingsConfig(); PotionEffectsConfig.initializeConfigs(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index e127f438e..4eb7bc8b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -88,8 +88,6 @@ public static void registerEvents() { register(new Navigation()); - register(new ResourcePackDataConfig.ResourcePackDataConfigEvents()); - register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener()); register(new VersionChecker.VersionCheckerEvents()); diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index 0a3986fe2..fd00f7ca7 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -1,8 +1,8 @@ package com.magmaguy.elitemobs.adventurersguild; 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; @@ -114,7 +114,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); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java index 9c7dbbe5d..1c6f75897 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java @@ -4,11 +4,11 @@ import com.magmaguy.magmacore.command.CommandData; import com.magmaguy.magmacore.command.SenderType; -import java.util.List; +import java.util.ArrayList; public class AdventurersGuildCommand extends AdvancedCommand { public AdventurersGuildCommand() { - super(List.of("adventurersguild", "ag")); + super(new ArrayList<>()); setUsage("/em adventurersguild"); setPermission("elitemobs.adventurersguild.command"); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 97d1734f0..eea0afcea 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -69,7 +69,7 @@ public static void registerCommands() { emCommand.registerCommand(new DiscordCommand()); //User commands - emCommand.registerCommand(new AdventurersGuildCommand()); +// emCommand.registerCommand(new AdventurersGuildCommand()); emCommand.registerCommand(new ShareItemCommand()); emCommand.registerCommand(new ShopDynamicCommand()); emCommand.registerCommand(new ShopCustomCommand()); 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 a2baef37f..b3fee7974 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -1,6 +1,5 @@ package com.magmaguy.elitemobs.commands.setup; -import com.magmaguy.elitemobs.config.ResourcePackDataConfig; import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig; import com.magmaguy.elitemobs.dungeons.EMPackage; import com.magmaguy.magmacore.util.ChatColorConverter; @@ -221,7 +220,7 @@ 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.YELLOW_STAINED_GLASS_PANE; diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java index 3cc651db0..6972a4ecf 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java @@ -76,6 +76,8 @@ public class DefaultConfig extends ConfigurationFile { private static String bossAlreadyGoneMessage; @Getter private static boolean resetPlayerScaleOnLogin; + @Getter + private static boolean forceMenuUnicode; public DefaultConfig() { super("config.yml"); @@ -202,6 +204,6 @@ public void initializeValues() { 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); 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); } } diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java index a05612a0f..3a0b9fcdd 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java +++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java @@ -98,6 +98,16 @@ public static String parseParticle(String potionEffectName) { 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; } 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 01ba3e076..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.magmacore.config.ConfigurationFile; -import com.magmaguy.magmacore.util.Logger; -import lombok.Getter; -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -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 extends ConfigurationFile { - - @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; - public static ResourcePackDataConfig instance; - - public ResourcePackDataConfig() { - super("resource_pack_config.yml"); - instance = this; - } - - 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) { - Logger.warn("[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) { - Logger.warn("[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) { - instance.fileConfiguration.set("eliteMobsResourcePackEnabled", status); - ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file); - eliteMobsResourcePackEnabled = status; - displayCustomMenuUnicodes = eliteMobsResourcePackEnabled; - if (status) { - updateSHA1(); - Bukkit.getOnlinePlayers().forEach(ResourcePackDataConfig::sendResourcePack); - } - } - - public static void toggleForceResourcePack(boolean status) { - instance.fileConfiguration.set("forceResourcePack", status); - forceResourcePack = status; - } - - public static void sendResourcePack(Player player) { - player.setResourcePack(resourcePackLink, SHA1, resourcePackPrompt, forceResourcePack); - } - - @Override - public void initializeValues() { - 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; - } - - 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/dungeonpackager/premade/PirateShipMinidungeon.java b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/PirateShipMinidungeon.java index f9aaa7e5e..18a471e88 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 @@ -17,7 +17,7 @@ public PirateShipMinidungeon() { "&6Credits: MagmaGuy & Realm of Lotheridon"), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, - "em_pirate_ship", + "em_the_pirate_ship", World.Environment.NORMAL, true, "em_the_pirate_ship,-85,63,243.5,-150,0", diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index d9a77bd98..67d3dfef0 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -1,7 +1,7 @@ package com.magmaguy.elitemobs.menus; +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; @@ -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); diff --git a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java index ee4246745..55c881ab7 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ScrapperMenu.java @@ -5,7 +5,6 @@ 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; @@ -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 3e59aec15..653e6e536 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/SellMenu.java @@ -3,7 +3,6 @@ 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; @@ -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/mobconstructor/custombosses/CustomBossBossBar.java b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java index fe43e4b3e..51655d24e 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossBossBar.java @@ -43,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); } 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 64bdee8e1..dea4169e6 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -407,7 +407,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 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 edae9f180..f3a352a97 100644 --- a/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java +++ b/src/main/java/com/magmaguy/elitemobs/utils/shapes/Cuboid.java @@ -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/resources/plugin.yml b/src/main/resources/plugin.yml index 84686f0dd..d53051303 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.0-SNAPSHOT +version: 9.1.0 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 2a89b9ec63c62937ae245d2b898f74fab4bbd8ca Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 4 Aug 2024 02:47:44 +0100 Subject: [PATCH 69/78] EliteMobs 9.1.1: - [New] Redid all permissions - [New] Readded /em adventurersguild as an alternative for /ag - [Fix] Fixed error related to repairing items - [Fix] Fixed quest turn in not working in book menus - [Tweak] Removed sticks being worn as helmets by the wood league arena bosses Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../PreventPathfindingExploit.java | 2 - .../elitemobs/commands/AltCommand.java | 1 + .../elitemobs/commands/ArenaCommand.java | 2 +- .../elitemobs/commands/CommandHandler.java | 2 + .../elitemobs/commands/DismissCommand.java | 1 + .../commands/DungeonTeleportCommand.java | 2 +- .../elitemobs/commands/EliteMobsCommand.java | 1 + .../elitemobs/commands/KillCommand.java | 2 +- .../elitemobs/commands/KillRadiusCommand.java | 2 +- .../elitemobs/commands/KillTypeCommand.java | 2 +- .../commands/KillTypeRadiusCommand.java | 2 +- .../elitemobs/commands/LootGiveCommand.java | 2 +- .../elitemobs/commands/LootMenuCommand.java | 2 +- .../elitemobs/commands/LootRandomCommand.java | 2 +- .../commands/LootSimulateCommand.java | 2 +- .../commands/LootSimulateMultipleCommand.java | 2 +- .../commands/MoneyAddAllCommand.java | 2 +- .../elitemobs/commands/MoneyAddCommand.java | 2 +- .../commands/MoneyCheckPlayerCommand.java | 2 +- .../commands/MoneyRemoveCommand.java | 2 +- .../elitemobs/commands/MoneySetCommand.java | 2 +- .../elitemobs/commands/PayCommand.java | 1 + .../elitemobs/commands/PlaceBossCommand.java | 2 +- .../commands/PlaceTreasureChestCommand.java | 2 +- .../commands/PlaceWormholeCommand.java | 2 +- .../commands/QuestAcceptCommand.java | 2 +- .../commands/QuestCompleteCommand.java | 2 +- .../elitemobs/commands/QuestResetCommand.java | 2 +- .../elitemobs/commands/QuestTrackCommand.java | 2 +- .../elitemobs/commands/RespawnAllCommand.java | 2 +- .../elitemobs/commands/SetupCommand.java | 2 +- .../elitemobs/commands/SetupDoneCommand.java | 2 +- .../commands/SetupToggleCommand.java | 2 +- .../commands/ShopCustomOtherCommand.java | 2 +- .../commands/ShopDynamicCommand.java | 2 +- .../commands/ShopSellOtherCommand.java | 2 +- .../commands/SpawnBossAtCommand.java | 2 +- .../elitemobs/commands/SpawnBossCommand.java | 2 +- .../commands/SpawnBossLevelAtCommand.java | 2 +- .../commands/SpawnBossLevelCommand.java | 2 +- .../elitemobs/commands/SpawnElite.java | 2 +- .../commands/SpawnEliteAtCommand.java | 2 +- .../commands/SpawnTeleportCommand.java | 2 +- .../elitemobs/commands/StartCommand.java | 1 + .../elitemobs/commands/StatsCommand.java | 2 +- .../elitemobs/commands/TrackBossCommand.java | 1 + .../TransitiveBlocksCancelCommand.java | 2 +- .../TransitiveBlocksEditAreaCommand.java | 2 +- .../commands/TransitiveBlocksEditCommand.java | 2 +- .../TransitiveBlocksRegisterAreaCommand.java | 2 +- .../TransitiveBlocksRegisterCommand.java | 2 +- .../config/AdventurersGuildConfig.java | 2 +- .../premade/WoodLeagueWave15Miniboss.java | 4 +- src/main/resources/plugin.yml | 358 ++++++------------ 55 files changed, 169 insertions(+), 293 deletions(-) diff --git a/build.gradle b/build.gradle index 4051736de..916d080a4 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.0' +version '9.1.1' repositories { maven { 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 a1e9652a4..6380c0f63 100644 --- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java +++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java @@ -2,7 +2,6 @@ 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; @@ -17,7 +16,6 @@ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent 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/commands/AltCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java index b78d4e5bf..4a6f18b00 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java @@ -14,6 +14,7 @@ public AltCommand() { super(List.of("alt")); setUsage("/em alt"); setDescription("Changes the style of the /em menu."); + setPermission("elitemobs.alt"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java index c66063126..9c97bb5ab 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java @@ -13,7 +13,7 @@ public ArenaCommand() { super(List.of("arena")); addArgument("arenaID", new ArrayList<>()); setUsage("/em arena "); - setPermission("elitemobs.event.start"); + setPermission("elitemobs.arena.start"); setDescription("Open the Arena menu."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index eea0afcea..5f907c5d4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -55,6 +55,7 @@ public static void registerCommands() { 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()); @@ -92,6 +93,7 @@ public static void registerCommands() { emCommand.registerCommand(new DungeonTeleportCommand()); emCommand.registerCommand(new TrackBossCommand()); emCommand.registerCommand(new PayCommand()); + emCommand.registerCommand(new AdventurersGuildArgCommand()); emCommand.registerCommand(new EliteMobsCommand()); emCommand.registerCommand(new HelpCommand()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java index 500607785..bb1b02fd4 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java @@ -12,6 +12,7 @@ public DismissCommand() { super(List.of("dismiss")); setDescription("Dismisses /em menu message."); setUsage("/em dismiss"); + setPermission("elitemobs.dismiss"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java index f0fb2b029..5c71e0f63 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java @@ -11,7 +11,7 @@ public class DungeonTeleportCommand extends AdvancedCommand { public DungeonTeleportCommand() { super(List.of("dungeontp")); addArgument("dungeonID", new ArrayList<>()); - setPermission("elitemobs.dungeontp"); + setPermission("elitemobs.dungeon.tp"); setDescription("Teleports players to Lairs, Minidungeons and Dungeons."); setUsage("/em dungeontp "); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java index 82b5e1e2a..c41a1a6b2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java @@ -13,6 +13,7 @@ public EliteMobsCommand() { super(new ArrayList<>()); setDescription("The main command for EliteMobs, opens the main menu."); setUsage("/em"); + setPermission("elitemobs.command"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java index ca0f27243..70c740edd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java @@ -10,7 +10,7 @@ public class KillCommand extends AdvancedCommand { public KillCommand() { super(List.of("kill")); setUsage("/em kill"); - setPermission("elitemobs.kill.kill"); + setPermission("elitemobs.kill.command"); setDescription("Kills all elites."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java index d4e84cd57..978c494a7 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java @@ -13,7 +13,7 @@ public KillRadiusCommand() { super(List.of("kill")); addArgument("radius", new ArrayList<>()); setUsage("/em kill "); - setPermission("elitemobs.kill.radius"); + setPermission("elitemobs.kill.command"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites in the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java index 6cec36a67..03b0ffdc6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java @@ -14,7 +14,7 @@ public KillTypeCommand() { addLiteral("type"); addArgument("type", new ArrayList<>()); setUsage("/em kill type "); - setPermission("elitemobs.kill.type"); + setPermission("elitemobs.kill.command"); setDescription("Kills all elites of the specified type."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java index a76c7b2d9..33cd0d2e8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java @@ -16,7 +16,7 @@ public KillTypeRadiusCommand() { addArgument("type", new ArrayList<>()); addArgument("range", new ArrayList<>()); setUsage("/em kill type "); - setPermission("elitemobs.kill.type.radius"); + setPermission("elitemobs.kill.command"); setSenderType(SenderType.PLAYER); setDescription("Kills all elites of the specified type within the specified radius."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java index 0014a9663..5938e9cfb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java @@ -15,7 +15,7 @@ public LootGiveCommand() { addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot give "); - setPermission("elitemobs.loot.give"); + setPermission("elitemobs.loot.admin"); setDescription("Gives the specified loot to a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java index 28b92ffa8..9126a677b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java @@ -12,7 +12,7 @@ public LootMenuCommand() { super(List.of("loot")); addLiteral("menu"); setUsage("/em loot menu"); - setPermission("elitemobs.loot.menu"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Opens the loot menu."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java index 7ae31801d..60c979976 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java @@ -15,7 +15,7 @@ public LootRandomCommand() { addArgument("level", new ArrayList<>()); addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot random "); - setPermission("elitemobs.loot.random"); + setPermission("elitemobs.loot.admin"); setDescription("Gives the player random loot of the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java index 5284dc1e6..9dbd97527 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java @@ -16,7 +16,7 @@ public LootSimulateCommand() { addArgument("level", new ArrayList<>()); addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.simulate"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java index cf7eba055..a38e117cb 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java @@ -17,7 +17,7 @@ public LootSimulateMultipleCommand() { addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("playerName", new ArrayList<>()); setUsage("/em loot simulate "); - setPermission("elitemobs.loot.simulate.times"); + setPermission("elitemobs.loot.admin"); setSenderType(SenderType.PLAYER); setDescription("Simulates loot drops for the specified amount of times for the specified level and player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java index d751e4547..176e7f042 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java @@ -12,7 +12,7 @@ public MoneyAddAllCommand() { addLiteral("addAll"); addArgument("amount", new ArrayList<>()); setUsage("/em money addAll "); - setPermission("elitemobs.money.add.all"); + setPermission("elitemobs.money.admin"); setDescription("Gives every player on the server the specified amount of money."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java index 31d4d871c..e7089faa2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java @@ -14,7 +14,7 @@ public MoneyAddCommand() { addArgument("player", new ArrayList<>()); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money add "); - setPermission("elitemobs.money.add.player"); + setPermission("elitemobs.money.admin"); setDescription("Gives the specified amount of money to the designated player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java index 62bb4caff..a73f8def9 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java @@ -12,7 +12,7 @@ public MoneyCheckPlayerCommand() { addLiteral("check"); addArgument("player", new ArrayList<>()); setUsage("/em money check "); - setPermission("elitemobs.money.check.player"); + setPermission("elitemobs.money.check.others"); setDescription("Checks the currency of the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java index a2d17c061..3bb188cd2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java @@ -14,7 +14,7 @@ public MoneyRemoveCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money remove "); - setPermission("elitemobs.money.remove"); + setPermission("elitemobs.money.admin"); setDescription("Deducts the specified amount of currency from a player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java index 9de1d06e0..5a1c9802d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java @@ -14,7 +14,7 @@ public MoneySetCommand() { addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet())); setUsage("/em money set "); - setPermission("elitemobs.money.set"); + setPermission("elitemobs.money.admin"); setDescription("Sets the specified amount of currency for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java index 3a7961030..fdd48e0a0 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java @@ -14,6 +14,7 @@ public PayCommand() { addArgument("amount", new ArrayList<>()); setDescription("Send money to a player, minus tax."); setUsage("/em pay "); + setPermission("elitemobs.money.pay"); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java index 9e6093dec..2a65ae715 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java @@ -20,7 +20,7 @@ public PlaceBossCommand() { regionalBosses.add(entry.getKey()); addArgument("filename", regionalBosses); setUsage("/em place boss "); - setPermission("elitemobs.place.boss"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Add a spawn location for the specified boss at your current location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java index fb1b012ca..b47ae3621 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java @@ -14,7 +14,7 @@ public PlaceTreasureChestCommand() { addLiteral("treasureChest"); addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet())); setUsage("/em place treasureChest "); - setPermission("elitemobs.place.treasure"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Permanently adds a treasure chest to the location the user is standing on."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java index 261fa79d9..04cb8aa06 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java @@ -17,7 +17,7 @@ public PlaceWormholeCommand() { addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet())); addArgument("wormholeOption", List.of(1, 2)); setUsage("/em place wormhole <1/2>"); - setPermission("elitemobs.place.wormhole"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Place a wormhole teleport at your current location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java index 29a552ad2..e5526ea69 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java @@ -14,7 +14,7 @@ public QuestAcceptCommand() { addLiteral("accept"); addArgument("questID", new ArrayList<>()); setUsage("/em quest accept "); - setPermission("elitemobs.quest.command"); + setPermission("elitemobs.quest.accept"); setSenderType(SenderType.PLAYER); setDescription("Accepts a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java index 63831dcdc..232fb266a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java @@ -12,7 +12,7 @@ public QuestCompleteCommand() { super(List.of("quest")); addLiteral("complete"); setUsage("/em quest complete"); - setPermission("elitemobs.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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java index 46d9e5586..f57951bbd 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java @@ -16,7 +16,7 @@ public QuestResetCommand() { addArgument("player", new ArrayList<>()); addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet())); setUsage("/em quest reset "); - setPermission("elitemobs.quest.reset.quest"); + setPermission("elitemobs.quest.reset"); setDescription("Resets a specific quest for a specific player."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java index 8629cc3a6..207a34243 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java @@ -14,7 +14,7 @@ public QuestTrackCommand() { addLiteral("track"); addArgument("questID", new ArrayList<>()); setUsage("/em quest track "); - setPermission("elitemobs.quest.command"); + setPermission("elitemobs.quest.track"); setSenderType(SenderType.PLAYER); setDescription("Tracks a quest. Used via menu, can't be directly used."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java index 0d344b743..63766ad2d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java @@ -11,7 +11,7 @@ public RespawnAllCommand() { super(List.of("respawn")); addLiteral("all"); setUsage("/em respawn all"); - setPermission("elitemobs.respawn"); + setPermission("elitemobs.respawn.force"); setDescription("Forces all regional bosses to respawn."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java index a7a604090..743545e32 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java @@ -10,7 +10,7 @@ public class SetupCommand extends AdvancedCommand { public SetupCommand() { super(List.of("setup")); - setPermission("elitemobs.setup.main"); + setPermission("elitemobs.setup"); setSenderType(SenderType.PLAYER); setDescription("The main command for setting up EliteMobs!"); setUsage("/em setup"); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java index 7222579ec..c94084e30 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java @@ -12,7 +12,7 @@ public SetupDoneCommand() { super(List.of("setup")); addLiteral("done"); setUsage("/em setup done"); - setPermission("elitemobs.setup.done"); + setPermission("elitemobs.setup"); setDescription("Toggles whether the setup message will show up."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java index f523de7d8..89082a29f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java @@ -14,7 +14,7 @@ public SetupToggleCommand() { addLiteral("toggle"); addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList())); setUsage("/em setup toggle "); - setPermission("elitemobs.setup.toggle"); + setPermission("elitemobs.setup"); setDescription("Allows you to toggle the installation of specified EliteMobs content."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java index 2d5d0bd9b..2d005cc46 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java @@ -15,7 +15,7 @@ public ShopCustomOtherCommand() { addLiteral("custom"); addArgument("player", new ArrayList<>()); setUsage("/em shop custom "); - setPermission("elitemobs.shop.custom.player"); + setPermission("elitemobs.shop.custom.other"); setDescription("Opens the EliteMobs shop for custom items for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java index b6e84d237..a4c047071 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java @@ -13,7 +13,7 @@ public ShopDynamicCommand() { super(List.of("shop")); addLiteral("dynamic"); setUsage("/em shop dynamic"); - setPermission("elitemobs.shop.command"); + setPermission("elitemobs.shop.dynamic"); setSenderType(SenderType.PLAYER); setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java index eed677e82..f4af0c02d 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java @@ -15,7 +15,7 @@ public ShopSellOtherCommand() { addLiteral("sell"); addArgument("player", new ArrayList<>()); setUsage("/em shop sell "); - setPermission("elitemobs.shop.sell.player"); + setPermission("elitemobs.shop.sell.other"); setDescription("Opens the EliteMobs shop sell menu for the specified player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java index b183dc2fa..8f2871d95 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java @@ -21,7 +21,7 @@ public SpawnBossAtCommand() { addArgument("y", new ArrayList<>()); addArgument("z", new ArrayList<>()); setUsage("/em spawn bossAt "); - setPermission("elitemobs.spawn.boss.at"); + setPermission("elitemobs.place.admin"); setDescription("Spawns a custom boss at the specified location."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java index 2d0560276..2deb74068 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java @@ -14,7 +14,7 @@ public SpawnBossCommand() { addLiteral("boss"); addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet())); setUsage("/em spawn boss "); - setPermission("elitemobs.spawn.boss"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java index 8d6955a6e..1fe0eecfc 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java @@ -22,7 +22,7 @@ public SpawnBossLevelAtCommand() { addArgument("z", new ArrayList<>()); addArgument("level", new ArrayList<>()); setUsage("/em spawn bossAt "); - setPermission("elitemobs.spawn.boss.at.level"); + setPermission("elitemobs.place.admin"); setDescription("Spawns a custom boss at the specified location with the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3d06e9055..3ccbe9497 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -15,7 +15,7 @@ public SpawnBossLevelCommand() { 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.spawn.boss.level"); + setPermission("elitemobs.place.admin"); setSenderType(SenderType.PLAYER); setDescription("Spawns a custom boss at the location the user is looking at with the specified level."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java index 8346397de..4823c0c5e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java @@ -18,7 +18,7 @@ public SpawnElite() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn elite <...>"); - setPermission("elitemobs.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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java index bcf53598e..502bb1811 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java @@ -23,7 +23,7 @@ public SpawnEliteAtCommand() { addArgument("level", new ArrayList<>()); addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList()); setUsage("/em spawn eliteAt <...>"); - setPermission("elitemobs.spawn.elite.at"); + 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."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java index 514a88788..d0e40f1d6 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java @@ -11,7 +11,7 @@ public class SpawnTeleportCommand extends AdvancedCommand { public SpawnTeleportCommand() { super(List.of("spawntp")); - setPermission("elitemobs.spawntp"); + setPermission("elitemobs.teleport.spawn"); setUsage("/em spawntp"); setDescription("Teleports players to the server spawn."); setSenderType(SenderType.PLAYER); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java index c99e1152a..35f3162fe 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java @@ -14,6 +14,7 @@ public StartCommand() { setUsage("/em start"); setDescription("When in instanced content, makes the player start the instance."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.instance.start"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java index 27c1d144e..db5660270 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java @@ -10,7 +10,7 @@ public class StatsCommand extends AdvancedCommand { public StatsCommand() { super(List.of("stats")); setUsage("/em stats"); - setPermission("elitemobs.*"); + setPermission("elitemobs.stats"); setSenderType(SenderType.PLAYER); setDescription("Displays EliteMobs server stats."); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java index 832f2fecc..02a58b06b 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java @@ -19,6 +19,7 @@ public TrackBossCommand() { setDescription("Tracks a Custom Boss."); setUsage("/em track boss "); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.boss.track"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java index 8673dfaeb..5a321f703 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java @@ -12,9 +12,9 @@ public TransitiveBlocksCancelCommand() { super(List.of("transitiveBlocks")); addLiteral("cancel"); setUsage("/em transitiveBlocks cancel"); - setPermission("elitemobs.transitiveblocks.cancel"); setDescription("Cancels transitive block registration."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java index 2c4d4acd6..d1a14a2b8 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java @@ -15,7 +15,7 @@ public TransitiveBlocksEditAreaCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks editArea "); - setPermission("elitemobs.transitiveblocks.edit.area"); + setPermission("elitemobs.transitiveblocks"); setDescription("Edits large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); } diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java index a7274abe6..db6a54c7f 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksEditCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks edit "); - setPermission("elitemobs.transitiveblocks.edit.edit"); setDescription("Edits transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java index b869df481..c68cb1115 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksRegisterAreaCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks registerArea "); - setPermission("elitemobs.transitiveblocks.register.area"); setDescription("Registers large transitive blocks areas for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java index 4af68f83f..22504ebed 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java @@ -15,9 +15,9 @@ public TransitiveBlocksRegisterCommand() { addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList()); addArgument("type", List.of("ON_SPAWN", "ON_REMOVE")); setUsage("/em transitiveBlocks register "); - setPermission("elitemobs.transitiveblocks.register.register"); setDescription("Registers transitive blocks for use by regional bosses."); setSenderType(SenderType.PLAYER); + setPermission("elitemobs.transitiveblocks"); } @Override diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index 96882a5f4..ad1be7cba 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -476,7 +476,7 @@ public void initializeValues() { 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); - additionalKillsForRankUpPerTier = ConfigurationEngine.setInt( + baseKillsForRankUp = 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); 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 36f73b115..8669484e2 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,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; import java.util.Arrays; import java.util.List; @@ -16,7 +14,7 @@ public WoodLeagueWave15Miniboss() { "$bossLevel &4Mr. Oinkers", "15"); setFollowDistance(60); - setHelmet(new ItemStack(Material.STICK)); + setPowers(Arrays.asList("gold_explosion.yml", "gold_shotgun.yml")); setMovementSpeedAttribute(0.6D); setHealthMultiplier(3D); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d53051303..ea46282de 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.0 +version: 9.1.1 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -31,300 +31,172 @@ commands: 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 - default: true - elitemobs.shop.npc: - description: Allows players to interact with NPCs for dynamic shops - default: true - elitemobs.shop.command: - description: Allows players to open the dynamic shop menu through commands - default: true - elitemobs.customshop.npc: - description: Allows players to interact with NPCs for dynamic shops - default: true - elitemobs.customshop.command: - description: Allows players to open the dynamic shop menu through commands + elitemobs.adventurersguild.command: + description: Allows players to either teleport to the Adventurer's Guild or open the Adventurer's Guild menu default: true - elitemobs.currency.pay: - description: Allows players to run /elitemobs pay [username] [amount] + elitemobs.alt: + description: Allows players to switch menu styles default: true - elitemobs.currency.check: - description: Allows players to run /elitemobs wallet + elitemobs.arena.start: + description: Allows players to start an arena default: true - elitemobs.currency.check.others: - description: Allows players to run /elitemobs check [username] + elitemobs.debug: + description: Gives access to the debug command default: op - elitemobs.events: - description: Allows players to launch all events + elitemobs.discord.link: + description: Gives the link to EliteMobs' discord server default: true - elitemobs.checktier.others: - description: Allows players to run /elitemobs checktier [player] - default: op - elitemobs.gettier: - description: Allows players to run /elitemobs gettier [tier] + elitemobs.discord.message: + description: Allows sending debug messages to discord via DiscordSRV for testing purposes default: op - elitemobs.versionnotification: - description: Allows players to get notified about plugin updates + elitemobs.dismiss: + description: Allows admins to dismiss the initial setup message default: op - elitemobs.adventurersguild.teleport: - description: Allows players to teleport to the adventurer's guild hub using /ag - default: true - elitemobs.adventurersguild.command: - description: Allows players to rank menu using the /em adventurersguild command - default: true - elitemobs.rank.command: - description: Allows players to open the rank menu through /em rank - default: true - elitemobs.rank.npc: - description: Allows players to access the /em rank menu through NPCs - default: true - elitemobs.quest.command: - description: Allows players to take on quests via command - default: true - elitemobs.quest.npc: - description: Allows players to take on quests via EliteMobs NPC - default: true - elitemobs.dungeontp: - description: Allows players to teleport to an elitemobs-set location - default: true - elitemobs.spawntp: - description: Allows players to teleport to the default spawn location of the server. - default: true - elitemobs.back.npc: - description: Allows players to interact with an npc to go back to a previous location. - default: true - elitemobs.shareitem: - description: Shares a held Elite Item on chat. - default: true - elitemobs.scrap.npc: - description: Allows players to scrap items at an npc + elitemobs.dungeon.tp: + description: Allows players to teleport to a dungeon default: true - elitemobs.scrap.command: - description: Allows players to scrap items using a command - default: true - elitemobs.smelt.command: - description: Allows players to smelt items using a command - default: true - elitemobs.smelt.npc: - description: Allows players to smelt items using an npc - default: true - elitemobs.repair.command: - description: Allows players to use the repair command to open the menu for repairing elite items - default: true - elitemobs.repair.npc: - description: Allows players to interact with the NPC for repairing items - default: true - elitemobs.refiner.command: - description: Allows players to use the refiner command to open the menu for upgrading Elite Scrap - default: true - elitemobs.refiner.npc: - description: Allows players to interact with the NPC for upgrading Elite Scrap - default: true - elitemobs.enhancer.command: - description: Allows players to use the enhancer command to open the menu for upgrading Elite Items - default: true - elitemobs.enhancer.npc: - description: Allows players to interact with the NPC for upgrading Elite Items - default: true - elitemobs.unbind.command: - description: Allows players to use the unbind command to open the menu to unbind Elite Items - 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 - elitemobs.enchant.npc: - description: Allows players to interact with the enchanter NPC to enchant Elite Items + elitemobs.command: + description: Allows players to use the main command of the plugin default: true elitemobs.enchant.command: - description: Allows players to use the enchant command to enchant Elite Items - default: true - elitemobs.arena.menu: - description: Allows players to open the Arena menu and join an Arena. - default: true - elitemobs.debug: - description: Allows players to have access to the player/bosses debug command. - default: true - elitemobs.discord.link: - description: Allows players to have access to the Discord link command. + description: Allows players to use the enchant command default: true - elitemobs.discord.message: - description: Allows players to have access to the DiscordSRV message debug command. - default: op elitemobs.event.start: - description: Allows players to start specific events. + description: Allows admins to manually launch an event default: op elitemobs.fireball: - description: Allows players to shoot a fireball at the pointer's location. + description: Allows admins to fire an elite fireball for terrain destruction testing purposes default: op elitemobs.help: - description: Allows players to see all available EliteMobs commands. - default: op - elitemobs.kill.kill: - description: Allows players to kill all elites. - default: op - elitemobs.kill.radius: - description: Allows players to kill all elites in the specified radius. - default: op - elitemobs.kill.type: - description: Allows players to kill all elites of the specified type. - default: op - elitemobs.kill.type.radius: - description: Allows players to kill all elites of the specified type within the given radius. + description: Allows players to run the help command + default: true + elitemobs.kill.command: + description: Allows admins to run the kill commands to kill elites default: op elitemobs.language: - description: Allows players to set the language that the server will use for EliteMobs. + 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.loot.debug: - description: Allows players to equip themselves with a complete armor set, weapons set of the specified level, and food for testing purposes. - default: op - elitemobs.loot.give: - description: Allows players to give the specified loot to a specific player. - default: op - elitemobs.loot.menu: - description: Allows players to open the loot menu and select any loot they want. + description: Gives admins a set of gear of a specific level for testing purposes default: op - elitemobs.loot.random: - description: Allows players to get random loot of the specified level. - default: op - elitemobs.loot.simulate: - description: Allows players to get simulated loot drops for the specified level and player. - default: op - elitemobs.loot.simulate.times: - description: Allows players to get simulated loot drops for a specified number of times for the given level and player. + elitemobs.loot.admin: + description: Lets admins give or obtain EliteMobs loot via command default: op elitemobs.loot.stats: - description: Allows players to see EliteMobs stats for the currently held item. - default: true - elitemobs.loot.stats: - description: Allows players to see EliteMobs stats for the currently held item. - default: op - elitemobs.money.add.all: - description: Allows players to give every player on the server the specified amount of money. + description: Gives the elite stats of gear, for debugging purposes default: op - elitemobs.money.add.player: - description: Allows players to give the specified amount of money to the designated player. + elitemobs.money.admin: + description: Allows admins to manually manipulate player elite currency default: op elitemobs.money.check.self: - description: Allows players to check their EliteMobs currency. + description: Allows users to check their balance default: true - elitemobs.money.check.player: - description: Allows players to check the currency of the specified player. - default: op - elitemobs.money.remove: - description: Allows players to deduct the specified amount of currency from a player. - default: op - elitemobs.money.set: - description: Allows players to set the specified amount of currency for the specified player. - default: op - elitemobs.package: - description: Allows players to package an EliteMobs dungeon for distribution. - default: op - elitemobs.place.boss: - description: Allows players to add a spawn location for the specified boss at their current location. + elitemobs.money.check.others: + description: Allows users to check their balance default: op - elitemobs.place.npc: - description: Allows players to permanently add an NPC to the location the user is standing on. + elitemobs.dungeon.package: + description: Allows admins to package EliteMobs content for distribution default: op - elitemobs.place.treasure: - description: Allows players to permanently add a treasure chest to the location the user is standing on. - default: op - elitemobs.place.wormhole: - description: Allows players to permanently add a wormhole teleport at their current location. + elitemobs.money.pay: + description: Allows users to check their balance + default: true + 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.quest.bypass: - description: Allows players to bypass permission restrictions for elite quests. + description: Allows users to accept a quest default: op - elitemobs.quest.complete: - description: Allows players to force complete all of their currently active elite quests. For debugging use only. + 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 players to leave a quest. Used via menu, can't be directly used. - default: op + description: Allows users to leave a quest + default: true elitemobs.quest.reset.all: - description: Allows players to reset all quests for a specific player. + description: Allows admins to reset all quests for a specific player default: op - elitemobs.quest.reset.quest: - description: Allows players to reset a specific quest for a specific player. + 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.quit: + description: Allows players to quit instanced content + default: true + elitemobs.rank.command: + description: Allows players to join open the rank menu of EliteMobs + default: true elitemobs.rank.set: - description: Allows players to manually set a player's guild rank to a the prestige level and guild level specified. + description: Allows admins to set a specific EliteMobs rank for a specific player default: op elitemobs.reload: - description: Allows players to reload EliteMobs. + description: Allows admins to reload EliteMobs default: op elitemobs.remove: - description: Allows players to toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content. + description: Allows admins to use the remove command default: op - elitemobs.respawn: - description: Allows players to force respawn all regional bosses. - default: op - elitemobs.setup.main: - description: Allows players to have access to the main command for setting up EliteMobs. - default: op - elitemobs.setup.done: - description: Allows players to toggle whether the setup message will show up in the server chat. + 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.setup.toggle: - description: Allows players to toggle the installation of specified EliteMobs content. + 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: Allows players to use the share item command + default: true elitemobs.shop.custom: - description: Allows players to open the EliteMobs shop for custom items for the specified player. - default: op - elitemobs.shop.sell.player: - description: Allows players to open the EliteMobs shop for custom items for the specified player. - default: op - elitemobs.spawn.boss.at: - description: Allows players to spawn a custom boss at the specified location. - default: op - elitemobs.spawn.boss: - description: Allows players to spawn a custom boss at the location the player is looking at. - default: op - elitemobs.spawn.boss.at.level: - description: Allows players to spawn a custom boss at the specified location with the specified level. - default: op - elitemobs.spawn.boss.level: - description: Allows players to spawn a custom boss at the location the user is looking at with the specified level. - default: op - elitemobs.spawn.elite: - description: Allows players to spawn an elite of a specified type and level, optionally with specific powers, at the targeted location. - default: op - elitemobs.spawn.elite.at: - description: Allows players to spawn an elite of the specified type and level, optionally with specified powers, at the chosen location. - default: op - elitemobs.transitiveblocks.cancel: - description: Allows players to cancel transitive block registration. + description: Allows players to use custom shop command + default: true + elitemobs.shop.custom.other: + description: Allows admins to open the custom shop for other people default: op - elitemobs.transitiveblocks.edit.area: - description: Allows players to edit large transitive blocks areas for use by regional bosses. + elitemobs.shop.dynamic: + description: Allows players to use dynamic shop command + default: true + elitemobs.shop.dynamic.other: + description: Allows admins to open the dynamic shop for other people default: op - elitemobs.transitiveblocks.edit.edit: - description: Allows players to edit transitive blocks for use by regional bosses. + elitemobs.shop.sell.other: + description: Allows admins to open the sell shop for other people default: op - elitemobs.transitiveblocks.register.area: - description: Allows players to register large transitive blocks areas for use by regional bosses. + elitemobs.teleport.spawn: + description: Allows players to use the spawn teleport command + default: true + elitemobs.instance.start: + description: Allows players to use the start command in instances + default: true + elitemobs.stats: + description: Allows admins to get stats related to EliteMobs default: op - elitemobs.transitiveblocks.register.register: - description: Allows players to register transitive blocks for use by regional bosses. + elitemobs.boss.track: + description: Allows players to track trackable bosses + default: true + 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.unbind.force: - description: Allows players to forcefully unbind a held item. + description: Allows admins to force unbind a held item via command default: op elitemobs.version: - description: Allows players to check the server's EliteMobs plugin version. - default: op + description: Allows admins to check the plugin version of EliteMobs + default: op \ No newline at end of file From 15828278c029dca83baf8d988c44c1d888e13470 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 4 Aug 2024 22:36:03 +0100 Subject: [PATCH 70/78] EliteMobs 9.1.2: - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../elitemobs/dungeons/DungeonProtector.java | 14 +++ .../instanced/dungeons/DungeonInstance.java | 107 +++++++++++++----- src/main/resources/plugin.yml | 39 ++++++- 4 files changed, 128 insertions(+), 34 deletions(-) diff --git a/build.gradle b/build.gradle index 916d080a4..5edfba4a0 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.1' +version '9.1.2' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 8a6e469be..950e208b0 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -1,6 +1,7 @@ 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; @@ -10,6 +11,9 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEvent; + +import java.util.Locale; public class DungeonProtector implements Listener { @@ -64,6 +68,7 @@ public void preventTntPrimeEvent(TNTPrimeEvent event) { @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); } @@ -113,5 +118,14 @@ public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { event.setCancelled(true); } + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void preventVanillaMobSpawning(PlayerInteractEvent event) { + if (!EliteMobsWorld.isEliteMobsWorld(event.getPlayer().getWorld().getUID())) return; + if (event.getClickedBlock() == null) return; + Material material = event.getClickedBlock().getType(); + if (material.toString().toLowerCase(Locale.ROOT).endsWith("_door") || + material.toString().toLowerCase(Locale.ROOT).endsWith("_trapdoor")) + event.setCancelled(true); + } } 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 2c0007530..93d9e344c 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -72,14 +72,7 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, 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); - TreasureChest.initializeInstancedTreasureChests(dungeonPackagerConfigFields.getWorldName(), world); - } - }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); + new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); } @@ -108,7 +101,7 @@ public static void setupInstancedDungeon(Player player, String instancedDungeonC new BukkitRunnable() { @Override public void run() { - initializeInstancedWorld(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); } }.runTask(MetadataHandler.PLUGIN); }); @@ -146,8 +139,6 @@ protected static DungeonInstance initializeInstancedWorld(DungeonPackagerConfigF 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()); @@ -206,14 +197,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 @@ -236,10 +220,6 @@ public void removeInstance() { 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); @@ -247,13 +227,7 @@ public void run() { Logger.warn("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 - //} + new RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } }.runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world } @@ -295,4 +269,77 @@ 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() { + WorldInstantiator.recursivelyDelete(instancedWorldFile); + } + }.runTaskLaterAsynchronously(MetadataHandler.PLUGIN, 20L * 60 * 2); //wait 2 minutes after unloading world before removing files + } + } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ea46282de..16389f548 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.1 +version: 9.1.2 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 @@ -33,7 +33,10 @@ permissions: description: Gives access to all elitemobs commands default: op elitemobs.adventurersguild.command: - description: Allows players to either teleport to the Adventurer's Guild or open the Adventurer's Guild menu + 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 @@ -131,6 +134,9 @@ permissions: elitemobs.quest.track: description: Allows players to track the objectives of a quest default: true + elitemobs.quest.npc: + description: Allows players to talk to quest npcs + default: true elitemobs.quit: description: Allows players to quit instanced content default: true @@ -199,4 +205,31 @@ permissions: default: op elitemobs.version: description: Allows admins to check the plugin version of EliteMobs - default: op \ No newline at end of file + default: op + elitemobs.rank.npc: + description: Allows players to talk to the rank npc + default: true + elitemobs.shop.dynamic.npc: + description: Allows players to talk to the dynamic shop npc + default: true + elitemobs.shop.custom.npc: + description: Allows players to talk to the custom shop npc + default: true + elitemobs.shop.sell.npc: + description: Allows players to talk to the sell shop npc + default: true + 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 talk to the unbind npc + default: true + elitemobs.enchant.npc: + description: Allows players to talk to the enchant npc + default: true \ No newline at end of file From 2673a2d12f65f65d1320e945fbfbbdef0d0837a6 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 8 Aug 2024 11:35:48 +0100 Subject: [PATCH 71/78] EliteMobs 9.1.3: - [New] Added the Dark Cathedral remake! - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [New] Added the scale setting to NPCs to allow for NPC scaling - [Fix] Fixed problem that was causing dungeon instantiation to not delete correctly and the recovery code on startup to not clear instanced dungeons on startup - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers - [Fix] Slimes and similar entities no longer constantly trigger the antiexploit - [Fix] Fixed the /em quest reset all by renaming it to /em quest resetAll Signed-off-by: MagmaGuy --- build.gradle | 4 +-- .../api/EliteMobDamagedByPlayerEvent.java | 2 ++ .../PreventPathfindingExploit.java | 2 ++ .../elitemobs/commands/CommandHandler.java | 1 + .../commands/QuestResetAllCommand.java | 5 ++- ...thedralLair.off => DarkCathedralLair.java} | 3 +- .../WorldInstancedDungeonPackage.java | 16 +++++++++ .../dungeons/utility/DungeonUtils.java | 2 ++ .../instanced/dungeons/DungeonInstance.java | 33 +++++++------------ src/main/resources/plugin.yml | 2 +- 10 files changed, 40 insertions(+), 30 deletions(-) rename src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/{DarkCathedralLair.off => DarkCathedralLair.java} (92%) diff --git a/build.gradle b/build.gradle index 5edfba4a0..8c5b4d6e0 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.2' +version '9.1.3' repositories { maven { @@ -50,7 +50,7 @@ repositories { //MagmaCore maven { - url = 'http://magmaguy.com:50001/releases' + url = 'https://repo.magmaguy.com/releases' allowInsecureProtocol = true } diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java index 8c0359157..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; @@ -255,6 +256,7 @@ 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) return; 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 6380c0f63..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,7 @@ 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; @@ -16,6 +17,7 @@ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent 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/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 5f907c5d4..482ab6632 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -68,6 +68,7 @@ public static void registerCommands() { emCommand.registerCommand(new SpawnEliteAtCommand()); emCommand.registerCommand(new DiscordMessageCommand()); emCommand.registerCommand(new DiscordCommand()); + emCommand.registerCommand(new MoneyRemoveCommand()); //User commands // emCommand.registerCommand(new AdventurersGuildCommand()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java index 9f4915e63..18b968908 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java @@ -10,10 +10,9 @@ public class QuestResetAllCommand extends AdvancedCommand { public QuestResetAllCommand() { super(List.of("quest")); - addLiteral("reset"); - addLiteral("all"); + addLiteral("resetAll"); addArgument("player", new ArrayList<>()); - setUsage("/em quest reset all "); + setUsage("/em quest resetAll "); setPermission("elitemobs.quest.reset.all"); setDescription("Resets all quests for a specific player."); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java similarity index 92% rename from src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off rename to src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java index bb967a2c7..0b99ab3b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/DarkCathedralLair.java @@ -17,7 +17,7 @@ public DarkCathedralLair() { DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_the_dark_cathedral", - World.Environment.NETHER, + World.Environment.NORMAL, true, "em_the_dark_cathedral,47.5,85.2,199.5,163,0", 0, @@ -29,6 +29,5 @@ public DarkCathedralLair() { "&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/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index c208a1f1c..40e6829f4 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -4,6 +4,9 @@ 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,19 @@ 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()){ + Logger.debug("world name: " + worldFile.getName()); + Logger.debug("current name: " + file.getName()); + 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/utility/DungeonUtils.java b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java index 9e63ac406..90504c1ad 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -69,9 +69,11 @@ public static World loadWorld(String worldName, World.Environment environment, D try { WorldCreator worldCreator = new WorldCreator(worldName); worldCreator.environment(environment); + worldCreator.keepSpawnInMemory(false); World world = Bukkit.createWorld(worldCreator); if (world != null) world.setKeepSpawnInMemory(false); world.setDifficulty(Difficulty.HARD); + world.setAutoSave(false); Bukkit.getLogger().setFilter(previousFilter); EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); 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 93d9e344c..94b26f0c1 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/dungeons/DungeonInstance.java @@ -21,6 +21,7 @@ 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; @@ -71,7 +72,6 @@ public DungeonInstance(DungeonPackagerConfigFields dungeonPackagerConfigFields, this.difficultyName = difficultyName; setDifficulty(difficultyName); addNewPlayer(player); - DungeonInstance dungeonInstance = this; new InitializeEntitiesTask(this, dungeonPackagerConfigFields, world).runTaskLater(MetadataHandler.PLUGIN, 20 * 3L); dungeonInstances.add(this); super.permission = dungeonPackagerConfigFields.getPermission(); @@ -98,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() { - new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); - } - }.runTask(MetadataHandler.PLUGIN); + new InitializeInstancedWorldTask(instancedDungeonsConfigFields, instancedWorldName, player, file, difficultyName).runTask(MetadataHandler.PLUGIN); }); } @@ -217,19 +212,7 @@ public void removeInstance() { return; } world.getEntities().forEach(entity -> EntityTracker.unregister(entity, RemovalReason.WORLD_UNLOAD)); - new BukkitRunnable() { - @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 RemoveInstanceTask(dungeonInstance, instancedWorldFile).runTaskLater(MetadataHandler.PLUGIN, 20 * 30L); //wait 30 seconds before unloading world - } - }.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) { @@ -276,7 +259,11 @@ private static class InitializeInstancedWorldTask extends BukkitRunnable { private final File file; private final String difficultyName; - public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, String instancedWorldName, Player player, File file, String difficultyName) { + public InitializeInstancedWorldTask(DungeonPackagerConfigFields instancedDungeonsConfigFields, + String instancedWorldName, + Player player, + File file, + String difficultyName) { this.instancedDungeonsConfigFields = instancedDungeonsConfigFields; this.instancedWorldName = instancedWorldName; this.player = player; @@ -337,7 +324,9 @@ public void run() { new BukkitRunnable() { @Override public void run() { - WorldInstantiator.recursivelyDelete(instancedWorldFile); + 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/resources/plugin.yml b/src/main/resources/plugin.yml index 16389f548..75c1f5688 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.2 +version: 9.1.3 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From fd05cee98d91f40b5460a20fc35c36fa2cb671d3 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 11 Aug 2024 23:01:22 +0100 Subject: [PATCH 72/78] EliteMobs 9.1.3: - [New] Updated to Minecraft 1.21.1 - [New] Elite protection of dungeons now blocks doors and trapdoors correctly as intended - [New] Named dungeon instancing tasks on timings to allow better debugging and optimizations - [New] Added the scale setting to NPCs to allow for NPC scaling - [New] Now correctly preventing players from dumping buckets in elitemobs worlds - [New] Now correctly defaulting to allowing liquid flow in elitemobs worlds, can be configured per-dungeon package to allow or deny through the settings `allowLiquidFlow` in the dungeon packager config - [New] Added the ability to play songs in dungeon packager content using the `song` setting with the same method and syntax as the custom boss song system - [New] Added /em protection bypass command to bypass dungeon protections and edit the world - [Fix] Fixed problem that was causing dungeon instantiation to not delete correctly and the recovery code on startup to not clear instanced dungeons on startup - [Fix] Frosted ice from ice walker now correctly melts in dungeons - [Fix] Fixed new permissions not allowing players to use /ag to teleport to the adventurer's guild - [Fix] Fixed new permissions now allowing players to talk to quest givers - [Fix] Slimes and similar entities no longer constantly trigger the antiexploit - [Fix] Fixed the /em quest reset all by renaming it to /em quest resetAll Signed-off-by: MagmaGuy --- build.gradle | 9 +- .../com/magmaguy/elitemobs/EliteMobs.java | 2 + .../magmaguy/elitemobs/EventsRegistrer.java | 3 + .../elitemobs/commands/CommandHandler.java | 1 + .../DungeonPackagerConfigFields.java | 8 + .../premade/DarkCathedralLair.java | 3 +- .../elitemobs/dungeons/DungeonProtector.java | 35 ++++- .../elitemobs/dungeons/EliteMobsWorld.java | 1 + .../WorldInstancedDungeonPackage.java | 2 - .../elitemobs/dungeons/WorldPackage.java | 5 + .../dungeons/utility/DungeonUtils.java | 50 +------ .../custombosses/BossMusic.java | 139 ------------------ .../elitemobs/powers/scripts/ScriptZone.java | 63 ++++---- src/main/resources/plugin.yml | 5 +- 14 files changed, 106 insertions(+), 220 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/BossMusic.java diff --git a/build.gradle b/build.gradle index 8c5b4d6e0..e7f928347 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,10 @@ repositories { //MagmaCore maven { url = 'https://repo.magmaguy.com/releases' - allowInsecureProtocol = true + } + //MagmaCore + maven { + url = 'https://repo.magmaguy.com/snapshots' } //Bstats API @@ -110,8 +113,8 @@ dependencies { 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.12.0' - implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.8' + implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.13.0' + implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT' } diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index a27940735..f5b6a62a6 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -38,6 +38,7 @@ 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.CustomMusic; import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity; import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity; import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties; @@ -337,6 +338,7 @@ public void onDisable() { Navigation.shutdown(); BossBarUtil.shutdown(); ScriptAction.shutdown(); + CustomMusic.shutdown(); Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); MagmaCore.shutdown(); diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 4eb7bc8b8..5f832fc28 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -325,6 +325,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()); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java index 482ab6632..dfe83b9f2 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java @@ -69,6 +69,7 @@ public static void registerCommands() { emCommand.registerCommand(new DiscordMessageCommand()); emCommand.registerCommand(new DiscordCommand()); emCommand.registerCommand(new MoneyRemoveCommand()); + emCommand.registerCommand(new ProtectionBypassCommand()); //User commands // emCommand.registerCommand(new AdventurersGuildCommand()); 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 ec81efad7..e48e6b2b4 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/DungeonPackagerConfigFields.java @@ -102,6 +102,12 @@ public class DungeonPackagerConfigFields extends CustomConfigFields { @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); @@ -283,6 +289,8 @@ public void processConfigFields() { 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(); } 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 0b99ab3b6..bb967a2c7 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 @@ -17,7 +17,7 @@ public DarkCathedralLair() { DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_the_dark_cathedral", - World.Environment.NORMAL, + World.Environment.NETHER, true, "em_the_dark_cathedral,47.5,85.2,199.5,163,0", 0, @@ -29,5 +29,6 @@ public DarkCathedralLair() { "&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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 950e208b0..cb4e81cb9 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -11,21 +11,40 @@ import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerInteractEvent; +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); } @@ -38,6 +57,7 @@ public void preventBlockBurnDamage(BlockBurnEvent event) { @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); } @@ -75,12 +95,15 @@ public void preventBlockFadeEvent(BlockFadeEvent event) { @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); } @@ -93,6 +116,15 @@ public void preventBlockFire(BlockIgniteEvent event) { @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); } @@ -119,9 +151,10 @@ public void preventFriendlyFireInDungeon(EntityDamageByEntityEvent event) { } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void preventVanillaMobSpawning(PlayerInteractEvent event) { + 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")) diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java index c746bd6f2..abac43260 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/EliteMobsWorld.java @@ -9,6 +9,7 @@ public class EliteMobsWorld { private static final HashMap eliteMobsWorlds = new HashMap<>(); + @Getter private final DungeonPackagerConfigFields dungeonPackagerConfigFields; @Getter private final boolean allowExplosions; diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java index 40e6829f4..efee487af 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldInstancedDungeonPackage.java @@ -31,8 +31,6 @@ public void baseInitialization() { } else { //This removes all instanced worlds not previously correctly removed for (File worldFile : Bukkit.getWorldContainer().listFiles()){ - Logger.debug("world name: " + worldFile.getName()); - Logger.debug("current name: " + file.getName()); if (worldFile.getName().contains(file.getName()) && worldFile.getName().matches(".*_\\d{1,2}$")) { try{ FileUtils.deleteDirectory(worldFile); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java index 8591340ff..dac8d1c87 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/WorldPackage.java @@ -2,6 +2,7 @@ import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; import com.magmaguy.elitemobs.dungeons.utility.DungeonUtils; +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; @@ -54,6 +55,8 @@ 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,6 +69,8 @@ public boolean install(Player player) { dungeonPackagerConfigFields.installWorld(); player.teleport(dungeonPackagerConfigFields.getTeleportLocation()); world = dungeonPackagerConfigFields.getTeleportLocation().getWorld(); + if (dungeonPackagerConfigFields.getSong() != null) + new CustomMusic(dungeonPackagerConfigFields.getSong(), dungeonPackagerConfigFields, world); // WorldGuardCompatibility.protectWorldMinidugeonArea(dungeonPackagerConfigFields.getTeleportLocation()); for (Wormhole wormhole : Wormhole.getWormholes()) wormhole.onDungeonInstall(dungeonPackagerConfigFields.getFilename()); 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 90504c1ad..65069d565 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/utility/DungeonUtils.java @@ -5,19 +5,13 @@ import com.magmaguy.elitemobs.dungeons.WorldDungeonPackage; import com.magmaguy.elitemobs.dungeons.WorldPackage; import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity; -import com.magmaguy.magmacore.util.Logger; +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) { @@ -46,45 +40,9 @@ public static World loadWorld(WorldPackage worldPackage) { } public static World loadWorld(String worldName, World.Environment environment, DungeonPackagerConfigFields dungeonPackagerConfigFields) { - if (Bukkit.getWorld(worldName) != null) { - EliteMobsWorld.create(Bukkit.getWorld(worldName).getUID(), dungeonPackagerConfigFields); - return Bukkit.getWorld(worldName); - } - - File folder = new File(Bukkit.getWorldContainer().getAbsolutePath()); - - if (!Files.exists(Paths.get(folder.getAbsolutePath() + File.separatorChar + worldName))) { - Logger.warn("File " + folder.getAbsolutePath() + File.separatorChar + worldName + " does not exist!"); - return null; - } - - Logger.info("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); - worldCreator.keepSpawnInMemory(false); - World world = Bukkit.createWorld(worldCreator); - if (world != null) world.setKeepSpawnInMemory(false); - world.setDifficulty(Difficulty.HARD); - world.setAutoSave(false); - Bukkit.getLogger().setFilter(previousFilter); - - EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); - - return world; - } catch (Exception exception) { - Bukkit.getLogger().setFilter(previousFilter); - Logger.warn("Failed to load world " + worldName + " !"); - exception.printStackTrace(); - } - return null; + World world = WorldLoader.loadVoidTemporaryWorld(worldName, environment); + if (world != null) EliteMobsWorld.create(world.getUID(), dungeonPackagerConfigFields); + return world; } public static boolean unloadWorld(WorldPackage worldPackage) { 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 26ca95ece..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.magmacore.util.Logger; -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<>(); - private final CustomBossEntity customBossEntity; - @Getter - private String name; - @Getter - private int durationTicks; - @Getter - private String name2 = null; - @Getter - private int durationTicks2 = -1; - private BukkitTask bukkitTask = null; - - //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: - Logger.warn("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/powers/scripts/ScriptZone.java b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java index 2fea67379..e066f3348 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptZone.java @@ -56,32 +56,7 @@ public void startZoneListener(EliteEntity eliteEntity) { if (!zoneListener) return; entitiesInZone = new HashSet<>(); ScriptActionData scriptActionData = new ScriptActionData(eliteEntity, targets, this); - new BukkitRunnable() { - @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; - } - }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); + new ZoneListenerTask(eliteEntity, scriptActionData).runTaskTimer(MetadataHandler.PLUGIN, 0, 1); } public void ZoneEnterEvent(EliteEntity eliteEntity, LivingEntity livingEntity) { @@ -208,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 @@ -267,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/resources/plugin.yml b/src/main/resources/plugin.yml index 75c1f5688..214631d41 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -232,4 +232,7 @@ permissions: default: true elitemobs.enchant.npc: description: Allows players to talk to the enchant npc - default: true \ No newline at end of file + default: true + elitemobs.protection.bypass: + description: Allows players to run the bypass command to toggle bypassing dungeon protections + default: op \ No newline at end of file From 3e69cdc4e79a4f1098586d991c30836fb583d453 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Thu, 22 Aug 2024 21:37:21 +0100 Subject: [PATCH 73/78] EliteMobs 9.1.4: - [New] Players can no longer open doors and trapdoors in elite worlds, as intended by the map design - [New] Added debug field to scripts to show a debug particle at the target location of scripts - [New] Landing location is now inherited through scripts - [New] Elite slimes no longer split when killed, fixing a number of bugs - [New] Fixed arena farming being too efficient by both tweaking rewards but also applying all limiters that exist in other elitemobs content to arenas (minimum guild rank requirements for looting from certain levels, maximum difference between player level and mob level) - [Fix] Fixed problem with reinforcement power in arena fights - [Fix] Language command now switches back to english correctly - [Fix] Teleporting directly to a dungeon via teleports page no longer risks being sent back via wormhole - [Fix] Fixed several problems that made FinalTarget script targets not behave the same way as normal targets are supposed to - [Fix] Elite silverfish can no longer enter blocks - [Fix] Fixed guild request text for bedrock-compatible menus - [Fix] Fixed all default wormhole locations - [Fix] Now using a more appropriate api version of FreeMinecraftModels Signed-off-by: MagmaGuy --- build.gradle | 4 +- .../magmaguy/elitemobs/EventsRegistrer.java | 1 + .../GuildRankMenuHandler.java | 5 +- .../AlternativeDurabilityLoss.java | 4 +- .../EliteSlimeDeathSplit.java | 53 +------- .../elitemobs/commands/DungeonCommands.java | 5 +- .../elitemobs/commands/LanguageCommand.java | 7 +- .../elitemobs/commands/QuestLeaveCommand.java | 2 + .../commands/SpawnBossLevelCommand.java | 2 +- .../elitemobs/commands/setup/SetupMenu.java | 4 +- .../elitemobs/config/ItemSettingsConfig.java | 6 +- ...roceduralItemGenerationSettingsConfig.java | 21 ++-- .../elitemobs/config/QuestsConfig.java | 9 +- .../config/commands/CommandsConfig.java | 6 +- .../customarenas/premade/WoodLeagueArena.java | 118 +++++++++--------- .../CustomBossesConfigFields.java | 4 +- .../premade/AlphaWerewolfP1Boss.java | 14 +-- .../premade/AlphaWerewolfP2Boss.java | 15 +-- .../custombosses/premade/ArmorGoblinBoss.java | 13 +- .../custombosses/premade/BalrogConfig.java | 9 +- .../custombosses/premade/BeastMasterBoss.java | 10 +- .../custombosses/premade/BetaWolfBoss.java | 3 +- .../custombosses/premade/BlayyzeConfig.java | 8 +- .../premade/CharmsGoblinBoss.java | 13 +- .../custombosses/premade/CoinsGoblinBoss.java | 9 +- .../custombosses/premade/FireFaeConfig.java | 4 +- .../premade/GamaWerewolfBoss.java | 7 +- .../custombosses/premade/IceFaeConfig.java | 4 +- .../KillerRabbitOfCaerbannogConfig.java | 7 +- .../custombosses/premade/KrakenConfig.java | 7 +- .../premade/LightningFaeConfig.java | 4 +- .../custombosses/premade/OmegaWolfBoss.java | 5 +- .../premade/PillagerCaravanBeastBoss.java | 3 +- .../premade/PillagerCaravanGuardBoss.java | 3 +- .../premade/PillagerCaravanLeaderBoss.java | 11 +- .../custombosses/premade/QueenBeeBoss.java | 9 +- .../custombosses/premade/SnoopyConfig.java | 4 +- .../premade/TestCustomBossesConfig.java | 9 +- .../premade/TheLivingDeadConfig.java | 5 +- .../premade/TotemZombie1Boss.java | 5 +- .../premade/TotemZombie2Boss.java | 5 +- .../premade/TotemZombie3Boss.java | 5 +- .../premade/TotemZombie4Boss.java | 5 +- .../premade/TotemZombie5Boss.java | 5 +- .../premade/TotemZombie6Boss.java | 5 +- .../premade/TreasureGoblinBoss.java | 9 +- .../premade/WeaponsGoblinBoss.java | 13 +- .../premade/WoodLeagueWave10Boss.java | 7 +- .../premade/WoodLeagueWave11Melee.java | 3 +- .../premade/WoodLeagueWave11Ranged.java | 3 +- .../premade/WoodLeagueWave12Melee.java | 3 +- .../premade/WoodLeagueWave12Ranged.java | 3 +- .../premade/WoodLeagueWave13Melee.java | 5 +- .../premade/WoodLeagueWave13Ranged.java | 5 +- .../premade/WoodLeagueWave14Melee.java | 3 +- .../premade/WoodLeagueWave14Ranged.java | 3 +- .../premade/WoodLeagueWave15Miniboss.java | 4 +- .../premade/WoodLeagueWave16Melee.java | 4 +- .../premade/WoodLeagueWave16Ranged.java | 3 +- .../premade/WoodLeagueWave17Melee.java | 5 +- .../premade/WoodLeagueWave17Ranged.java | 5 +- .../premade/WoodLeagueWave18Melee.java | 6 +- .../premade/WoodLeagueWave19Ranged.java | 5 +- .../premade/WoodLeagueWave20Boss.java | 4 +- .../premade/WoodLeagueWave21Melee.java | 4 +- .../premade/WoodLeagueWave21Ranged.java | 4 +- .../premade/WoodLeagueWave22Melee.java | 4 +- .../premade/WoodLeagueWave22Ranged.java | 4 +- .../premade/WoodLeagueWave23Melee.java | 4 +- .../premade/WoodLeagueWave23Ranged.java | 4 +- .../premade/WoodLeagueWave24Melee.java | 4 +- .../premade/WoodLeagueWave24Ranged.java | 4 +- .../premade/WoodLeagueWave25Miniboss.java | 4 +- .../premade/WoodLeagueWave26Melee.java | 4 +- .../premade/WoodLeagueWave26Ranged.java | 4 +- .../premade/WoodLeagueWave27Melee.java | 4 +- .../premade/WoodLeagueWave27Ranged.java | 4 +- .../premade/WoodLeagueWave28Melee.java | 4 +- .../premade/WoodLeagueWave29Ranged.java | 4 +- .../premade/WoodLeagueWave30Boss.java | 4 +- .../premade/WoodLeagueWave31Melee.java | 4 +- .../premade/WoodLeagueWave31Ranged.java | 4 +- .../premade/WoodLeagueWave32Melee.java | 4 +- .../premade/WoodLeagueWave32Ranged.java | 4 +- .../premade/WoodLeagueWave33Melee.java | 4 +- .../premade/WoodLeagueWave33Ranged.java | 4 +- .../premade/WoodLeagueWave34Melee.java | 4 +- .../premade/WoodLeagueWave34Ranged.java | 4 +- .../premade/WoodLeagueWave35Miniboss.java | 4 +- .../premade/WoodLeagueWave36Melee.java | 4 +- .../premade/WoodLeagueWave36Ranged.java | 4 +- .../premade/WoodLeagueWave37Melee.java | 4 +- .../premade/WoodLeagueWave37Ranged.java | 4 +- .../premade/WoodLeagueWave38Melee.java | 4 +- .../premade/WoodLeagueWave39Ranged.java | 4 +- .../premade/WoodLeagueWave3Melee.java | 3 +- .../premade/WoodLeagueWave3Ranged.java | 3 +- .../premade/WoodLeagueWave40Boss.java | 4 +- .../premade/WoodLeagueWave41Melee.java | 4 +- .../premade/WoodLeagueWave41Ranged.java | 4 +- .../premade/WoodLeagueWave42Healer.java | 3 +- .../premade/WoodLeagueWave42Melee.java | 5 +- .../premade/WoodLeagueWave42Ranged.java | 5 +- .../premade/WoodLeagueWave43Healer.java | 3 +- .../premade/WoodLeagueWave43Melee.java | 5 +- .../premade/WoodLeagueWave43Ranged.java | 5 +- .../premade/WoodLeagueWave44Healer.java | 3 +- .../premade/WoodLeagueWave44Melee.java | 5 +- .../premade/WoodLeagueWave44Ranged.java | 5 +- .../premade/WoodLeagueWave45Miniboss.java | 5 +- .../premade/WoodLeagueWave46Healer.java | 3 +- .../premade/WoodLeagueWave46Melee.java | 5 +- .../premade/WoodLeagueWave46Ranged.java | 5 +- .../premade/WoodLeagueWave47Healer.java | 3 +- .../premade/WoodLeagueWave47Melee.java | 5 +- .../premade/WoodLeagueWave47Ranged.java | 5 +- .../premade/WoodLeagueWave48Healer.java | 3 +- .../premade/WoodLeagueWave48Melee.java | 5 +- .../premade/WoodLeagueWave49Healer.java | 3 +- .../premade/WoodLeagueWave49Ranged.java | 5 +- .../premade/WoodLeagueWave50Boss.java | 10 +- .../premade/WoodLeagueWave50BossP2.java | 7 +- .../premade/WoodLeagueWave50BossP3.java | 7 +- .../WoodLeagueWave50Reinforcement.java | 3 +- .../premade/WoodLeagueWave5Miniboss.java | 4 +- .../premade/WoodLeagueWave7Melee.java | 4 +- .../premade/WoodLeagueWave7Ranged.java | 3 +- .../premade/WoodLeagueWave8Melee.java | 3 +- .../premade/WoodLeagueWave9Ranged.java | 3 +- .../custombosses/premade/ZombieKingBoss.java | 7 +- .../customevents/premade/BalrogEvent.java | 6 +- .../config/customevents/premade/FaeEvent.java | 9 +- .../premade/BerserkerCharmConfig.java | 6 +- .../premade/ChallengersBootsConfig.java | 7 +- .../premade/ChallengersChestplateConfig.java | 7 +- .../premade/ChallengersHelmetConfig.java | 7 +- .../premade/ChallengersLeggingsConfig.java | 7 +- .../premade/ChallengersSwordConfig.java | 7 +- .../premade/ChameleonCharmConfig.java | 6 +- .../premade/CheetahCharmConfig.java | 6 +- .../premade/DepthsSeekerConfig.java | 9 +- .../premade/DwarvenGreedConfig.java | 9 +- .../premade/ElephantCharmConfig.java | 6 +- .../premade/FireflyCharmConfig.java | 4 +- .../customitems/premade/FishyCharmConfig.java | 4 +- .../premade/GoblinBallistaItem.java | 4 +- .../customitems/premade/GoblinBootsItem.java | 4 +- .../premade/GoblinChestplateItem.java | 4 +- .../premade/GoblinCleaverItem.java | 4 +- .../customitems/premade/GoblinHelmetItem.java | 4 +- .../premade/GoblinLeggingsItem.java | 4 +- .../customitems/premade/GoblinPokerItem.java | 4 +- .../premade/GoblinShooterItem.java | 4 +- .../premade/GoblinSlasherItem.java | 4 +- .../premade/GruntsBootsConfig.java | 7 +- .../premade/GruntsChestplateConfig.java | 7 +- .../premade/GruntsHelmetConfig.java | 7 +- .../premade/GruntsLeggingsConfig.java | 7 +- .../premade/GruntsSwordConfig.java | 7 +- .../premade/InvictusBootsConfig.java | 6 +- .../premade/InvictusChestplateConfig.java | 6 +- .../premade/InvictusHelmetConfig.java | 6 +- .../premade/InvictusLeggingsConfig.java | 6 +- .../premade/InvictusPickaxeConfig.java | 6 +- .../premade/InvictusShovelConfig.java | 6 +- .../premade/InvictusSwordConfig.java | 6 +- .../premade/LuckyCharmsConfig.java | 4 +- .../premade/MeteorShowerScrollConfig.java | 4 +- .../premade/NovicesBootsConfig.java | 7 +- .../premade/NovicesChestplateConfig.java | 7 +- .../premade/NovicesHelmetConfig.java | 7 +- .../premade/NovicesLeggingsConfig.java | 7 +- .../premade/NovicesSwordConfig.java | 7 +- .../customitems/premade/OwlCharmConfig.java | 6 +- .../premade/RabbitCharmConfig.java | 4 +- .../premade/RodOfTheDepthsConfig.java | 9 +- .../premade/SalamanderCharmConfig.java | 4 +- .../customitems/premade/ScorpionCharm.java | 4 +- .../premade/ScrapEliteHugeConfig.java | 3 +- .../premade/ScrapEliteLargeConfig.java | 3 +- .../premade/ScrapEliteMediumConfig.java | 3 +- .../premade/ScrapEliteSmallConfig.java | 3 +- .../premade/ScrapEliteTinyConfig.java | 3 +- .../premade/ShulkerCharmConfig.java | 6 +- .../premade/SlowpokeCharmConfig.java | 6 +- .../premade/SummonMerchantScrollConfig.java | 4 +- .../premade/SummonWolfScrollConfig.java | 4 +- .../customitems/premade/TheFellerConfig.java | 9 +- .../customitems/premade/TheStingerConfig.java | 6 +- .../premade/UnbindScrollConfig.java | 6 +- .../premade/VampiricCharmConfig.java | 6 +- .../premade/VeteransBootsConfig.java | 7 +- .../premade/VeteransChestplateConfig.java | 7 +- .../premade/VeteransHelmetConfig.java | 7 +- .../premade/VeteransLeggingsConfig.java | 7 +- .../premade/VeteransSwordConfig.java | 7 +- .../customitems/premade/WerewolfBoneItem.java | 4 +- .../customitems/premade/WolfsbaneItem.java | 9 +- .../premade/ZombieKingsAxeConfig.java | 11 +- .../premade/WelcomeQuest0Config.java | 6 +- .../premade/WelcomeQuest1Config.java | 4 +- .../premade/XmasQuest0Config.java | 10 +- .../customspawns/premade/DeadMoonSpawn.java | 3 +- .../customspawns/premade/FullMoonSpawn.java | 3 +- .../premade/NighttimeSurfaceSpawn.java | 3 +- .../premade/NormalSurfaceSpawn.java | 3 +- .../premade/NormalUndergroundSpawn.java | 3 +- .../premade/AirShipMinidungeon.off | 4 +- .../premade/BeastsSanctuaryLair.java | 2 +- .../premade/BinderOfWorldsSanctum.java | 6 +- .../premade/BoneMonasteryDungeon.java | 6 +- .../dungeonpackager/premade/CatacombsLair.off | 4 +- .../dungeonpackager/premade/ColosseumLair.off | 4 +- .../premade/CraftenminesLabSanctum.java | 6 +- .../premade/DarkCathedralLair.java | 7 +- .../premade/DarkSpireMinidungeon.java | 9 +- .../premade/FireworksLair.java | 9 +- .../premade/FrostPalaceSanctum.java | 6 +- .../premade/HallosseumLair.java | 9 +- .../premade/InvasionMinidungeon.java | 9 +- .../premade/KnightCastleLair.java | 2 +- .../premade/NorthPoleMinidungeon.java | 9 +- .../premade/OasisAdventure.java | 9 +- .../premade/OasisPyramidSanctum.java | 6 +- .../premade/PirateShipMinidungeon.java | 9 +- .../premade/PrimisAdventure.java | 9 +- .../premade/PrimisBloodTempleSanctum.java | 6 +- .../premade/PrimisGladiusInvasionDungeon.java | 4 +- .../dungeonpackager/premade/RuinsLair.off | 2 +- .../premade/SewersMinidungeon.java | 9 +- .../ShadowOfTheBinderOfWorldsLair.java | 9 +- .../premade/SteamworksLair.java | 2 +- .../premade/TheBridgeSanctum.java | 6 +- .../premade/TheCaveSanctum.java | 6 +- .../premade/TheCityDungeon.java | 6 +- .../premade/TheClimbDungeon.java | 6 +- .../premade/TheDeepMinesDungeon.java | 6 +- .../premade/TheMinesDungeon.java | 6 +- .../premade/TheNetherBellSanctum.java | 6 +- .../premade/TheNetherWastes.java | 6 +- .../premade/ThePalaceSanctum.java | 6 +- .../premade/TheQuarryDungeon.java | 6 +- .../premade/UnderGroveLair.java | 2 +- .../premade/VampireManorMinidungeon.off | 6 +- .../menus/premade/BuyOrSellMenuConfig.java | 6 +- .../menus/premade/CustomShopMenuConfig.java | 6 +- .../menus/premade/DynamicQuestMenuConfig.java | 2 +- .../menus/premade/GuildRankMenuConfig.java | 27 ++-- .../premade/ItemEnchantmentMenuConfig.java | 6 +- .../menus/premade/PlayerStatusMenuConfig.java | 46 +++---- .../premade/ProceduralShopMenuConfig.java | 6 +- .../config/menus/premade/QuestMenuConfig.java | 11 +- .../menus/premade/RepairMenuConfig.java | 6 +- .../menus/premade/ScrapperMenuConfig.java | 12 +- .../config/menus/premade/SellMenuConfig.java | 12 +- .../menus/premade/UnbinderMenuConfig.java | 6 +- .../mobproperties/MobPropertiesConfig.java | 6 +- .../premade/EliteCreeperConfig.java | 7 +- .../premade/EliteDrownedConfig.java | 7 +- .../premade/EliteEndermanConfig.java | 7 +- .../premade/EliteGhastConfig.java | 7 +- .../premade/EliteGoatConfig.java | 7 +- .../premade/EliteHoglinConfig.java | 7 +- .../premade/EliteIronGolemConfig.java | 7 +- .../premade/EliteKillerBunnyConfig.java | 7 +- .../premade/EliteLlamaConfig.java | 7 +- .../premade/EliteMagmaCubeConfig.java | 5 +- .../premade/ElitePhantomConfig.java | 7 +- .../premade/ElitePiglinBruteConfig.java | 7 +- .../premade/ElitePiglinConfig.java | 7 +- .../premade/ElitePillagerConfig.java | 7 +- .../premade/ElitePolarBearConfig.java | 7 +- .../premade/EliteSkeletonConfig.java | 7 +- .../premade/EliteSpiderConfig.java | 7 +- .../premade/EliteWitchConfig.java | 7 +- .../premade/EliteWitherConfig.java | 7 +- .../premade/EliteWitherSkeletonConfig.java | 7 +- .../premade/EliteWolfConfig.java | 7 +- .../premade/EliteZoglinConfig.java | 7 +- .../premade/EliteZombieConfig.java | 7 +- .../premade/EliteZombiefiedPiglin.java | 7 +- .../config/npcs/NPCsConfigFields.java | 2 + .../config/npcs/premade/BarkeepConfig.java | 15 +-- .../npcs/premade/BinderOfWorldsNPCConfig.java | 5 +- .../config/npcs/premade/BlacksmithConfig.java | 15 +-- .../npcs/premade/CombatInstructorConfig.java | 11 +- .../config/npcs/premade/EnchanterConfig.java | 15 +-- .../config/npcs/premade/Guide0Config.java | 15 +-- .../config/npcs/premade/Guide1Config.java | 15 +-- .../npcs/premade/GuildAttendantConfig.java | 15 +-- .../config/npcs/premade/QuestGiverConfig.java | 15 +-- .../config/npcs/premade/RepairmanConfig.java | 15 +-- .../config/npcs/premade/SantaConfig.java | 6 +- .../config/npcs/premade/ScrapperConfig.java | 15 +-- .../npcs/premade/SpecialBlacksmithConfig.java | 15 +-- .../premade/TravellingMerchantConfig.java | 15 +-- .../config/npcs/premade/UnbinderConfig.java | 15 +-- .../potioneffects/PotionEffectsConfig.java | 9 +- .../config/powers/premade/TauntConfig.java | 22 ++-- .../powers/premade/ZombieFriendsConfig.java | 14 +-- .../powers/premade/ZombieParentsConfig.java | 18 +-- .../elitemobs/dungeons/DungeonProtector.java | 7 ++ .../instanced/arena/ArenaInstance.java | 27 +++- .../elitemobs/items/ItemLootShower.java | 5 +- .../magmaguy/elitemobs/menus/GetLootMenu.java | 9 +- .../elitemobs/menus/ItemEnchantmentMenu.java | 2 +- .../magmaguy/elitemobs/menus/RepairMenu.java | 7 +- .../magmaguy/elitemobs/menus/UnbindMenu.java | 2 +- .../playerdata/database/GenerateDatabase.java | 2 +- .../powers/scripts/ScriptAction.java | 19 ++- .../powers/scripts/ScriptActionData.java | 2 + .../powers/scripts/ScriptTargets.java | 6 +- .../caching/ScriptActionBlueprint.java | 3 + .../quests/menus/QuestInventoryMenu.java | 13 +- .../magmaguy/elitemobs/wormhole/Wormhole.java | 7 ++ .../elitemobs/wormhole/WormholeTask.java | 2 +- src/main/resources/plugin.yml | 2 +- 317 files changed, 1220 insertions(+), 973 deletions(-) diff --git a/build.gradle b/build.gradle index e7f928347..781206eba 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.3' +version '9.1.4' repositories { maven { @@ -105,7 +105,7 @@ dependencies { //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' + 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' diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java index 5f832fc28..246e9a667 100644 --- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java +++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java @@ -273,6 +273,7 @@ public static void registerEvents() { register(new AlternativeDurabilityLoss()); register(new EnderCrystalDamageProtectionBypass()); register(new NPCsBecomeWitches()); + register(new PreventEliteSilverfishBlockEnter()); //Antiexploits diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java index fd00f7ca7..3d2525113 100644 --- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java +++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java @@ -21,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) { diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 24c42aa45..46fc3627a 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -15,7 +15,7 @@ import org.bukkit.inventory.meta.Damageable; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class AlternativeDurabilityLoss implements Listener { @@ -41,7 +41,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())); + ArrayList itemsList = new ArrayList<>(new ArrayList<>(List.of(player.getInventory().getArmorContents()))); itemsList.add(player.getInventory().getItemInMainHand()); itemsList.add(player.getInventory().getItemInOffHand()); 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/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/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java index 27574baf1..57d0aee9a 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java @@ -6,12 +6,15 @@ 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")); - addArgument("language", TranslationsConfig.getTranslationConfigs().keySet().stream().toList()); + 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."); @@ -20,7 +23,7 @@ public LanguageCommand() { @Override public void execute(CommandData commandData) { String language = commandData.getStringArgument("language"); - if (!TranslationsConfig.getTranslationConfigs().containsKey(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; diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java index 306478b72..3472647ca 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java @@ -5,12 +5,14 @@ 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); diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java index 3ccbe9497..cb6a6515e 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java @@ -13,7 +13,7 @@ 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)); + 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); 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 b3fee7974..459eaa264 100644 --- a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java @@ -29,8 +29,8 @@ public class SetupMenu { private final int previousIcon = 27; Inventory inventory; Player player; - 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)); + 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; diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java index 5c3e787db..1e3dc63ec 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java @@ -4,7 +4,7 @@ import com.magmaguy.magmacore.util.ChatColorConverter; import lombok.Getter; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; public class ItemSettingsConfig extends ConfigurationFile { @@ -156,7 +156,7 @@ public void initializeValues() { "$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"), @@ -173,7 +173,7 @@ public void initializeValues() { 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); diff --git a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java index 33ba488b6..c49ca5e92 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java @@ -6,7 +6,6 @@ import org.bukkit.Material; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile { @@ -154,7 +153,7 @@ public void initializeValues() { 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", @@ -162,9 +161,9 @@ public void initializeValues() { "$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", @@ -455,9 +454,9 @@ public void initializeValues() { "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", @@ -984,9 +983,9 @@ public void initializeValues() { "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", @@ -1248,9 +1247,9 @@ public void initializeValues() { "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", @@ -1459,7 +1458,7 @@ public void initializeValues() { "Snorer", "Thruster", "Slapper" - ), true); + )), true); MaterialGenerator.initializeValidProceduralMaterials(); } diff --git a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java index fa5a2824c..863584853 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java @@ -13,7 +13,6 @@ import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class QuestsConfig extends ConfigurationFile { @@ -110,7 +109,7 @@ public QuestsConfig() { } private static List setEntityTypes(FileConfiguration fileConfiguration, File file) { - List entityTypes = new ArrayList<>(Arrays.asList( + List entityTypes = new ArrayList<>(new ArrayList<>(List.of( EntityType.BLAZE.toString(), EntityType.CAVE_SPIDER.toString(), EntityType.DROWNED.toString(), @@ -134,14 +133,14 @@ private static List setEntityTypes(FileConfiguration fileConfigurati EntityType.WITHER_SKELETON.toString(), EntityType.WOLF.toString(), EntityType.ZOMBIE.toString() - )); + ))); - List laterEntities = Arrays.asList( + List laterEntities = new ArrayList<>(List.of( EntityType.HOGLIN.toString(), EntityType.ZOGLIN.toString(), EntityType.PIGLIN_BRUTE.toString(), EntityType.PIGLIN.toString(), - EntityType.ZOMBIFIED_PIGLIN.toString()); + EntityType.ZOMBIFIED_PIGLIN.toString())); entityTypes.addAll(laterEntities); ConfigurationEngine.setList(file, fileConfiguration, "questEntityTypes", entityTypes, false); 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/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/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java index b0e1f3584..d8fe6319a 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java @@ -466,14 +466,14 @@ private List 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() { 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 6049a2675..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.LARGE_SMOKE.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/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 be97a8262..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,7 +17,7 @@ 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.DRIPPING_WATER.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 66a9379c6..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.LARGE_SMOKE.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 c5feefa37..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.LARGE_SMOKE.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 6f7b618b4..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,7 +17,7 @@ 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.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 d9ded5199..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 @@ -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 QueenBeeBoss extends CustomBossesConfigFields { public QueenBeeBoss() { @@ -14,13 +15,13 @@ public QueenBeeBoss() { true, "$eventBossLevel &6Queen Bee", "dynamic"); - 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.LARGE_SMOKE.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/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 1a887fa97..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 @@ -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 TestCustomBossesConfig extends CustomBossesConfigFields { public TestCustomBossesConfig() { @@ -25,17 +26,17 @@ 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")); 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 83547319e..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 @@ -5,7 +5,8 @@ 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 f23c6b3c0..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 @@ -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 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); setHelmet(new ItemStack(Material.NETHERITE_HELMET)); 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 4410a3ef6..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 @@ -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 WeaponsGoblinBoss extends CustomBossesConfigFields { public WeaponsGoblinBoss() { @@ -24,28 +25,28 @@ public WeaponsGoblinBoss() { 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 d8f89e774..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 @@ -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 WoodLeagueWave10Boss extends CustomBossesConfigFields { public WoodLeagueWave10Boss() { @@ -14,8 +15,8 @@ public WoodLeagueWave10Boss() { "10"); setFollowDistance(60); - 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/WoodLeagueWave11Melee.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave11Melee.java index 30ea74915..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 @@ -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 WoodLeagueWave11Melee extends CustomBossesConfigFields { @@ -13,7 +14,7 @@ public WoodLeagueWave11Melee() { "$normalLevel &4Arena Zombie", "11"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); + 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 a99afc165..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 { @@ -17,6 +18,6 @@ public WoodLeagueWave11Ranged() { setFollowDistance(60); 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 200adbb63..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 @@ -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 WoodLeagueWave12Melee extends CustomBossesConfigFields { @@ -13,7 +14,7 @@ public WoodLeagueWave12Melee() { "$normalLevel &4Arena Zombie", "12"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); + 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 a0ce3c216..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 { @@ -17,6 +18,6 @@ public WoodLeagueWave12Ranged() { setFollowDistance(60); 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 059605609..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 @@ -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 WoodLeagueWave13Melee extends CustomBossesConfigFields { public WoodLeagueWave13Melee() { @@ -13,7 +14,7 @@ public WoodLeagueWave13Melee() { "$normalLevel &4Arena Zombie", "13"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_poison.yml")); + 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 1a0b09714..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() { @@ -17,6 +18,6 @@ public WoodLeagueWave13Ranged() { setFollowDistance(60); 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 160b4208c..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 @@ -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 WoodLeagueWave14Melee extends CustomBossesConfigFields { @@ -13,7 +14,7 @@ public WoodLeagueWave14Melee() { "$normalLevel &4Arena Zombie", "14"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); + 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 4acb7ecbf..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 { @@ -17,6 +18,6 @@ public WoodLeagueWave14Ranged() { setFollowDistance(60); 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 8669484e2..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 @@ -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 WoodLeagueWave15Miniboss extends CustomBossesConfigFields { @@ -15,7 +15,7 @@ public WoodLeagueWave15Miniboss() { "15"); setFollowDistance(60); - 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 0abbdd6c2..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 @@ -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 WoodLeagueWave16Melee extends CustomBossesConfigFields { @@ -13,8 +14,7 @@ public WoodLeagueWave16Melee() { "$normalLevel Mr. Oinkers Fan", "16"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - + 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 f06942cac..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 { @@ -17,7 +18,7 @@ public WoodLeagueWave16Ranged() { setFollowDistance(60); 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 ec65d5e09..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 @@ -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 WoodLeagueWave17Melee extends CustomBossesConfigFields { public WoodLeagueWave17Melee() { @@ -13,7 +14,7 @@ public WoodLeagueWave17Melee() { "$normalLevel &4Arena Zombie", "17"); setFollowDistance(60); - setPowers(Arrays.asList("corpse.yml", "attack_fire.yml")); + 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 652f7de39..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() { @@ -17,6 +18,6 @@ public WoodLeagueWave17Ranged() { setFollowDistance(60); 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 cbadbb2dc..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")); - + 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 73b21f52c..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() { @@ -17,6 +18,6 @@ public WoodLeagueWave19Ranged() { setFollowDistance(60); 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/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/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 e1d251a87..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 @@ -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 WoodLeagueWave3Melee extends CustomBossesConfigFields { @@ -12,7 +13,7 @@ public WoodLeagueWave3Melee() { true, "$normalLevel Arena Zombie", "3"); - setPowers(List.of("attack_fire.yml")); + setPowers(new ArrayList<>(List.of("attack_fire.yml"))); setFollowDistance(60); } 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/WoodLeagueWave50Boss.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/premade/WoodLeagueWave50Boss.java index 19505489b..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 @@ -6,7 +6,7 @@ import org.bukkit.inventory.ItemStack; import java.util.ArrayList; -import java.util.Arrays; +import java.util.List; public class WoodLeagueWave50Boss extends CustomBossesConfigFields { public WoodLeagueWave50Boss() { @@ -18,17 +18,17 @@ public WoodLeagueWave50Boss() { setFollowDistance(60); 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 0c1b37520..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 @@ -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 WoodLeagueWave50BossP2 extends CustomBossesConfigFields { public WoodLeagueWave50BossP2() { @@ -17,12 +18,12 @@ public WoodLeagueWave50BossP2() { setFollowDistance(60); 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 84cd323d2..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 @@ -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 WoodLeagueWave50BossP3 extends CustomBossesConfigFields { public WoodLeagueWave50BossP3() { @@ -17,12 +18,12 @@ public WoodLeagueWave50BossP3() { setFollowDistance(60); 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 673843916..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 @@ -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 WoodLeagueWave5Miniboss extends CustomBossesConfigFields { @@ -13,7 +13,7 @@ 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); 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 137a62dd0..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 @@ -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 WoodLeagueWave7Melee extends CustomBossesConfigFields { @@ -13,7 +14,6 @@ public WoodLeagueWave7Melee() { "$normalLevel Arena Zombie", "7"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); - + 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 a70ee1936..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 { @@ -17,6 +18,6 @@ public WoodLeagueWave7Ranged() { setFollowDistance(60); 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 3148275c3..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 @@ -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 WoodLeagueWave8Melee extends CustomBossesConfigFields { @@ -13,7 +14,7 @@ public WoodLeagueWave8Melee() { "$normalLevel Arena Zombie", "8"); setFollowDistance(60); - setPowers(List.of("corpse.yml")); + 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 235add016..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 { @@ -17,6 +18,6 @@ public WoodLeagueWave9Ranged() { setFollowDistance(60); 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/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/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 722f4e7e8..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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 af578aa61..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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 e09906e3b..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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 18192d44d..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,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 a760313e7..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("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "UNBREAKING,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 f56ab5db4..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_OF_THE_SEA,3", "UNBREAKING,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 cd672c0c7..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("FORTUNE,4", "UNBREAKING,6", "EFFICIENCY,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/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 051a010f0..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("POWER,1", "UNBREAKING,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 824e68316..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 @@ -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 GoblinBootsItem extends CustomItemsConfigFields { @@ -15,7 +15,7 @@ public GoblinBootsItem() { "&8Goblin Boots", List.of("&8A treasure among goblins!")); setMaterial(Material.NETHERITE_BOOTS); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,1")); + 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 a6d88b11b..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 @@ -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 GoblinChestplateItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinChestplateItem() { Material.NETHERITE_CHESTPLATE, "&8Goblin Chestplate", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,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 8d25f4031..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 @@ -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 GoblinCleaverItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinCleaverItem() { Material.NETHERITE_AXE, "&8Goblin Cleaver", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,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 0fdb800ea..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 @@ -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 GoblinHelmetItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinHelmetItem() { Material.NETHERITE_HELMET, "&8Goblin Helmet", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,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 c3e741248..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 @@ -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 GoblinLeggingsItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinLeggingsItem() { Material.NETHERITE_LEGGINGS, "&8Goblin Leggings", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("PROTECTION,1", "BLAST_PROTECTION,1", "PROJECTILE_PROTECTION,1", "UNBREAKING,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 18f8f4c42..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("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,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 ab49b074a..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("POWER,1", "UNBREAKING,1", "INFINITY,1", "FLAME,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 b56592181..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 @@ -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 GoblinSlasherItem extends CustomItemsConfigFields { @@ -14,7 +14,7 @@ public GoblinSlasherItem() { Material.NETHERITE_SWORD, "&8Goblin Slasher", List.of("&8A treasure among goblins!")); - setEnchantments(Arrays.asList("SHARPNESS,1", "SMITE,1", "UNBREAKING,1", "KNOCKBACK,1", "LOOTING,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 58bebb3fc..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,5", "PROJECTILE_PROTECTION,5", "UNBREAKING,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 4b9e48791..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,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,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 9a9dd33b4..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,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,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 7439c8751..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,5", "PROJECTILE_PROTECTION,4", "UNBREAKING,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 111c8de7a..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("SHARPNESS,5", "KNOCKBACK,2", "SWEEPING_EDGE,1", "UNBREAKING,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 8ea25d6f4..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 @@ -4,13 +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 InvictusBootsConfig extends CustomItemsConfigFields { public InvictusBootsConfig() { - super("invictus_boots", true, Material.NETHERITE_BOOTS, "&4Invictus Boots", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 cd9caded1..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 @@ -4,13 +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 InvictusChestplateConfig extends CustomItemsConfigFields { public InvictusChestplateConfig() { - super("invictus_chestplate", true, Material.NETHERITE_CHESTPLATE, "&4Invictus Chestplate", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 12beeca3a..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 @@ -4,13 +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 InvictusHelmetConfig extends CustomItemsConfigFields { public InvictusHelmetConfig() { - super("invictus_helmet", true, Material.NETHERITE_HELMET, "&4Invictus Helmet", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 5d0f114e3..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 @@ -4,13 +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 InvictusLeggingsConfig extends CustomItemsConfigFields { public InvictusLeggingsConfig() { - super("invictus_leggings", true, Material.NETHERITE_LEGGINGS, "&4Invictus Leggings", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("PROTECTION,5", "BLAST_PROTECTION,4", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 7b43f3e85..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 @@ -4,13 +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 InvictusPickaxeConfig extends CustomItemsConfigFields { public InvictusPickaxeConfig() { - super("invictus_pickaxe", true, Material.NETHERITE_PICKAXE, "&4Invictus Pickaxe", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("EFFICIENCY,6", "DRILLING,3", "UNBREAKING,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 dab2b0359..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 @@ -4,13 +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 InvictusShovelConfig extends CustomItemsConfigFields { public InvictusShovelConfig() { - super("invictus_shovel", true, Material.NETHERITE_SHOVEL, "&4Invictus Shovel", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("EFFICIENCY,6", "DRILLING,3", "UNBREAKING,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 72e8632ca..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 @@ -4,13 +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 InvictusSwordConfig extends CustomItemsConfigFields { public InvictusSwordConfig() { - super("invictus_sword", true, Material.NETHERITE_SWORD, "&4Invictus Sword", Arrays.asList("&2Awarded to the champions of the", "&2Wood League Arena!")); - setEnchantments(Arrays.asList("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "LIGHTNING,3", "SWEEPING_EDGE,1", "UNBREAKING,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 d0d4ebd14..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,5", "UNBREAKING,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 de5dca260..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,5", "UNBREAKING,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 189462464..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,5", "UNBREAKING,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 5e891f5ca..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,5", "UNBREAKING,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 08395d999..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("SHARPNESS,5", "SWEEPING_EDGE,1", "UNBREAKING,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 213325b25..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_OF_THE_SEA,1", "UNBREAKING,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 956586568..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("FORTUNE,4", "SILK_TOUCH,1", "UNBREAKING,6", "EFFICIENCY,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 8ddacaf59..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("SHARPNESS,1", "UNBREAKING,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 8860d84b7..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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 9284f9720..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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 bdb6b7cf0..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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 b9c51e254..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,5", "PROJECTILE_PROTECTION,4", "MENDING,1", "UNBREAKING,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 bfbadbfcd..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("SHARPNESS,5", "KNOCKBACK,2", "MENDING,1", "SWEEPING_EDGE,1", "UNBREAKING,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 95736297d..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("SHARPNESS,1", "FIRE_ASPECT,4", "UNBREAKING,5", "LOOTING,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 d8fd9b37c..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("SHARPNESS,1", "SMITE,5", "EFFICIENCY,5", "UNBREAKING,5", "KNOCKBACK,3", - "FIRE_ASPECT,4", "LOOTING,5", "AQUA_AFFINITY,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/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 b7ee0e5d4..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; @@ -11,7 +11,7 @@ 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( + 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/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/dungeonpackager/premade/AirShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off index a2c641bb9..b81419e4b 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off @@ -13,10 +13,10 @@ public class AirShipMinidungeon extends DungeonPackagerConfigFields { "airship_minidungeon", true, "&2[lvl 045-055] &6The Airship", - Arrays.asList("&fAn awesome airship full of undead pirates!", + new ArrayList<>(List.of("&fAn awesome airship full of undead pirates!", "&6Credits: MagmaGuy, 69OzCanOfBepis", "&6and Realm of Lotheridon"), - Arrays.asList( + new ArrayList<>(List.of( "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", 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 0837e31e2..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 @@ -17,7 +17,7 @@ public BeastsSanctuaryLair() { "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" + 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 f795aa65a..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public BinderOfWorldsSanctum() { super("binder_of_worlds_sanctum", 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", 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 3f5de8c35..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public BoneMonasteryDungeon() { super("bone_monastery_dungeon", 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", diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off index 0b64e9905..9e7decd1f 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/CatacombsLair.off @@ -12,9 +12,9 @@ public class CatacombsLair extends DungeonPackagerConfigFields { super("catacombs_lair", 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.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off index 8071ed2f5..b9bbff526 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/ColosseumLair.off @@ -12,11 +12,11 @@ public class ColosseumLair extends DungeonPackagerConfigFields { super("colosseum_lair", 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 36de8c98b..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public CraftenminesLabSanctum() { super("craftenmines_lab_sanctum", 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", 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 bb967a2c7..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 @@ -4,16 +4,17 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; import org.bukkit.World; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; public class DarkCathedralLair extends DungeonPackagerConfigFields { public DarkCathedralLair() { super("dark_cathedral_lair", 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, Frost, Dali"), + "&6Credits: MagmaGuy, 69OzCanOfBepis, Frost, Dali")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.LAIR, "em_the_dark_cathedral", 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 d1b0ccb68..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,22 +4,23 @@ 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", 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" + 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 94c9ec00d..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,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 FireworksLair extends DungeonPackagerConfigFields { public FireworksLair() { super("fireworks_lair", 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" + 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 ea29d5208..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,7 +4,7 @@ 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; @@ -13,9 +13,9 @@ public FrostPalaceSanctum() { super("frost_palace_sanctum", 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", 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 c905a352a..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,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 HallosseumLair extends DungeonPackagerConfigFields { public HallosseumLair() { super("hallosseum_lair", 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" + 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 f53ef5ff5..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,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 InvasionMinidungeon extends DungeonPackagerConfigFields { public InvasionMinidungeon() { super("invasion_minidungeon", 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" + 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 015ea0546..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 @@ -17,7 +17,7 @@ public KnightCastleLair() { "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" + 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 247d7b656..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,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 NorthPoleMinidungeon extends DungeonPackagerConfigFields { public NorthPoleMinidungeon() { super("north_pole_minidungeon", 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" + 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 1ebc4c2cb..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,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 OasisAdventure extends DungeonPackagerConfigFields { public OasisAdventure() { super("oasis_adventure", 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" + 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 fcb138eb3..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public OasisPyramidSanctum() { super("oasis_pyramid_sanctum", 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", 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 18a471e88..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 @@ -4,23 +4,24 @@ import com.magmaguy.elitemobs.utils.DiscordLinks; 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", 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"), + "&6Credits: MagmaGuy & Realm of Lotheridon")), DiscordLinks.freeMinidungeons, DungeonSizeCategory.MINIDUNGEON, "em_the_pirate_ship", World.Environment.NORMAL, true, - "em_the_pirate_ship,-85,63,243.5,-150,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" + 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 27f328016..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,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 PrimisAdventure extends DungeonPackagerConfigFields { public PrimisAdventure() { super("primis_adventure", 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" + 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 efb87a384..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public PrimisBloodTempleSanctum() { super("primis_blood_temple_sanctum", 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", 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 90d9e9f05..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,7 +4,7 @@ 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; @@ -13,7 +13,7 @@ public PrimisGladiusInvasionDungeon() { super("primis_gladius_invasion_dungeon", 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", diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off index 9fa5eccb3..77e9f1202 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/RuinsLair.off @@ -12,7 +12,7 @@ public class RuinsLair extends DungeonPackagerConfigFields { super("the_ruins", 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 af70c536b..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", 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" + 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 312147208..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,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 ShadowOfTheBinderOfWorldsLair extends DungeonPackagerConfigFields { public ShadowOfTheBinderOfWorldsLair() { super("shadow_of_the_binder_of_worlds_lair", 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" + 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 bc0d59940..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 @@ -17,7 +17,7 @@ public SteamworksLair() { "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" + 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 e82a38921..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheBridgeSanctum() { super("the_bridge_sanctum", 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", 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 c0e5d7873..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheCaveSanctum() { super("the_cave_sanctum", 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", 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 b135a5a4f..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheCityDungeon() { super("the_city_dungeon", 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", 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 dafbc9154..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheClimbDungeon() { super("the_climb_dungeon", 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", 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 96cd82d74..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheDeepMinesDungeon() { super("the_deep_mines_dungeon", 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", 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 1c8a64927..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheMinesDungeon() { super("the_mines_dungeon", 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", 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 index ed22a2e06..1f6238f42 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/TheNetherBellSanctum.java @@ -4,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheNetherBellSanctum() { super("the_nether_bell_sanctum", true, "&2[lvl 055] &3The Nether Bell Sanctum", - Arrays.asList("&fVenture into the deepest part of the Nether!", - "&6Credits: Dali_, MagmaGuy, Frostcone"), + 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", 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 f0714a345..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheNetherWastes() { super("the_nether_wastes_dungeon", 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", 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 0ef8587f6..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public ThePalaceSanctum() { super("the_palace_sanctum", 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", 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 4b08260a5..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,7 +4,7 @@ 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; @@ -13,8 +13,8 @@ public TheQuarryDungeon() { super("the_quarry_dungeon", 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", 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 64eff941b..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 @@ -17,7 +17,7 @@ public UnderGroveLair() { "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" + diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off index 4663fa25b..26eb8377e 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off +++ b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/VampireManorMinidungeon.off @@ -11,9 +11,9 @@ public class VampireManorMinidungeon extends DungeonPackagerConfigFields { super("vampire_manor", 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", @@ -125,7 +125,7 @@ public class VampireManorMinidungeon extends DungeonPackagerConfigFields { "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/menus/premade/BuyOrSellMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/BuyOrSellMenuConfig.java index 92f8bade2..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 @@ -9,7 +9,7 @@ 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/CustomShopMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/CustomShopMenuConfig.java index 3c7146b40..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 @@ -7,7 +7,7 @@ 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 5528b24af..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 @@ -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/GuildRankMenuConfig.java b/src/main/java/com/magmaguy/elitemobs/config/menus/premade/GuildRankMenuConfig.java index d10bea9e4..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 @@ -9,7 +9,8 @@ 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 d7f6d3e9b..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 @@ -9,7 +9,7 @@ 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 078211799..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 @@ -11,7 +11,7 @@ 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 { @@ -347,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", @@ -399,22 +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); gearThreatItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "gearThreatItem", ItemStackGenerator.generateItemStack(Material.TARGET, "&cThreat Level: $threat", - Arrays.asList("&fThis determines the level of the", + 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); + "&ftier into account."))), true); gearThreatSlot = ConfigurationEngine.setInt(fileConfiguration, "gearThreatSlot", 25); statsChestMenuName = ConfigurationEngine.setString(file, fileConfiguration, "statsChestMenuName", "&2EliteMobs Stats", true); @@ -422,21 +422,21 @@ 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); statsGuildTierItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsGuildTierItem", ItemStackGenerator.generateItemStack(Material.TARGET, "&6Guild Tier: $tier", - Arrays.asList("&fGuild Rank determines how good your loot can ", + 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); + "&f⚜ = prestige rank, ✧ = guild rank!"))), true); statsGuildTierSlot = ConfigurationEngine.setInt(fileConfiguration, "statsGuildTierSlot", 11); statsEliteKillsItem = ConfigurationEngine.setItemStack(file, fileConfiguration, "statsEliteKillsItem", @@ -448,10 +448,10 @@ public void processAdditionalFields() { 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", @@ -463,18 +463,18 @@ 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); @@ -482,18 +482,18 @@ public void processAdditionalFields() { 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 fad0a5f59..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 @@ -7,7 +7,7 @@ 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 c8db6f1e7..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 @@ -8,7 +8,8 @@ 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 3add3eebb..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 @@ -8,7 +8,7 @@ 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 5d5e59f92..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 @@ -8,7 +8,7 @@ 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 cbcca2963..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 @@ -8,7 +8,7 @@ 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 3746afa01..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 @@ -9,7 +9,7 @@ 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 a2016203e..a643065ff 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/MobPropertiesConfig.java @@ -7,13 +7,13 @@ 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(), @@ -58,7 +58,7 @@ public class MobPropertiesConfig { new EliteBeeConfig(), new EliteBreezeConfig(), new EliteWitherConfig() - )); + ))); public static HashMap getMobProperties() { return mobProperties; 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/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 index eff26cef7..9996b3473 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/mobproperties/premade/EliteWitherConfig.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 EliteWitherConfig extends MobPropertiesConfigFields { public EliteWitherConfig() { @@ -11,8 +12,8 @@ public EliteWitherConfig() { EntityType.WITHER, true, "&fLvl &2$level &7Elite &5Wither", - Arrays.asList("$player &cangered $entity&c!", - "$player &chas met $entity's &cfury!"), + 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/npcs/NPCsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java index ecbff418f..13ea6d0a3 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java +++ b/src/main/java/com/magmaguy/elitemobs/config/npcs/NPCsConfigFields.java @@ -128,6 +128,8 @@ public void processConfigFields() { 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); 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 774e587bd..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,6 @@ import org.bukkit.entity.Villager; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class BinderOfWorldsNPCConfig extends NPCsConfigFields { @@ -18,10 +17,10 @@ public BinderOfWorldsNPCConfig() { "em_adventurers_guild,294.5,91,223.5,180,0", 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/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/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/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 92191d0e7..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,12 +5,15 @@ 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(), @@ -48,7 +51,7 @@ public class PotionEffectsConfig { 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/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/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/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index cb4e81cb9..0aca7625c 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -9,6 +9,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.*; import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; @@ -161,4 +162,10 @@ public void preventDoorOpeningSpawning(PlayerInteractEvent event) { 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); + } + } 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 467f217c5..d489b4bb7 100644 --- a/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java +++ b/src/main/java/com/magmaguy/elitemobs/instanced/arena/ArenaInstance.java @@ -6,10 +6,13 @@ 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; @@ -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()); @@ -212,7 +216,6 @@ private void nextWave() { }, 20L * customArenasConfigFields.getDelayBetweenWaves()); } - private void arenaWatchdog() { new BukkitRunnable() { @Override @@ -238,8 +241,8 @@ 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()); @@ -252,6 +255,8 @@ 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()) { Logger.warn("Arena " + getCustomArenasConfigFields().getArenaName() + " failed to spawn boss " + customBossEntity.getCustomBossesConfigFields().getFilename()); continue; @@ -283,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/items/ItemLootShower.java b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java index 4fbd06cf8..71782f7d2 100644 --- a/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java +++ b/src/main/java/com/magmaguy/elitemobs/items/ItemLootShower.java @@ -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; @@ -201,7 +202,7 @@ 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); 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/ItemEnchantmentMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java index 67d3dfef0..b0bf40320 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/ItemEnchantmentMenu.java @@ -313,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/RepairMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java index b84b5c3f8..be98f13ea 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/RepairMenu.java @@ -19,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; @@ -195,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/UnbindMenu.java b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java index 16c47a94c..e55eca9bd 100644 --- a/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/menus/UnbindMenu.java @@ -191,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/playerdata/database/GenerateDatabase.java b/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java index b01cc634d..eecd9e4ba 100644 --- a/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java +++ b/src/main/java/com/magmaguy/elitemobs/playerdata/database/GenerateDatabase.java @@ -57,7 +57,7 @@ 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 { Logger.info("Adding new database column " + columnName); addColumn(columnName, columnValues); 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 dea4169e6..7fca4400f 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptAction.java @@ -125,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() { @@ -228,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; } @@ -235,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; } @@ -245,7 +261,8 @@ private void runTeleport(ScriptActionData scriptActionData) { 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)); 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 adc4cca3e..461676ec9 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptActionData.java @@ -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,6 +80,7 @@ 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 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 4bde7b10e..89510d7b6 100644 --- a/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptTargets.java +++ b/src/main/java/com/magmaguy/elitemobs/powers/scripts/ScriptTargets.java @@ -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); @@ -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; } 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 4390f4ed8..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 @@ -111,6 +111,8 @@ public class ScriptActionBlueprint { private float velocity = 1f; @Getter private double scale = 1f; + @Getter + private boolean debug = false; public ScriptActionBlueprint(Map entry, String scriptName, String scriptFilename) { @@ -198,6 +200,7 @@ protected void processKeyAndValue(String key, Object value) { case "volume" -> volume = parseFloat(key, value, scriptName); 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/quests/menus/QuestInventoryMenu.java b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java index e1cee7b08..b38f8a395 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/menus/QuestInventoryMenu.java @@ -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/wormhole/Wormhole.java b/src/main/java/com/magmaguy/elitemobs/wormhole/Wormhole.java index 7a71d00db..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,6 +26,11 @@ 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<>(); diff --git a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java index 54403879d..26fb6bb92 100644 --- a/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java +++ b/src/main/java/com/magmaguy/elitemobs/wormhole/WormholeTask.java @@ -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); }); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 214631d41..dd8e5eda3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.3 +version: 9.1.4 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From d2d0418b596650e51df4d4f48f293d0a998c8a27 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Fri, 23 Aug 2024 23:19:12 +0100 Subject: [PATCH 74/78] EliteMobs 9.1.5: - [Fix] Fixed pretty important bug where guild prices would be significantly lower than intended for some servers - [Fix] NPC subtitles are now correctly colored Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../magmaguy/elitemobs/config/AdventurersGuildConfig.java | 6 +++--- src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java | 2 +- src/main/resources/plugin.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 781206eba..6cb296950 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.4' +version '9.1.5' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java index ad1be7cba..e29f97515 100644 --- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java +++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java @@ -475,11 +475,11 @@ public void initializeValues() { 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); - baseKillsForRankUp = ConfigurationEngine.setInt( + 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.", diff --git a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java index 0b800b5a4..480d7af16 100644 --- a/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/npcs/NPCEntity.java @@ -280,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); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index dd8e5eda3..074e56b97 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.4 +version: 9.1.5 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 29065baba103dc0f96f640bfe61ec2f0fd4ea7c4 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 25 Aug 2024 00:56:28 +0100 Subject: [PATCH 75/78] EliteMobs 9.1.6: - [Fix] Fixed error caused by the newest version of LibsDisguises - [Fix] Fixed important error with durability loss on player death Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../collateralminecraftchanges/AlternativeDurabilityLoss.java | 3 ++- .../elitemobs/thirdparty/libsdisguises/DisguiseEntity.java | 3 +-- src/main/resources/plugin.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 6cb296950..aeb01c425 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.5' +version '9.1.6' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java index 46fc3627a..f805347df 100644 --- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java +++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java @@ -15,6 +15,7 @@ import org.bukkit.inventory.meta.Damageable; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class AlternativeDurabilityLoss implements Listener { @@ -41,7 +42,7 @@ private static boolean isOnLastDamage(ItemStack itemStack) { public static void doDurabilityLoss(Player player) { if (!ItemSettingsConfig.isEliteDurability()) return; - ArrayList itemsList = new ArrayList<>(new ArrayList<>(List.of(player.getInventory().getArmorContents()))); + List itemsList = new ArrayList<>(Arrays.stream(player.getInventory().getArmorContents()).toList()); itemsList.add(player.getInventory().getItemInMainHand()); itemsList.add(player.getInventory().getItemInOffHand()); 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 627ad13e2..9e030fd0e 100644 --- a/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/thirdparty/libsdisguises/DisguiseEntity.java @@ -3,7 +3,6 @@ import com.magmaguy.elitemobs.config.DefaultConfig; 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); } /** diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 074e56b97..963cc8e2a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.5 +version: 9.1.6 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From ae0cb9df908d35fca5a41138e116b4147379676b Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Sun, 25 Aug 2024 16:43:07 +0100 Subject: [PATCH 76/78] EliteMobs 9.1.7: -[New] The Airship Minidungeon remake release! Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../premade/AirShipMinidungeon.off | 105 ------------------ .../premade/AirshipMinidungeon.java | 34 ++++++ src/main/resources/plugin.yml | 2 +- 4 files changed, 36 insertions(+), 107 deletions(-) delete mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off create mode 100644 src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirshipMinidungeon.java diff --git a/build.gradle b/build.gradle index aeb01c425..25ebb48ae 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.6' +version '9.1.7' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off b/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off deleted file mode 100644 index b81419e4b..000000000 --- a/src/main/java/com/magmaguy/elitemobs/config/dungeonpackager/premade/AirShipMinidungeon.off +++ /dev/null @@ -1,105 +0,0 @@ -package com.magmaguy.elitemobs.config.dungeonpackager.premade; - -import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields; -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", - 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"), - new ArrayList<>(List.of( - "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/resources/plugin.yml b/src/main/resources/plugin.yml index 963cc8e2a..b79dd014a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.6 +version: 9.1.7 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From f1f0e0d24dc44c0b40249c2ad3739a42cbb359b8 Mon Sep 17 00:00:00 2001 From: MagmaGuy Date: Tue, 27 Aug 2024 02:02:34 +0100 Subject: [PATCH 77/78] EliteMobs 9.1.8: - [New] Weaving potions are now blocked in EliteMobs worlds to prevent creating permanent cobwebs where they shouldn't be - [New] Seriously optimized bosses with dynamic levels, which should result in big performance boosts for all servers running EliteMobs shrines, especially those who pregenerated their worlds - [Fix] Now handling null quest objectives better - [Fix] Fixed issues that were preventing people from compiling EliteMobs locally or depending on EliteMobs Signed-off-by: MagmaGuy --- build.gradle | 2 +- .../com/magmaguy/elitemobs/EliteMobs.java | 3 + .../elitemobs/dungeons/DungeonProtector.java | 30 +++++-- .../custombosses/CustomBossEntity.java | 82 ++++++++++++------- .../quests/objectives/QuestObjectives.java | 8 +- src/main/resources/plugin.yml | 2 +- 6 files changed, 87 insertions(+), 40 deletions(-) diff --git a/build.gradle b/build.gradle index 25ebb48ae..da02e0566 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ processResources { } group 'com.magmaguy' -version '9.1.7' +version '9.1.8' repositories { maven { diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java index f5b6a62a6..e57279907 100644 --- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java +++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java @@ -38,6 +38,7 @@ 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; @@ -278,6 +279,7 @@ public void onEnable() { VersionChecker.check(); DynamicQuest.startRandomizingQuests(); + CustomBossEntity.startUpdatingDynamicLevels(); } @Override @@ -339,6 +341,7 @@ public void onDisable() { BossBarUtil.shutdown(); ScriptAction.shutdown(); CustomMusic.shutdown(); + CustomBossEntity.shutdown(); Logger.info("Saving EliteMobs databases..."); PlayerData.closeConnection(); MagmaCore.shutdown(); diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index 0aca7625c..d933a6c02 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -8,12 +8,10 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.*; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; +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; @@ -22,8 +20,8 @@ public class DungeonProtector implements Listener { private static final HashSet bypassingPlayers = new HashSet<>(); - public static boolean toggleBypass (UUID playerUUID){ - if (bypassingPlayers.contains(playerUUID)){ + public static boolean toggleBypass(UUID playerUUID) { + if (bypassingPlayers.contains(playerUUID)) { bypassingPlayers.remove(playerUUID); return false; } @@ -168,4 +166,24 @@ public void preventDoorOpeningSpawning(EntityChangeBlockEvent event) { 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); + }); + } + } 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 b2d479fdd..ecc48c5d1 100644 --- a/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java +++ b/src/main/java/com/magmaguy/elitemobs/mobconstructor/custombosses/CustomBossEntity.java @@ -45,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 { @@ -102,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 @@ -364,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; @@ -378,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() { @@ -488,7 +502,7 @@ public void fullHeal() { @Override public void remove(RemovalReason removalReason) { - if (dynamicLevelUpdater != null) dynamicLevelUpdater.cancel(); + dynamicLevelBossEntities.remove(this); if (livingEntity != null) persistentLocation = livingEntity.getLocation(); //Remove the living entity super.remove(removalReason); @@ -613,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/quests/objectives/QuestObjectives.java b/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java index 2019dc36f..17a23b443 100644 --- a/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java +++ b/src/main/java/com/magmaguy/elitemobs/quests/objectives/QuestObjectives.java @@ -10,6 +10,7 @@ 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; @@ -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/resources/plugin.yml b/src/main/resources/plugin.yml index b79dd014a..0e361e346 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: EliteMobs -version: 9.1.7 +version: 9.1.8 author: MagmaGuy main: com.magmaguy.elitemobs.EliteMobs api-version: 1.14 From 4674e3703349069719afdc832b030078a5316d0e Mon Sep 17 00:00:00 2001 From: "Aaron James R. Mission" <68337605+CptZee@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:26:47 +0800 Subject: [PATCH 78/78] Disabled anchor respawn points interactions. --- .../com/magmaguy/elitemobs/dungeons/DungeonProtector.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java index d933a6c02..829acdaf7 100644 --- a/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java +++ b/src/main/java/com/magmaguy/elitemobs/dungeons/DungeonProtector.java @@ -186,4 +186,12 @@ public void preventCobwebPotions(PotionSplashEvent event) { }); } + @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); + } + } + }