Initial commit

This commit is contained in:
Rares Bozga
2025-11-29 22:53:32 +02:00
parent e9fa13dbd3
commit 461e95114c
157 changed files with 7597 additions and 1 deletions

View File

@@ -0,0 +1,100 @@
sports_volleyball_join:
debug: false
type: task
definitions: id|player|team
script:
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
- if <[team]> == red:
- teleport <[player]> <[extra].get[red_start]>
- else if <[team]> == blue:
- teleport <[player]> <[extra].get[blue_start]>
- define count <proc[sports_arena_player_count].context[<[id]>]>
- if <[count]> == 2:
- define teams <proc[sports_arena_teams].context[<[id]>]>
- repeat 3:
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> title:<&6><element[3].sub[<[value].sub[1]>]> fade_in:0 fade_out:0 stay:1s
- wait 1s
- if <proc[sports_arena_player_count].context[<[id]>]> < 2:
- stop
- run sports_volleyball_restart_game def.id:<[id]> def.side:red
- stop
- if <[count]> < 2:
- run sports_volleyball_idle_game def.id:<[id]>
sports_volleyball_leave:
debug: false
type: task
definitions: id|player
script:
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
- teleport <[player]> <[extra].get[exit]>
- glow <[player]> reset
- define ball <proc[ball_get].context[<[id]>].if_null[null]>
- if <proc[sports_arena_player_count].context[<[id]>]> <= 1:
- run sports_volleyball_idle_game def.id:<[id]>
sports_volleyball_redistribute:
debug: false
type: task
definitions: id|player|from|to
script:
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
- if <[to]> == red:
- teleport <[player]> <[extra].get[red_start]>
- narrate targets:<[player]> format:formats_prefix "You were auto-balanced to the <&c>red team"
- else if <[to]> == blue:
- teleport <[player]> <[extra].get[blue_start]>
- narrate targets:<[player]> format:formats_prefix "You were auto-balanced to the <&9>blue team"
sports_volleyball_restart_game:
debug: false
type: task
definitions: id|side
script:
- define arena <proc[sports_arena].context[<[id]>]>
- define extra <[arena].get[extra_data]>
- run sports_arena_redistribute def.id:<[id]>
- define teams <proc[sports_arena_teams].context[<[id]>]>
- foreach <[teams].get[red]> as:red_player:
- teleport <[red_player]> <[extra].get[red_start]>
- foreach <[teams].get[blue]> as:blue_player:
- teleport <[blue_player]> <[extra].get[blue_start]>
- run sports_arena_set_status def.id:<[id]> def.status:<tern[<[side].equals[red]>].pass[red_start].fail[blue_start]>
- define ball_start <tern[<[side].equals[red]>].pass[<[extra].get[red_ball_start]>].fail[<[extra].get[blue_ball_start]>]>
- run ball_create def.id:<[id]> def.location:<[ball_start]> def.size:<[arena].get[ball_size]> def.display_item:<[arena].get[ball_display]> def.gravity_multiplier:<[arena].get[ball_gravity]>
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "Next round..."
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> "title:<&e>Next Round" fade_in:0 fade_out:0 stay:1s
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:BLOCK_NOTE_BLOCK_PLING pitch:1 volume:30
sports_volleyball_idle_game:
debug: false
type: task
definitions: id
script:
- define extra <proc[sports_arena].context[<[id]>].get[extra_data]>
- define teams <proc[sports_arena_teams].context[<[id]>]>
- run sports_arena_set_status def.id:<[id]> def.status:waiting
- run ball_remove def.id:<[id]>
- teleport <[teams].get[red]> <[extra].get[red_start]>
- teleport <[teams].get[blue]> <[extra].get[blue_start]>
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "Not enough players. Waiting..."
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> title:<&7>Waiting fade_in:0 fade_out:0 stay:3s
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:BLOCK_NOTE_BLOCK_HAT pitch:1 volume:30
sports_volleyball_score_goal:
debug: false
type: task
definitions: id|team
script:
- run sports_arena_set_status def.id:<[id]> def.status:goal
- define teams <proc[sports_arena_teams].context[<[id]>]>
- if <[team]> == red:
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> "title:<&c>Point for Red" fade_in:0 fade_out:0 stay:2s
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "<&c>Red team <&7>scored a goal!"
- if <[team]> == blue:
- title targets:<[teams].get[red].include[<[teams].get[blue]>]> "title:<&9>Point for Blue" fade_in:0 fade_out:0 stay:2s
- narrate targets:<[teams].get[red].include[<[teams].get[blue]>]> format:formats_prefix "<&9>Blue team <&7>scored a goal!"
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:BLOCK_NOTE_BLOCK_PLING pitch:2 volume:30
- playsound <[teams].get[red].include[<[teams].get[blue]>]> sound:ENTITY_FIREWORK_ROCKET_TWINKLE_FAR pitch:1 volume:30
- wait 3s
- run sports_volleyball_restart_game def.id:<[id]> def.side:<tern[<[team].equals[red]>].pass[red].fail[blue]>

View File

@@ -0,0 +1,67 @@
sports_volleyball_world:
debug: false
type: world
events:
## ball click
on player damages entity bukkit_priority:low:
- ratelimit <player> 10t
- define ball <context.entity>
- if !<[ball].has_flag[ball]>:
- stop
- if <[ball].entity_type> == armor_stand:
- define ball <proc[ball_get].context[<[ball].flag[ball]>]>
- if !<[ball].flag[ball].starts_with[sports_volleyball]>:
- stop
- if !<player.has_flag[sports]>:
- stop
- define arena_id <player.flag[sports].get[id]>
- if !<[arena_id].starts_with[sports_volleyball]>:
- stop
- define status <proc[sports_arena_get_status].context[<[arena_id]>]>
- if <[status]> == normal:
- if <player.location.with_y[<[ball].location.y>].distance_squared[<[ball].location>]> > 22:
- stop
- define y <player.eye_location.direction.vector.y>
- if <[y]> < 0.45:
- define y 0.45
- if <[y]> > 0.95:
- define y 0.95
- define kick <player.eye_location.direction.vector.mul[0.58].with_y[<[y]>]>
- if <player.is_sneaking>:
- define kick <location[0,0.525,0]>
- if !<player.is_on_ground>:
- define kick <location[0,0.375,0]>
- define kick <[kick].add[<player.eye_location.direction.vector.with_y[0].mul[0.35]>]>
- define kick <[kick].add[<location[0,0,0].sub[<[ball].flag[ball_velocity]>]>]>
- run ball_vector_add def.ball:<[ball]> def.vector:<[kick]>
- flag <[ball]> sports_volleyball_delay_score:!
- else if <[status]> == blue_start || <[status]> == red_start:
- run sports_arena_set_status def.id:<[arena_id]> def.status:normal
- define kick <player.eye_location.direction.vector.mul[0.58].with_y[0.75]>
- run ball_vector_add def.ball:<[ball]> def.vector:<[kick]>
- playsound <[ball].location> sound:BLOCK_STONE_BREAK pitch:1.8
## point scored
on custom event id:ball_move bukkit_priority:low:
- if !<context.ball_id.starts_with[sports_volleyball]>:
- stop
- define arena_id <context.ball_id>
- if <proc[sports_arena_get_status].context[<[arena_id]>]> != normal:
- define status <proc[sports_arena_get_status].context[<[arena_id]>]>
- if <[status]> == blue_start || <[status]> == red_start:
- determine cancelled
- stop
- if !<context.ball.has_flag[sports_volleyball_delay_score]>:
- if !<context.bounced>:
- stop
- flag <context.ball> sports_volleyball_delay_score:<util.current_time_millis>
- stop
- else:
- if <util.current_time_millis.sub[<context.ball.flag[sports_volleyball_delay_score]>]> < 300:
- stop
- define extra <proc[sports_arena].context[<[arena_id]>].get[extra_data]>
- define red_start <[extra].get[red_start]>
- define blue_start <[extra].get[blue_start]>
- if <context.next.distance_squared[<[red_start]>]> < <context.next.distance_squared[<[blue_start]>]>:
- run sports_volleyball_score_goal def.id:<[arena_id]> def.team:blue
- else:
- run sports_volleyball_score_goal def.id:<[arena_id]> def.team:red