Files
plugins
bossbar.sk
commands.sk
gui.sk
hologram.sk
items.sk
main.sk
notifications.sk
particles.sk
protection.sk
README.md
scoreboard.sk
visual.sk
Code
15 1,926
commands.sk
options:
prefix: &6[&eProtectionCore&6]&r
command /pc [<text>] [<text>] [<text>]:
aliases: /protectioncore, /pcore
trigger:
if arg-1 is not set:
send "&6&l=== ProtectionCore Commands ===" to player
send "&e/pc info &7- Check core information" to player
send "&e/pc list &7- List your cores" to player
send "&e/pc remove &7- Remove a core" to player
send "&e/pc toggle &7- Enable/disable a core" to player
send "&e/pc upgrade &7- Upgrade core tier" to player
send "&e/pc fuel <amount> &7- Add fuel to core" to player
send "&e/pc member <add|remove|list> &7- Manage members" to player
send "&e/pc role <player> <role> &7- Change member role" to player
send "&e/pc blacklist <add|remove|list> &7- Manage blacklist" to player
send "&e/pc module &7- Open module GUI" to player
send "&e/pc tp <core-id> &7- Teleport to core" to player
send "&e/pc logs [page] &7- View core logs" to player
send "&e/pc bypass &7- Toggle admin bypass" to player
send "&e/pc reload &7- Reload configuration" to player
stop
if arg-1 is "info":
set {_id} to isLocationInCore(location of player)
if {_id} is "NONE":
send "{@prefix} &cYou are not in a protected area!" to player
stop
set {_owner} to {pc.core::%{_id}%::owner} parsed as offline player
set {_enabled} to {pc.core::%{_id}%::enabled}
set {_tier} to {pc.core::%{_id}%::tier}
set {_radius} to {pc.core::%{_id}%::radius}
set {_fuel} to {pc.core::%{_id}%::fuel}
set {_fuelMax} to {pc.core::%{_id}%::fuel-max}
set {_moduleCount} to size of {pc.core::%{_id}%::modules::*}
send "&6&l=== Core Information ===" to player
send "&eID: &7%{_id}%" to player
send "&eOwner: &7%{_owner}%" to player
if {_enabled} is true:
send "&eStatus: &aEnabled" to player
else:
send "&eStatus: &cDisabled" to player
send "&eTier: &7%{_tier}%" to player
send "&eRadius: &7%{_radius}% blocks" to player
send "&eFuel: &7%{_fuel}%/%{_fuelMax}%" to player
send "&eModules: &7%{_moduleCount}%" to player
stop
if arg-1 is "list":
set {_count} to 0
loop {pc.data::cores::*}:
set {_id} to loop-value
if {_id} is not "EMPTY":
if {pc.core::%{_id}%::owner} is "%uuid of player%":
add 1 to {_count}
if {_count} is 0:
send "{@prefix} &cYou don't own any cores!" to player
stop
send "&6&l=== Your Cores (%{_count}%/%{pc.config::max-cores-per-player}%) ===" to player
loop {pc.data::cores::*}:
set {_id} to loop-value
if {_id} is not "EMPTY":
if {pc.core::%{_id}%::owner} is "%uuid of player%":
set {_loc} to {pc.core::%{_id}%::location}
set {_enabled} to {pc.core::%{_id}%::enabled}
set {_tier} to {pc.core::%{_id}%::tier}
if {_enabled} is true:
send "&e%{_id}% &7- Tier %{_tier}% - &aOn &7@ %{_loc}%" to player
else:
send "&e%{_id}% &7- Tier %{_tier}% - &cOff &7@ %{_loc}%" to player
stop
if arg-1 is "remove":
set {_id} to isLocationInCore(location of player)
if {_id} is "NONE":
send "{@prefix} &cYou are not in a protected area!" to player
stop
if {pc.core::%{_id}%::owner} is not "%uuid of player%":
send "{@prefix} &cOnly the owner can remove this core!" to player
stop
set {_loc} to {pc.core::%{_id}%::location}
set {_tier} to {pc.core::%{_id}%::tier}
delete {pc.cache::location::%{_loc}%}
delete {pc.core::%{_id}%::*}
remove {_id} from {pc.data::cores::*}
set block at {_loc} to air
if {_tier} is 1:
drop 1 of {pc.item::core::tier1} at {_loc}
else if {_tier} is 2:
drop 1 of {pc.item::core::tier2} at {_loc}
else if {_tier} is 3:
drop 1 of {pc.item::core::tier3} at {_loc}
logCoreAction({_id}, player, "REMOVED", "Core removed by owner")
send "{@prefix} &aCore removed successfully!" to player
play sound "entity.item.pickup" with volume 1 and pitch 1 to player
stop
if arg-1 is "toggle":
set {_id} to isLocationInCore(location of player)
if {_id} is "NONE":
send "{@prefix} &cYou are not in a protected area!" to player
stop
if hasPermissionInCore(player, {_id}, "manage") is false:
send "{@prefix} &cYou don't have permission to toggle this core!" to player
stop
if {pc.core::%{_id}%::fuel} <= 0:
send "{@prefix} &cCannot enable core without fuel!" to player
stop
set {_current} to {pc.core::%{_id}%::enabled}
if {_current} is false:
set {pc.core::%{_id}%::enabled} to true
send "{@prefix} &aCore is now &aenabled&a!" to player
logCoreAction({_id}, player, "TOGGLE", "Core enabled")
else:
set {pc.core::%{_id}%::enabled} to false
send "{@prefix} &aCore is now &cdisabled&a!" to player
logCoreAction({_id}, player, "TOGGLE", "Core disabled")
play sound "block.beacon.power_select" with volume 1 and pitch 1 to player
stop
if arg-1 is "upgrade":
set {_id} to isLocationInCore(location of player)
if {_id} is "NONE":
send "{@prefix} &cYou are not in a protected area!" to player
stop
if {pc.core::%{_id}%::owner} is not "%uuid of player%":
send "{@prefix} &cOnly the owner can upgrade this core!" to player
stop
set {_tier} to {pc.core::%{_id}%::tier}
if {_tier} >= 3:
send "{@prefix} &cCore is already at maximum tier!" to player
stop
set {_newTier} to {_tier} + 1
set {_newRadius} to {pc.config::tier%{_newTier}%-radius}
set {_newMaxFuel} to {pc.config::tier%{_newTier}%-max-fuel}
if {pc.config::overlap-check} is true:
set {_loc} to {pc.core::%{_id}%::location}
if checkCoreOverlapExclude({_loc}, {_newRadius}, {_id}) is true:
send "{@prefix} &cUpgrade would overlap with another core!" to player
stop
set {pc.core::%{_id}%::tier} to {_newTier}
set {pc.core::%{_id}%::radius} to {_newRadius}
set {pc.core::%{_id}%::fuel-max} to {_newMaxFuel}
logCoreAction({_id}, player, "UPGRADE", "Core upgraded to Tier %{_newTier}%")
send "{@prefix} &aCore upgraded to Tier %{_newTier}%!" to player
send "{@prefix} &eNew radius: &7%{_newRadius}% blocks" to player
send "{@prefix} &eNew max fuel: &7%{_newMaxFuel}%" to player
play sound "entity.player.levelup" with volume 1 and pitch 1 to player
stop
if arg-1 is "fuel":
if arg-2 is not set:
send "{@prefix} &cUsage: /pc fuel <amount>" to player
stop
set {_amount} to arg-2 parsed as integer
if {_amount} is not set:
send "{@prefix} &cInvalid amount!" to player
stop
set {_id} to isLocationInCore(location of player)
if {_id} is "NONE":
send "{@prefix} &cYou are not in a protected area!" to player
stop
if hasPermissionInCore(player, {_id}, "manage") is false:
send "{@prefix} &cYou don't have permission to add fuel!" to player
stop
if player's tool is coal or player's tool is charcoal:
if amount of player's tool >= {_amount}:
remove {_amount} of player's tool from player's inventory
set {_fuelValue} to {_amount} * 60
set {_current} to {pc.core::%{_id}%::fuel}
set {_max} to {pc.core::%{_id}%::fuel-max}
add {_fuelValue} to {_current}
if {_current} > {_max}:
set {_current} to {_max}