Files
status.sk
Code
1 181
status.sk
# Persistent player status system
# Requires Skript 2.15.4, PlaceholderAPI and skript-placeholders 1.7.2
options:
placeholder-prefix: survival
max-status-length: 14
command /status [<text>] [<offlineplayer>]:
trigger:
if arg-1 is not set:
send "&e/status <text> &7- Eigenen Status setzen"
send "&e/status clear &7- Eigenen Status entfernen"
send "&e/status pvp &7- PvP-Status für deinen Status an/aus schalten"
send "&e/status invite <Spieler> &7- Spieler in deinen Status einladen"
if player has permission "status.owner":
send "&e/status promote <Spieler> &7- Spieler für Status und PvP freigeben"
stop
if arg-1 is "promote":
if player does not have permission "status.owner":
send "&cNur der Status-Owner darf Spieler freigeben."
stop
if arg-2 is not set:
send "&cVerwendung: /status promote <Spieler>"
stop
set {status::promoted::%uuid of arg-2%} to true
send "&a%arg-2% darf jetzt Status und PvP verwalten."
stop
if arg-1 is "invite":
if arg-2 is not set:
send "&cVerwendung: /status invite <Spieler>"
stop
if uuid of arg-2 is uuid of player:
send "&cDu kannst dich nicht selbst einladen."
stop
set {_owner} to {status::owner::%uuid of player%}
if {_owner} is not set:
set {_owner} to "%uuid of player%"
set {status::owner::%uuid of player%} to {_owner}
if {_owner} is not "%uuid of player%":
if player does not have permission "status.owner":
send "&cNur der Status-Owner darf Spieler einladen."
stop
set {_target-uuid} to "%uuid of arg-2%"
set {_old-owner} to {status::owner::%{_target-uuid}%}
if {_old-owner} is set:
if {_old-owner} is not {_owner}:
delete {status::members::%{_old-owner}%::%{_target-uuid}%}
set {status::owner::%{_target-uuid}%} to {_owner}
set {status::members::%{_owner}%::%{_target-uuid}%} to true
send "&a%arg-2% wurde in deinen Status eingeladen."
stop
if arg-1 is "clear":
set {_owner} to {status::owner::%uuid of player%}
if {_owner} is not set:
set {_owner} to "%uuid of player%"
set {status::owner::%uuid of player%} to {_owner}
if {_owner} is not "%uuid of player%":
if player does not have permission "status.owner":
if {status::promoted::%uuid of player%} is not true:
send "&cNur der Status-Owner oder ein promoteter Spieler darf den gemeinsamen Status entfernen."
stop
delete {status::custom::%{_owner}%}
send "&aDer gemeinsame Status wurde entfernt."
stop
if arg-1 is "pvp":
set {_owner} to {status::owner::%uuid of player%}
if {_owner} is not set:
set {_owner} to "%uuid of player%"
set {status::owner::%uuid of player%} to {_owner}
if {_owner} is not "%uuid of player%":
if player does not have permission "status.owner":
if {status::promoted::%uuid of player%} is not true:
send "&cDu darfst den PvP-Status für diesen Status nicht an- oder ausschalten."
stop
if {status::pvp::%{_owner}%} is true:
delete {status::pvp::%{_owner}%}
send "&aDer PvP-Status wurde für deinen Status deaktiviert."
else:
set {status::pvp::%{_owner}%} to true
send "&aDer PvP-Status wurde für deinen Status aktiviert: &cPvP"
stop
set {_status} to arg-1
set {_owner} to {status::owner::%uuid of player%}
if {_owner} is not set:
set {_owner} to "%uuid of player%"
set {status::owner::%uuid of player%} to {_owner}
if {_owner} is not "%uuid of player%":
if player does not have permission "status.owner":
if {status::promoted::%uuid of player%} is not true:
send "&cDu bist in einem gemeinsamen Status."
send "&cNur der Status-Owner oder ein promoteter Spieler darf ihn ändern."
stop
set {_visible-status} to {_status}
replace all "&0" in {_visible-status} with ""
replace all "&1" in {_visible-status} with ""
replace all "&2" in {_visible-status} with ""
replace all "&3" in {_visible-status} with ""
replace all "&4" in {_visible-status} with ""
replace all "&5" in {_visible-status} with ""
replace all "&6" in {_visible-status} with ""
replace all "&7" in {_visible-status} with ""
replace all "&8" in {_visible-status} with ""
replace all "&9" in {_visible-status} with ""
replace all "&a" in {_visible-status} with ""
replace all "&b" in {_visible-status} with ""
replace all "&c" in {_visible-status} with ""
replace all "&d" in {_visible-status} with ""
replace all "&e" in {_visible-status} with ""
replace all "&f" in {_visible-status} with ""
replace all "&k" in {_visible-status} with ""
replace all "&l" in {_visible-status} with ""
replace all "&m" in {_visible-status} with ""
replace all "&n" in {_visible-status} with ""
replace all "&o" in {_visible-status} with ""
replace all "&r" in {_visible-status} with ""
replace all "&A" in {_visible-status} with ""
replace all "&B" in {_visible-status} with ""
replace all "&C" in {_visible-status} with ""
replace all "&D" in {_visible-status} with ""
replace all "&E" in {_visible-status} with ""
replace all "&F" in {_visible-status} with ""
replace all "&K" in {_visible-status} with ""
replace all "&L" in {_visible-status} with ""
replace all "&M" in {_visible-status} with ""
replace all "&N" in {_visible-status} with ""
replace all "&O" in {_visible-status} with ""
replace all "&R" in {_visible-status} with ""
replace all "&" in {_visible-status} with ""
if length of {_visible-status} > {@max-status-length}:
send "&cDein Status darf maximal {@max-status-length} sichtbare Zeichen lang sein."
send "&7Farbcodes und &-Zeichen werden nicht mitgezählt."
stop
replace all "&" in {_status} with "§"
set {status::custom::%{_owner}%} to {_status}
send "&aDer gemeinsame Status wurde gesetzt auf: %{_status}%"
# Erstellt den Placeholder %survival_status%
# Der Placeholder wird von TAB vor dem Spielernamen verwendet.
placeholderapi placeholder with the prefix "survival":
if the identifier is "status":
set {_owner} to {status::owner::%uuid of player%}
if {_owner} is not set:
set {_owner} to "%uuid of player%"
if {status::pvp::%{_owner}%} is true:
set the result to "§cPvP"
else if {status::custom::%{_owner}%} is set:
set the result to {status::custom::%{_owner}%}
else:
set the result to ""