Sueta

[Skript] SpeedGUI API (7 functions) for Skript

1.0

This skript provides an API(functions) for a SpeedGUI made with Skript!

·Plugin

Potions_Speed_Potion.png This skript provides an API(with 7 functions) to make it easy to make and manage a SpeedGUI using Skript

DEPENDENCIES.png
Skript ( https://docs.skunity.com/downloads)
Skellet ( http://tinyurl.com/Skellett)
SkQuery-Lime ( http://tinyurl.com/skquery-lime)
TuSKe ( http://tinyurl.com/TuSKe)
WildSkript ( http://tinyurl.com/wildskript-1-8-4)

SkriptsUsingThisAPI.png

  • SpeedGUI_command (/speedgui)
  • SpeedGUI_manage (join, world change, teleport, respawn)
  • SpeedGUI_reload (check/reload config)

Contact me if you want your plugin using this API in this list

VARIABLES.png
<space> between '::' and '(' because else it is recognized as ':(' \/

{SpeedGUI::used:: (player)} get set to last player's speed selected
through a GUI that use this API

{SpeedGUI::using:: (player)} more opportunities for skripts that use this api, same of {SpeedGUI::used:: (player)}, it get set to last player's speed selected through a GUI that use this API

functions.png
Here you are the 7 functions provided by this API skript:

  • SpeedGUI(player, text, integer, integer, integer, integer, item type, text, text, boolean, boolean, text, text)
  • SpeedGUI_used(player) :: boolean
  • SpeedGUI_using(player) :: boolean
  • SpeedGUI_remove_used(player)
  • SpeedGUI_remove_using(player)
  • SpeedGUI_remove(player)
  • SpeedGUI_restore(player)

First Function.png
SpeedGUI(player, text, integer, integer, integer, integer, item type, text, text, boolean, boolean, text, text)

Through this function of this API you can send a SpeedGUI to a player

SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>", "&7Set your walk speed to &3##&b<speed>", true, true, "&cYou can't use this speed&4!", "&aYour walk speed is now &3##&b<speed>")


Arguments:

Let's see step-by-step how to use arguments, in an example for a /speedgui command for the GUI.

command /speedgui:
    trigger:

1) player | player to send the SpeedGUI to
it can be arg x, loop-player, victim, attacker, etc
but it must be an online player

function SpeedGUI(executor,

2) text | title that the GUI must have
it can also be with color codes

function SpeedGUI(executor, "SpeedGUI",

3) integer | rows that the GUI must have
GUI are essentially virtual chest,
so max rows value is 6 as max chest rows(double chest)

function SpeedGUI(executor, "SpeedGUI", 2,


4)
integer | min-slot starting from the items will be in the opened GUI
ttps://postimg.cc/image/qspm62zvb/

function SpeedGUI(executor, "SpeedGUI", 2, 0,

5) integer | speed to be gave if first item is clicked in the opened GUI
6) integer | speed to be gave if last item is clicked in the opened GUI
Possible values are from - 1(walk speed 0. 1) to 9(walk speed 1)
0 = walk speed 0; 1 = walk speed 0.2(default minecraft walk speed)

function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9,

7) item | Item to be clicked for <speed> in the opened GUI
Possible values: https://github.com/bensku/Skript/blob/master/src/main/resources/aliases-english.sk (and/or aliases-english.sk of your Skript version)

function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed,

8) text | Name of the item to be clicked for <speed>

command /speedgui:
    trigger:
        function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>",

9) text | Lore of the item to be clicked for <speed>

function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>", "&7Set your walk speed to &3##&b<speed>",

10) boolean | Should be there a permission needed for each speed number?

function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>", "&7Set your walk speed to &3##&b<speed>", true,


11)
boolean | If each speed number for which the player doesn't have permission has to be skipped and has to not be in the GUI

function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>", "&7Set your walk speed to &3##&b<speed>", true, true,

12) text | Error message to send if player doesn't have the permission-needed

function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>", "&7Set your walk speed to &3##&b<speed>", true, true, "<none>",

<none> because "If each speed number for which the player doesn't have permission has to be skipped and has to not be in the GUI" is set to true so even if we set it to a message it will not be ever shown

13)
text | Confirm-mesage for the <speed> choosed through the item clicked corresponding in the gui

command /speedgui:
    trigger:
       function SpeedGUI(executor, "SpeedGUI", 2, 0, -1, 9, potion of speed, "&aSpeed &3##&b<speed>", "&7Set your walk speed to &3##&b<speed>", true, true, "<none>", "&aYour walk speed is now &3##&b<speed>")


= 2018-05-12_14.52.01.png

(A player with all permissions execute this example /speedgui command)

2) SpeedGUI_used(player) :: boolean

it returns true if {SpeedGUI::used:: (player)} is set
else it returns false

3) SpeedGUI_using(player) :: boolean

it returns true if {SpeedGUI::using:: (player)} is set and if (player)'s walk speed isn't 0.2

4) SpeedGUI_remove_used(player)

If {SpeedGUI::used:: (player)} is set, it delete {SpeedGUI::used:: (player)}

5) SpeedGUI_remove_used(player)

If {SpeedGUI::using:: (player)} is set, it set (player)'s walk speed to default (0.2) and it delete {SpeedGUI::using:: (player)}

6) SpeedGUI_remove(player)

If {SpeedGUI::using:: (player)} is set, it set (player)'s walk speed to default (0.2) and it delete {SpeedGUI::using:: (player)}

It also delete {SpeedGUI::used:: (player)}

7) SpeedGUI_restore(player)
If {SpeedGUI::used:: (player)} is set, it set player's walk speed to value stored in {SpeedGUI::used:: (player)} and it set {SpeedGUI::using:: (player)} to value stored in {SpeedGUI::used:: (player)} too

config.png
(plugins/SpeedGUI/config.yml)

version: '1.0'
per-speed-permission: speedgui.use.<speed>

Don't change version in the config manually

License.png

This work (SpeedGUI by Sitieno14) is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact.png

Similar projects

Plugin →