Create a Minecraft Paper plugin named "GlyphSMP" compatible with 1.20.4 to 1.21.11. Use Java 17, Paper API only, MiniMessage. No NMS, no dependencies.
ITEM SYSTEM:
- Base: Material.AMETHYST_SHARD with customModelData 101=G1 to 109=G9.
- DisplayName: "<gradient:#7B68EE:#FF55FF>Glyph of {glyph_name}</gradient>". Never use word "Shard" in name.
- Lore format exactly:
Line0: "<#AAAAAA>───────────────────" Line1: "<#FFD700>Ability: {short_name}" Line2: "<#FFFFFF>{desc_line_1}" Line3: "<#FFFFFF>{desc_line_2}" Line4: "<#FFFFFF>" Line5: "<#55FF55>Cooldown: <#FFFFFF>{cd}s" Line6: "<#55FFFF>Trigger: <#FFFFFF>{keybind}" Line7: "<#AAAAAA>───────────────────" Line8: "<#555555>Bound to: {owner_name}" Line9: "<#555555>Unique ID: {nano}" Line10: "<#FF0000>⚠ Drop = stealable"
NBT SECURITY - CRITICAL - NO NAME CHECK:
- Use PersistentDataContainer with NamespacedKey "glyph_id" String, "glyph_owner" String UUID, "glyph_unique" Long nanoTime.
- Validation on PlayerInteractEvent: if!item.hasPDC("glyph_id") ||!item.PDC("glyph_owner").equals(player.UUID.toString()) ||!player.PDC("active_glyph_id").equals(item.PDC("glyph_id")) -> cancel event + send "<#FF5555>This is a fake glyph or not bound to you".
- Display name and lore are IRRELEVANT for validation. Renamed items MUST fail.
SOUND SYSTEM:
All sounds use low volume. Abilities 0.5f, UI clicks 0.3f, errors 0.4f, final reveal 0.3f. Always pitch 1.0f unless specified.
THE 9 GLYPHS - ULTRA UNIQUE:
G1 Chrono Rewind: Store HashMap<UUID, Queue<Pair<Location,Double>>> last 80 ticks. Right click -> teleport+setHealth to 80 ticks ago. CD120s. Sound BLOCK_PORTAL_TRAVEL 0.5f. Lore: "Right click to rewind 4s back in time. Escape death." Trigger: "Right Click"
G2 Mimic Plague: Shift+Right click player -> Map<UUID, Pair<UUID,Long>> expires 15s. If target uses glyph, give caster 1 free use. CD90s. Sound ENTITY_ILLUSIONER_CAST_SPELL 0.5f. Lore: "Copy enemy ability once. Shift+RC on player." Trigger: "Shift+RC Player"
G3 Pocket Dimension: Right click block -> place 5x5x5 bedrock for 200t. Store List<Location> to remove. Whitelist team UUIDs, others get PlayerMoveEvent cancel if entering. CD180s. Sound BLOCK_END_PORTAL_SPAWN 0.5f. Lore: "Create safe room 10s. RC on ground." Trigger: "Right Click Ground"
G4 Life Swap: Right click player <=15b -> double hp1=target.getHealth(); target.setHealth(player.getHealth()); player.setHealth(hp1); CD100s. Sound ENTITY_EVOKER_CAST_SPELL 0.5f. Lore: "Swap HP with enemy. RC on player." Trigger: "Right Click Player"
G5 Gravity Well: Right click air -> spawn armorstand marker 120t. Every 2t pull entities <=7b by vector *0.3, damage 0.5. CD70s. Sound ENTITY_WITHER_AMBIENT 0.5f. Lore: "Black hole pulls enemies. RC in air." Trigger: "Right Click Air"
G6 Soul Anchor: Shift+Right click -> player.PDC.set("soul_anchor", player.getLocation()). On PlayerDeathEvent if PDC has key, BukkitRunnable 100t later respawn at loc with 50% max health + drop items back, clear key. One time use. CD150s. Sound ITEM_TOTEM_USE 0.5f. Lore: "Set respawn point. Shift+RC. One time use." Trigger: "Shift+RC"
G7 Reality Slash: Right click -> get direction, place 12x1x4 barrier blocks for 80t in line. Store to remove. CD60s. Sound BLOCK_GLASS_PLACE 0.5f. Lore: "Create wall 4s. RC forward." Trigger: "Right Click"
G8 Quantum Entangle: Right click teammate -> Map<UUID,Pair<UUID,Long>> 20s. On EntityDamageEvent if either damaged, apply 50% to partner. CD110s. Sound BLOCK_BEACON_POWER_SELECT 0.5f. Lore: "Link HP with ally 20s. RC teammate." Trigger: "Right Click Teammate"
G9 Pandora's Box: Right click -> for Player p : Bukkit.getOnlinePlayers(), if p.team==caster.team give random PotionEffectType beneficial 200t, else random harmful 200t. CD200s. Sound ENTITY_ELDER_GUARDIAN_CURSE 0.5f. Lore: "Chaos for all. Enemies debuff, team buff." Trigger: "Right Click"
CINEMATIC SPINNER - 0.5s TIMING:
Do NOT use inventory INVENTORY GUI. Use sendTitle for animation. Total 168 ticks = 8.4s.
Trigger: /smpstart confirm OR PlayerJoinEvent if smp_started==true && PDC=="NONE" Process:
- player.setMetadata("rolling", new FixedMetadataValue(plugin, true)); player.setWalkSpeed(0f);
- int finalGlyph = ThreadLocalRandom.current().nextInt(1,10); int[] seq = {1,2,3,4,5,6,finalGlyph,finalGlyph,finalGlyph,finalGlyph};
- int[] delays = {10,10,10,10,12,16,20,20}; // ticks: 0.5s,0.5s,0.5s,0.5s,0.6s,0.8s,1s,1s
- new BukkitRunnable(){int i=0;int tick=0;public void run(){if(i>=seq.length){cancel();return;} int g=seq[i]; String name=getGlyphName(g); int cmd=100+g; player.sendTitle(" ", "<#7B68EE>Glyph of "+name, 0, delays[i]+5, 0); player.playSound(player.getLocation(), Sound.UI_BUTTON_CLICK, 0.3f, 1.0f); player.sendActionBar(MiniMessage.miniMessage().deserialize("<#AAAAAA>Selecting your fate...")); i++;}}.runTaskTimer(plugin, 0L, delays[i]);
- After 128t: player.sendTitle("<gradient:#FFD700:#FF55FF>Glyph of "+finalName+"</gradient>", "<#AAAAAA>You have been chosen", 10, 70, 20); player.playSound(player.getLocation(), Sound.UI_TOAST_CHALLENGE_COMPLETE, 0.3f, 1.2f); spawn FIREWORK_ROCKET.
- After 168t: create ItemStack with full NBT+lore+CMD+owner=player, player.PDC.set("active_glyph_id","G"+finalGlyph), giveItem/drop, removeMetadata("rolling"), setWalkSpeed(0.2f), playSound ITEM_PICKUP 0.4f, broadcast "<#7B68EE>{player} <#AAAAAA>awakened <#FF55FF>{name}<#AAAAAA>!".
EVENTS:
- PlayerInteractEvent: NBT validation before ability. Cancel if item is glyph.
- InventoryClickEvent: if clickTopInv.getType()==ENDER_CHEST && (cursor||current).hasPDC("glyph_id") -> cancel + send config.messages.echest_block.
- PlayerDeathEvent: do nothing. Allow natural drop.
- PlayerMoveEvent: if player.hasMetadata("rolling") -> to.set(from.getX(), from.getY(), from.getZ(), to.getYaw(), to.getPitch());
- PlayerItemHeldEvent: if new item fails owner check, do nothing. Just ability won't work.
COMMANDS - All tabcomplete:
- /glyph - Open personal INVENTORY GUI showing current glyph, description, live cooldown timer. Perm glyph.use
- /glyph give <player> <G1-G9|random> - Create item with full NBT+lore+CMD, set target PDC, remove old glyph. Perm glyph.admin
- /glyph remove <player> - Set PDC "NONE", remove all matching items from inv. Perm glyph.admin
- /glyph set <player> <G1-G9> - Set PDC only. Perm glyph.admin
- /glyph info <player> - Show PDC + cooldowns. Perm glyph.admin
- /glyph resetcooldowns <player|all> - Clear map. Perm glyph.admin
- /glyph reload - Reload config.yml. Perm glyph.admin
- /smpstart confirm - Start spinner for all online. Perm glyph.admin
COOLDOWN SYSTEM:
HashMap<UUID, Map<String, Long>> cooldowns. On use check System.currentTimeMillis. If on CD: actionbar "<#FF5555>Cooldown: {s}s" + BLOCK_NOTE_BLOCK_BASS 0.4f. Save to cooldowns.yml onDisable, load onEnable.
CONFIG.YML: smp_started: false block_enderchest: true sounds: ability_vol: 0.5 ui_vol: 0.3 reveal_vol: 0.3 error_vol: 0.4 messages: prefix: "<#7B68EE>Glyph ᴘᴠᴘ <#555555>» " fake_glyph: "<#FF5555>This is a fake glyph or not bound to you" echest_block: "<#FF5555>Glyphs cannot be stored in Ender Chests" no_glyph: "<#FF5555>You have not awakened a glyph yet" cooldown: "<#FF5555>Cooldown: {time}s" cooldowns:
G1: 120 G2: 90 G3: 180 G4: 100 G5: 70 G6: 150 G7: 60 G8: 110 G9: 200
STRUCTURE: Main, GlyphManager, AbilityManager, CooldownManager, SpinnerManager, NBTUtil, CommandManager, ListenerManager. Keep under 78k tokens.
Comments: //TEXTURE_HOOK for Material and CMD, //NBT_HOOK for PDC logic, //SPINNER_HOOK for title animation.
plugin.yml: name: GlyphSMP, version: 1.0, main: com.glyphsmp.Main, api-version: 1.20, commands: glyph,smpstart, permissions: glyph.use default:true, glyph.admin default:op.
Build complete plugin. Ensure 1.20.4 to 1.21.11 compatible. Use NamespacedKey, PersistentDataType.STRING/LONG. No deprecated methods.