Files
command-blocker.sk
Code
1 124
command-blocker.sk
# ==========================================
# CommandBlocker - Blokowanie komend
# ==========================================
# Umieść w: plugins/Skript/scripts/
# Przeładuj: /sk reload command-blocker
# ==========================================
options:
# Wiadomość wysyłana gdy komenda jest zablokowana
blocked-message: &cNie masz uprawnień do użycia tej komendy!
# Uprawnienie pozwalające ominąć blokadę
bypass-permission: commandblocker.bypass
# Prefix do logowania w konsoli
prefix: &8[&6CommandBlocker&8]&r
# ==========================================
# Lista zablokowanych komend
# ==========================================
# Dodaj lub usuń komendy według potrzeb
# Format: "/komenda" (małe litery)
# ==========================================
on script load:
set {blocked-commands::*} to "/plugins", "/pl", "/version", "/ver", "/about", "/bukkit:plugins", "/bukkit:version", "/bukkit:pl", "/spigot:plugins", "/spigot:version", "/minecraft:plugins", "/icanhasbukkit", "/?", "/help", "/timings", "/paper", "/waterfall", "/velocity"
send "{@prefix} &aZaładowano! Zablokowano &e%size of {blocked-commands::*}% &akomend." to console
on script unload:
clear {blocked-commands::*}
# ==========================================
# Główna logika blokowania
# ==========================================
on command:
# Pobierz wpisaną komendę (małe litery, bez argumentów)
set {_cmd} to "/%subtext of full command label from index 1 to (index of "" in full command label) - 1%"
set {_full} to "/%full command label%"
set {_raw} to "/%subtext of full command label from index 1 to length of full command label%"
# Sprawdź każdą zablokowaną komendę
loop {blocked-commands::*}:
set {_blocked} to loop-value
# Porównaj komendę (ignorując wielkość liter)
if {_full} contains {_blocked}:
# Sprawdź czy gracz ma uprawnienie do ominięcia
if player has permission "{@bypass-permission}":
stop loop
# Zablokuj komendę
cancel event
send "{@blocked-message}" to player
stop
# ==========================================
# Komendy administracyjne
# ==========================================
command /cb [<text>] [<text>]:
permission: commandblocker.admin
permission message: &cBrak uprawnień!
trigger:
# Brak argumentów - pokaż pomoc
if arg-1 is not set:
send "&8&m------------------------------------" to player
send "&6CommandBlocker &7- Pomoc" to player
send "&8&m------------------------------------" to player
send "&e/cb list &7- Lista zablokowanych komend" to player
send "&e/cb add <komenda> &7- Dodaj komendę do listy" to player
send "&e/cb remove <komenda> &7- Usuń komendę z listy" to player
send "&e/cb reload &7- Przeładuj listę komend" to player
send "&8&m------------------------------------" to player
stop
# Lista zablokowanych komend
if arg-1 is "list":
send "&8&m------------------------------------" to player
send "&6Zablokowane komendy &7(&e%size of {blocked-commands::*}%&7):" to player
loop {blocked-commands::*}:
send " &7- &c%loop-value%" to player
send "&8&m------------------------------------" to player
stop
# Dodaj komendę
if arg-1 is "add":
if arg-2 is not set:
send "&cUżycie: /cb add <komenda>" to player
stop
set {_new} to arg-2
# Upewnij się że komenda zaczyna się od /
if {_new} does not start with "/":
set {_new} to "/%{_new}%"
# Sprawdź czy już istnieje
if {blocked-commands::*} contains {_new}:
send "&cKomenda &e%{_new}% &cjest już zablokowana!" to player
stop
add {_new} to {blocked-commands::*}
send "&aKomenda &e%{_new}% &azostała zablokowana!" to player
stop
# Usuń komendę
if arg-1 is "remove":
if arg-2 is not set:
send "&cUżycie: /cb remove <komenda>" to player
stop
set {_rem} to arg-2
if {_rem} does not start with "/":
set {_rem} to "/%{_rem}%"
if {blocked-commands::*} does not contain {_rem}:
send "&cKomenda &e%{_rem}% &cnie jest zablokowana!" to player
stop
remove {_rem} from {blocked-commands::*}
send "&aKomenda &e%{_rem}% &azostała odblokowana!" to player
stop
# Przeładuj
if arg-1 is "reload":
clear {blocked-commands::*}
set {blocked-commands::*} to "/plugins", "/pl", "/version", "/ver", "/about", "/bukkit:plugins", "/bukkit:version", "/bukkit:pl", "/spigot:plugins", "/spigot:version", "/minecraft:plugins", "/icanhasbukkit", "/?", "/help", "/timings", "/paper", "/waterfall", "/velocity"
send "&aLista komend została przeładowana! Zablokowano &e%size of {blocked-commands::*}% &akomend." to player
stop
send "&cNieznana opcja. Wpisz &e/cb &caby zobaczyć pomoc." to player