π
pasted-code-1776591194747.txt
txt
1 lines
βΆ
Develop a robust Mob Leveling System for Minecraft 1.21.11 where hostile mobs spawn with levels (1-50), scaling their stats and drops.# Environment:- Server: Paper 1.21.1- Java: Version 21- Build Tool: Maven/Gradle# Core Requirements:1. **Targeting & Blacklist**: - Apply levels ONLY to hostile mobs (Monsters). - **STRICT EXCLUSION**: Do NOT apply levels to Bosses (Ender Dragon, Wither) or passive mobs (Villagers, Pets).2. **Leveling Logic (Level 1-50)**: - Upon spawning, assign a level (1-50) using `PersistentDataContainer`. - Scaling: HP and Damage should increase based on the level. - Formula: `final_stat = base_stat * (1 + level * multiplier)`. - Custom Name: Change display name to `Lv.[Level] [MobName]` with color codes (e.g., Green for low, Red for high).3. **Visual Effects (Particles)**: - High-level mobs (e.g., Lv.40+) should have subtle, persistent particles (e.g., FLAME or SMOKE) to indicate their danger level. - Play a specific sound or particle effect when a high-level mob spawns nearby.4. **Loot Scaling**: - Increase drop quantity and quality based on the level. Higher levels should have a chance to drop bonus loot defined in `config.yml`.5. **Configuration (config.yml)**: - Multipliers for HP and Damage. - Particle settings (type, density, level threshold). - Boss/Mob blacklist.# Technical Specs (Security & Performance):- Use `EntitySpawnEvent` for initialization.- Use `PersistentDataContainer` for lightweight data storage.- Ensure all I/O operations (config loading) are efficient and thread-safe to leverage high-performance CPUs like Ryzen 9800X3D.# Output:1. Proposed package and class structure.2. Complete `config.yml` with original default settings.3. Source code for `LevelManager`, `MobSpawnListener`, and the Main class.
Plan:
ConfigManagerwraps all config values (multipliers, particle settings, blacklist, bonus loot)LevelManagerassigns levels via PDC and applies HP/damage scaling via XAttributeMobSpawnListenertriggers onCreatureSpawnEvent, filters Monsters vs blacklistMobDeathListenerhandles scaled loot drops from config bonus loot listParticleTaskruns a repeating scheduler that spawns particles on high-level mobs in loaded chunks
Hereβs a summary of what was built:
MobLevelingPluginβ main class, wires all managers and registers listeners/tasksConfigManagerβ typed accessors for every config key including theBonusLootEntryPOJO for parsed loot table entriesLevelManagerβ assigns a 1β50 level viaPersistentDataContainer, scales HP and damage withXAttribute, and appliesΒ§aβΒ§4coloredLv.X MobNamedisplay namesMobSpawnListenerβ filters toMonsterinstances, checks the blacklist, callsLevelManager.assignLevel(), and plays a configurableXSoundto nearby players when a high-level mob spawnsMobDeathListenerβ boosts XP by 5% per level and rolls configurable bonus loot drops with level-scaled drop chance usingXMaterialParticleTaskβ repeating task (every 2 s) that iterates all world entities and spawnsXParticleeffects on mobs at or above the configured threshold level
π
pasted-code-1776591886085.txt
txt
30 lines
βΆ
# Additional Requirements for Mob Leveling Plugin
Please implement the following features building upon the current code:
1. **Special Combat Logic (Lv.40+ Only)**:
- High-level mobs should perform special attacks at random intervals (e.g., every 5-10 seconds).
- Attack ideas: A small AoE "Shockwave" (knockback nearby players) or a "Dash" attack toward the player.
- Please create a `SpecialAttackHandler` class to manage these behaviors.
2. **Custom Equipment Drops (Lv.30+ Only)**:
- Create a new file `drops.yml` to define special equipment (Items with custom names, lore, and enchantments).
- Mobs Lv.30 and above have a configurable chance to drop one item from this file.
- Use `PersistentDataContainer` to tag these items as "Legendary" or "Epic".
3. **Enhanced Visuals (Dynamic Particles)**:
- Diversify particle effects based on level:
- Lv.30-39: `VILLAGER_HAPPY` or `SPELL_WITCH` (Magic aura)
- Lv.40-50: `FLAME` combined with `SOUL_FIRE_FLAME` or `DRAGON_BREATH` for an intense look.
- Ensure these effects are still performance-optimized.
4. **Dynamic Equipment & Behavior**:
- High-level mobs should have a higher probability of spawning with armor (Iron/Diamond).
- **Unique Behavior**: Occasionally make Skeletons spawn with a Sword instead of a Bow (and vice versa for Zombies if possible) to surprise players.
- Level-based Scaling: The higher the level, the better the equipment quality.
5. **Configuration Update**:
- Add sections to `config.yml` for:
- Special attack frequency.
- Equipment spawn chances per level tier.
- Particle type assignments per level range.
Let me read all existing files before making any changes.
Now I have a complete picture of the existing codebase. Here is my plan:
SpecialAttackTaskβ repeating task polling Lv.40+ mobs with targets, executing shockwave or dash at random intervals tracked per UUIDEquipmentManagerβ applies iron/diamond armor sets and skeleton sword / zombie bow swaps based on level tiersDropsManagerβ loadsdrops.yml, builds taggedLEGENDARY/EPICItemStacks via PDC onItemMeta, called fromMobDeathListenermodel/CustomDropβ Lombok@DataPOJO for drops.yml entriesUpdate
ConfigManager,ParticleTask(tier-based),MobSpawnListener,MobDeathListener,MobLevelingPlugin,config.yml, and createdrops.yml
Here is a summary of everything that was added and changed:
New files:
model/CustomDrop.javaβ Lombok@Datarecord for drops.yml entries (material, name, lore, enchantments, rarity, drop-chance, level-required)manager/DropsManager.javaβ loadsdrops.ymlon startup, builds fully decoratedItemStacks with custom names/lore/enchantments and aitem_rarityPDC tag (LEGENDARY/EPIC) on theItemMeta;tryDrop()applies a level-scaled drop chance roll for each eligible entrymanager/EquipmentManager.javaβapplyEquipment()handles skeleton sword-swap and zombie bow-swap chances, then applies enchanted iron (Lv.30+) or diamond armor sets (Lv.40+ secondary roll) with 0% drop chance so gear stays on the mobtask/SpecialAttackTask.javaβ runs every tick (20L), tracks per-UUID cooldowns in aHashMap<UUID, Long>with a random interval betweenmin-interval-secondsandmax-interval-seconds; flips a coin between Shockwave (velocity + damage to nearby players + zero-power cosmetic explosion) and Dash (velocity vector toward the target player); dead entity UUIDs are pruned each cycledrops.ymlβ six default legendary/epic items (Infernal Edge sword, Soul Reaper Bow, Void Warden Plate, Mystic Crown, Bloodthirst Axe, Phantom Striders) with full enchantments and level requirements from 30β48
Updated files:
ConfigManagerβ all old particle methods replaced with tier1/tier2 accessors; new methods forspecial-attacks,equipment, andlegendary-dropsconfig sectionsParticleTaskβ now selects the correct particle list and density per tier based on mob level (Lv.30-39 β VILLAGER_HAPPY + SPELL_WITCH; Lv.40+ β FLAME + SOUL_FIRE_FLAME)MobSpawnListenerβ callsequipmentManager.applyEquipment()afterassignLevel(); uses the newgetSpawnSoundThreshold()methodMobDeathListenerβ callsdropsManager.tryDrop()after bonus loot processingMobLevelingPluginβ registersDropsManager,EquipmentManager, andSpecialAttackTask(20L timer for 1-second polling fidelity)config.ymlβ replaced flat particle keys withtiers, addedspecial-attacks,equipment, andlegendary-dropssections
π
pasted-code-1776593635695.txt
txt
36 lines
βΆ
# Role:
Expert Minecraft Plugin Developer (Paper API)
# Goal:
Upgrade the existing Mob Leveling Plugin to support a "5-year lifecycle" by implementing meaningful progression, regional diversity, and a resource-driven economy.
# New Features to Implement:
1. **Regional Biome Modifiers (Target: Feature #3)**:
- Implement a `BiomeAbilityManager`.
- Mobs spawning in specific Biomes should get a "Regional Prefix" and a unique ability.
- Examples:
- [Desert] Mobs: 20% chance to apply Blindness on hit.
- [Ice] Mobs: 20% chance to apply Slowness.
- [Jungle] Mobs: 20% chance to apply Poison.
- These abilities should scale with the mob's level.
2. **Player Rank & Progression System (Target: Feature #4)**:
- Create a `PlayerLevelManager` that tracks "Slayer XP" (earned by killing leveled mobs).
- Higher Player Ranks should unlock passive perks (e.g., +1% Loot Luck per rank, or 5% Damage Resistance against Lv.50 mobs).
- Display the player's rank prefix in chat or on the Action Bar when they kill a mob.
- Use `PersistentDataContainer` or a flat file to store player progress.
3. **Material Recycling & "Essence" System (Target: Feature #2)**:
- High-level mobs (Lv.40+) should have a chance to drop a "Mob Essence" (Custom Item).
- This Essence should be used as a "Currency" or "Crafting Ingredient" for the Legendary Drops defined in `drops.yml`.
- Purpose: Ensure even if a player has the best gear, they still need to hunt high-level mobs to maintain or "Upgrade" their items (Resource Sink).
4. **Advanced Special Attacks & Particle Polishing**:
- Add a "Boss Aura" for Lv.50 mobs: A rotating particle circle at their feet using `SONIC_BOOM` or `TRIAL_SPARKS`.
- Special attacks (Shockwave/Dash) should have a 1-second visual "Telegraph" (e.g., smoke rising) before firing to allow skilled players to dodge.
# Technical Requirements:
- Use **Lombok** for new Data classes.
- Ensure `drops.yml` is updated to include "Mob Essence" and crafting/exchange requirements.
- Maintain high performance by using asynchronous tasks for XP saving and particle rendering.
Let me read every existing file before touching anything.
I have a complete picture of the codebase. My plan:
New:
PlayerDatamodel,BiomeAbilityManager(biome-prefix + on-hit effects),PlayerLevelManager(slayer XP / ranks / perks / flat-file persistence),MobDamageListener(biome-effect + rank resistance hooks),BossAuraTask(Lv.50 rotating particle ring)Patch:
ConfigManager(new sections),DropsManager(essence drop + luck multiplier),MobSpawnListener(biome tagging),MobDeathListener(XP award + essence + luck),SpecialAttackTask(smoke telegraph before attack fires),MobLevelingPlugin(register all new systems)Update:
config.ymlanddrops.ymlwith all new sections
Here is a summary of every change made:
5 new files:
model/PlayerData.javaβ@Getter @SetterLombok POJO storing UUID,slayerXp, andrankmanager/BiomeAbilityManager.javaβ loads biome groups from config, tags entities with abiome_groupPDC key on spawn and prepends a coloured prefix to their name, then intryApplyBiomeEffect()rolls a configurable 20% chance to apply a level-scaled blindness/slowness/poison effect when that mob hits a playermanager/PlayerLevelManager.javaβConcurrentHashMap-backed player registry, persists toplayerdata.yml, awards Slayer XP per kill (scales with mob level), drives rank-up with sound + chat notification, sends the playerβs current rank + XP total to the action bar on every kill, providesgetLootLuckMultiplier()andgetDamageReduction()for downstream systems; async periodic save every 5 minutes, sync save on disablelistener/MobDamageListener.javaβ firesBiomeAbilityManager.tryApplyBiomeEffectand applies rank-based damage reduction when a leveled mob damages a playertask/BossAuraTask.javaβ runs every 5 ticks, draws a rotating ring ofSONIC_BOOM(configurable) particles around every Lv.50+ mob using per-UUID angle tracking; dead mob UUIDs are pruned each cycle
7 patched / updated files:
ConfigManagerβ 11 new accessor methods forboss-aura,essence,special-attacks.telegraph-duration-ticks, and the biome/rank sectionsDropsManagerβ addedessenceKeyPDC key, newtryDropEssence()method that reads all essence properties from config and tags the item, updatedtryDrop()signature to accept aluckMultiplierthat scales effective drop chance by player rankMobSpawnListenerβ one-line addition: callsbiomeAbilityManager.applyBiomeTag(entity)immediately after level assignmentMobDeathListenerβ resolves the killer player, awards Slayer XP, derives a luck multiplier from their rank, passes it totryDrop(), and callstryDropEssence()SpecialAttackTaskβ replaced directperformShockwave/performDashcalls withtriggerWithTelegraph(), which spawns a risingLARGE_SMOKEcloud every 5 ticks for the configured telegraph window then fires the actual attack viarunTaskLaterso skilled players can dodgeconfig.ymlβ addedboss-aura,essence,special-attacks.telegraph-duration-ticks,biome-abilities(desert/ice/jungle groups), andplayer-ranks(10 rank tiers with XP thresholds, names, loot luck, and damage resistance settings)drops.ymlβ addedmob_essence_infused_bladeas the canonical Essence-exchange target item (drop-chance 0.0 β intentionally server-drop-disabled, used as a crafting/economy reference)
π
pasted-code-1776596487856.txt
txt
39 lines
βΆ
Markdown
# Role:
Expert Minecraft Plugin Developer (Paper API / Java)
# Goal:
Implement a Player Leveling System with custom Stat Allocation and a Bestiary (Collection) UI.
# New Core Features:
1. **Player Leveling & Stat Points**:
- When a player gains enough Slayer XP (from the existing system), they level up.
- Each level-up grants "Stat Points" (e.g., 3 points per level).
- Create a INVENTORY GUI `/stats` where players can spend points on:
- **Strength**: Increases melee damage.
- **Vitality**: Increases max health.
- **Agility**: Increases movement speed.
- **Intelligence**: Increases ability damage or reduces cooldowns.
- Use `AttributeModifier` to apply these stats persistently.
2. **Visual Feedback (On-Screen Effects)**:
- **Level Up**: When a player levels up, show a large "LEVEL UP!" Title on their screen with firework effects and a high-pitched sound.
- **XP Gain**: Show a temporary "XP +[Amount]" hologram (using Display Entities or Action Bar) above the mob's death location.
3. **Bestiary (Mob Collection) UI**:
- Create a INVENTORY GUI `/bestiary` to track killed mob types.
- Features:
- Icons for each mob type (locked/unlocked).
- Displays "Total Kills" and "Highest Level Defeated" per mob.
- Reward: If a player kills 100 of a specific mob, they get a permanent "Hunter's Perk" (e.g., 5% more damage against that mob).
4. **Technical Integration**:
- Store Player Stats and Bestiary data in a new `player_profiles.yml` or via `PersistentDataContainer`.
- Ensure UI menus are intuitive with clickable items (Chest INVENTORY GUI).
# Output:
1. `PlayerStats` model class (Lombok).
2. `StatGUIManager` and `BestiaryGUIManager` classes.
3. Updated `MobDeathListener` to trigger Level Up effects and log bestiary data.
4. `config.yml` additions for stat scaling values and level-up rewards.
Let me read every relevant file before writing a single line.
Now I have a full picture of every file. Let me plan before writing a single line of code:
New models:
PlayerStats(@Data, 4 int stat fields),BestiaryEntry(@Data)Updated model:
PlayerDataβ addplayerLevel+availableStatPointsfields and 5-arg constructorNew manager:
PlayerProfileManagerβ stat allocation (AttributeModifier), bestiary tracking, intelligence XP multiplier, persistence toplayer_profiles.yml,PlayerJoinEventto reapply attributesGUI framework:
InventoryHandler,InventoryButton,InventoryGUI(lazy init +clearButtons()),GUIManager,GUIListenerGUI impls:
StatGUI(4-row chest, allocate strength/vitality/agility/intelligence),BestiaryGUI(6-row paged chest, mob kill tracking + hunter perk badge)New commands:
StatsCommand,BestiaryCommandPatch:
ConfigManager(new stat/bestiary/level accessors),PlayerLevelManager(player level tracking, stat point award, Title + firework + sound level-up effect),MobDeathListener(bestiary logging, floating TextDisplay XP gain, intelligence multiplier),MobDamageListener(hunter perk for playerβmob),MobLevelingPlugin(wire everything),config.yml,plugin.yml
Now patch all existing files:
Hereβs a full summary of everything added and changed:
12 new files created:
File | Purpose |
|---|---|
model/PlayerStats | @Data Lombok β strength, vitality, agility, intelligence fields |
model/BestiaryEntry | @Data Lombok β mob type, kills, highest level |
model/PlayerData | Updated with playerLevel + availableStatPoints (5-arg constructor) |
inventory/InventoryHandler | Interface β onClick, onOpen, onClose |
inventory/InventoryButton | Builder pattern β creator() + consumer() |
inventory/InventoryGUI | Abstract base, lazy inventory init, added clearButtons() |
inventory/gui/GUIManager | Tracks active inventories, routes all events to correct handler |
inventory/gui/GUIListener | Bukkit Listener that delegates to GUIManager |
inventory/impl/StatGUI | 4-row chest β shows current stats, lets players spend 1 point per click, refreshes in-place |
inventory/impl/BestiaryGUI | 6-row paged chest β mob icons, kill counts, highest level, hunterβs perk badge |
command/StatsCommand | /stats β opens StatGUI |
command/BestiaryCommand | /bestiary β opens BestiaryGUI |
PlayerProfileManager β the central new manager: loads/saves player_profiles.yml, allocates stats and immediately applies AttributeModifier for Strength/Vitality/Agility using XAttribute, computes an Intelligence XP multiplier, tracks bestiary kill data, fires the βHunterβs Perkβ chat notification at 100 kills, implements PlayerJoinEvent to re-apply attribute modifiers on reconnect, and async-saves every 5 minutes.
Patched files: PlayerLevelManager adds level tracking (level = total XP Γ· xp-per-player-level), awards stat points on level-up, and fires a bold LEVEL UP! Title + firework + ENTITY_PLAYER_LEVELUP sound purely on the main thread. MobDeathListener now logs the kill to the bestiary, applies the intelligence XP multiplier, then spawns a TextDisplay entity at death location showing +XP {amount} that auto-removes after 2 seconds. MobDamageListener gained a second handler for playerβmob hits that applies the Hunterβs Perk damage bonus. MobLevelingPlugin wires PlayerProfileManager, GUIManager, GUIListener, and both commands. config.yml gained stats and bestiary sections. plugin.yml gained /stats and /bestiary commands with permissions.
change language japanese
package com.example.mobleveling;
import com.example.mobleveling.command.BestiaryCommand;
import com.example.mobleveling.command.StatsCommand;
import com.example.mobleveling.inventory.gui.GUIListener;
import com.example.mobleveling.inventory.gui.GUIManager;
import com.example.mobleveling.listener.MobDamageListener;
import com.example.mobleveling.listener.MobDeathListener;
import com.example.mobleveling.listener.MobSpawnListener;
import com.example.mobleveling.manager.BiomeAbilityManager;
import com.example.mobleveling.manager.ConfigManager;
import com.example.mobleveling.manager.DropsManager;
import com.example.mobleveling.manager.EquipmentManager;
import com.example.mobleveling.manager.LevelManager;
import com.example.mobleveling.manager.PlayerLevelManager;
import com.example.mobleveling.manager.PlayerProfileManager;
import com.example.mobleveling.task.BossAuraTask;
import com.example.mobleveling.task.ParticleTask;
import com.example.mobleveling.task.SpecialAttackTask;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
public class MobLevelingPlugin extends JavaPlugin {
@Getter private ConfigManager configManager;
@Getter private LevelManager levelManager;
@Getter private DropsManager dropsManager;
@Getter private EquipmentManager equipmentManager;
@Getter private BiomeAbilityManager biomeAbilityManager;
@Getter private PlayerLevelManager playerLevelManager;
@Getter private PlayerProfileManager playerProfileManager;
@Getter private GUIManager guiManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.levelManager = new LevelManager(this);
this.dropsManager = new DropsManager(this);
this.equipmentManager = new EquipmentManager(this);
this.biomeAbilityManager = new BiomeAbilityManager(this);
this.playerLevelManager = new PlayerLevelManager(this);
this.playerProfileManager = new PlayerProfileManager(this);
this.guiManager = new GUIManager();
getServer().getPluginManager().registerEvents(new MobSpawnListener(this), this);
getServer().getPluginManager().registerEvents(new MobDeathListener(this), this);
getServer().getPluginManager().registerEvents(new MobDamageListener(this), this);
getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
new ParticleTask(this).runTaskTimer(this, 40L, 40L);
new SpecialAttackTask(this).runTaskTimer(this, 20L, 20L);
new BossAuraTask(this).runTaskTimer(this, 5L, 5L);
getServer().getScheduler().runTaskTimerAsynchronously(this,
() -> playerLevelManager.saveDataAsync(), 6000L, 6000L);
getServer().getScheduler().runTaskTimerAsynchronously(this,
() -> playerProfileManager.saveDataAsync(), 6000L, 6000L);
getCommand("stats").setExecutor(new StatsCommand(this));
getCommand("bestiary").setExecutor(new BestiaryCommand(this));
getLogger().info("MobLevelingSystem enabled.");
}
@Override
public void onDisable() {
if (playerLevelManager != null) {
playerLevelManager.saveDataSync();
}
if (playerProfileManager != null) {
playerProfileManager.saveDataSync();
}
getLogger().info("MobLevelingSystem disabled.");
}
}