Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # █▀▀█ █░░█ █▀▀▄ ░▀░ █▀▀ █░░█ █▀▄▀█ █▀▀ █▀▀▄ ▀▀█▀▀
- # █░░█ █░░█ █░░█ ▀█▀ ▀▀█ █▀▀█ █░▀░█ █▀▀ █░░█ ░░█░░
- # █▀▀▀ ░▀▀▀ ▀░░▀ ▀▀▀ ▀▀▀ ▀░░▀ ▀░░░▀ ▀▀▀ ▀░░▀ ░░▀░░
- #
- # author: HiiqhFive
- # version: 1.0.000
- options:
- path_punishments: plugins/Punishments/config.yml
- version: 1.0.000
- # setting up your SQL-database connection.
- # script options:
- # $ db url jdbc:mysql://ms1215.nitrado.net:3306/ni359528_1_DB
- # $ db username ni359528_1_DB
- # $ db password zb7ml2YN
- function createConfig(~: INT=0):
- set yaml value "punish.servername" of file "{@path_punishments}" to "SERVERNAME"
- set yaml value "punish.tag" of file "{@path_punishments}" to "SVRNM"
- set yaml value "punish.permission" of file "{@path_punishments}" to "punishment.execute"
- set yaml value "punish.log-executed-punishment" of file "{@path_punishments}" to true
- set yaml value "punish.log-path" of file "{@path_punishments}" to "plugins/Punishments/punishments.txt"
- add "---------------- <SERVERNAME> ----------------" to yaml list "punish.alert-for-target" of file "{@path_punishments}"
- add "You were punished by <EXECUTOR> due to <REASON>." to yaml list "punish.alert-for-target" of file "{@path_punishments}"
- add "---------------- <SERVERNAME> ----------------" to yaml list "punish.alert-for-target" of file "{@path_punishments}"
- set yaml value "punish.gui.gui-name" of file "{@path_punishments}" to "Punish: <TARGET>"
- set yaml value "punish.gui.rows" of file "{@path_punishments}" to 1
- set yaml value "punish.gui.slots.0.item" of file "{@path_punishments}" to "redstone"
- set yaml value "punish.gui.slots.0.title" of file "{@path_punishments}" to "Spam"
- set yaml value "punish.gui.slots.0.lore" of file "{@path_punishments}" to "Punish the player <TARGET> for Spam."
- add "mute <TARGET>" to yaml list "punish.gui.slots.0.cmds" of file "{@path_punishments}"
- add "kick <TARGET> spam" to yaml list "punish.gui.slots.0.cmds" of file "{@path_punishments}"
- set yaml value "punish.gui.slots.1.item" of file "{@path_punishments}" to "iron ingot"
- set yaml value "punish.gui.slots.1.title" of file "{@path_punishments}" to "Capslock"
- set yaml value "punish.gui.slots.1.lore" of file "{@path_punishments}" to "Punish the player <TARGET> for Capslock."
- add "mute <TARGET>" to yaml list "punish.gui.slots.1.cmds" of file "{@path_punishments}"
- add "kick <TARGET> spam" to yaml list "punish.gui.slots.1.cmds" of file "{@path_punishments}"
- function loadScript(~: INT=0):
- if existence of "{@path_punishments}" is false:
- createConfig()
- set {punishments::servername} to yaml value "punish.servername" of file "{@path_punishments}"
- set {punishments::tag} to yaml value "punish.tag" of file "{@path_punishments}"
- set {punishments::inventory_name} to yaml value "punish.gui.gui-name" of file "{@path_punishments}"
- set {punishments::permission} to yaml value "punish.permission" of file "{@path_punishments}"
- function getGUI(executor: player, target: offline player):
- set {punishments::%{_executor}%::target} to {_target}
- set {_title} to yaml value "punish.gui.gui-name" of file "{@path_punishments}"
- replace all "<TARGET>" in {_title} with "%{_target}%"
- set {_rows} to yaml value "punish.gui.rows" of file "{@path_punishments}"
- open chest with {_rows} rows named "%{_title}%" to {_executor}
- set {_items::*} to yaml nodes "punish.gui.slots" of file "{@path_punishments}"
- wait a tick
- loop {_items::*}:
- set {_slot} to loop-value parsed as integer
- set {_item} to yaml value "punish.gui.slots.%loop-value%.item" of file "{@path_punishments}"
- set {_item} to {_item} parsed as item
- set {_title} to yaml value "punish.gui.slots.%loop-value%.title" of file "{@path_punishments}"
- set {_lore} to yaml value "punish.gui.slots.%loop-value%.lore" of file "{@path_punishments}"
- replace all "<TARGET>" in {_lore} with "%{_target}%"
- set slot {_slot} of {_executor}'s current inventory to {_item} named "&c%{_title}%" with lore "&7%{_lore}%"
- function logExecutedPunishment(executor: player, target: offline player, reason: text):
- set {_settings} to yaml value "punish.log-executed-punishment" of file "{@path_punishments}"
- {_settings} is true:
- set {_path} to yaml value "punish.log-path" of file "{@path_punishments}"
- existence of "%{_path}%" is false:
- create file "%{_path}%"
- write "[%now%] %{_executor}% punished %{_target}% for %{_reason}%." to "%{_path}%"
- add "[%now%] ""%{_reason}%"" by %{_executor}%." to {records::%{_target}%::*}
- function executeCommands(executor: player, slot: integer) :: objects:
- set {_commands::*} to yaml list "punish.gui.slots.%{_slot}%.cmds" of file "{@path_punishments}"
- set {_alerts::*} to yaml list "punish.alert-for-target" of file "{@path_punishments}"
- loop {_alerts::*}:
- set {_alert} to loop-value
- set {_reason} to yaml value "punish.gui.slots.%{_slot}%.title" of file "{@path_punishments}"
- replace all "<SERVERNAME>" in {_alert} with "%{punishments::servername}%"
- replace all "<EXECUTOR>" in {_alert} with "%{_executor}%"
- replace all "<REASON>" in {_alert} with "%{_reason}%"
- send "%{_alert}%" to {punishments::%{_executor}%::target}
- logExecutedPunishment({_executor}, {punishments::%{_executor}%::target}, {_reason})
- wait a second
- loop {_commands::*}:
- set {_execute} to loop-value
- replace all "<TARGET>" in {_execute} with "%{punishments::%{_executor}%::target}%"
- execute {_executor} command "%{_execute}%"
- on load:
- loadScript()
- on inventory click:
- set {_gui-name} to {punishments::inventory_name}
- replace all "<TARGET>" in {_gui-name} with "%{punishments::%player%::target}%"
- if inventory name of player's current inventory contains "%{_gui-name}%":
- cancel the event
- clicked item is not air
- set {_slot} to "%clicked slot%" parsed as integer
- executeCommands(player, {_slot})
- close player's inventory
- send "%{punishments::tag}% | You're punishment was executed."
- command /punish [<offline player>]:
- permission: {punishment::permission}
- permission message: You don't have the required permission to use that command.
- trigger:
- arg 1 is set:
- getGUI(player, arg 1)
- else:
- send "%{punishments::tag}% | Please name a target."
- command /records [<offline player>]:
- trigger:
- arg 1 is not set:
- size of {records::%player%::*} is more than 0:
- send "%{punishments::tag}% | You have the following records:"
- loop {records::%player%::*}:
- send "%{punishments::tag}% | %loop-value%"
- else:
- send "%{punishments::tag}% | You don't have any records."
- else:
- player has permission "%{punishments::permission}%":
- size of {records::%arg 1%::*} is more than 0:
- send "%{punishments::tag}% | %arg 1% has the following records:"
- loop {records::%arg 1%::*}:
- send "%{punishments::tag}% | %loop-value%"
- else:
- send "%{punishments::tag}% | %arg 1% doesn't have any records."
- else:
- execute player command "records"
Add Comment
Please, Sign In to add comment