๐
1 file
10,803 chars
๐
pasted-code-1783868531954.txt
txt
111 lines
โถ
pasted-code-1783868531954.txt
txt
111 lines
# Build Prompt: Paper 1.21.11 PvP Rebalance Plugin
plugin name:Senpai_pvp_Rebalance
By: SenpaiSensei
## Goal / Design Philosophy
Build a Paper (Java, Minecraft 1.21.11) plugin for a PvP server whose core mission is fixing kit imbalance. In vanilla-adjacent PvP, meta kits (SMP sword-and-shield, Mace, TNT-Carts, Crystal) are wildly unbalanced against each other โ Mace and Carts shred SMP, Crystal shreds everyone. The goal of this plugin is **not** to nerf everything into blandness, but to buff/adjust each playstyle so that every kit is roughly equally strong and equally fun to play and fight against. Numbers below are starting points for live balance testing, not final values โ **everything numeric must live in `config.yml`**, not be hardcoded, since the values will be iterated on constantly.
Target stack: Java 21, Paper API for 1.21.11 (confirm exact artifact version/build against the PaperMC repo โ `io.papermc.paper:paper-api`, repo `repo.papermc.io/repository/maven-public/`), Maven or Gradle, standard `plugin.yml`.
---
## 1. Class Selection System (current phase)
- On a player's **first join ever** (track with a persisted flag, e.g. a PDC tag or a row in the player-data store), force-open a class-select INVENTORY GUI. Until a class is chosen, restrict PvP/damage output from that player (or simply block combat) so nobody fights class-less.
- INVENTORY GUI: single-row chest inventory. One item per class (e.g. Iron Sword = Warrior, Minecart = Carter, Mace = Macer). Since Macer isn't designed yet, show it as a **locked/disabled placeholder** (gray dye or barrier, "Coming Soon" name) โ clicking it does nothing yet.
- Add a `/class` command that reopens the menu, and a `/class info` that shows the player's current class and its perks.
- Class changes after initial pick should require admin permission (`/class set `) to prevent mid-fight class-swapping abuse โ unless you want free re-picking, make this a config toggle (`allow-self-reclass: false`).
- Persist chosen class per-player (SQLite recommended over YAML once the player count grows; PDC alone is fine for MVP but doesn't survive entity/attribute resets cleanly โ use a small data layer you can swap later).
- Classes are mutually exclusive. Re-apply class effects (health, resistance, attribute modifiers) on `PlayerJoinEvent` and `PlayerRespawnEvent`, since attributes/effects don't persist perfectly across sessions/deaths.
### Warrior
- **Health:** set `GENERIC_MAX_HEALTH` attribute to 30.0 (15 hearts). Also heal/set current health appropriately when first applied so they don't spawn at 10 hearts out of 30.
- **Resistance:** permanent Resistance I. Apply via `PotionEffect(PotionEffectType.RESISTANCE, PotionEffect.INFINITE_DURATION, 0, true, false)` on join/respawn. Also listen for `EntityPotionEffectEvent` and cancel removal of this specific effect (e.g. via milk bucket) if you want it truly unremovable โ otherwise just silently reapply it a tick after any removal.
- **Strength splash upgrade:** listen on `PotionSplashEvent`. For each affected Warrior entity, read the base potion level off the thrown `ThrownPotion`'s `PotionData`/effects (`PotionType.STRENGTH` = level 1, `PotionType.STRONG_STRENGTH` = level 2). Cancel the potion's normal effect application on that entity and manually apply Strength at `amplifier + 1` (so a Strength I splash gives Strength II, a Strength II splash gives Strength III) for the potion's normal duration. Note vanilla has no natural Strength III potion โ this is intentionally exceeding the vanilla cap, which is fine since `PotionEffect` amplifiers are just integers.
- **Restrictions โ no Mace, no Carts:** two things to decide and lock in before building (see Open Questions below), but the straightforward version is:
- Cancel/zero damage when a Warrior lands a hit while holding a Mace (`EntityDamageByEntityEvent`, check attacker's class + held item), and/or simply deny Warriors the ability to pick up/keep a Mace in their inventory.
- Cancel minecart placement (`PlayerInteractEvent` placing a minecart) and/or cancel `VehicleEnterEvent` for Warriors entering a minecart.
### Carter
- **Auto blast protection, stackable with normal Protection:** do **not** implement this as a real stored enchantment โ vanilla puts Protection and Blast Protection in the same exclusivity group, so trying to have both as real enchants means fighting the anvil/enchant-table conflict rules and resource-pack weirdness. Instead:
- On `EntityDamageEvent` where the victim is a Carter, the damage cause is explosion-related (`EXPLOSION`, `BLOCK_EXPLOSION`), and they're wearing a chestplate + leggings, apply an **additional** damage reduction on top of whatever real enchantments (including normal Protection) already reduced โ equivalent to roughly Blast Protection IV. Make the level configurable.
- This keeps their actual Protection enchant fully functional and vanilla-compliant, while giving the innate blast reduction as a class perk layered on top.
### Macer
- **Not designed yet.** Leave it registered in the class enum/INVENTORY GUI as locked, wire up the data plumbing (so picking it later doesn't require a schema change), but implement no perks. Placeholder for a future spec.
---
## 2. Global Item Rebalance (applies to everyone, independent of class)
### Fishing Rod โ Grapple / Anti-Windcharge
- Goal: give fishing rod users a way to ground a Mace/wind-charge player instead of just watching them fly off.
- On `PlayerFishEvent` with state `IN_GROUND`/`HOOK_ENTITY` and a successful reel-in of another player, apply a short "rooted" status to the hooked player (config: default 3 seconds).
- While rooted: cancel or heavily dampen velocity changes from Wind Charge explosions (and optionally Elytra boosts) hitting that player โ you'll likely need to intercept the knockback/velocity change right after the explosion (there's no single clean vanilla event for "wind charge launched me," so track it via velocity delta right after `EntityDamageEvent`/explosion interaction from a wind charge, or via a short-lived marker + `PlayerVelocityEvent`-equivalent handling on the next movement tick).
- All numbers (root duration, whether it also applies to Elytra glide velocity) go in config.
### Elytra โ Stamina System (replaces durability-based flight limits)
- Set Elytra items unbreakable (`ItemMeta#setUnbreakable(true)`) so vanilla durability loss is irrelevant โ flight is now gated by a custom per-player stamina value instead.
- Track a per-player "flight stamina" value, default max = 1200 ticks (60s).
- While `Player#isGliding()` is true, drain stamina every tick (or batch every few ticks for performance).
- While not gliding, regenerate stamina back toward max (default: same rate as drain, i.e. 1:1 โ make the ratio configurable in case you want slower regen for balance).
- When stamina hits 0: force `setGliding(false)`, and lock the player out of gliding entirely for a cooldown window (default 60s) โ cancel `PlayerToggleGlideEvent` while on cooldown.
- Show remaining stamina to the player via action bar or boss bar (percentage or seconds remaining) so it reads as a clear "stamina bar," not an invisible mechanic.
---
## 3. Future Direction โ Passive Kit-Based Balance (Phase 2, described for context)
This is the long-term "more vanilla" replacement for hand-picked classes: instead of choosing a class, every player gets baseline buffs automatically, and those buffs turn off if their inventory shows they're running one of the historically-overpowered kits (since those kits get their own separate balancing instead).
- **Baseline for everyone:** 16 hearts (32 HP), +3 attack damage (attribute modifier on `GENERIC_ATTACK_DAMAGE`), +20% movement speed while wearing a full diamond armor set. The speed bonus stacks with Speed potions (attribute modifiers and potion effects stack naturally, so no extra math needed there). No speed bonus while wearing netherite armor (netherite check should override/suppress the diamond bonus, not stack with it).
- **Buff-disable condition:** if the player's inventory contains a full flagged "kit," none of the three baseline buffs apply at all:
- Cart Kit A: Minecart + Rails + Flint & Steel + Crossbow
- Cart Kit B: Minecart + Rails + Flint & Steel + Bow
- Mace Kit A: Mace + Wind Charge
- Mace Kit B: Mace + Elytra
- Having *any one* of these four full sets simultaneously in inventory (not equipped, just carried) is enough to disable the baseline.
- **Implementation note:** don't try to catch every inventory-changing event individually โ run a periodic per-player inventory scan (e.g. every 20 ticks) that checks for the kit combos and toggles the attribute modifiers on/off. It's simpler and more reliable than chasing every pickup/drop/click event.
**Open design decision, flag before building this phase:** the message this spec is based on describes Phase 2 as replacing the class system ("instead of there being classes..."), but Phase 1 (Warrior/Carter/Macer) is the part actually meant to be built right now. Don't build both simultaneously โ treat Phase 2 as a documented future direction, not part of this build.
---
## 4. Suggested config.yml skeleton
```yaml
classes:
warrior:
max-health: 30.0
resistance-level: 1
strength-splash-bonus-levels: 1
block-mace-damage: true
block-minecart-use: true
carter:
blast-protection-level: 4
requires-chest-and-legs: true
global:
fishing-rod:
root-duration-seconds: 3
affects-windcharge: true
elytra:
max-stamina-seconds: 60
regen-rate-multiplier: 1.0
cooldown-on-empty-seconds: 60
class-select:
allow-self-reclass: false
```
---
## 5. Open Questions to Settle Before/While Building
- Warrior's "no carts" restriction: block *all* minecarts, or only the specific TNT-cart kit combo (Minecart + Rails + Flint & Steel + Crossbow/Bow)? Affects how strict the interaction-cancel logic needs to be.
- Should Warrior's Mace/Cart restriction *deny holding the items at all* (drop-on-pickup) or just *neuter their function* (item sits inert in inventory)? The latter is less punishing but more code paths to cover.
- Blast Protection level for Carter โ IV suggested above, but this is a balance number you'll want to tune live.
- Elytra regen rate โ 1:1 with drain is the simplest starting point, but you may want regen slower than drain so stamina-management actually matters.
- Is class selection permanent per player forever, or reset on death/season/reset command?
- Confirm exact Paper 1.21.11 API artifact/build string against PaperMC's repo before setting up the build file, since patch-version API coordinates can shift.
KodariJul 12 at 3:25 pm 14
SenpaiPvpRebalance
A Paper 1.21.11 PvP rebalance plugin that balances Warrior, Carter, and future Macer playstyles through configurable class selection, persistent player choices, class-specific protections, and upgraded potion behavior. It provides a first-join class GUI, administrative class management, combat restrictions, Carter blast resistance, Warrior strength-splash upgrades, fishing-rod rooting against wind charges, and an unbreakable Elytra stamina system with regeneration, cooldowns, and action-bar feedback. All balance values live in config.yml.
.1 Create the Gradle project and Paper plugin metadata.
2. Implement persistent class selection, GUI handling, and /class administration.
3. Implement Warrior, Carter, fishing-rod, and combat rebalance mechanics.
4. Implement Elytra stamina, cooldowns, item protection, and player feedback.
5. Add configurable defaults and register all runtime components.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
14 1,151
src/main/java/com/senpaisensei/senpaipvprebalance/SenpaiPvpRebalance.java
package com.senpaisensei.senpaipvprebalance;
import com.senpaisensei.senpaipvprebalance.command.ClassCommand;
import com.senpaisensei.senpaipvrebalance.listener.GameplayListener;
import com.senpaisensei.senpaipvprebalance.player.ClassManager;
import com.senpaisensei.senpaipvprebalance.system.RootManager;
import com.senpaisensei.senpaipvprebalance.system.StaminaManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class SenpaiPvpRebalance extends JavaPlugin {
private ClassManager classManager;
private RootManager rootManager;
private StaminaManager staminaManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.classManager = new ClassManager(this);
this.rootManager = new RootManager(this);
this.staminaManager = new StaminaManager(this);
Bukkit.getPluginManager().registerEvents(
new GameplayListener(this, classManager, rootManager, staminaManager),
this
);
ClassCommand classCommand = new ClassCommand(classManager);
if (getCommand("class") != null) {
getCommand("class").setExecutor(classCommand);
getCommand("class").setTabCompleter(classCommand);
}
}
@Override
public void onDisable() {
if (staminaManager != null) {
staminaManager.shutdown();
}
}
}