From 1babbcb37733d3854bc0053519618078078eb0c4 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sun, 6 Feb 2022 14:31:22 +0000 Subject: [PATCH] Filled config with comments, registered boss with entity lookup system --- .../com/willfp/ecobosses/bosses/EcoBoss.kt | 27 +++++- .../src/main/resources/ecobosses.yml | 89 +++++++++++++------ 2 files changed, 88 insertions(+), 28 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt index 69a730c..99e5dfe 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecobosses/bosses/EcoBoss.kt @@ -2,6 +2,7 @@ package com.willfp.ecobosses.bosses import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.entities.CustomEntity import com.willfp.eco.core.entities.Entities import com.willfp.eco.core.entities.TestableEntity import com.willfp.eco.core.items.CustomItem @@ -283,14 +284,16 @@ class EcoBoss( return currentlyAlive.values.toSet() } - fun spawn(location: Location) { + fun spawn(location: Location): LivingEcoBoss { val mob = mob.spawn(location) as LivingEntity - currentlyAlive[mob.uniqueId] = LivingEcoBoss( + val boss = LivingEcoBoss( plugin, mob.uniqueId, this, createTickers() ) + currentlyAlive[mob.uniqueId] = boss + return boss } private fun createTickers(): Set { @@ -352,6 +355,26 @@ class EcoBoss( } } + init { + Entities.registerCustomEntity( + plugin.namespacedKeyFactory.create(id), + CustomEntity( + plugin.namespacedKeyFactory.create(id), + { + if (it !is LivingEntity) { + return@CustomEntity false + } + + return@CustomEntity Bosses[it]?.boss == this + }, + { + this.spawn(it).entity + } + ) + ) + } + + override fun equals(other: Any?): Boolean { if (other !is EcoBoss) { return false diff --git a/eco-core/core-plugin/src/main/resources/ecobosses.yml b/eco-core/core-plugin/src/main/resources/ecobosses.yml index 7083df1..20b2bd1 100644 --- a/eco-core/core-plugin/src/main/resources/ecobosses.yml +++ b/eco-core/core-plugin/src/main/resources/ecobosses.yml @@ -20,63 +20,85 @@ chains: bosses: - id: steel_golem + # A base mob and modifiers + # View an explanation for this system here: https://plugins.auxilor.io/all-plugins/the-entity-lookup-system mob: iron_golem attack-damage:90 movement-speed:1.5 follow-range:16 health:1200 + # Supported placeholders: %health%, %time% (formats as minutes:seconds, eg 1:56) displayName: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" - influence: 40 - effects: [ ] - conditions: [ ] - lifespan: 120 + influence: 40 # The distance at which effects will be applied to players + effects: [ ] # Effects are done from the player's perspective: to treat the player as the victim, use the self_as_victim option in args + conditions: [ ] # Conditions to apply effects to players; useful if you don't want to affect low-level players + lifespan: 120 # The lifespan of the boss before it despawns, in seconds. Set to a massive number to disable. defence: - preventMounts: true - explosionImmune: true - fireImmune: true - drowningImmune: true - suffocationImmune: true + preventMounts: true # If the boss shouldn't be able to get into boats, minecarts, etc + explosionImmune: true # If the boss should be immune to explosions + fireImmune: true # If the boss should be immune to fire damage + drowningImmune: true # If the boss should be immune to drowning damage + suffocationImmune: true # If the boss should be immune to suffocation - meleeDamageMultiplier: 0.8 - projectileDamageMultiplier: 0.2 + meleeDamageMultiplier: 0.8 # Incoming melee damage will be multiplied by this value. Set to 0 to render immune against melee + projectileDamageMultiplier: 0.2 # Same as melee multiplier, but for projectiles - teleportation: - enabled: true - interval: 100 - range: 20 + teleportation: # Teleport every x ticks in order to avoid being caged in obsidian or similar + enabled: true # If the boss should teleport + interval: 100 # Ticks between teleportation attempts + range: 20 # The range that the boss should check for safe teleportation blocks. rewards: - xp: + xp: # Experience will be randomly generated between these values minimum: 30000 maximum: 60000 topDamagerCommands: - 1: [ ] + # You can specify as many ranks as you want (adding 4, 5, etc) + # You can use %player% as a placeholder for the player name + 1: + - chance: 100 # As a percentage + commands: + - eco give %player% 10000 2: [ ] 3: [ ] nearbyPlayerCommands: + # Commands to be executed for all players near the boss death location radius: 10 + # Uses the same syntax as top damager commands (chance and a list of commands, can use %player%) commands: [ ] - drops: [ ] + # You can specify as many drops as you want, and group several drops together under one chance + drops: + - chance: 100 + items: + - diamond_sword unbreaking:1 name:"Example Sword" target: + # How the boss should choose which player to attack, choices are: + # highest_health, lowest_health, closest, random mode: highest_health + # The distance to scan for players range: 40 bossBar: + # If the boss should have a boss bar enabled: true - color: white - style: progress - radius: 120 + color: white # Options: blue, green, pink, purple, red, white, yellow + style: progress # Options: progress, notched_20, notched_12, notched_10, notched_6 + radius: 120 # The distance from the boss where the boss bar is visible spawn: + # A list of conditions required for a player to be able to spawn a boss, useful to set + # minimum skill levels, etc conditions: [ ] autospawn: - interval: -1 - locations: + # Spawn the boss automatically every x ticks. Picks a random location, but will only + # ever spawn in a world if there are no other bosses of that type in the world. + interval: -1 # The interval in ticks, set to -1 to disable + locations: # Add as many locations as you want - world: world x: 100 y: 100 z: 100 totem: - enabled: false + enabled: false # A spawn totem is a set of 3 blocks on top of each other to spawn a boss (like a snow golem) top: netherite_block middle: iron_block bottom: magma_block - notInWorlds: [ ] + notInWorlds: [ ] # If spawn totems should be disallowed in certain worlds, specify them here egg: - enabled: true + enabled: true # If the boss should have a spawn egg item: evoker_spawn_egg unbreaking:1 hide_enchants name:"&8Steel Golem&f Spawn Egg" lore: - "" @@ -94,6 +116,11 @@ bosses: - netherite_block - iron_block messages: + # For each category, you can add as many messages as you want, each with their own radius. + # Radius is the distance from the boss where the player will be sent the message + # Set to -1 to broadcast globally to all players online + + # Supported placeholders: %x%, %y%, %z% (coordinates) spawn: - message: - "" @@ -101,6 +128,10 @@ bosses: - "&fCome fight it at &8%x%&f, &8%y%&f, &8%z%&f!" - "" radius: -1 + + # Supported placeholders: %damage__player%, %damage_% + # You can include as many ranks as you want - if there is no player at a certain rank, + # it will be replaced with N/A (change in lang.yml) kill: - message: - "" @@ -118,6 +149,12 @@ bosses: - "" radius: -1 injure: [ ] + + # All sounds will be played together at the same time + # A list of sounds can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html + # Volume functions as the distance at which the sound will be heard + # Pitch is any value between 0.5 and 2 + # If you don't want the vanilla mob sounds, add 'silent' as an option to the mob sounds: spawn: - sound: entity_iron_golem_death