Files
hub
OrionHubX.sk
Code
4 722
hub/hub_core.sk
# ============================================================
# DeluxeHub Skript - Core System
# Place in: plugins/Skript/scripts/hub/
# Reload with: /sk reload hub_core
# ============================================================
options:
# World name that is considered the hub
hub-world: world
# Prefix for all messages
prefix: &8[&b&lOrionHUBX&8] &r
# Title shown on join
join-title: &b&lWELCOME
join-subtitle: &7to the &b&lNetwork
# Double jump options
double-jump-enabled: true
double-jump-strength: 1.2
double-jump-cooldown: 3
# Hotbar slots (0-8)
slot-navigator: 0
slot-visibility: 4
slot-cosmetics: 8
# Item definitions
item-navigator: compass named "&b&lNavigator" with lore "&7Click to browse&7servers!"
item-visibility-on: lime dye named "&a&lPlayers: &2ON" with lore "&7Click to hide&7all players"
item-visibility-off: red dye named "&c&lPlayers: &4OFF" with lore "&7Click to show&7all players"
item-cosmetics: chest named "&d&lCosmetics" with lore "&7Click to open&7your cosmetics"
# ================
# VARIABLES INIT
# ================
on script load:
broadcast "{@prefix}&aHub system loaded successfully!"
# ================
# PLAYER JOIN
# ================
on join:
wait 1 tick
if world of player is world({@hub-world}):
call hub setup for player
on world change:
if event-world is world({@hub-world}):
call hub setup for player
else:
# Clean up when leaving hub
delete {hub::doublejump::%player's uuid%}
# ================
# HUB SETUP
# ================
function hub setup(p: player):
# Reset player state
set {_p}'s game mode to adventure
set {_p}'s food level to 20
set {_p}'s health to 20
set {_p}'s fly speed to 0.1
clear {_p}'s potion effects
# Give hotbar items
call give hub items to {_p}
# Show welcome title
send title "{@join-title}" with subtitle "{@join-subtitle}" and fade in 20 and stay 60 and fade out 20 to {_p}
# Welcome message
send "{@prefix}&7Welcome back, &b%{_p}%&7!" to {_p}
send "{@prefix}&7Use your &bhotbar items &7to navigate." to {_p}
# ================
# HOTBAR ITEMS
# ================
function give hub items(p: player):
set slot {@slot-navigator} of {_p}'s inventory to {@item-navigator}
if {hub::visibility::%{_p}'s uuid%} is true:
set slot {@slot-visibility} of {_p}'s inventory to {@item-visibility-off}
else:
set slot {@slot-visibility} of {_p}'s inventory to {@item-visibility-on}
set slot {@slot-cosmetics} of {_p}'s inventory to {@item-cosmetics}
# ================
# ANTI-BUILD
# ================
on block break:
if world of player is world({@hub-world}):
if player doesn't have permission "hub.admin.build":
cancel event
send "{@prefix}&cYou cannot break blocks in the hub!" to player
on block place:
if world of player is world({@hub-world}):
if player doesn't have permission "hub.admin.build":
cancel event
send "{@prefix}&cYou cannot place blocks in the hub!" to player
# ================
# NO DAMAGE
# ================
on damage:
if world of victim is world({@hub-world}):
cancel event
# ================
# NO HUNGER
# ================
on hunger change:
if world of player is world({@hub-world}):
cancel event
set player's food level to 20
# ================
# ITEM DROP PREVENTION
# ================
on drop:
if world of player is world({@hub-world}):
cancel event
# ================
# INVENTORY CLICK PROTECTION
# ================
on inventory click:
if world of player is world({@hub-world}):
if event-inventory is player's inventory:
if player doesn't have permission "hub.admin.inventory":
cancel event
# ================
# HOTBAR ITEM INTERACTION
# ================
on right click:
if world of player is world({@hub-world}):
# Navigator
if player's tool is {@item-navigator}:
cancel event
open virtual chest inventory with 3 rows named "&b&lServer Navigator" to player
call populate navigator for player
# Visibility toggle
else if player's tool is {@item-visibility-on}:
cancel event
call toggle visibility for player
else if player's tool is {@item-visibility-off}:
cancel event
call toggle visibility for player
# Cosmetics
else if player's tool is {@item-cosmetics}:
cancel event
send "{@prefix}&7Cosmetics coming soon!" to player
# ================
# DOUBLE JUMP
# ================
on player toggle flight:
if world of player is world({@hub-world}):
if player's game mode is not creative:
if player's game mode is not spectator:
cancel event
if {hub::doublejump::%player's uuid%} is not set:
set {hub::doublejump::%player's uuid%} to true
launch player upward with force {@double-jump-strength}
set {hub::doublejump::%player's uuid%} to true
# Play effect
play sound "entity.firework_rocket.launch" with volume 0.5 and pitch 1.5 to player
# Cooldown removal
wait {@double-jump-cooldown} seconds
delete {hub::doublejump::%player's uuid%}
on land:
if world of player is world({@hub-world}):
delete {hub::doublejump::%player's uuid%}
if player's game mode is not creative:
if player's game mode is not spectator:
allow player to fly
on player start sprinting:
if world of player is world({@hub-world}):
if player's game mode is not creative:
if player's game mode is not spectator: