permisje: home.admin ADMIN, home.+, home.++, home.+++, home.++++ np: + vip ++ svip itd bo jest 40 home
/homegracz dla adm zeby sprawdzic home gracza\
options:
prefix: &8[&d&lHOME&8] &7
gui: &8Moje homy
config_gui: &8Konfiguracja domu
confirm_gui: &8Potwierdzenie usunięcia
# ==========================================
# LIMIT DOMÓW
# ==========================================
function limitDomow(p: player) :: number:
if {_p} has permission "home.++++":
return 40
if {_p} has permission "home.+++":
return 30
if {_p} has permission "home.++":
return 20
if {_p} has permission "home.+":
return 10
return 3
# ==========================================
# TELEPORTACJA
# ==========================================
function teleportDoDomu(p: player, n: number):
set {_id} to uuid of {_p}
if {home::teleportowanie::%{_id}%} is set:
send "{@prefix}&cTeleportacja już trwa!" to {_p}
stop
if {homes::%{_id}%::%{_n}%} is not set:
send "{@prefix}&cTen dom nie istnieje!" to {_p}
stop
close {_p}'s inventory
set {home::teleportowanie::%{_id}%} to true
set {_start} to location of {_p}
set {_cel} to {homes::%{_id}%::%{_n}%}
set {_nazwa} to {homes::%{_id}%::nazwa::%{_n}%}
if {_nazwa} is not set:
set {_nazwa} to "Dom %{_n}%"
play sound "block.beacon.activate" with volume 1 and pitch 1 to {_p}
send title "&5&l✦ &d&lPORTAL DOMU &5&l✦" with subtitle "&7Przygotowujemy teleportację..." to {_p} for 2 seconds
wait 1 second
loop 5 times:
set {_czas} to 6 - loop-number
if distance between location of {_p} and {_start} > 0.2:
delete {home::teleportowanie::%{_id}%}
play sound "block.note_block.bass" with volume 1 and pitch 0.7 to {_p}
send title "&c&l✖ ANULOWANO" with subtitle "&7Poruszyłeś się podczas teleportacji!" to {_p} for 2 seconds
stop
if {_czas} is 5:
send title "&5&l✦ &d&lTELEPORTACJA &5&l✦" with subtitle "&7Dom: &d%{_nazwa}% &8┃ &f5 sekund" to {_p} for 1 second
play sound "block.note_block.pling" with volume 1 and pitch 0.8 to {_p}
else if {_czas} is 4:
send title "&5&l✦ &d&lTELEPORTACJA &5&l✦" with subtitle "&7Dom: &d%{_nazwa}% &8┃ &e4 sekundy" to {_p} for 1 second
play sound "block.note_block.pling" with volume 1 and pitch 1 to {_p}
else if {_czas} is 3:
send title "&d&l✦ &f&lOTWIERANIE PORTALU &d&l✦" with subtitle "&7Dom: &d%{_nazwa}% &8┃ &e3 sekundy" to {_p} for 1 second
play sound "block.note_block.pling" with volume 1 and pitch 1.2 to {_p}
else if {_czas} is 2:
send title "&d&l✦ &f&lOTWIERANIE PORTALU &d&l✦" with subtitle "&7Dom: &d%{_nazwa}% &8┃ &c2 sekundy" to {_p} for 1 second
play sound "block.note_block.pling" with volume 1 and pitch 1.4 to {_p}
else:
send title "&5&l✦ &d&lPORTAL AKTYWNY &5&l✦" with subtitle "&7Dom: &d%{_nazwa}% &8┃ &c&l1..." to {_p} for 1 second
play sound "block.note_block.pling" with volume 1 and pitch 1.7 to {_p}
wait 1 second
if distance between location of {_p} and {_start} > 0.2:
delete {home::teleportowanie::%{_id}%}
play sound "block.note_block.bass" with volume 1 and pitch 0.7 to {_p}
send title "&c&l✖ ANULOWANO" with subtitle "&7Nie poruszaj się podczas teleportacji!" to {_p} for 2 seconds
stop
teleport {_p} to {_cel}
delete {home::teleportowanie::%{_id}%}
play sound "entity.player.levelup" with volume 1 and pitch 1 to {_p}
send title "&a&l✔ TELEPORTACJA UDANA" with subtitle "&fWitaj w domu &d&l%{_nazwa}%&f!" to {_p} for 3 seconds
# ==========================================
# GŁÓWNE GUI DOMÓW
# ==========================================
function otworzDomy(p: player):
set {_id} to uuid of {_p}
set {_limit} to limitDomow({_p})
open chest inventory with 5 rows named "{@gui}" to {_p}
wait 1 tick
loop 40 times:
set {_n} to loop-number
set {_slot} to {_n} - 1
if {_n} <= {_limit}:
if {homes::%{_id}%::%{_n}%} is set:
set {_nazwa} to {homes::%{_id}%::nazwa::%{_n}%}
if {_nazwa} is not set:
set {_nazwa} to "Dom %{_n}%"
set slot {_slot} of {_p}'s current inventory to emerald block named "&a&l%{_nazwa}%" with lore "&8&m--------------------" and "&7Status: &aUstawiony" and "" and "&eLewy przycisk &8» &fTeleportuj się" and "&ePrawy przycisk &8» &fKonfiguracja" and "&8&m--------------------"
else:
set slot {_slot} of {_p}'s current inventory to ender pearl named "&e&lDom %{_n}%" with lore "&8&m--------------------" and "&7Status: &cNie ustawiono" and "" and "&aKliknij, aby ustawić dom" and "&7w swojej aktualnej lokalizacji." and "&8&m--------------------"
else:
set slot {_slot} of {_p}'s current inventory to black stained glass pane named "&8&lZablokowany slot" with lore "&cNie masz dostępu do tego slotu."
set slot 40 of {_p}'s current inventory to book named "&d&lInformacje" with lore "&7Limit domów: &d%{_limit}%" and "&7Ustawione domy oznaczają" and "&7szmaragdowe bloki."
# ==========================================
# ADMIN: PODGLĄD DOMÓW GRACZA
# ==========================================
function otworzDomyGracza(admin: player, target: offline player):
set {_adminId} to uuid of {_admin}
set {_targetId} to uuid of {_target}
set {homegui::admin_target::%{_adminId}%} to "%{_targetId}%"
set {homegui::admin_nick::%{_adminId}%} to name of {_target}
open chest inventory with 5 rows named "{@gui}" to {_admin}
wait 1 tick
loop 40 times:
set {_n} to loop-number
set {_slot} to {_n} - 1
if {homes::%{_targetId}%::%{_n}%} is set:
set {_nazwa} to {homes::%{_targetId}%::nazwa::%{_n}%}
if {_nazwa} is not set:
set {_nazwa} to "Dom %{_n}%"
set slot {_slot} of {_admin}'s current inventory to emerald block named "&a&l%{_nazwa}%" with lore "&7Właściciel: &e%name of {_target}%" and "&7Numer domu: &f%{_n}%" and "" and "&eKliknij, aby teleportować się do tego domu."
else:
set slot {_slot} of {_admin}'s current inventory to gray stained glass pane named "&8Brak domu" with lore "&7Ten slot nie jest ustawiony."
set slot 40 of {_admin}'s current inventory to book named "&d&lPodgląd administratora" with lore "&7Gracz: &f%name of {_target}%" and "&7Podgląd wszystkich 40 slotów." and "" and "&cKliknięcie ustawionego domu teleportuje Cię do niego."
# ==========================================
# KOMENDA /HOME
# ==========================================
command /home:
trigger:
delete {homegui::admin_target::%uuid of player%}
delete {homegui::admin_nick::%uuid of player%}
otworzDomy(player)
command /homegracz <offline player>:
permission: home.admin
permission message: &cNie masz permisji home.admin.
trigger:
otworzDomyGracza(player, arg-1)
send "{@prefix}&aOtworzono podgląd domów gracza &e%name of arg-1%&a." to player
command /usunhomekazdemu:
permission: op
permission message: &cTa komenda jest dostępna tylko dla operatora.
trigger:
set {_usunieto} to 0
set {_gracze} to 0
loop all offline players:
set {_targetId} to uuid of loop-offlineplayer
set {_mialDom} to false
loop 40 times:
set {_n} to loop-number
if {homes::%{_targetId}%::%{_n}%} is set:
add 1 to {_usunieto}
set {_mialDom} to true
delete {homes::%{_targetId}%::%{_n}%}
delete {homes::%{_targetId}%::nazwa::%{_n}%}
if {_mialDom} is true:
add 1 to {_gracze}
send "{@prefix}&aUsunięto wszystkie domy wszystkim graczom. Łącznie: &e%{_usunieto}% &adomów u &e%{_gracze}% &agraczy." to player
command /usunhomeall <offline player>:
permission: home.admin
permission message: &cNie masz permisji home.admin.
trigger:
set {_targetId} to uuid of arg-1
set {_nick} to name of arg-1
set {_usunieto} to 0
loop 40 times:
set {_n} to loop-number
if {homes::%{_targetId}%::%{_n}%} is set:
add 1 to {_usunieto}
delete {homes::%{_targetId}%::%{_n}%}
delete {homes::%{_targetId}%::nazwa::%{_n}%}
send "{@prefix}&aUsunięto wszystkie home gracza &e%{_nick}%&a. Usunięte domy: &e%{_usunieto}%&a." to player
# ==========================================
# KLIKANIE W GUI DOMÓW
# ==========================================
on inventory click:
if name of event-inventory is "{@gui}":
cancel event
if clicked inventory is player's inventory:
stop
if index of event-slot > 39:
stop
set {_adminId} to uuid of player
if {homegui::admin_target::%{_adminId}%} is set:
set {_targetId} to {homegui::admin_target::%{_adminId}%}
set {_n} to index of event-slot + 1
if {homes::%{_targetId}%::%{_n}%} is set:
set {_cel} to {homes::%{_targetId}%::%{_n}%}
set {_nazwa} to {homes::%{_targetId}%::nazwa::%{_n}%}
if {_nazwa} is not set:
set {_nazwa} to "Dom %{_n}%"
close player's inventory
teleport player to {_cel}
play sound "entity.player.levelup" with volume 1 and pitch 1 to player
send title "&a&l✔ TELEPORTACJA UDANA" with subtitle "&fDom gracza &d%{homegui::admin_nick::%{_adminId}%}%&f: &e%{_nazwa}%" to player for 3 seconds
else:
send "{@prefix}&cTen slot nie ma ustawionego domu." to player
stop
set {_id} to uuid of player
set {_n} to index of event-slot + 1
set {_limit} to limitDomow(player)
if {_n} > {_limit}:
stop
if {homes::%{_id}%::%{_n}%} is set:
if click type is right mouse button:
set {homegui::wybrany::%{_id}%} to {_n}
open chest inventory with 3 rows named "{@config_gui}" to player
wait 1 tick
set slot 11 of player's current inventory to name tag named "&e&lZmień nazwę" with lore "&7Kliknij, aby zmienić nazwę domu."
set slot 13 of player's current inventory to emerald block named "&a&lTeleportuj" with lore "&7Teleportuj się do wybranego domu."
set slot 15 of player's current inventory to barrier named "&c&lUsuń dom" with lore "&7Usuń ten dom na stałe."
else:
teleportDoDomu(player, {_n})
else:
set {homes::%{_id}%::%{_n}%} to location of player
set {homes::%{_id}%::nazwa::%{_n}%} to "Dom %{_n}%"
play sound "block.note_block.pling" with volume 1 and pitch 1.5 to player
send "{@prefix}&aUstawiono dom &eDom %{_n}%&a!" to player
otworzDomy(player)
# ==========================================
# GUI KONFIGURACJI
# ==========================================
on inventory click:
if name of event-inventory is "{@config_gui}":
cancel event
if clicked inventory is player's inventory:
stop
set {_id} to uuid of player
set {_n} to {homegui::wybrany::%{_id}%}
if {_n} is not set:
stop
if index of event-slot is 11:
set {homegui::zmiana_nazwy::%{_id}%} to {_n}
close player's inventory
send "{@prefix}&eWpisz nową nazwę domu na czacie." to player
send "{@prefix}&7Wpisz &cANULUJ &7, aby anulować." to player
stop
if index of event-slot is 13:
teleportDoDomu(player, {_n})
stop
if index of event-slot is 15:
open chest inventory with 3 rows named "{@confirm_gui}" to player
wait 1 tick
set slot 11 of player's current inventory to lime wool named "&a&lTAK, USUŃ DOM" with lore "&7Potwierdź usunięcie domu."
set slot 15 of player's current inventory to red wool named "&c&lNIE, WRÓĆ" with lore "&7Wróć bez usuwania domu."
stop
# ==========================================
# POTWIERDZENIE USUWANIA
# ==========================================
on inventory click:
if name of event-inventory is "{@confirm_gui}":
cancel event
if clicked inventory is player's inventory:
stop
set {_id} to uuid of player
set {_n} to {homegui::wybrany::%{_id}%}
if index of event-slot is 11:
if {_n} is set:
delete {homes::%{_id}%::%{_n}%}
delete {homes::%{_id}%::nazwa::%{_n}%}
delete {homegui::wybrany::%{_id}%}
play sound "block.anvil.break" with volume 1 and pitch 1 to player
send "{@prefix}&cUsunięto dom." to player
otworzDomy(player)
stop
if index of event-slot is 15:
otworzDomy(player)
stop
# ==========================================
# ZMIANA NAZWY DOMU
# ==========================================
on chat:
set {_id} to uuid of player
if {homegui::zmiana_nazwy::%{_id}%} is set:
cancel event
set {_n} to {homegui::zmiana_nazwy::%{_id}%}
if message is "ANULUJ":
delete {homegui::zmiana_nazwy::%{_id}%}
send "{@prefix}&cAnulowano zmianę nazwy." to player
stop
if length of message > 24:
send "{@prefix}&cNazwa może mieć maksymalnie 24 znaki. Spróbuj ponownie lub wpisz ANULUJ." to player
stop
set {homes::%{_id}%::nazwa::%{_n}%} to message
delete {homegui::zmiana_nazwy::%{_id}%}
play sound "block.note_block.pling" with volume 1 and pitch 1.5 to player
send "{@prefix}&aZmieniono nazwę domu na &e%message%&a." to player
otworzDomy(player)
# ==========================================
# BLOKADA PRZENOSZENIA ITEMÓW
# ==========================================
on inventory drag:
if name of event-inventory is "{@gui}" or name of event-inventory is "{@config_gui}" or name of event-inventory is "{@confirm_gui}":
cancel event
# ==========================================
# CZYSZCZENIE PO WYJŚCIU GRACZA
# ==========================================
on quit:
set {_id} to uuid of player
delete {home::teleportowanie::%{_id}%}
delete {homegui::zmiana_nazwy::%{_id}%}
delete {homegui::wybrany::%{_id}%}
delete {homegui::admin_target::%{_id}%}
delete {homegui::admin_nick::%{_id}%}