wuweeuea

--- 📎 Attached 2 file(s):

File: pasted-code-1794165746976.txt

txt
options:
    prefix: &8[&8&lSoulSMP&8]&r
    gui-title: &8&lSoulSMP &8- &7Souls

    max-souls: 5
    passive-unlock: 3
    ultimate-unlock: 5
    select-min-souls: 1

    pvp-souls: true
    farm-lockout-minutes: 30

    wither-hits: 4
    barrier-hits: 20
    glitch-hits: 10
    invis-hits: 10
    void-hits: 10

    wither-ult-hits: 10
    barrier-ult-hits: 10
    glitch-ult-hits: 10
    invis-ult-hits: 10
    void-ult-hits: 10

    wither-ult-seconds: 20
    barrier-ult-seconds: 10
    glitch-ult-seconds: 10
    invis-ult-seconds: 5
    void-ult-seconds: 5

    ult-cooldown-seconds: 90
    show-cooldown-bar: true

    target-memory-seconds: 30
    target-range: 40

# =============================================================================
#  SECTION 1 - SMALL HELPERS
# =============================================================================

function soulKey(p: offlineplayer) :: text:
    return "%uuid of {_p}%"

function soulPlayerFromKey(k: text) :: player:
    loop all players:
        if "%uuid of loop-player%" is {_k}:
            return loop-player

function soulNum(k: text, f: text) :: number:
    if {soulsmp::data::%{_k}%::%{_f}%} is not set:
        return 0
    return {soulsmp::data::%{_k}%::%{_f}%}

function soulGetCount(p: offlineplayer) :: number:
    return soulNum(soulKey({_p}), "count")

function soulSetCount(p: offlineplayer, n: number):
    set {_k} to soulKey({_p})
    set {soulsmp::data::%{_k}%::count} to max(0, min({_n}, {@max-souls}))

function soulGetType(p: offlineplayer) :: text:
    set {_k} to soulKey({_p})
    if {soulsmp::data::%{_k}%::type} is not set:
        return "none"
    return {soulsmp::data::%{_k}%::type}

function soulSetType(p: offlineplayer, t: text):
    set {_k} to soulKey({_p})
    set {soulsmp::data::%{_k}%::type} to {_t}
    set {soulsmp::data::%{_k}%::hits} to 0
    set {soulsmp::data::%{_k}%::charge} to 0

function soulValid(t: text) :: boolean:
    if {_t} is "wither" or "barrier" or "glitch" or "invis" or "void":
        return true
    return false

function soulName(t: text) :: text:
    if {_t} is "wither":
        return "&8&lWither Soul"
    if {_t} is "barrier":
        return "&c&lBarrier Soul"
    if {_t} is "glitch":
        return "&a&lGlitch Soul"
    if {_t} is "invis":
        return "&b&lInvis Soul"
    if {_t} is "void":
        return "&5&lVoid Soul"
    return "&7No Soul"

function soulPassiveHits(t: text) :: number:
    if {_t} is "wither":
        return {@wither-hits}
    if {_t} is "barrier":
        return {@barrier-hits}
    if {_t} is "glitch":
        return {@glitch-hits}
    if {_t} is "invis":
        return {@invis-hits}
    if {_t} is "void":
        return {@void-hits}
    return 10

function soulUltHits(t: text) :: number:
    if {_t} is "wither":
        return {@wither-ult-hits}
    if {_t} is "barrier":
        return {@barrier-ult-hits}
    if {_t} is "glitch":
        return {@glitch-ult-hits}
    if {_t} is "invis":
        return {@invis-ult-hits}
    if {_t} is "void":
        return {@void-ult-hits}
    return 5

function soulUltSeconds(t: text) :: number:
    if {_t} is "wither":
        return {@wither-ult-seconds}
    if {_t} is "barrier":
        return {@barrier-ult-seconds}
    if {_t} is "glitch":
        return {@glitch-ult-seconds}
    if {_t} is "invis":
        return {@invis-ult-seconds}
    if {_t} is "void":
        return {@void-ult-seconds}
    return 10

function soulPassiveDesc(t: text) :: text:
    if {_t} is "wither":
        return "Every {@wither-hits}th hit applies Wither I for 5s."
    if {_t} is "barrier":
        return "Every {@barrier-hits}th hit stuns the enemy for 3s (chain effect)."
    if {_t} is "glitch":
        return "Every {@glitch-hits}th hit scrambles the enemy's screen."
    if {_t} is "invis":
        return "Every {@invis-hits}th hit makes you invisible for 5s."
    if {_t} is "void":
        return "Every {@void-hits}th hit blanks the enemy's status bars for 2s."
    return "-"

function soulUltDesc(t: text) :: text:
    if {_t} is "wither":
        return "Crits steal 1 heart (you max 15, enemy min 5) for {@wither-ult-seconds}s."
    if {_t} is "barrier":
        return "Trap the last-hit enemy in a 16x16 area for {@barrier-ult-seconds}s."
    if {_t} is "glitch":
        return "Corrupt the last-hit enemy screen for {@glitch-ult-seconds}s."
    if {_t} is "invis":
        return "Empty the last-hit enemy's inventory slots 0-35 for {@invis-ult-seconds}s."
    if {_t} is "void":
        return "Split the last-hit enemy's soul from its body for {@void-ult-seconds}s."
    return "-"

function soulIsCrit(p: player) :: boolean:
    if {_p} is on ground:
        return false
    if fall distance of {_p} is less than or equal to 0:
        return false
    if {_p} is sprinting:
        return false
    if {_p} is flying:
        return false
    if vehicle of {_p} is set:
        return false
    if block at {_p} is water:
        return false
    return true

function soulActiveOK(k: text, id: text) :: boolean:
    if {-soulsmp::activeid::%{_k}%} is {_id}:
        return true
    return false

function soulClearActive(k: text):
    delete {-soulsmp::active::%{_k}%}
    delete {-soulsmp::activeid::%{_k}%}
    delete {-soulsmp::left::%{_k}%}

function soulFinish(k: text, id: text):
    if {-soulsmp::activeid::%{_k}%} is {_id}:
        soulClearActive({_k})

# =============================================================================
#  SECTION 2 - EFFECT HELPERS (health, stun, glitch, inventory, void)
# =============================================================================

# ---- max health bookkeeping (we only ever undo our OWN change) ----
function soulHealthRestore(p: player):
    set {_k} to soulKey({_p})
    if {soulsmp::hpdelta::%{_k}%} is not set:
        stop
    set {_new} to (max health of {_p}) - {soulsmp::hpdelta::%{_k}%}
    set max health of {_p} to max(1, {_new})
    delete {soulsmp::hpdelta::%{_k}%}

function soulWitherSteal(a: player, v: player):
    set {_ak} to soulKey({_a})
    set {_vk} to soulKey({_v})
    set {_amax} to max health of {_a}
    set {_vmax} to max health of {_v}
    if {_amax} + 1 is greater than 15:
        send action bar "&8Wither &7- you are at the 15 heart limit" to {_a}
        stop
    if {_vmax} - 1 is less than 5:
        send action bar "&8Wither &7- enemy is at the 5 heart floor" to {_a}
        stop
    set max health of {_a} to {_amax} + 1
    set max health of {_v} to {_vmax} - 1
    add 1 to {soulsmp::hpdelta::%{_ak}%}
    remove 1 from {soulsmp::hpdelta::%{_vk}%}
    set {-soulsmp::wither::victims::%{_ak}%::%{_vk}%} to true
    heal {_a} by 1
    play sound "entity.wither.hurt" with volume 0.7 and pitch 1.6 at {_v}
    send action bar "&8&lHEART STOLEN &7(%{_amax} + 1%/15)" to {_a}

function soulWitherEnd(a: player):
    set {_ak} to soulKey({_a})
    soulHealthRestore({_a})
    loop {-soulsmp::wither::victims::%{_ak}%::*}:
        set {_vp} to soulPlayerFromKey(loop-index)
        if {_vp} is set:
            soulHealthRestore({_vp})
    delete {-soulsmp::wither::victims::%{_ak}%::*}

# ---- stun (Barrier passive): walk speed 0 + jump cancelled, restored after ----
function soulChainRing(l: location):
    set {_x} to x-coordinate of {_l}
    set {_y} to y-coordinate of {_l}
    set {_z} to z-coordinate of {_l}
    set {_w} to world of {_l}
    for each {_i} in integers from 1 to 12:
        set {_ang} to {_i} * 30
        set {_px} to {_x} + 0.7 * cos({_ang})
        set {_pz} to {_z} + 0.7 * sin({_ang})
        draw 1 light grey dust particle at location({_px}, {_y} + 0.3, {_pz}, {_w})
        draw 1 light grey dust particle at location({_px}, {_y} + 1.2, {_pz}, {_w})

function soulStunEnd(v: player):
    set {_k} to soulKey({_v})
    if {soulsmp::wsrestore::%{_k}%} is set:
        set walk speed of {_v} to {soulsmp::wsrestore::%{_k}%}
        delete {soulsmp::wsrestore::%{_k}%}
    delete {-soulsmp::stun::%{_k}%}

function soulStun(v: player, secs: number):
    set {_k} to soulKey({_v})
    if {-soulsmp::stun::%{_k}%} is set:
        stop
    set {-soulsmp::stun::%{_k}%} to true
    set {soulsmp::wsrestore::%{_k}%} to walk speed of {_v}
    set walk speed of {_v} to 0
    play sound "block.chain.place" with volume 1 and pitch 0.8 at {_v}
    send action bar "&7&lSTUNNED" to {_v}
    set {_ticks} to {_secs} * 4
    set {_n} to 0
    loop {_ticks} times:
        if {-soulsmp::stun::%{_k}%} is not set:
            stop
        if {_v} is not online:
            exit loop
        soulChainRing(location of {_v})
        wait 5 ticks
    soulStunEnd({_v})

# ---- glitch screen (Glitch passive on enemy / ultimate on self) ----
function soulGlitchText(n: number) :: text:
    set {_c::*} to "▓", "▒", "░", "█", "▌", "▐", "╬", "Ж", "Ѫ", "҉", "Ξ", "¦", "Ω" and "Ψ"
    set {_s} to ""
    loop {_n} times:
        set {_i} to a random integer between 1 and size of {_c::*}
        set {_s} to "%{_s}%%{_c::%{_i}%}%"
    return {_s}

function soulGlitchScreen(v: player, secs: number, intense: boolean):
    set {_d} to 1 second * {_secs}
    apply an ambient potion effect of nausea of tier 1 to {_v} for {_d}
    apply an ambient potion effect of darkness of tier 1 to {_v} for {_d}
    set {_msgs::*} to "&4[ERROR] &cConnection to server corrupted", "&8&k||||&7 packet loss detected &8&k||||", "&c&k##&4 fatal exception in render thread &c&k##", "&8&k|&7 chunk data mismatch &8&k|" and "&4&k####&c WARNING: reality unstable &4&k####"
    set {_ticks} to {_secs} * 4
    set {_n} to 0
    loop {_ticks} times:
        if {_v} is not online:
            stop
        add 1 to {_n}
        send title "&k%soulGlitchText(6)%" with subtitle "&c&k%soulGlitchText(14)%" to {_v} for 5 ticks
        send action bar "&4&k|||&c ERR_%a random integer between 100 and 999% &4&k|||&r &8%soulGlitchText(10)%" to {_v}
        play sound "block.note_block.bit" with volume 0.6 and pitch (a random number between 0.5 and 2) at {_v}
        if {_intense} is true:
            if mod({_n}, 3) is 0:
                set {_m} to a random integer between 1 and size of {_msgs::*}
                send "%{_msgs::%{_m}%}%" to {_v}
                play sound "entity.elder_guardian.curse" with volume 0.4 and pitch 1.8 at {_v}
        wait 5 ticks

# ---- Invis ultimate: inventory slots 0-35 backed up (persistent) then cleared ----
function soulInvBackup(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::inv::%{_vk}%::active} is set:
        stop
    loop integers from 0 to 35:
        set {_it} to slot loop-value of {_v}'s inventory
        if {_it} is not air:
            set {soulsmp::inv::%{_vk}%::slot::%loop-value%} to {_it}
    set {soulsmp::inv::%{_vk}%::active} to true
    loop integers from 0 to 35:
        set slot loop-value of {_v}'s inventory to air

function soulInvRestore(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::inv::%{_vk}%::active} is not set:
        stop
    loop {soulsmp::inv::%{_vk}%::slot::*}:
        set {_i} to loop-index parsed as integer
        set {_it} to loop-value
        if slot {_i} of {_v}'s inventory is air:
            set slot {_i} of {_v}'s inventory to {_it}
        else:
            give {_it} to {_v}
    delete {soulsmp::inv::%{_vk}%::*}

# ---- Void ultimate: tagged zombie body stays, soul goes to spectator ----
function soulVoidRemoveBody(l: location, k: text):
    loop all entities in radius 6 around {_l}:
        if (scoreboard tags of loop-entity) contains "soulbody_%{_k}%":
            delete loop-entity

function soulVoidStart(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::void::%{_vk}%::active} is set:
        stop
    set {_body} to location of {_v}
    set {soulsmp::void::%{_vk}%::active} to true
    set {soulsmp::void::%{_vk}%::loc} to {_body}
    set {soulsmp::void::%{_vk}%::gm} to gamemode of {_v}
    spawn an armor stand at {_body}
    set {_e} to last spawned entity
    add "soulbody_%{_vk}%" to scoreboard tags of {_e}
    set name of {_e} to "&5%name of {_v}%'s Void Body"
    set helmet of {_e} to {_v}'s skull
    if {_v}'s chestplate is not air:
        set chestplate of {_e} to {_v}'s chestplate
    if {_v}'s leggings is not air:
        set leggings of {_e} to {_v}'s leggings
    if {_v}'s boots is not air:
        set boots of {_e} to {_v}'s boots
    set {_bx} to x-coordinate of {_body}
    set {_by} to y-coordinate of {_body}
    set {_bz} to z-coordinate of {_body}
    set {_sy} to min({_by} + 40, 250)
    set {_spirit} to location({_bx}, {_sy}, {_bz}, world of {_body})
    set {-soulsmp::void::spirit::%{_vk}%} to {_spirit}
    set gamemode of {_v} to spectator
    teleport {_v} to {_spirit}

function soulVoidEnd(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::void::%{_vk}%::active} is not set:
        stop
    set {_loc} to {soulsmp::void::%{_vk}%::loc}
    set {_gm} to {soulsmp::void::%{_vk}%::gm}
    delete {soulsmp::void::%{_vk}%::*}
    delete {-soulsmp::void::spirit::%{_vk}%}
    teleport {_v} to {_loc}
    if {_gm} is set:
        set gamemode of {_v} to {_gm}
    else:
        set gamemode of {_v} to survival
    wait 2 ticks
    soulVoidRemoveBody({_loc}, {_vk})

function soulVoidAbort(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::void::%{_vk}%::active} is not set:
        stop
    set {_loc} to {soulsmp::void::%{_vk}%::loc}
    delete {soulsmp::void::%{_vk}%::*}
    delete {-soulsmp::void::spirit::%{_vk}%}
    soulVoidRemoveBody({_loc}, {_vk})

# ---- cleanup of everything for one player (idempotent) ----
function soulForceEnd(p: player):
    set {_k} to soulKey({_p})
    if {-soulsmp::active::%{_k}%} is "wither":
        soulWitherEnd({_p})
    soulHealthRestore({_p})
    soulStunEnd({_p})
    soulInvRestore({_p})
    soulVoidEnd({_p})
    delete {-soulsmp::barrier::%{_k}%}
    soulClearActive({_k})

function soulRecover(p: player):
    soulHealthRestore({_p})
    soulStunEnd({_p})
    soulInvRestore({_p})
    soulVoidEnd({_p})

# =============================================================================
#  SECTION 3 - PASSIVES
# =============================================================================

function soulVoidPassive(v: player):
    if gamemode of {_v} is creative:
        stop
    apply an ambient potion effect of darkness of tier 1 to {_v} for 10 seconds
    apply an ambient potion effect of blindness of tier 1 to {_v} for 10 seconds
    send title "&8&lVOIDED" with subtitle "&7Darkness and blindness..." to {_v} for 2 seconds
    play sound "block.sculk_sensor.clicking" with volume 1 and pitch 0.6 at {_v}
    loop 8 times:
        if {_v} is not online:
            stop
        send action bar "&8♥ ░░░░░░░░░░     &8◆ ░░░░░░░░░░" to {_v}
        wait 5 ticks

function soulPassive(a: player, v: player, t: text):
    if {_t} is "wither":
        apply an ambient potion effect of wither of tier 1 to {_v} for 5 seconds
        play sound "entity.wither.hurt" with volume 0.6 and pitch 1.4 at {_v}
        send action bar "&8Wither Passive &7triggered" to {_a}
    else if {_t} is "barrier":
        soulStun({_v}, 3)
        send action bar "&cBarrier Passive &7triggered" to {_a}
    else if {_t} is "glitch":
        soulGlitchScreen({_v}, 3, true)
        send action bar "&aGlitch Passive &7triggered" to {_a}
    else if {_t} is "invis":
        apply an ambient potion effect of invisibility of tier 1 to {_a} for 5 seconds:
            hide the particles
            hide the icon
        play sound "entity.enderman.teleport" with volume 0.6 and pitch 1.5 at {_a}
        send action bar "&bInvis Passive &7triggered" to {_a}
    else if {_t} is "void":
        soulVoidPassive({_v})
        send action bar "&5Void Passive &7triggered" to {_a}

# =============================================================================
#  SECTION 4 - HIT PIPELINE (passive counter + ultimate charge + Wither steal)
# =============================================================================

function soulOnHit(a: player, v: player, crit: boolean):
    set {_ak} to soulKey({_a})
    set {-soulsmp::last::%{_ak}%} to soulKey({_v})
    set {-soulsmp::lasttime::%{_ak}%} to now
    set {_type} to soulGetType({_a})
    if {_type} is "none":
        stop
    set {_c} to soulGetCount({_a})

    if {_c} is greater than or equal to {@passive-unlock}:
        add 1 to {soulsmp::data::%{_ak}%::hits}
        if {soulsmp::data::%{_ak}%::hits} is greater than or equal to soulPassiveHits({_type}):
            set {soulsmp::data::%{_ak}%::hits} to 0
            soulPassive({_a}, {_v}, {_type})

    if {_c} is greater than or equal to {@ultimate-unlock}:
        if {-soulsmp::active::%{_ak}%} is not set:
            # Do not build charge or display the CHARGED title while the
            # Ultimate is cooling down. Charge starts building again once
            # the cooldown reaches zero.
            set {_cd} to soulNum({_ak}, "cd")
            if {_cd} is less than or equal to 0:
                set {_need} to soulUltHits({_type})
                if soulNum({_ak}, "charge") is less than {_need}:
                    add 1 to {soulsmp::data::%{_ak}%::charge}
                    set {_ch} to soulNum({_ak}, "charge")
                    if {_ch} is greater than or equal to {_need}:
                        send "&8&lCharged" to {_a}
                        send "{@prefix} &7Your Ultimate is ready. Use &e/ability&7." to {_a}
                        play sound "block.beacon.activate" with volume 0.8 and pitch 1.5 at {_a}
                    else:
                        send action bar "&5Ultimate &8» &f%{_ch}%&7/&f%{_need}%" to {_a}

    if {-soulsmp::active::%{_ak}%} is "wither":
        if {_crit} is true:
            soulWitherSteal({_a}, {_v})

on damage of player:
    if attacker is not a player:
        stop
    set {_a} to attacker
    set {_v} to victim
    if {_a} is {_v}:
        stop
    if damage was caused by entity attack:
        soulOnHit({_a}, {_v}, soulIsCrit({_a}))

on damage of player:
    if {soulsmp::inv::%uuid of victim%::active} is set:
        if (health of victim) - (final damage) is less than or equal to 0:
            set {_v} to victim
            soulInvRestore({_v})

# =============================================================================
#  SECTION 5 - ULTIMATES
# =============================================================================

function soulWitherUltimate(a: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    send "{@prefix} &8&lWITHER ULTIMATE &7- crits steal hearts for %{_secs}%s." to {_a}
    play sound "entity.wither.spawn" with volume 0.5 and pitch 1.5 at {_a}
    loop {_secs} times:
        wait 1 second
        if soulActiveOK({_ak}, {_id}) is not true:
            stop
    soulWitherEnd({_a})
    soulFinish({_ak}, {_id})
    send "{@prefix} &8Wither Ultimate ended." to {_a}

function soulBarrierDraw(cx: number, cz: number, centerY: number, w: world, v: player):
    set {_vk} to soulKey({_v})
    delete {-soulsmp::barrier::fake::%{_vk}%::*}

    # Full-block glass walls, 17 blocks wide and 33 blocks tall.
    # Fake blocks are sent only to the trapped player.
    set {_west} to floor({_cx}) - 8
    set {_east} to floor({_cx}) + 8
    set {_north} to floor({_cz}) - 8
    set {_south} to floor({_cz}) + 8
    set {_bottom} to floor({_centerY}) - 16
    set {_top} to floor({_centerY}) + 16

    loop integers from -8 to 8:
        set {_offset} to loop-value-1
        loop integers from -16 to 16:
            set {_height} to loop-value-2
            set {_y} to floor({_centerY}) + {_height}
            set {_z} to floor({_cz}) + {_offset}
            set {_x} to floor({_cx}) + {_offset}

            set {_loc1} to location({_west}, {_y}, {_z}, {_w})
            set {_loc2} to location({_east}, {_y}, {_z}, {_w})
            set {_loc3} to location({_x}, {_y}, {_north}, {_w})
            set {_loc4} to location({_x}, {_y}, {_south}, {_w})

            make {_v} see {_loc1} as barrier
            make {_v} see {_loc2} as barrier
            make {_v} see {_loc3} as barrier
            make {_v} see {_loc4} as barrier

            add {_loc1} to {-soulsmp::barrier::fake::%{_vk}%::*}
            add {_loc2} to {-soulsmp::barrier::fake::%{_vk}%::*}
            add {_loc3} to {-soulsmp::barrier::fake::%{_vk}%::*}
            add {_loc4} to {-soulsmp::barrier::fake::%{_vk}%::*}

function soulBarrierClear(v: player):
    set {_vk} to soulKey({_v})
    if {_v} is online:
        make {_v} see {-soulsmp::barrier::fake::%{_vk}%::*} as original blocks
    delete {-soulsmp::barrier::fake::%{_vk}%::*}

function soulBarrierUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    set {_vk} to soulKey({_v})
    set {_l} to location of {_v}
    set {_cx} to x-coordinate of {_l}
    set {_cz} to z-coordinate of {_l}
    set {_w} to world of {_l}
    set {_minx} to {_cx} - 8
    set {_maxx} to {_cx} + 8
    set {_minz} to {_cz} - 8
    set {_maxz} to {_cz} + 8
    set {-soulsmp::barrier::%{_vk}%} to {_id}
    soulBarrierDraw({_cx}, {_cz}, y-coordinate of {_l}, {_w}, {_v})
    send "{@prefix} &c&lBARRIER ULTIMATE &7- %{_v}% is trapped for %{_secs}%s." to {_a}
    send title "&c&lTRAPPED" with subtitle "&7you cannot leave the barrier" to {_v} for 2 seconds
    play sound "block.beacon.activate" with volume 1 and pitch 0.5 at {_v}
    set {_ticks} to {_secs} * 4
    loop {_ticks} times:
        if {-soulsmp::barrier::%{_vk}%} is not {_id}:
            exit loop
        if {_v} is not online:
            exit loop
        if soulActiveOK({_ak}, {_id}) is not true:
            exit loop
        if world of {_v} is not {_w}:
            exit loop
        set {_pl} to location of {_v}
        set {_px} to x-coordinate of {_pl}
        set {_pz} to z-coordinate of {_pl}
        set {_nx} to max({_minx} + 0.5, min({_maxx} - 0.5, {_px}))
        set {_nz} to max({_minz} + 0.5, min({_maxz} - 0.5, {_pz}))
        set {_out} to false
        if {_nx} is not {_px}:
            set {_out} to true
        if {_nz} is not {_pz}:
            set {_out} to true
        if {_out} is true:
            teleport {_v} to location({_nx}, y-coordinate of {_pl}, {_nz}, {_w}, yaw of {_pl}, pitch of {_pl})
            send action bar "&c&lBARRIER &7- you cannot leave" to {_v}
            play sound "block.chain.hit" with volume 0.8 and pitch 0.7 at {_v}
        wait 5 ticks
    if {-soulsmp::barrier::%{_vk}%} is {_id}:
        delete {-soulsmp::barrier::%{_vk}%}
    soulBarrierClear({_v})
    soulFinish({_ak}, {_id})
    send "{@prefix} &cBarrier Ultimate ended." to {_a}

function soulGlitchUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    send "{@prefix} &a&lGLITCH ULTIMATE &7- enemy screen corrupted for %{_secs}%s." to {_a}
    send title "&4&lSIGNAL CORRUPTED" with subtitle "&aReality is breaking..." to {_v} for 2 seconds
    soulGlitchScreen({_v}, {_secs}, true)
    soulFinish({_ak}, {_id})

function soulInvUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    soulInvBackup({_v})
    send "{@prefix} &b&lINVIS ULTIMATE &7- %{_v}%'s inventory is empty for %{_secs}%s." to {_a}
    send title "&b&lINVENTORY GONE" with subtitle "&7it will return" to {_v} for 2 seconds
    play sound "entity.enderman.scream" with volume 0.5 and pitch 1.6 at {_v}
    loop {_secs} times:
        wait 1 second
        if soulActiveOK({_ak}, {_id}) is not true:
            exit loop
        if {_v} is not online:
            exit loop
    soulInvRestore({_v})
    soulFinish({_ak}, {_id})
    send "{@prefix} &bYour Invis Ultimate ended - inventory returned." to {_a}

function soulVoidUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    set {_vk} to soulKey({_v})
    soulVoidStart({_v})
    set {_spirit} to {-soulsmp::void::spirit::%{_vk}%}
    send "{@prefix} &5&lVOID ULTIMATE &7- %{_v}%'s soul left its body for %{_secs}%s." to {_a}
    send title "&5&lSOUL SEVERED" with subtitle "&7your body is defenceless" to {_v} for 2 seconds
    set {_ticks} to {_secs} * 2
    loop {_ticks} times:
        if {_v} is not online:
            exit loop
        if soulActiveOK({_ak}, {_id}) is not true:
            exit loop
        if {soulsmp::void::%{_vk}%::active} is not set:
            exit loop
        if world of {_v} is not world of {_spirit}:
            teleport {_v} to {_spirit}
        else if distance between {_v} and {_spirit} is greater than 40:
            teleport {_v} to {_spirit}
        wait 10 ticks
    soulVoidEnd({_v})
    soulFinish({_ak}, {_id})
    send "{@prefix} &5Void Ultimate ended." to {_a}

on damage of armor stand:
    set {_vk} to ""
    loop scoreboard tags of victim:
        if loop-value starts with "soulbody_":
            set {_vk} to loop-value
            replace "soulbody_" in {_vk} with ""

    if {_vk} is "":
        stop
    if {soulsmp::void::%{_vk}%::active} is not set:
        cancel event
        stop

    # The armor stand is the hittable body; transfer the hit to its owner.
    set {_dmg} to damage
    if {_dmg} is less than or equal to 0:
        set {_dmg} to 1
    cancel event

    set {_p} to soulPlayerFromKey({_vk})
    if {_p} is not set:
        stop
    if {_p} is not online:
        stop

    if (health of {_p}) - {_dmg} is less than or equal to 0:
        soulVoidEnd({_p})
        set gamemode of {_p} to survival
        damage {_p} by {_dmg}
        stop

    set gamemode of {_p} to survival
    damage {_p} by {_dmg}
    wait 1 tick

    if {_p} is online:
        if {soulsmp::void::%{_vk}%::active} is set:
            set gamemode of {_p} to spectator
            set {_spirit} to {-soulsmp::void::spirit::%{_vk}%}
            if {_spirit} is set:
                teleport {_p} to {_spirit}

on right click on armor stand:
    loop scoreboard tags of event-entity:
        if loop-value starts with "soulbody_":
            cancel event
            stop

File: pasted-code-1794165748568.txt

txt
# SOULSMP — COMPLETE JAVA PLUGIN DEVELOPMENT PROMPT

I am providing you with an existing SoulSMP Skript. Your task is to carefully read and understand the entire Skript, then convert it into a fully functional native Minecraft Java plugin.

**IMPORTANT: I DO NOT WANT A SKRIPT FILE. I WANT A COMPILED `.jar` PLUGIN.**

You must implement the existing mechanics and features in Java, preserving their intended behaviour. Do not simply recreate the Skript syntax or give me code snippets. Build the actual plugin.

# 1. PLUGIN REQUIREMENTS

- Plugin name: `SoulSMP`
- Minecraft version: Paper 1.21.11
- Language: Java
- Java version: 21
- Build system: Maven
- API: Paper API
- Output: `SoulSMP.jar`
- The plugin must work independently without requiring Skript.
- Use a clean, professional Java package structure.
- Store player data using UUIDs, not usernames.
- Make important settings configurable.
- Avoid unnecessary repeating tasks and performance-heavy loops.
- Handle player deaths, disconnects, reconnects, world changes, and server shutdown safely.

# 2. SOUL SYSTEM

There are five Souls:

1. Wither
2. Barrier
3. Glitch
4. Invis
5. Void

### Soul progression

- Maximum Souls: 5.
- Passive abilities unlock at 3 Souls.
- Ultimate abilities unlock at 5 Souls.
- Players need at least 1 Soul to select a Soul.
- Players can obtain Souls through PvP kills.
- When a player kills another player, handle Soul transfer according to the original Skript.
- Players should receive a random first Soul where the original Skript specifies this.
- Prevent Soul farming using a 30-minute lockout.
- Preserve the original Soul limits and progression mechanics.

# 3. SOUL ABILITIES

## WITHER SOUL

**Passive — 3 Souls**

- Every 4th successful hit against another player applies Wither I for 5 seconds.
- Only count successful player-versus-player hits.
- Do not count mobs or invalid attacks.

**Ultimate — 5 Souls**

- Requires 10 successful PvP hits to charge.
- Duration: 20 seconds.
- Use the original Skript's critical-hit and heart-transfer mechanics.
- The attacker can gain hearts from the target.
- Maximum attacker health: 15 hearts.
- Minimum victim health: 5 hearts.
- Correctly update and restore maximum-health attributes.
- Prevent players from exceeding the configured health limits.

## BARRIER SOUL

**Material:** Preserve the original Skript's material unless otherwise specified.

**Passive — 3 Souls**

- Every 20th successful PvP hit activates the Barrier Passive.
- Stun the opponent for 3 seconds.
- Set their movement speed to zero.
- Prevent jumping during the stun.
- Display appropriate particles.
- Restore their original movement settings afterward.
- Make sure the player cannot remain permanently frozen if they disconnect or die.

**Ultimate — 5 Souls**

- Requires 10 successful PvP hits to charge.
- Duration: 10 seconds.
- Activate a custom, player-specific Minecraft World Border around the targeted opponent.
- The target must see the familiar BLUE Minecraft World Border warning walls.
- Use the second attached screenshot as the visual reference for the blue World Border.
- The border should surround the target and keep them trapped inside.
- The target must be unable to cross the border until the ultimate ends.
- Only the targeted player should see the blue World Border.
- Other players must NOT see the blue World Border.
- The actual server-wide World Border must remain unchanged.

**What OTHER players should see:**

- Other players must see reddish particles highlighting the edges of the Barrier Ultimate.
- The particles should clearly outline the boundaries of the barrier.
- Keep the reddish particle highlights visible for the entire 10-second duration.
- Do not show the blue World Border to other players.
- Remove the particles automatically when the ultimate ends.

**Technical requirements:**

- Use Paper's per-player World Border functionality if supported by Paper 1.21.11.
- Otherwise, use appropriate client-side packets.
- Never modify the global World Border.
- Ensure the target cannot escape through teleportation, pearls, movement abilities, or other movement methods during the ultimate.
- Restore all temporary restrictions safely when the ability ends, the target dies, disconnects, or changes worlds.
- Make sure other players' World Border settings are not affected.

## GLITCH SOUL

**Material: OMINOUS_BOTTLE**

**Color: Green**

**Passive — 3 Souls**

- Requires 20 successful PvP hits to activate.
- Every 20th successful hit against an opponent triggers the Glitch Passive.
- The opponent's entire screen must turn completely black.
- The black screen must cover the FULL Minecraft game viewport.
- Duration: exactly 2 seconds (40 ticks).
- After 2 seconds, the opponent's screen returns to normal automatically.
- Only the targeted opponent should experience the black screen.
- The attacker and all other players must see their screens normally.
- Do not deal additional damage.
- Play an appropriate glitch sound when activated.
- Display a small Glitch Passive activation notification to the attacker.

**IMPORTANT:** This must be a genuine full-screen black visual effect. Do NOT substitute it with Darkness, Nausea, a black title, or random glitch symbols.

Use a reliable client-side rendering approach compatible with Minecraft 1.21.11. If a resource pack or client-side packet implementation is necessary, implement the required approach and explain any installation requirements.

**Ultimate — 5 Souls**

- Requires 10 successful PvP hits to charge.
- Duration: 10 seconds.
- When activated, the target experiences a strange, distorted SPIDER'S POINT OF VIEW.
- Use the first attached screenshot as the visual reference.
- The victim should see the Minecraft world from a spider-like perspective, as if looking through the eyes of a spider.

**Spider POV visual requirements:**

- Extremely low camera position, almost at ground level.
- Wide, unusual field of view.
- The ground should occupy much more of the screen.
- The viewpoint should feel like a spider looking across the Minecraft world.
- Reproduce the unusual low-angle, distorted appearance in the first screenshot as closely as technically possible.
- Do not simply apply a normal FOV change or Darkness effect.
- The effect should be clearly noticeable and different from normal Minecraft first-person vision.

**Sound effect:**

- Play a strange, creepy, distorted sound continuously throughout the entire 10-second ultimate.
- The sound must repeatedly play rather than playing only once.
- Make the sound audible ONLY to the targeted victim.
- Use suitable Minecraft sounds or custom resource-pack sounds.
- Stop the sound immediately when the ultimate ends.
- Do not leave repeating sound tasks running after the ability finishes.

**Technical requirements:**

- Investigate a camera-entity or packet-based implementation compatible with Paper 1.21.11.
- Do not use Spectator Mode as a shortcut.
- Do not permanently change the player's camera or position.
- The victim should retain control of their actual player body according to the ability's restrictions.
- Restore the original camera viewpoint and player state after exactly 10 seconds.
- Handle death, disconnects, world changes, and server shutdown safely.
- Ensure the sound stops in every cancellation scenario.

## INVIS SOUL

**Passive — 3 Souls**

- Every 10th successful PvP hit makes the attacker invisible for 5 seconds.
- Preserve the original Skript's intended invisibility behaviour.
- Make sure the effect ends automatically.

**Ultimate — 5 Souls**

- Requires 10 successful PvP hits to charge.
- Duration: 5 seconds.
- The last-hit enemy should see their inventory slots 0–35 as completely empty.
- Their actual inventory must NOT be deleted or permanently modified.
- Save a complete backup of every affected inventory item and its data.
- Restore the inventory exactly as it was after the ability ends.
- Handle death, disconnects, reconnects, and unexpected ability cancellation.
- Never permanently delete or duplicate the target's items.

## VOID SOUL

**Passive — 3 Souls**

- Every 10th successful PvP hit activates the Void Passive.
- Apply Darkness and Blindness to the opponent.
- Duration: 10 seconds.
- Preserve the original Skript's intended behaviour.

**Ultimate — 5 Souls**

- Requires 10 successful PvP hits to charge.
- Duration: 5 seconds.
- When activated, separate the target's soul from their body.

**VERY IMPORTANT: DO NOT USE AN ARMOR STAND FOR THE BODY.**

I want the target's actual Minecraft player body to remain at its original position.

The intended behaviour:

1. Record the target's original location, rotation, health, velocity, and relevant player state.
2. Keep the target's real player entity at its original position.
3. The actual player body must remain visible in the world.
4. Move the target's camera/viewpoint into a separate soul viewpoint above their body.
5. The soul should be able to fly around in the sky and look down at and watch their own body.
6. The player's game mode must remain SURVIVAL. Do not switch them into Spectator Mode.
7. Give the soul free aerial movement during the ability, without allowing it to interact with the world or attack players.
8. The soul should be visually distinct from the body using appropriate particles or visual effects.
9. The original body must remain the real player entity — no armor stand, fake body, or replacement entity.
10. Damage dealt to the body during the ability must affect the actual player.
11. The player must not be able to use their soul viewpoint to bypass combat restrictions.
12. After exactly 5 seconds, return the player's camera to their actual body.
13. Restore their original movement and relevant player state safely.

**Technical implementation requirements:**

- Investigate a proper camera-entity or packet-based implementation compatible with Paper 1.21.11.
- If an invisible camera entity is required, use it ONLY as the soul's camera viewpoint, never as a replacement for the player's body.
- Keep the actual player entity at the original body location.
- Ensure the player remains in SURVIVAL mode throughout.
- Restore the camera to the real player entity when the ultimate ends.
- Handle disconnects, deaths, server shutdowns, and ability cancellation without leaving the player stuck or losing control.
- Do not use the normal Spectator gamemode as a shortcut.

# 4. ULTIMATE CHARGE SYSTEM

Every Soul has its own ultimate charge system.

- Each ultimate requires 10 successful PvP hits.
- Only valid player-versus-player hits count.
- Hits against mobs must not count.
- Invalid attacks must not count.
- Do not allow charge generation while the ultimate is on cooldown.
- When fully charged, display a title notifying the player that their ultimate is ready.
- The charged state expires after 5 seconds if not activated.
- Activating the ultimate consumes the charge.
- Starting an ultimate begins a 90-second cooldown.
- Using an ultimate must NOT display the `Lost` message.
- Only display `Lost` when the charge genuinely expires without being used.
- Prevent duplicate activation and charge exploits.

**Important hit-count distinction:**

- Wither Passive: every 4th hit.
- Barrier Passive: every 20th hit.
- Glitch Passive: every 20th hit.
- Invis Passive: every 10th hit.
- Void Passive: every 10th hit.
- All five Ultimates: 10 hits to charge.

Do not accidentally use the Glitch Passive's 20-hit requirement for its Ultimate.

# 5. TARGET MEMORY SYSTEM

- Remember the last valid PvP target.
- Target memory duration: 30 seconds.
- Maximum target distance: 40 blocks.
- Abilities that require a target should use the correct last-hit target.
- Clear expired or invalid target data.
- Handle targets who disconnect, die, or change worlds.

# 6. SOUL SELECTION GUI

Create a professional inventory GUI.

**GUI title:**

`&8&lSoulSMP &8- &7Souls`

**GUI size:** 5 rows (45 slots).

Use the following slots:

| Slot | Item |
|---|---|
| 4 | Player Soul Status |
| 11 | Wither Soul |
| 13 | Barrier Soul |
| 15 | Glitch Soul |
| 29 | Invis Soul |
| 31 | Void Soul |
| 33 | Reserved for a future sixth Soul |

Requirements:

- Show each Soul's name, description, passive ability, ultimate ability, and unlock requirements.
- Show the player's current Soul count.
- Show whether the player has unlocked the passive and ultimate.
- Indicate the currently selected Soul.
- Prevent selection if the player does not meet the requirements.
- Prevent players from taking GUI items.
- Prevent shift-clicking and other inventory exploits.
- Preserve the original Skript's item names, lore, colours, and descriptions wherever possible.

# 7. SOUL ITEMS

### Soul Item

- Material: ECHO_SHARD
- Custom Model Data: 12345
- Name: `&8&lSoul`

### Soul Reroll Book

- Use the original Skript's specified material if present.
- Custom Model Data: 12346.
- Name and lore should follow the original Skript.

Preserve the original item behaviour and restrictions.

# 8. COMMANDS

Implement the following commands:

### `/souls`

Open the Soul selection GUI.

### `/soul`

Show the player's current Soul information.

### `/soul info`

Display Soul information.

### `/soul select <soul>`

Select a Soul if the player meets the requirements.

### `/ability`

Activate the currently selected Soul's ultimate if it is charged and available.

### `/cooldown [player]`

Show the remaining ultimate cooldown.

### `/soulsmp info`

Show plugin information.

### `/soulsmp reload`

Reload configuration and plugin settings.

### `/soulsmp give`

Admin command for giving Soul items.

### `/soulsmp set`

Admin command for modifying Soul counts.

### `/soulsmp settype`

Admin command for setting a player's Soul type.

### `/soulsmp reset`

Reset a player's Soul data.

### `/soulsmp soulitem`

Give the Soul item.

### `/soulsmp rerollbook`

Give the Soul Reroll Book.

# 9. PERMISSIONS

Implement proper permissions:

- `soulsmp.info` — Access information commands.
- `soulsmp.admin` — Access administrative commands.

Normal players must not be able to use admin commands.

# 10. CONFIGURATION

Create a proper `config.yml` containing configurable values.

Use the existing Skript settings as the starting point:
yaml prefix: "&8[&8&lSoulSMP&8]&r" gui-title: "&8&lSoulSMP &8- &7Souls"

max-souls: 5 passive-unlock: 3 ultimate-unlock: 5 select-min-souls: 1

pvp-souls: true farm-lockout-minutes: 30

wither-hits: 4 barrier-hits: 20 glitch-hits: 20 invis-hits: 10 void-hits: 10

wither-ult-hits: 10 barrier-ult-hits: 10 glitch-ult-hits: 10 invis-ult-hits: 10 void-ult-hits: 10

wither-ult-seconds: 20 barrier-ult-seconds: 10 glitch-ult-seconds: 10 invis-ult-seconds: 5 void-ult-seconds: 5

ult-cooldown-seconds: 90 show-cooldown-bar: true

target-memory-seconds: 30 target-range: 40

code

Also make ability-specific settings configurable where appropriate, including:

- Glitch Passive black-screen duration.
- Glitch Ultimate spider-view duration.
- Glitch Ultimate sound interval and sound type.
- Barrier Ultimate duration and border size.
- Barrier particle type and colour.
- Void Ultimate duration and soul viewpoint height.

# 11. CODE QUALITY AND ARCHITECTURE

Organize the plugin into separate classes instead of putting everything into one giant Java file.

Suggested structure:

- `SoulSMP.java`
- `SoulManager.java`
- `SoulType.java`
- `SoulAbilityManager.java`
- `UltimateManager.java`
- `CooldownManager.java`
- `TargetManager.java`
- `SoulGUI.java`
- `SoulItemManager.java`
- `SoulCommand.java`
- `SoulSMPCommand.java`
- `PlayerDataManager.java`
- `listeners/`
- `abilities/`
- `utils/`

You can improve this structure if necessary.

Requirements:

- Use UUID-based player storage.
- Save player data persistently.
- Use safe Bukkit/Paper event handling.
- Avoid memory leaks and unnecessary repeating tasks.
- Cancel scheduled tasks when abilities end.
- Restore player states after every temporary ability.
- Handle plugin reloads and server restarts safely.
- Prevent item duplication and inventory loss.
- Add appropriate permission checks.
- Keep code readable and maintainable.

# 12. IMPORTANT EXISTING SKRIPT BEHAVIOUR

The existing Skript is the source of truth for the original mechanics.

Before implementing:

1. Read the entire Skript.
2. Identify every command, function, event, variable, item, message, sound, particle, and ability.
3. Understand how all systems interact.
4. Preserve existing functionality unless a requirement in this prompt explicitly changes it.
5. Do not silently remove features.
6. If the original Skript has conflicting descriptions and implementations, identify the discrepancy and follow the explicit requirements in this prompt.
7. Fix bugs and improve reliability without changing intended gameplay.

The following changes are explicitly required even if the original Skript behaves differently:

- Glitch Passive requires 20 successful PvP hits.
- Glitch Passive creates a genuine full-screen black screen for exactly 2 seconds.
- Glitch Soul's material must be OMINOUS_BOTTLE.
- Glitch Ultimate uses the spider-like low-ground camera perspective from the first attached screenshot.
- Glitch Ultimate plays a strange sound repeatedly and only to the victim for 10 seconds.
- Barrier Ultimate uses a personal blue World Border visible only to the target.
- Other players see reddish particles outlining the Barrier Ultimate instead of the blue border.
- Void Ultimate uses the player's actual body, with the soul viewpoint flying above it in SURVIVAL mode. Do not use an armor stand as the body.
- Activating an ultimate must not display `Lost`.

# 13. VISUAL REFERENCE SCREENSHOTS

I am providing two Minecraft screenshots. You MUST use them as visual references when implementing the abilities.

**Screenshot 1 — Spider POV**

Use the first screenshot for the Glitch Ultimate.

Match its visual characteristics:

- Very low camera height.
- Ground-level perspective.
- Wide and unusual viewpoint.
- Ground taking up a large portion of the screen.
- Distorted, strange visual appearance.

Do not replace this with a generic FOV change or a normal potion effect.

**Screenshot 2 — Minecraft World Border**

Use the second screenshot for the Barrier Ultimate.

Match its visual characteristics:

- Familiar blue Minecraft World Border walls.
- Diagonal blue border pattern.
- Border surrounding the target.
- Only the target sees the blue walls.
- Other players see reddish particles outlining the barrier's edges.

The screenshots are visual references, not assets that should be displayed inside the game.

# 14. BUILD AND DELIVERABLES

I expect an actual compiled plugin, not just source code.

You must:

1. Create the complete Maven project.
2. Implement all required Java classes.
3. Create `plugin.yml`.
4. Create `config.yml`.
5. Compile the project successfully.
6. Fix compilation errors.
7. Test the important mechanics.
8. Provide the final `SoulSMP.jar`.
9. Provide the complete source project as a ZIP.
10. Explain where to place the JAR in the Paper server.
11. Explain any resource pack or client-side requirements, especially for the full-screen Glitch effect.
12. Include installation and configuration instructions.

# FINAL REQUIREMENT

Do not stop after generating Java source code.

Do not give me a Skript.

Do not just explain how to compile it.

I want you to actually build the complete **SoulSMP.jar** plugin for Paper 1.21.11, along with the complete source project ZIP.

If something cannot be implemented reliably using the normal Paper API, find an appropriate compatible technical solution and clearly explain its requirements instead of silently replacing the feature with a weaker version.

**Before finishing, verify that all five Souls, their passives, their Ultimates, GUI, commands, permissions, data saving, and temporary visual effects work correctly.**

Kodari AI
KodariNov 8 at 7:27 pm 2
SoulSMPPlugin
A comprehensive Minecraft Paper plugin implementing a five-soul combat system with unique passives and ultimates. Players collect souls through PvP kills, unlock passive abilities at three souls, and powerful ultimates at five souls. Features include Wither heart-stealing, Barrier world-border trapping, Glitch screen corruption, Invis inventory manipulation, and Void soul-separation mechanics. Includes a selection GUI, persistent UUID-based data storage, configurable settings, cooldown management, target memory, and complete command/permission system for Paper 1.21.11.
  1. Create the Maven/Paper project, persistent UUID-based soul data, configuration, and plugin metadata.

  2. Implement the GUI, items, commands, PvP progression, cooldowns, and abilities that the server API can support safely.

  3. Keep unsupported client-only camera/full-screen effects explicit rather than substituting a misleading visual effect.

Created the SoulSMP Maven project with UUID-based data storage, configurable progression, the Soul GUI and items, commands and permissions, PvP Soul transfer with a farming lockout, cooldowns, and supported abilities. The Barrier Ultimate uses a personal world border and red boundary particles; the Invis Ultimate restores the target’s backed-up inventory when it ends or is cancelled.

Important limitation: Paper’s server API cannot provide the requested full-screen black overlay or detach a Survival player’s camera for the Glitch and Void viewpoints. The Glitch passive does not create that overlay, and those two Ultimates refuse activation without consuming charge or cooldown. The limits are documented in README.md.

I have not produced a compiled JAR or source ZIP artifact here, and I can’t claim the project has been compiled or tested. To build the JAR in Kodari:

  1. Click Compile in the top bar (on phone: ⋮ → Compile Project).

  2. Click Compile in the window.

  3. On success, click Download for the build.

The source files are in the project workspace; a ZIP archive has not been generated. Place the downloaded JAR in the server’s plugins folder.

wuweeuea

fix messages code color not working.

Kodari AI
KodariNov 8 at 7:35 pm 1

Plan: add one legacy & color formatter, then route every player and command message through it while keeping the existing config and item color format.

Fixed the color-code issue: all SoulSMP chat messages now translate legacy & codes before sending, including commands, ability notifications, and item messages. GUI titles and item names/lore already used that format and remain supported.

wuweeuea

where to download now

Kodari AI
KodariNov 8 at 7:36 pm 1

Click Compile in the top bar, then Compile in the window. When the build succeeds, click Download on the build or Download SoulSMP.jar in the chat. On a phone, tap ⋮ → Compile Project first.

wuweeuea

what is client side required?

Kodari AI
KodariNov 8 at 7:40 pm 1

“Client-side support” means a mod installed on the affected player’s Minecraft client—not just the SoulSMP plugin on the server. The mod would handle visuals the server plugin can’t control through Paper, such as a true full-screen black overlay or a custom camera viewpoint. Only players receiving those effects would need it; without the mod, they can still join, but those visuals won’t work.

The current SoulSMP plugin does not include that client mod, so those effects aren’t available yet. A resource pack alone won’t reliably provide the custom camera effects.

wuweeuea

then just make it do weird stuff without requiring mods or resource pack by using vanilla... Give nausea and darkness and blindness and play the weird sounds and send title &kRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

To victim and also remove messages that sould like its from the promnt (make it sound more humanized and natural)

Kodari AI
KodariNov 8 at 7:44 pm 1
  • Replace Glitch’s client-support placeholder with vanilla Nausea, Darkness, Blindness, a long obfuscated title, and victim-only repeating sounds.

  • Let Glitch Ultimate target the last-hit player and clean up its effects/tasks when it ends or is interrupted.

  • Rewrite the player-facing Glitch/Void descriptions and activation notice in natural wording.

Glitch now uses vanilla effects: Nausea, Darkness, Blindness, a long obfuscated “RRRR” title, and a repeating configured sound heard only by the victim. The passive applies them for the configured duration; Glitch Ultimate now affects your last-hit target instead of refusing to activate. I also replaced the Glitch info text with a natural description.

These are vanilla effects—not a true full-screen black overlay or spider camera view. The Void Ultimate remains unavailable.

wuweeuea

and for The Void also.. Dont use aly client side only use Server side

Kodari AI
KodariNov 8 at 7:46 pm 1
  • Make Void Ultimate work without client mods or resource packs.

  • Apply vanilla status effects, a victim-only eerie sound loop, and a brief title; use the last PvP target and clean up its task with the ability.

  • Update the Void description and sound settings.

Void Ultimate now works entirely server-side: it affects the last player you hit with Nausea, Darkness, Blindness, a brief title, and a repeating eerie sound heard only by them. The effects last for the configured duration, and the sound task is stopped when the ability ends or is interrupted.

It doesn’t detach the player’s camera or move a separate “soul” viewpoint; those visuals aren’t possible with server-only vanilla effects.

wuweeuea

broo the Nausea darkness thing is for Glitch ability Ultimate not Void. For void turn the victim into spectator with their hearts shown and turn their body to armor stand surrounded by black particles and it hittable and the damages transfers to the victim health divided by 0.5

Kodari AI
KodariNov 8 at 7:50 pm 1
  • Replace Void Ultimate’s effects/sound with a spectator soul phase and a visible armor-stand body.

  • Show the victim’s health in their action bar, ring the body with black particles, and redirect body damage at double the armor stand’s received damage.

  • Restore the victim and remove the body on ability end, death, disconnect, world change, or plugin shutdown; keep Glitch’s strange effects separate.

Void Ultimate is now server-side only: it sends the target into Spectator mode, leaves an armor stand in their place with black particles around it, and shows the target’s health in their action bar. Hitting the stand transfers damage to the target at 2× damage (damage ÷ 0.5). When the ability ends or is interrupted, it removes the stand and restores the target’s previous game mode and location. Glitch’s nausea, darkness, blindness, and strange sounds remain on Glitch Ultimate.

wuweeuea

not 2x dmg its half the damage they normally do

Kodari AI
KodariNov 9 at 4:44 am 1
  • Change the Void body’s transferred damage from double to half the armor stand’s damage.

Changed Void body damage transfer to half the armor stand’s damage (damage × 0.5).

wuweeuea

all abilities doesnt even work.. and when i do /ability it says land more PVP hits dont make that. make a messages section in config so i can configure it.. and display the hits in action bar like 0/10, 0/20

Kodari AI
KodariNov 9 at 5:53 am 1
  1. Fix the ability activation path so a ready charge doesn’t become unusable due to its short expiry or stale target state.

  2. Add configurable player-facing messages in config.yml, including activation feedback.

  3. Show each hit counter continuously as current/required in the action bar.

Updated SoulSMP’s ability feedback and hit tracking:

  • The action bar now shows both counters, for example Passive 3/20 | Ultimate 7/10. It updates on valid PvP hits; show-cooldown-bar controls it.

  • /ability now gives a configurable message with your current charge, like Your Ultimate isn’t ready yet (7/10), instead of the hardcoded “Land more PvP hits” text.

  • Added a messages: section in config.yml for ability feedback, titles, and passive notifications.

  • Charge still expires after 5 seconds by default; change charge-expiry-seconds if you need a longer activation window.

Reload the plugin/config to apply the new settings.

wuweeuea

check this skript and reference it then make

📎 1 file 55,943 chars
📄
pasted-code-1794203540654.txt
txt 1360 lines
▶

# ░██████╗░█████╗░██╗░░░██╗██╗░░░░░░██████╗███╗░░░███╗██████╗░
# ██╔════╝██╔══██╗██║░░░██║██║░░░░░██╔════╝████╗░████║██╔══██╗
# ╚█████╗░██║░░██║██║░░░██║██║░░░░░╚█████╗░██╔████╔██║██████╔╝
# ░╚═══██╗██║░░██║██║░░░██║██║░░░░░░╚═══██╗██║╚██╔╝██║██╔═══╝░
# ██████╔╝╚█████╔╝╚██████╔╝███████╗██████╔╝██║░╚═╝░██║██║░░░░
# ╚═════╝░░╚════╝░░╚═════╝░╚══════╝╚═════╝░╚═╝░░░░░╚═╝╚═╝░░░░
#
# ██████╗░██╗░░░██╗  ░██╗░░░░░░░██╗██╗░░░██╗░██╗░░░░░░░██╗███████╗███████╗██╗░░░██╗███████╗░█████╗░
# ██╔══██╗╚██╗░██╔╝  ░██║░░██╗░░██║██║░░░██║░██║░░██╗░░██║██╔════╝██╔════╝██║░░░██║██╔════╝██╔══██╗
# ██████╦╝░╚████╔╝░  ░╚██╗████╗██╔╝██║░░░██║░╚██╗████╗██╔╝█████╗░░█████╗░░██║░░░██║█████╗░░███████║
# ██╔══██╗░░╚██╔╝░░  ░░████╔═████║░██║░░░██║░░████╔═████║░██╔══╝░░██╔══╝░░██║░░░██║██╔══╝░░██╔══██║
# ██████╦╝░░░██║░░░  ░░╚██╔╝░╚██╔╝░╚██████╔╝░░╚██╔╝░╚██╔╝░███████╗███████╗╚██████╔╝███████╗██║░░██║
# ╚═════╝░░░░╚═╝░░░  ░░░╚═╝░░░╚═╝░░░╚═════╝░░░░╚═╝░░░╚═╝░░╚══════╝╚══════╝░╚═════╝░╚══════╝╚═╝░░╚═╝
# ─────────────────────────────────────────────────────────────────────────────
# 
# Paper 1.21.11 | Skript 2.14.x | Java 21
# 
#
# CONTROLS
#   Shift + F       Activate Ultimate
#   /ability        Activate Ultimate
#   /soul           Open menu (OP) / view Soul info (non-OP)
#   /soul info      View Soul info
#
# Save as: plugins/Skript/scripts/soulsmp.sk
# Reload:  /sk reload soulsmp
# ─────────────────────────────────────────────────────────────────────────────

options:
    prefix: &8[&8&lSoulSMP&8]&r
    gui-title: &8&lSoulSMP &8- &7Souls

    max-souls: 5
    passive-unlock: 3
    ultimate-unlock: 5
    select-min-souls: 1

    pvp-souls: true
    farm-lockout-minutes: 30

    wither-hits: 4
    barrier-hits: 20
    glitch-hits: 10
    invis-hits: 10
    void-hits: 10

    wither-ult-hits: 10
    barrier-ult-hits: 10
    glitch-ult-hits: 10
    invis-ult-hits: 10
    void-ult-hits: 10

    wither-ult-seconds: 20
    barrier-ult-seconds: 10
    glitch-ult-seconds: 10
    invis-ult-seconds: 5
    void-ult-seconds: 5

    ult-cooldown-seconds: 90
    show-cooldown-bar: true

    target-memory-seconds: 30
    target-range: 40

# =============================================================================
#  SECTION 1 - SMALL HELPERS
# =============================================================================

function soulKey(p: offlineplayer) :: text:
    return "%uuid of {_p}%"

function soulPlayerFromKey(k: text) :: player:
    loop all players:
        if "%uuid of loop-player%" is {_k}:
            return loop-player

function soulNum(k: text, f: text) :: number:
    if {soulsmp::data::%{_k}%::%{_f}%} is not set:
        return 0
    return {soulsmp::data::%{_k}%::%{_f}%}

function soulGetCount(p: offlineplayer) :: number:
    return soulNum(soulKey({_p}), "count")

function soulSetCount(p: offlineplayer, n: number):
    set {_k} to soulKey({_p})
    set {soulsmp::data::%{_k}%::count} to max(0, min({_n}, {@max-souls}))

function soulGetType(p: offlineplayer) :: text:
    set {_k} to soulKey({_p})
    if {soulsmp::data::%{_k}%::type} is not set:
        return "none"
    return {soulsmp::data::%{_k}%::type}

function soulSetType(p: offlineplayer, t: text):
    set {_k} to soulKey({_p})
    set {soulsmp::data::%{_k}%::type} to {_t}
    set {soulsmp::data::%{_k}%::hits} to 0
    set {soulsmp::data::%{_k}%::charge} to 0

function soulValid(t: text) :: boolean:
    if {_t} is "wither" or "barrier" or "glitch" or "invis" or "void":
        return true
    return false

function soulName(t: text) :: text:
    if {_t} is "wither":
        return "&8&lWither Soul"
    if {_t} is "barrier":
        return "&c&lBarrier Soul"
    if {_t} is "glitch":
        return "&a&lGlitch Soul"
    if {_t} is "invis":
        return "&b&lInvis Soul"
    if {_t} is "void":
        return "&5&lVoid Soul"
    return "&7No Soul"

function soulPassiveHits(t: text) :: number:
    if {_t} is "wither":
        return {@wither-hits}
    if {_t} is "barrier":
        return {@barrier-hits}
    if {_t} is "glitch":
        return {@glitch-hits}
    if {_t} is "invis":
        return {@invis-hits}
    if {_t} is "void":
        return {@void-hits}
    return 10

function soulUltHits(t: text) :: number:
    if {_t} is "wither":
        return {@wither-ult-hits}
    if {_t} is "barrier":
        return {@barrier-ult-hits}
    if {_t} is "glitch":
        return {@glitch-ult-hits}
    if {_t} is "invis":
        return {@invis-ult-hits}
    if {_t} is "void":
        return {@void-ult-hits}
    return 5

function soulUltSeconds(t: text) :: number:
    if {_t} is "wither":
        return {@wither-ult-seconds}
    if {_t} is "barrier":
        return {@barrier-ult-seconds}
    if {_t} is "glitch":
        return {@glitch-ult-seconds}
    if {_t} is "invis":
        return {@invis-ult-seconds}
    if {_t} is "void":
        return {@void-ult-seconds}
    return 10

function soulPassiveDesc(t: text) :: text:
    if {_t} is "wither":
        return "Every {@wither-hits}th hit applies Wither I for 5s."
    if {_t} is "barrier":
        return "Every {@barrier-hits}th hit stuns the enemy for 3s (chain effect)."
    if {_t} is "glitch":
        return "Every {@glitch-hits}th hit scrambles the enemy's screen."
    if {_t} is "invis":
        return "Every {@invis-hits}th hit makes you invisible for 5s."
    if {_t} is "void":
        return "Every {@void-hits}th hit blanks the enemy's status bars for 2s."
    return "-"

function soulUltDesc(t: text) :: text:
    if {_t} is "wither":
        return "Crits steal 1 heart (you max 15, enemy min 5) for {@wither-ult-seconds}s."
    if {_t} is "barrier":
        return "Trap the last-hit enemy in a 16x16 area for {@barrier-ult-seconds}s."
    if {_t} is "glitch":
        return "Corrupt the last-hit enemy screen for {@glitch-ult-seconds}s."
    if {_t} is "invis":
        return "Empty the last-hit enemy's inventory slots 0-35 for {@invis-ult-seconds}s."
    if {_t} is "void":
        return "Split the last-hit enemy's soul from its body for {@void-ult-seconds}s."
    return "-"

function soulIsCrit(p: player) :: boolean:
    if {_p} is on ground:
        return false
    if fall distance of {_p} is less than or equal to 0:
        return false
    if {_p} is sprinting:
        return false
    if {_p} is flying:
        return false
    if vehicle of {_p} is set:
        return false
    if block at {_p} is water:
        return false
    return true

function soulActiveOK(k: text, id: text) :: boolean:
    if {-soulsmp::activeid::%{_k}%} is {_id}:
        return true
    return false

function soulClearActive(k: text):
    delete {-soulsmp::active::%{_k}%}
    delete {-soulsmp::activeid::%{_k}%}
    delete {-soulsmp::left::%{_k}%}

function soulFinish(k: text, id: text):
    if {-soulsmp::activeid::%{_k}%} is {_id}:
        soulClearActive({_k})

# =============================================================================
#  SECTION 2 - EFFECT HELPERS (health, stun, glitch, inventory, void)
# =============================================================================

# ---- max health bookkeeping (we only ever undo our OWN change) ----
function soulHealthRestore(p: player):
    set {_k} to soulKey({_p})
    if {soulsmp::hpdelta::%{_k}%} is not set:
        stop
    set {_new} to (max health of {_p}) - {soulsmp::hpdelta::%{_k}%}
    set max health of {_p} to max(1, {_new})
    delete {soulsmp::hpdelta::%{_k}%}

function soulWitherSteal(a: player, v: player):
    set {_ak} to soulKey({_a})
    set {_vk} to soulKey({_v})
    set {_amax} to max health of {_a}
    set {_vmax} to max health of {_v}
    if {_amax} + 1 is greater than 15:
        send action bar "&8Wither &7- you are at the 15 heart limit" to {_a}
        stop
    if {_vmax} - 1 is less than 5:
        send action bar "&8Wither &7- enemy is at the 5 heart floor" to {_a}
        stop
    set max health of {_a} to {_amax} + 1
    set max health of {_v} to {_vmax} - 1
    add 1 to {soulsmp::hpdelta::%{_ak}%}
    remove 1 from {soulsmp::hpdelta::%{_vk}%}
    set {-soulsmp::wither::victims::%{_ak}%::%{_vk}%} to true
    heal {_a} by 1
    play sound "entity.wither.hurt" with volume 0.7 and pitch 1.6 at {_v}
    send action bar "&8&lHEART STOLEN &7(%{_amax} + 1%/15)" to {_a}

function soulWitherEnd(a: player):
    set {_ak} to soulKey({_a})
    soulHealthRestore({_a})
    loop {-soulsmp::wither::victims::%{_ak}%::*}:
        set {_vp} to soulPlayerFromKey(loop-index)
        if {_vp} is set:
            soulHealthRestore({_vp})
    delete {-soulsmp::wither::victims::%{_ak}%::*}

# ---- stun (Barrier passive): walk speed 0 + jump cancelled, restored after ----
function soulChainRing(l: location):
    set {_x} to x-coordinate of {_l}
    set {_y} to y-coordinate of {_l}
    set {_z} to z-coordinate of {_l}
    set {_w} to world of {_l}
    for each {_i} in integers from 1 to 12:
        set {_ang} to {_i} * 30
        set {_px} to {_x} + 0.7 * cos({_ang})
        set {_pz} to {_z} + 0.7 * sin({_ang})
        draw 1 light grey dust particle at location({_px}, {_y} + 0.3, {_pz}, {_w})
        draw 1 light grey dust particle at location({_px}, {_y} + 1.2, {_pz}, {_w})

function soulStunEnd(v: player):
    set {_k} to soulKey({_v})
    if {soulsmp::wsrestore::%{_k}%} is set:
        set walk speed of {_v} to {soulsmp::wsrestore::%{_k}%}
        delete {soulsmp::wsrestore::%{_k}%}
    delete {-soulsmp::stun::%{_k}%}

function soulStun(v: player, secs: number):
    set {_k} to soulKey({_v})
    if {-soulsmp::stun::%{_k}%} is set:
        stop
    set {-soulsmp::stun::%{_k}%} to true
    set {soulsmp::wsrestore::%{_k}%} to walk speed of {_v}
    set walk speed of {_v} to 0
    play sound "block.chain.place" with volume 1 and pitch 0.8 at {_v}
    send action bar "&7&lSTUNNED" to {_v}
    set {_ticks} to {_secs} * 4
    set {_n} to 0
    loop {_ticks} times:
        if {-soulsmp::stun::%{_k}%} is not set:
            stop
        if {_v} is not online:
            exit loop
        soulChainRing(location of {_v})
        wait 5 ticks
    soulStunEnd({_v})

# ---- glitch screen (Glitch passive on enemy / ultimate on self) ----
function soulGlitchText(n: number) :: text:
    set {_c::*} to "▓", "▒", "░", "█", "▌", "▐", "╬", "Ж", "Ѫ", "҉", "Ξ", "¦", "Ω" and "Ψ"
    set {_s} to ""
    loop {_n} times:
        set {_i} to a random integer between 1 and size of {_c::*}
        set {_s} to "%{_s}%%{_c::%{_i}%}%"
    return {_s}

function soulGlitchScreen(v: player, secs: number, intense: boolean):
    set {_d} to 1 second * {_secs}
    apply an ambient potion effect of nausea of tier 1 to {_v} for {_d}
    apply an ambient potion effect of darkness of tier 1 to {_v} for {_d}
    set {_msgs::*} to "&4[ERROR] &cConnection to server corrupted", "&8&k||||&7 packet loss detected &8&k||||", "&c&k##&4 fatal exception in render thread &c&k##", "&8&k|&7 chunk data mismatch &8&k|" and "&4&k####&c WARNING: reality unstable &4&k####"
    set {_ticks} to {_secs} * 4
    set {_n} to 0
    loop {_ticks} times:
        if {_v} is not online:
            stop
        add 1 to {_n}
        send title "&k%soulGlitchText(6)%" with subtitle "&c&k%soulGlitchText(14)%" to {_v} for 5 ticks
        send action bar "&4&k|||&c ERR_%a random integer between 100 and 999% &4&k|||&r &8%soulGlitchText(10)%" to {_v}
        play sound "block.note_block.bit" with volume 0.6 and pitch (a random number between 0.5 and 2) at {_v}
        if {_intense} is true:
            if mod({_n}, 3) is 0:
                set {_m} to a random integer between 1 and size of {_msgs::*}
                send "%{_msgs::%{_m}%}%" to {_v}
                play sound "entity.elder_guardian.curse" with volume 0.4 and pitch 1.8 at {_v}
        wait 5 ticks

# ---- Invis ultimate: inventory slots 0-35 backed up (persistent) then cleared ----
function soulInvBackup(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::inv::%{_vk}%::active} is set:
        stop
    loop integers from 0 to 35:
        set {_it} to slot loop-value of {_v}'s inventory
        if {_it} is not air:
            set {soulsmp::inv::%{_vk}%::slot::%loop-value%} to {_it}
    set {soulsmp::inv::%{_vk}%::active} to true
    loop integers from 0 to 35:
        set slot loop-value of {_v}'s inventory to air

function soulInvRestore(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::inv::%{_vk}%::active} is not set:
        stop
    loop {soulsmp::inv::%{_vk}%::slot::*}:
        set {_i} to loop-index parsed as integer
        set {_it} to loop-value
        if slot {_i} of {_v}'s inventory is air:
            set slot {_i} of {_v}'s inventory to {_it}
        else:
            give {_it} to {_v}
    delete {soulsmp::inv::%{_vk}%::*}

# ---- Void ultimate: tagged zombie body stays, soul goes to spectator ----
function soulVoidRemoveBody(l: location, k: text):
    loop all entities in radius 6 around {_l}:
        if (scoreboard tags of loop-entity) contains "soulbody_%{_k}%":
            delete loop-entity

function soulVoidStart(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::void::%{_vk}%::active} is set:
        stop
    set {_body} to location of {_v}
    set {soulsmp::void::%{_vk}%::active} to true
    set {soulsmp::void::%{_vk}%::loc} to {_body}
    set {soulsmp::void::%{_vk}%::gm} to gamemode of {_v}
    spawn an armor stand at {_body}
    set {_e} to last spawned entity
    add "soulbody_%{_vk}%" to scoreboard tags of {_e}
    set name of {_e} to "&5%name of {_v}%'s Void Body"
    set helmet of {_e} to {_v}'s skull
    if {_v}'s chestplate is not air:
        set chestplate of {_e} to {_v}'s chestplate
    if {_v}'s leggings is not air:
        set leggings of {_e} to {_v}'s leggings
    if {_v}'s boots is not air:
        set boots of {_e} to {_v}'s boots
    set {_bx} to x-coordinate of {_body}
    set {_by} to y-coordinate of {_body}
    set {_bz} to z-coordinate of {_body}
    set {_sy} to min({_by} + 40, 250)
    set {_spirit} to location({_bx}, {_sy}, {_bz}, world of {_body})
    set {-soulsmp::void::spirit::%{_vk}%} to {_spirit}
    set gamemode of {_v} to spectator
    teleport {_v} to {_spirit}

function soulVoidEnd(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::void::%{_vk}%::active} is not set:
        stop
    set {_loc} to {soulsmp::void::%{_vk}%::loc}
    set {_gm} to {soulsmp::void::%{_vk}%::gm}
    delete {soulsmp::void::%{_vk}%::*}
    delete {-soulsmp::void::spirit::%{_vk}%}
    teleport {_v} to {_loc}
    if {_gm} is set:
        set gamemode of {_v} to {_gm}
    else:
        set gamemode of {_v} to survival
    wait 2 ticks
    soulVoidRemoveBody({_loc}, {_vk})

function soulVoidAbort(v: player):
    set {_vk} to soulKey({_v})
    if {soulsmp::void::%{_vk}%::active} is not set:
        stop
    set {_loc} to {soulsmp::void::%{_vk}%::loc}
    delete {soulsmp::void::%{_vk}%::*}
    delete {-soulsmp::void::spirit::%{_vk}%}
    soulVoidRemoveBody({_loc}, {_vk})

# ---- cleanup of everything for one player (idempotent) ----
function soulForceEnd(p: player):
    set {_k} to soulKey({_p})
    if {-soulsmp::active::%{_k}%} is "wither":
        soulWitherEnd({_p})
    soulHealthRestore({_p})
    soulStunEnd({_p})
    soulInvRestore({_p})
    soulVoidEnd({_p})
    delete {-soulsmp::barrier::%{_k}%}
    soulClearActive({_k})

function soulRecover(p: player):
    soulHealthRestore({_p})
    soulStunEnd({_p})
    soulInvRestore({_p})
    soulVoidEnd({_p})

# =============================================================================
#  SECTION 3 - PASSIVES
# =============================================================================

function soulVoidPassive(v: player):
    if gamemode of {_v} is creative:
        stop
    apply an ambient potion effect of darkness of tier 1 to {_v} for 10 seconds
    apply an ambient potion effect of blindness of tier 1 to {_v} for 10 seconds
    send title "&8&lVOIDED" with subtitle "&7Darkness and blindness..." to {_v} for 2 seconds
    play sound "block.sculk_sensor.clicking" with volume 1 and pitch 0.6 at {_v}
    loop 8 times:
        if {_v} is not online:
            stop
        send action bar "&8♥ ░░░░░░░░░░     &8◆ ░░░░░░░░░░" to {_v}
        wait 5 ticks

function soulPassive(a: player, v: player, t: text):
    if {_t} is "wither":
        apply an ambient potion effect of wither of tier 1 to {_v} for 5 seconds
        play sound "entity.wither.hurt" with volume 0.6 and pitch 1.4 at {_v}
        send action bar "&8Wither Passive &7triggered" to {_a}
    else if {_t} is "barrier":
        soulStun({_v}, 3)
        send action bar "&cBarrier Passive &7triggered" to {_a}
    else if {_t} is "glitch":
        soulGlitchScreen({_v}, 3, true)
        send action bar "&aGlitch Passive &7triggered" to {_a}
    else if {_t} is "invis":
        apply an ambient potion effect of invisibility of tier 1 to {_a} for 5 seconds:
            hide the particles
            hide the icon
        play sound "entity.enderman.teleport" with volume 0.6 and pitch 1.5 at {_a}
        send action bar "&bInvis Passive &7triggered" to {_a}
    else if {_t} is "void":
        soulVoidPassive({_v})
        send action bar "&5Void Passive &7triggered" to {_a}

# =============================================================================
#  SECTION 4 - HIT PIPELINE (passive counter + ultimate charge + Wither steal)
# =============================================================================

function soulOnHit(a: player, v: player, crit: boolean):
    set {_ak} to soulKey({_a})
    set {-soulsmp::last::%{_ak}%} to soulKey({_v})
    set {-soulsmp::lasttime::%{_ak}%} to now
    set {_type} to soulGetType({_a})
    if {_type} is "none":
        stop
    set {_c} to soulGetCount({_a})

    if {_c} is greater than or equal to {@passive-unlock}:
        add 1 to {soulsmp::data::%{_ak}%::hits}
        if {soulsmp::data::%{_ak}%::hits} is greater than or equal to soulPassiveHits({_type}):
            set {soulsmp::data::%{_ak}%::hits} to 0
            soulPassive({_a}, {_v}, {_type})

    if {_c} is greater than or equal to {@ultimate-unlock}:
        if {-soulsmp::active::%{_ak}%} is not set:
            # Do not build charge or display the CHARGED title while the
            # Ultimate is cooling down. Charge starts building again once
            # the cooldown reaches zero.
            set {_cd} to soulNum({_ak}, "cd")
            if {_cd} is less than or equal to 0:
                set {_need} to soulUltHits({_type})
                if soulNum({_ak}, "charge") is less than {_need}:
                    add 1 to {soulsmp::data::%{_ak}%::charge}
                    set {_ch} to soulNum({_ak}, "charge")
                    if {_ch} is greater than or equal to {_need}:
                        send "&8&lCharged" to {_a}
                        send "{@prefix} &7Your Ultimate is ready. Use &e/ability&7." to {_a}
                        play sound "block.beacon.activate" with volume 0.8 and pitch 1.5 at {_a}
                    else:
                        send action bar "&5Ultimate &8» &f%{_ch}%&7/&f%{_need}%" to {_a}

    if {-soulsmp::active::%{_ak}%} is "wither":
        if {_crit} is true:
            soulWitherSteal({_a}, {_v})

on damage of player:
    if attacker is not a player:
        stop
    set {_a} to attacker
    set {_v} to victim
    if {_a} is {_v}:
        stop
    if damage was caused by entity attack:
        soulOnHit({_a}, {_v}, soulIsCrit({_a}))

on damage of player:
    if {soulsmp::inv::%uuid of victim%::active} is set:
        if (health of victim) - (final damage) is less than or equal to 0:
            set {_v} to victim
            soulInvRestore({_v})

# =============================================================================
#  SECTION 5 - ULTIMATES
# =============================================================================

function soulWitherUltimate(a: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    send "{@prefix} &8&lWITHER ULTIMATE &7- crits steal hearts for %{_secs}%s." to {_a}
    play sound "entity.wither.spawn" with volume 0.5 and pitch 1.5 at {_a}
    loop {_secs} times:
        wait 1 second
        if soulActiveOK({_ak}, {_id}) is not true:
            stop
    soulWitherEnd({_a})
    soulFinish({_ak}, {_id})
    send "{@prefix} &8Wither Ultimate ended." to {_a}

function soulBarrierDraw(cx: number, cz: number, centerY: number, w: world, v: player):
    set {_vk} to soulKey({_v})
    delete {-soulsmp::barrier::fake::%{_vk}%::*}

    # Full-block glass walls, 17 blocks wide and 33 blocks tall.
    # Fake blocks are sent only to the trapped player.
    set {_west} to floor({_cx}) - 8
    set {_east} to floor({_cx}) + 8
    set {_north} to floor({_cz}) - 8
    set {_south} to floor({_cz}) + 8
    set {_bottom} to floor({_centerY}) - 16
    set {_top} to floor({_centerY}) + 16

    loop integers from -8 to 8:
        set {_offset} to loop-value-1
        loop integers from -16 to 16:
            set {_height} to loop-value-2
            set {_y} to floor({_centerY}) + {_height}
            set {_z} to floor({_cz}) + {_offset}
            set {_x} to floor({_cx}) + {_offset}

            set {_loc1} to location({_west}, {_y}, {_z}, {_w})
            set {_loc2} to location({_east}, {_y}, {_z}, {_w})
            set {_loc3} to location({_x}, {_y}, {_north}, {_w})
            set {_loc4} to location({_x}, {_y}, {_south}, {_w})

            make {_v} see {_loc1} as barrier
            make {_v} see {_loc2} as barrier
            make {_v} see {_loc3} as barrier
            make {_v} see {_loc4} as barrier

            add {_loc1} to {-soulsmp::barrier::fake::%{_vk}%::*}
            add {_loc2} to {-soulsmp::barrier::fake::%{_vk}%::*}
            add {_loc3} to {-soulsmp::barrier::fake::%{_vk}%::*}
            add {_loc4} to {-soulsmp::barrier::fake::%{_vk}%::*}

function soulBarrierClear(v: player):
    set {_vk} to soulKey({_v})
    if {_v} is online:
        make {_v} see {-soulsmp::barrier::fake::%{_vk}%::*} as original blocks
    delete {-soulsmp::barrier::fake::%{_vk}%::*}

function soulBarrierUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    set {_vk} to soulKey({_v})
    set {_l} to location of {_v}
    set {_cx} to x-coordinate of {_l}
    set {_cz} to z-coordinate of {_l}
    set {_w} to world of {_l}
    set {_minx} to {_cx} - 8
    set {_maxx} to {_cx} + 8
    set {_minz} to {_cz} - 8
    set {_maxz} to {_cz} + 8
    set {-soulsmp::barrier::%{_vk}%} to {_id}
    soulBarrierDraw({_cx}, {_cz}, y-coordinate of {_l}, {_w}, {_v})
    send "{@prefix} &c&lBARRIER ULTIMATE &7- %{_v}% is trapped for %{_secs}%s." to {_a}
    send title "&c&lTRAPPED" with subtitle "&7you cannot leave the barrier" to {_v} for 2 seconds
    play sound "block.beacon.activate" with volume 1 and pitch 0.5 at {_v}
    set {_ticks} to {_secs} * 4
    loop {_ticks} times:
        if {-soulsmp::barrier::%{_vk}%} is not {_id}:
            exit loop
        if {_v} is not online:
            exit loop
        if soulActiveOK({_ak}, {_id}) is not true:
            exit loop
        if world of {_v} is not {_w}:
            exit loop
        set {_pl} to location of {_v}
        set {_px} to x-coordinate of {_pl}
        set {_pz} to z-coordinate of {_pl}
        set {_nx} to max({_minx} + 0.5, min({_maxx} - 0.5, {_px}))
        set {_nz} to max({_minz} + 0.5, min({_maxz} - 0.5, {_pz}))
        set {_out} to false
        if {_nx} is not {_px}:
            set {_out} to true
        if {_nz} is not {_pz}:
            set {_out} to true
        if {_out} is true:
            teleport {_v} to location({_nx}, y-coordinate of {_pl}, {_nz}, {_w}, yaw of {_pl}, pitch of {_pl})
            send action bar "&c&lBARRIER &7- you cannot leave" to {_v}
            play sound "block.chain.hit" with volume 0.8 and pitch 0.7 at {_v}
        wait 5 ticks
    if {-soulsmp::barrier::%{_vk}%} is {_id}:
        delete {-soulsmp::barrier::%{_vk}%}
    soulBarrierClear({_v})
    soulFinish({_ak}, {_id})
    send "{@prefix} &cBarrier Ultimate ended." to {_a}

function soulGlitchUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    send "{@prefix} &a&lGLITCH ULTIMATE &7- enemy screen corrupted for %{_secs}%s." to {_a}
    send title "&4&lSIGNAL CORRUPTED" with subtitle "&aReality is breaking..." to {_v} for 2 seconds
    soulGlitchScreen({_v}, {_secs}, true)
    soulFinish({_ak}, {_id})

function soulInvUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    soulInvBackup({_v})
    send "{@prefix} &b&lINVIS ULTIMATE &7- %{_v}%'s inventory is empty for %{_secs}%s." to {_a}
    send title "&b&lINVENTORY GONE" with subtitle "&7it will return" to {_v} for 2 seconds
    play sound "entity.enderman.scream" with volume 0.5 and pitch 1.6 at {_v}
    loop {_secs} times:
        wait 1 second
        if soulActiveOK({_ak}, {_id}) is not true:
            exit loop
        if {_v} is not online:
            exit loop
    soulInvRestore({_v})
    soulFinish({_ak}, {_id})
    send "{@prefix} &bYour Invis Ultimate ended - inventory returned." to {_a}

function soulVoidUltimate(a: player, v: player, secs: number, id: text):
    set {_ak} to soulKey({_a})
    set {_vk} to soulKey({_v})
    soulVoidStart({_v})
    set {_spirit} to {-soulsmp::void::spirit::%{_vk}%}
    send "{@prefix} &5&lVOID ULTIMATE &7- %{_v}%'s soul left its body for %{_secs}%s." to {_a}
    send title "&5&lSOUL SEVERED" with subtitle "&7your body is defenceless" to {_v} for 2 seconds
    set {_ticks} to {_secs} * 2
    loop {_ticks} times:
        if {_v} is not online:
            exit loop
        if soulActiveOK({_ak}, {_id}) is not true:
            exit loop
        if {soulsmp::void::%{_vk}%::active} is not set:
            exit loop
        if world of {_v} is not world of {_spirit}:
            teleport {_v} to {_spirit}
        else if distance between {_v} and {_spirit} is greater than 40:
            teleport {_v} to {_spirit}
        wait 10 ticks
    soulVoidEnd({_v})
    soulFinish({_ak}, {_id})
    send "{@prefix} &5Void Ultimate ended." to {_a}

on damage of armor stand:
    set {_vk} to ""
    loop scoreboard tags of victim:
        if loop-value starts with "soulbody_":
            set {_vk} to loop-value
            replace "soulbody_" in {_vk} with ""

    if {_vk} is "":
        stop
    if {soulsmp::void::%{_vk}%::active} is not set:
        cancel event
        stop

    # The armor stand is the hittable body; transfer the hit to its owner.
    set {_dmg} to damage
    if {_dmg} is less than or equal to 0:
        set {_dmg} to 1
    cancel event

    set {_p} to soulPlayerFromKey({_vk})
    if {_p} is not set:
        stop
    if {_p} is not online:
        stop

    if (health of {_p}) - {_dmg} is less than or equal to 0:
        soulVoidEnd({_p})
        set gamemode of {_p} to survival
        damage {_p} by {_dmg}
        stop

    set gamemode of {_p} to survival
    damage {_p} by {_dmg}
    wait 1 tick

    if {_p} is online:
        if {soulsmp::void::%{_vk}%::active} is set:
            set gamemode of {_p} to spectator
            set {_spirit} to {-soulsmp::void::spirit::%{_vk}%}
            if {_spirit} is set:
                teleport {_p} to {_spirit}

on right click on armor stand:
    loop scoreboard tags of event-entity:
        if loop-value starts with "soulbody_":
            cancel event
            stop

# ---- /ability entry point ----
function soulActivate(p: player):
    set {_k} to soulKey({_p})
    set {_type} to soulGetType({_p})
    if {_type} is "none":
        send "{@prefix} &cSelect a Soul first with &e/soul&c." to {_p}
        stop
    if soulGetCount({_p}) is less than {@ultimate-unlock}:
        send "{@prefix} &cUltimates need &e{@ultimate-unlock} Souls&c (you have %soulGetCount({_p})%)." to {_p}
        stop
    if {-soulsmp::active::%{_k}%} is set:
        send "{@prefix} &cAn Ultimate is already active." to {_p}
        stop
    set {_cd} to soulNum({_k}, "cd")
    if {_cd} is greater than 0:
        send "{@prefix} &cUltimate on cooldown: &f%{_cd}%s&c." to {_p}
        stop
    set {_need} to soulUltHits({_type})
    set {_ch} to soulNum({_k}, "charge")
    if {_ch} is less than {_need}:
        send "{@prefix} &cNot charged yet: &f%{_ch}%&7/&f%{_need}%&c hits." to {_p}
        stop
    if {_type} is "barrier" or "glitch" or "invis" or "void":
        set {_target} to soulLastTarget({_p})
        if {_target} is not set:
            send "{@prefix} &cHit an enemy within range first - this Ultimate targets your last-hit player." to {_p}
            stop
    set {_secs} to soulUltSeconds({_type})
    set {_id} to "%now%-%a random integer between 1000 and 9999%"
    set {soulsmp::data::%{_k}%::charge} to 0
    send "&8&lLost" to {_p}
    set {soulsmp::data::%{_k}%::cd} to {@ult-cooldown-seconds}
    set {-soulsmp::active::%{_k}%} to {_type}
    set {-soulsmp::activeid::%{_k}%} to {_id}
    set {-soulsmp::left::%{_k}%} to {_secs}
    send title "&5&lULTIMATE" with subtitle soulName({_type}) to {_p} for 2 seconds
    if {_type} is "wither":
        soulWitherUltimate({_p}, {_secs}, {_id})
    else if {_type} is "barrier":
        soulBarrierUltimate({_p}, {_target}, {_secs}, {_id})
    else if {_type} is "glitch":
        soulGlitchUltimate({_p}, {_target}, {_secs}, {_id})
    else if {_type} is "invis":
        soulInvUltimate({_p}, {_target}, {_secs}, {_id})
    else if {_type} is "void":
        soulVoidUltimate({_p}, {_target}, {_secs}, {_id})

function soulLastTarget(p: player) :: player:
    set {_k} to soulKey({_p})
    if {-soulsmp::last::%{_k}%} is not set:
        stop
    set {_diff} to difference between {-soulsmp::lasttime::%{_k}%} and now
    if {_diff} is greater than {@target-memory-seconds} seconds:
        stop
    set {_tp} to soulPlayerFromKey({-soulsmp::last::%{_k}%})
    if {_tp} is not set:
        stop
    if world of {_tp} is not world of {_p}:
        stop
    if distance between {_p} and {_tp} is greater than {@target-range}:
        stop
    return {_tp}

# =============================================================================
#  SOUL ITEMS
# =============================================================================

function soulCreateItem() :: item:
    set {_i} to echo shard
    set name of {_i} to "&8&lSoul"
    set lore of {_i} to "&7Right-click to gain &f1 Soul&7."
    return {_i}

function soulCreateRerollBook() :: item:
    set {_i} to book
    set name of {_i} to "&5&lSoul Reroll"
    set lore of {_i} to "&7Right-click to reroll your selected Soul." and "&8Your hit progress and charge will reset."
    return {_i}

on right click:
    if player's tool is echo shard:
        if name of player's tool is "&8&lSoul":
            cancel event
            if soulGetCount(player) is greater than or equal to {@max-souls}:
                send "{@prefix} &cYou already have the maximum number of Souls." to player
                stop
            set amount of player's tool to (amount of player's tool - 1)
            soulSetCount(player, soulGetCount(player) + 1)
            send "{@prefix} &aYou gained &f1 Soul&a! &7(%soulGetCount(player)%/{@max-souls})" to player
            play sound "entity.player.levelup" with volume 0.7 and pitch 1.4 at player
            stop

    if player's tool is book:
        if name of player's tool is "&5&lSoul Reroll":
            cancel event
            set {_current} to soulGetType(player)
            delete {_choices::*}
            if {_current} is not "wither":
                add "wither" to {_choices::*}
            if {_current} is not "barrier":
                add "barrier" to {_choices::*}
            if {_current} is not "glitch":
                add "glitch" to {_choices::*}
            if {_current} is not "invis":
                add "invis" to {_choices::*}
            if {_current} is not "void":
                add "void" to {_choices::*}
            set {_new} to a random element out of {_choices::*}
            if {_new} is not set:
                send "{@prefix} &cNo Soul is available to reroll." to player
                stop
            set amount of player's tool to (amount of player's tool - 1)
            soulSetType(player, {_new})
            send "{@prefix} &aYour Soul was rerolled to %soulName({_new})%&a!" to player
            send "{@prefix} &7Your hit progress and Ultimate charge were reset. Cooldown was kept." to player
            play sound "block.enchantment_table.use" with volume 1 and pitch 1.5 at player
            stop

# =============================================================================
#  SECTION 6 - GUI
# =============================================================================

function soulIcon(t: text, p: player) :: itemtype:
    set {_count} to soulGetCount({_p})
    set {_sel} to soulGetType({_p})
    if {_t} is "wither":
        set {_i} to wither skeleton skull
    else if {_t} is "barrier":
        set {_i} to barrier
    else if {_t} is "glitch":
        set {_i} to paper
    else if {_t} is "invis":
        set {_i} to potion of invisibility
    else:
        set {_i} to nether star
    set name of {_i} to soulName({_t})
    add "&8&m                    " to {_l::*}
    add "&5Passive &8(&e{@passive-unlock} Souls&8)" to {_l::*}
    add "&7  %soulPassiveDesc({_t})%" to {_l::*}
    if {_count} is greater than or equal to {@passive-unlock}:
        add "&a  ✔ Unlocked" to {_l::*}
    else:
        add "&c  ✘ Locked" to {_l::*}
    add "&5Ultimate &8(&e{@ultimate-unlock} Souls&8)" to {_l::*}
    add "&7  %soulUltDesc({_t})%" to {_l::*}
    if {_count} is greater than or equal to {@ultimate-unlock}:
        add "&a  ✔ Unlocked" to {_l::*}
    else:
        add "&c  ✘ Locked" to {_l::*}
    add "&8&m                    " to {_l::*}
    if {_sel} is {_t}:
        add "&a&l» SELECTED" to {_l::*}
    else if {_count} is greater than or equal to {@select-min-souls}:
        add "&eClick to select" to {_l::*}
    else:
        add "&cRequires {@select-min-souls}+ Soul(s) to select" to {_l::*}
    set lore of {_i} to {_l::*}
    return {_i}

function soulReservedIcon() :: itemtype:
    set {_i} to gray dye
    set name of {_i} to "&8&l6th Soul &7- Coming Soon"
    set lore of {_i} to "&7Reserved for future development." and "&8No ability has been assigned."
    return {_i}

function soulStatusItem(p: player) :: itemtype:
    set {_k} to soulKey({_p})
    set {_type} to soulGetType({_p})
    set {_count} to soulGetCount({_p})
    set {_hits} to soulNum({_k}, "hits")
    set {_charge} to soulNum({_k}, "charge")
    set {_cd} to soulNum({_k}, "cd")
    set {_i} to {_p}'s skull
    set name of {_i} to "&5&l%{_p}%&r &8- &7Soul Status"
    add "&7Souls: &f%{_count}%&7/&f{@max-souls}" to {_l::*}
    add "&7Selected: %soulName({_type})%" to {_l::*}
    if {_type} is "none":
        add "&7Passive: &8-" to {_l::*}
        add "&7Ultimate: &8-" to {_l::*}
    else:
        if {_count} is greater than or equal to {@passive-unlock}:
            add "&7Passive: &aActive &8(%{_hits}%/%soulPassiveHits({_type})%)" to {_l::*}
        else:
            add "&7Passive: &cLocked &8(needs {@passive-unlock} Souls)" to {_l::*}
        if {_count} is greater than or equal to {@ultimate-unlock}:
            add "&7Ultimate charge: &f%{_charge}%&7/&f%soulUltHits({_type})%" to {_l::*}
            if {_cd} is greater than 0:
                add "&7Cooldown: &c%{_cd}%s" to {_l::*}
            else:
                add "&7Cooldown: &aReady" to {_l::*}
        else:
            add "&7Ultimate: &cLocked &8(needs {@ultimate-unlock} Souls)" to {_l::*}
    set lore of {_i} to {_l::*}
    return {_i}

function soulFillGui(p: player):
    set {_inv} to current inventory of {_p}
    loop integers from 0 to 44:
        set slot loop-value of {_inv} to gray stained glass pane named " "
    set slot 4 of {_inv} to soulStatusItem({_p})
    set slot 11 of {_inv} to soulIcon("wither", {_p})
    set slot 13 of {_inv} to soulIcon("barrier", {_p})
    set slot 15 of {_inv} to soulIcon("glitch", {_p})
    set slot 29 of {_inv} to soulIcon("invis", {_p})
    set slot 31 of {_inv} to soulIcon("void", {_p})
    set slot 33 of {_inv} to soulReservedIcon()

function soulOpenGui(p: player):
    open chest inventory with 5 rows named "{@gui-title}" to {_p}
    soulFillGui({_p})
    set {-soulsmp::gui::%uuid of {_p}%} to true

function soulTrySelect(p: player, t: text):
    set {_k} to soulKey({_p})
    set {_t} to {_t} in lowercase
    if {_t} is "sixth" or "6th" or "6":
        send "{@prefix} &86th Soul Coming Soon &7- it is reserved for future development." to {_p}
        stop
    if soulValid({_t}) is not true:
        send "{@prefix} &cUnknown Soul. Choose: &ewither, barrier, glitch, invis, void&c." to {_p}
        stop
    if soulGetCount({_p}) is less than {@select-min-souls}:
        send "{@prefix} &cYou need at least &e{@select-min-souls} Soul(s) &cto select one." to {_p}
        stop
    if {-soulsmp::active::%{_k}%} is set:
        send "{@prefix} &cYou cannot change Soul while an Ultimate is active." to {_p}
        stop
    if soulGetType({_p}) is {_t}:
        send "{@prefix} &7%soulName({_t})% &7is already selected." to {_p}
        stop
    soulSetType({_p}, {_t})
    send "{@prefix} &7Selected %soulName({_t})%&7. Hit progress and charge were reset (cooldown is kept)." to {_p}
    play sound "block.enchantment_table.use" with volume 1 and pitch 1.2 at {_p}

on inventory click:
    if {-soulsmp::gui::%uuid of player%} is not set:
        stop
    cancel event
    set {_n} to name of event-item
    if {_n} is not set:
        stop
    set {_p} to player
    if {_n} contains "Wither Soul":
        soulTrySelect({_p}, "wither")
    else if {_n} contains "Barrier Soul":
        soulTrySelect({_p}, "barrier")
    else if {_n} contains "Glitch Soul":
        soulTrySelect({_p}, "glitch")
    else if {_n} contains "Invis Soul":
        soulTrySelect({_p}, "invis")
    else if {_n} contains "Void Soul":
        soulTrySelect({_p}, "void")
    else if {_n} contains "Coming Soon":
        soulTrySelect({_p}, "sixth")
    else:
        stop
    soulFillGui({_p})

on inventory close:
    delete {-soulsmp::gui::%uuid of player%}

# =============================================================================
#  SECTION 7 - INFO MESSAGES
# =============================================================================

function soulSendInfo(p: player):
    set {_k} to soulKey({_p})
    set {_type} to soulGetType({_p})
    set {_count} to soulGetCount({_p})
    send "&8&m-----------&r {@prefix} &5Soul Info &8&m-----------" to {_p}
    send "&7Souls: &f%{_count}%&7/&f{@max-souls}" to {_p}
    send "&7Selected: %soulName({_type})%" to {_p}
    set {_hits} to soulNum({_k}, "hits")
    set {_charge} to soulNum({_k}, "charge")
    set {_cd} to soulNum({_k}, "cd")
    if {_type} is not "none":
        if {_count} is greater than or equal to {@passive-unlock}:
            send "&7Passive: &aUnlocked &8(%{_hits}%/%soulPassiveHits({_type})% hits) &7- %soulPassiveDesc({_type})%" to {_p}
        else:
            send "&7Passive: &cLocked &8(needs {@passive-unlock} Souls)" to {_p}
        if {_count} is greater than or equal to {@ultimate-unlock}:
            send "&7Ultimate: &aUnlocked &8(charge %{_charge}%/%soulUltHits({_type})%) &7- %soulUltDesc({_type})%" to {_p}
            if {_cd} is greater than 0:
                send "&7Cooldown: &c%{_cd}%s" to {_p}
            else:
                send "&7Cooldown: &aReady" to {_p}
        else:
            send "&7Ultimate: &cLocked &8(needs {@ultimate-unlock} Souls)" to {_p}

function soulSendOverview(p: player):
    send "&8&m-----------&r {@prefix} &5The Souls &8&m-----------" to {_p}
    loop "wither", "barrier", "glitch", "invis" and "void":
        send soulName(loop-value) to {_p}
        send "  &5Passive &8({@passive-unlock} Souls)&7: %soulPassiveDesc(loop-value)%" to {_p}
        send "  &5Ultimate &8({@ultimate-unlock} Souls)&7: %soulUltDesc(loop-value)%" to {_p}
    send "&86th Soul &7- Coming Soon" to {_p}
    send "&7Your Souls: &f%soulGetCount({_p})%&7/&f{@max-souls} &8| &7Use &e/soul &7to open the menu." to {_p}

# =============================================================================
#  SECTION 8 - SOUL GAINING, JOIN / QUIT / DEATH SAFETY, HUD LOOP
# =============================================================================

on death of player:
    set {_v} to victim
    set {_vk} to "%uuid of {_v}%"

    if {soulsmp::inv::%{_vk}%::active} is set:
        loop {soulsmp::inv::%{_vk}%::slot::*}:
            add loop-value to drops
        delete {soulsmp::inv::%{_vk}%::*}

    if soulGetCount({_v}) is greater than 0:
        set {_transfer} to false

        if {@pvp-souls} is true:
            if attacker is a player:
                set {_a} to attacker
                if {_a} is not {_v}:
                    set {_ak} to "%uuid of {_a}%"
                    set {_transfer} to true

                    # Do not transfer if the killer is already at the Soul cap.
                    if soulGetCount({_a}) is greater than or equal to {@max-souls}:
                        set {_transfer} to false

                    # Prevent repeated farming between the same two players.
                    if {soulsmp::farm::%{_ak}%::%{_vk}%} is set:
                        set {_diff} to difference between {soulsmp::farm::%{_ak}%::%{_vk}%} and now
                        if {_diff} is less than {@farm-lockout-minutes} minutes:
                            set {_transfer} to false
                    if {soulsmp::farm::%{_vk}%::%{_ak}%} is set:
                        set {_diff} to difference between {soulsmp::farm::%{_vk}%::%{_ak}%} and now
                        if {_diff} is less than {@farm-lockout-minutes} minutes:
                            set {_transfer} to false

                    if {_transfer} is true:
                        soulSetCount({_v}, soulGetCount({_v}) - 1)
                        soulSetCount({_a}, soulGetCount({_a}) + 1)
                        set {soulsmp::farm::%{_ak}%::%{_vk}%} to now
                        set {soulsmp::farm::%{_vk}%::%{_ak}%} to now
                        send "{@prefix} &aYou gained 1 Soul from killing %{_v}%! &7(%soulGetCount({_a})%/{@max-souls})" to {_a}
                        send "{@prefix} &cYou lost 1 Soul to %{_a}%. &7(%soulGetCount({_v})%/{@max-souls})" to {_v}

        # Natural deaths, PvP-disabled deaths, farming-locked kills, and kills
        # where the killer is at max Souls all drop a physical Soul item instead.
        if {_transfer} is not true:
            soulSetCount({_v}, soulGetCount({_v}) - 1)
            add soulCreateItem() to drops
            send "{@prefix} &cYou dropped 1 Soul Item and lost 1 Soul on death. &7(%soulGetCount({_v})%/{@max-souls})" to {_v}

    soulVoidAbort({_v})
    soulForceEnd({_v})

on quit:
    soulForceEnd(player)

# Prevent the trapped player from breaking the client-side fake barrier blocks.
on break:
    set {_vk} to soulKey(player)
    if {-soulsmp::barrier::%{_vk}%} is not set:
        stop
    loop {-soulsmp::barrier::fake::%{_vk}%::*}:
        if location of event-block is loop-value:
            cancel event
            send action bar "&c&lBARRIER &7- these blocks cannot be broken" to player
            stop

on join:
    set {_k} to soulKey(player)

    # Assign one random Soul exactly once, on the player's first join.
    if {soulsmp::data::%{_k}%::first-soul-assigned} is not set:
        if soulGetType(player) is "none":
            delete {_choices::*}
            add "wither" to {_choices::*}
            add "barrier" to {_choices::*}
            add "glitch" to {_choices::*}
            add "invis" to {_choices::*}
            add "void" to {_choices::*}
            set {_randomSoul} to a random element out of {_choices::*}
            soulSetType(player, {_randomSoul})
            send "{@prefix} &7Your first Soul was randomly assigned: %soulName({_randomSoul})%&7!" to player
            play sound "block.enchantment_table.use" with volume 1 and pitch 1.3 at player
        set {soulsmp::data::%{_k}%::first-soul-assigned} to true

    wait 1 second
    if player is online:
        soulRecover(player)

every 1 second:
    loop all players:
        set {_p} to loop-player
        set {_k} to "%uuid of {_p}%"
        set {_type} to soulGetType({_p})
        if {soulsmp::data::%{_k}%::cd} is set:
            remove 1 from {soulsmp::data::%{_k}%::cd}
            if {soulsmp::data::%{_k}%::cd} is less than or equal to 0:
                delete {soulsmp::data::%{_k}%::cd}
                if {_type} is not "none":
                    if soulGetCount({_p}) is greater than or equal to {@ultimate-unlock}:
                        if soulNum({_k}, "charge") is greater than or equal to soulUltHits({_type}):
                            send action bar "&5&lULTIMATE READY &7- use &d/ability" to {_p}
                            play sound "block.beacon.activate" with volume 0.6 and pitch 1.7 at {_p}
        if {-soulsmp::active::%{_k}%} is set:
            remove 1 from {-soulsmp::left::%{_k}%}
            if {-soulsmp::left::%{_k}%} is greater than 0:
                set {_act} to {-soulsmp::active::%{_k}%}
                set {_left} to {-soulsmp::left::%{_k}%}
                send action bar "%soulName({_act})% &8| &7Ultimate: &f%{_left}%s" to {_p}
            else if {-soulsmp::left::%{_k}%} is less than -5:
                soulForceEnd({_p})
        else if {@show-cooldown-bar} is true:
            if {soulsmp::data::%{_k}%::cd} is set:
                if soulGetCount({_p}) is greater than or equal to {@ultimate-unlock}:
                    send action bar "&8Ultimate cooldown: &c%{soulsmp::data::%{_k}%::cd}%s" to {_p}

on jump:
    if {-soulsmp::stun::%uuid of player%} is set:
        cancel event

on swap hand items:
    if player is sneaking:
        cancel event
        soulActivate(player)

# =============================================================================
#  SECTION 9 - COMMANDS
# =============================================================================

command /souls:
    description: Show Soul information
    trigger:
        if sender is not a player:
            send "&cPlayers only."
            stop
        soulSendOverview(player)

command /soul [] [] []:
    description: Open the Soul GUI / soul info / select
    trigger:
        if sender is not a player:
            send "&cPlayers only."
            stop

        if player is not op:
            if argument 1 is not set:
                soulSendInfo(player)
                stop
            if argument 1 is "info":
                soulSendInfo(player)
                stop
            send "{@prefix} &cOnly operators can use Soul menu commands."
            stop

        if argument 1 is not set:
            soulOpenGui(player)
            stop

        if argument 1 is "info":
            soulSendInfo(player)
            stop

        if argument 1 is "select":
            if argument 2 is not set:
                send "{@prefix} &cUsage: &e/soul select "
                stop
            soulTrySelect(player, argument 2)
            stop

        if argument 1 is "set":
            if argument 2 is not set:
                send "{@prefix} &cUsage: &e/soul set  "
                stop
            if argument 3 is not set:
                send "{@prefix} &cUsage: &e/soul set  "
                stop
            set {_target} to argument 2 parsed as offlineplayer
            if {_target} is not set:
                send "{@prefix} &cUnknown player."
                stop
            if {_target} has not played before:
                send "{@prefix} &cThat player has never joined."
                stop
            set {_amount} to argument 3 parsed as integer
            if {_amount} is not set:
                send "{@prefix} &cAmount must be a whole number."
                stop
            if {_amount} is less than 0:
                send "{@prefix} &cAmount cannot be negative."
                stop
            soulSetCount({_target}, {_amount})
            send "{@prefix} &a%{_target}% now has &f%soulGetCount({_target})%&a Souls."
            if {_target} is online:
                send "{@prefix} &aYour Souls were set to &f%soulGetCount({_target})%&7/&f{@max-souls}" to {_target}
            stop

        send "{@prefix} &cUsage: &e/soul &7| &e/soul info &7| &e/soul select  &7| &e/soul set  "

command /ability:
    description: Activate your Ultimate
    trigger:
        if sender is not a player:
            send "&cPlayers only."
            stop
        soulActivate(player)

command /cooldown []:
    description: Reset an Ultimate cooldown (admin)
    permission: soulsmp.admin
    permission message: &cYou do not have permission.
    trigger:
        if arg-1 is set:
            set {_t} to arg-1
        else if sender is a player:
            set {_t} to player
        else:
            send "&cUsage: /cooldown "
            stop
        set {_tk} to "%uuid of {_t}%"
        delete {soulsmp::data::%{_tk}%::cd}
        send "{@prefix} &aCooldown reset for &f%{_t}%&a."
        if {_t} is online:
            send "{@prefix} &aYour Ultimate cooldown was reset." to {_t}

command /soulsmp [] [] []:
    description: SoulSMP administration
    trigger:
        if arg-1 is not set:
            send "{@prefix} &7Usage: &e/soulsmp info|reload|give|set|settype|reset|soulitem|rerollbook"
            stop
        set {_sub} to arg-1 in lowercase

        if {_sub} is "info":
            if sender does not have permission "soulsmp.info":
                if sender does not have permission "soulsmp.admin":
                    send "{@prefix} &cYou do not have permission."
                    stop
            send "&8&m-----------&r {@prefix} &5SoulSMP by wuweeuea &8&m-----------"
            send "&7Souls: &f0-{@max-souls} &8| &7Passive at &f{@passive-unlock} &8| &7Ultimate at &f{@ultimate-unlock}"
            send "&7Ultimate cooldown: &f{@ult-cooldown-seconds}s &8| &7Souls: wither, barrier, glitch, invis, void (+6th reserved)"
            send "&7Players online: &f%number of all players%"
            stop

        if sender does not have permission "soulsmp.admin":
            send "{@prefix} &cYou do not have permission."
            stop

        if {_sub} is "reload":
            loop all players:
                soulForceEnd(loop-player)
            send "{@prefix} &eReloading SoulSMP..."
            execute console command "sk reload soulsmp"
            stop

        if arg-2 is not set:
            send "{@prefix} &cUsage: &e/soulsmp %{_sub}%  ..."
            stop
        set {_t} to arg-2 parsed as offlineplayer
        if {_t} is not set:
            send "{@prefix} &cUnknown player."
            stop
        if {_t} has not played before:
            send "{@prefix} &cThat player has never joined."
            stop
        set {_tk} to soulKey({_t})

        if {_sub} is "give":
            set {_n} to arg-3 parsed as integer
            if {_n} is not set:
                send "{@prefix} &cUsage: &e/soulsmp give  "
                stop
            soulSetCount({_t}, soulGetCount({_t}) + {_n})
            send "{@prefix} &a%{_t}% now has &f%soulGetCount({_t})%&a Souls."
            if {_t} is online:
                send "{@prefix} &aYour Souls: &f%soulGetCount({_t})%&7/&f{@max-souls}" to {_t}
        else if {_sub} is "set":
            set {_n} to arg-3 parsed as integer
            if {_n} is not set:
                send "{@prefix} &cUsage: &e/soulsmp set  "
                stop
            soulSetCount({_t}, {_n})
            send "{@prefix} &a%{_t}% now has &f%soulGetCount({_t})%&a Souls."
            if {_t} is online:
                send "{@prefix} &aYour Souls were set to &f%soulGetCount({_t})%&7/&f{@max-souls}" to {_t}
        else if {_sub} is "settype":
            if arg-3 is not set:
                send "{@prefix} &cUsage: &e/soulsmp settype  "
                stop
            set {_ty} to arg-3 in lowercase
            if soulValid({_ty}) is not true:
                send "{@prefix} &cUnknown Soul (the 6th Soul is reserved)."
                stop
            if {_t} is online:
                soulForceEnd({_t})
            soulSetType({_t}, {_ty})
            send "{@prefix} &a%{_t}% is now %soulName({_ty})%&a."
            if {_t} is online:
                send "{@prefix} &aYour Soul was set to %soulName({_ty})%&a." to {_t}
        else if {_sub} is "reset":
            if {_t} is online:
                soulForceEnd({_t})
            delete {soulsmp::data::%{_tk}%::*}
            delete {soulsmp::farm::%{_tk}%::*}
            send "{@prefix} &aSoul data reset for &f%{_t}%&a."
            if {_t} is online:
                send "{@prefix} &cYour Soul data was reset." to {_t}
        else if {_sub} is "soulitem":
            if {_t} is not online:
                send "{@prefix} &cThat player must be online to receive items."
                stop
            set {_amount} to arg-3 parsed as integer
            if {_amount} is not set:
                set {_amount} to 1
            if {_amount} is less than 1:
                send "{@prefix} &cAmount must be at least 1."
                stop
            loop {_amount} times:
                give soulCreateItem() to {_t}
            send "{@prefix} &aGave &f%{_amount}% Soul Item(s) &ato %{_t}%."
            send "{@prefix} &aYou received &f%{_amount}% Soul Item(s)&a." to {_t}
        else if {_sub} is "rerollbook":
            if {_t} is not online:
                send "{@prefix} &cThat player must be online to receive items."
                stop
            set {_amount} to arg-3 parsed as integer
            if {_amount} is not set:
                set {_amount} to 1
            if {_amount} is less than 1:
                send "{@prefix} &cAmount must be at least 1."
                stop
            loop {_amount} times:
                give soulCreateRerollBook() to {_t}
            send "{@prefix} &aGave &f%{_amount}% Reroll Book(s) &ato %{_t}%."
            send "{@prefix} &aYou received &f%{_amount}% Reroll Book(s)&a." to {_t}
        else:
            send "{@prefix} &cUnknown subcommand."
Kodari AI
KodariNov 9 at 5:55 am 1
  1. Compare the Java plugin’s PvP hit tracking and /ability flow with the Skript you provided.

  2. Fix mismatches that prevent hits charging or abilities activating, keeping the Skript’s intended rules and configured messages.

Used the Skript as the reference and fixed the hit/activation flow:

  • Direct player melee hits now count, matching the Skript; projectile hits don’t charge abilities.

  • Setting a player’s Soul count above zero now assigns a random Soul if they don’t have one selected, so their hits can progress.

  • /ability now reports a missing Soul before checking charge. Passive hits and Ultimate charge use their separate Soul thresholds.

  • Removed “Land more PvP hits” from the default charge-expired message; it remains configurable under messages.charge-expired.

I kept the newer 20-hit Glitch Passive setting rather than reverting it to the Skript’s 10-hit value.

wuweeuea

assign random Soul to players on first join

Kodari AI
KodariNov 9 at 5:58 am 1
  1. Persist a first-join marker with player data.

  2. On a player’s first join, assign one random Soul if they don’t already have one and send a configurable message.

Players now receive a random selected Soul type on their first join, and the assignment is saved so it won’t reroll on later joins. The welcome message is configurable at messages.first-soul-assigned. As in the Skript, this selects a Soul type but does not grant a Soul token.

wuweeuea

dont send anything in title.. For ability charged Say

&8&lCharged (in chat) and when lost say &8&lLost (in chat)

Kodari AI
KodariNov 9 at 6:49 am 1
  1. Remove all title overlays used by Soul abilities.

  2. Send configurable Charged and Lost messages directly in chat, without the plugin prefix.

Removed all title overlays from the Soul abilities. When Ultimate charge completes, chat now shows &8&lCharged; when the charge expires, it shows &8&lLost. Both are configurable under messages.charged and messages.lost in config.yml.

wuweeuea

been hitting this player for 10 years still charge is 0

Kodari AI
KodariNov 9 at 6:56 am 1
  1. Fix the hit-progress display that masks partial Ultimate charge.

  2. Preserve the Skript’s Ultimate unlock and cooldown requirements.

Fixed the charge display in SoulAbilityManager: partial Ultimate charge was being shown as 0 because the expiry timer is only set once the charge is full. It will now show progress like 3/10 as hits accumulate.

Ultimate charge still requires 5 Souls by default and won’t build while the Ultimate is on cooldown, matching the Skript’s rules.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
16 1,893
src/main/java/com/kodari/soulsmp/SoulSMP.java
package com.kodari.soulsmp;

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class SoulSMP extends JavaPlugin implements Listener {
    private PlayerDataManager playerDataManager;
    private SoulManager soulManager;
    private TargetManager targetManager;
    private SoulAbilityManager abilityManager;
    private SoulItemManager itemManager;
    private SoulGUI soulGUI;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        playerDataManager = new PlayerDataManager(this);
        soulManager = new SoulManager(this, playerDataManager);
        targetManager = new TargetManager(this);
        abilityManager = new SoulAbilityManager(this, soulManager, playerDataManager, targetManager);
        itemManager = new SoulItemManager(this, soulManager);
        soulGUI = new SoulGUI(this, soulManager);

        Bukkit.getPluginManager().registerEvents(this, this);
        Bukkit.getPluginManager().registerEvents(abilityManager, this);
        Bukkit.getPluginManager().registerEvents(itemManager, this);
        Bukkit.getPluginManager().registerEvents(soulGUI, this);

        SoulCommand playerCommands = new SoulCommand(this, soulManager, soulGUI, abilityManager);
        registerCommand("souls", playerCommands);
        registerCommand("soul", playerCommands);
        registerCommand("ability", playerCommands);
        registerCommand("cooldown", playerCommands);
        registerCommand("soulsmp", new SoulSMPCommand(this, soulManager, itemManager));

        Bukkit.getScheduler().runTaskTimer(this, playerDataManager::save, 1200L, 1200L);
        getLogger().info("SoulSMP enabled.");
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        soulManager.initializeFirstJoin(player.getUniqueId(), !player.hasPlayedBefore()).ifPresent(type -> {
            String message = getConfig().getString("messages.first-soul-assigned",
                    "&7Your first Soul was randomly assigned: %soul%&7!");
            ColorUtil.send(player, getConfig().getString("prefix", "") + " "
                    + message.replace("%soul%", type.displayName()));
        });
    }

    @Override
    public void onDisable() {
        if (abilityManager != null) abilityManager.shutdown();
        if (playerDataManager != null) playerDataManager.save();
    }

    private void registerCommand(String name, SoulCommand executor) {
        PluginCommand command = getCommand(name);
        if (command == null) throw new IllegalStateException("Missing command definition: " + name);
        command.setExecutor(executor);
        command.setTabCompleter(executor);
    }

    private void registerCommand(String name, SoulSMPCommand executor) {
        PluginCommand command = getCommand(name);
        if (command == null) throw new IllegalStateException("Missing command definition: " + name);
        command.setExecutor(executor);
        command.setTabCompleter(executor);
    }
}