плагин script для майнкрафт
Плагин script для майнкрафт
Skript is a plugin for Paper/Spigot, which allows server owners and other people to modify their servers without learning Java. It can also be useful if you do know Java; some tasks are quicker to do with Skript, and so it can be used for prototyping etc.
This Github fork of Skript is based on Mirreski’s improvements which was built on Njol’s original Skript.
Skript requires Spigot to work. You heard it right, Bukkit does not work. Paper, which is a fork of Spigot, is recommended; it is required for some parts of Skript to be available.
Skript supports only the latest patch versions of Minecraft 1.9+. For example, this means that 1.16.4 is supported, but 1.16.3 is not. Testing with all old patch versions is not feasible for us.
Minecraft 1.8 and earlier are not, and will not be supported. New Minecraft versions will be supported as soon as possible.
You can find the downloads for each version with their release notes in the releases page.
Documentation is available here for the latest version of Skript.
Please see our contribution guidelines before reporting issues.
A Note About Add-ons
We don’t support add-ons here, even though some of Skript developers have also developed their own add-ons.
Skript uses Gradle for compilation. Use your command prompt of preference and navigate to Skript’s source directory. Then you can just call Gradle to compile and package Skript for you:
You can get source code from the releases page. You may also clone this repository, but that code may or may not be stable.
Parts of Skript are provided as Gradle subprojects. They require Skript, so they are compiled after it has been built. For this reason, if you want them embedded in Skript jar, you must re-package it after compiling once. For example:
Note that modules are not necessary for Skript to work. Currently, they are only used to provide compatibility with old WorldGuard versions.
Skript has some tests written in Skript. Running them requires a Minecraft server, but our build script can fetch it for you. Running tests is easy:
quickTest runs the test suite on newest supported server. skriptTest additionally runs the tests on oldest supported server, and on 1.12 (pre-flattening). skriptTestFull runs tests on ALL supported versions, some of which do not work on Java 9+.
By running tests, you agree to Mojang’s End User License Agreement.
Importing to Eclipse
With new Eclipse versions, there is integrated Gradle support, and it actually works now. So, first get latest Eclipse, then import Skript as any Gradle project. Just make sure to keep the configuration when the importer asks for that!
If you encounter strange issues, make sure you follow the instructions above and have actually downloaded latest Eclipse or update your installation correctly. Skript’s new Gradle version (starting from dev26) does not work very well with older Eclipse versions. Also, do not use Gradle STS; it is outdated.
You’ll need to make sure that nullness annotations are working correctly. Also, when sending pull requests, make sure not to change IDEA configuration files that may have been stored in the repository.
Available flavors are github and spigot. Please do not abuse flavors by compiling your own test builds as releases.
Please review our contribution guidelines. In addition to that, if you are contributing Java code, check our coding conventions.
If you use Skript as (soft) dependency for your plugin, and use maven or Gradle, this is for you.
First, you need to add the JitPack repository at the END of all your repositories. Skript is not available in Maven Central.
Or, if you use Maven:
For versions of Skript after dev37 you might need to add the paper-api repository to prevent build issues.
Or, if you use Maven:
Then you will also need to add Skript as a dependency.
Note: If Gradle isn’t able to resolve Skript’s dependencies, just disable the resolution of transitive dependencies for Skript in your project.
Or, if you use Maven:
Note that these resources are not maintained by Skript’s developers. Don’t contact us about any problems you might have with them.
You can find all contributors here.
All code is owned by its writer, licensed for others under GPLv3 (see LICENSE) unless otherwise specified.
About
Skript is a Bukkit plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
Bukkit
Skript
Bukkit Plugins
Skript
Table of Contents
This version of Skript is not maintained any more (since 2014).
Please download new releases from the SkriptLang fork.
Updated documentation for can be found here.
More resources may be found on skUnity.
To get an idea of what is possible with Skript consider taking a look at the scripts forum where users of this plugin share the scripts they have written themselves, improving their servers without the need for a plugin developer. Skript can also be used to replace smaller plugins, allowing you to shorten your likely long plugin list. An incomplete list of replaceable plugins can be found on the replacers forum.
The latest version of Skript is 2.1.1 (11 March 2014)
Notice
I’m back from my hiatus, but I will likely not be able to update Skript until I can download a recent build of CraftBukkit to fix new bugs. Also, with the future of Bukkit uncertain and no official Minecraft API in sight, I don’t know how actively I’ll update this plugin.
Introduction
To write a script you simply have to write down what you want Skript to do when some conditions are met. This is a simple ‘event → condition(s) → effect(s)’ syntax, which could look like the following example:
Each script can contain many so-called triggers which each start with an event and have a list of as many conditions and effects as you want. The event determines when the conditions are checked, and if all are met, the effects are executed in order. Take a look at the following example which has everything:
Custom commands can be defined similarly, e.g. the following defines a powerful ‘ /item ‘ command that can be used like ‘ /item 5 diamond swords of sharpness 5 and a cake ‘:
Furthermore Skript also features more complex script elements like loops and conditional statements, which are described in the documentation. Skript also supports variables that can persistently store information globally, per player, per block, etc., and has a wide range of expressions that you can use in conditions, effects, messages and variable names.
A notable feature of Skript are aliases, which are names for Minecraft’s items and blocks. Each alias can consist of multiple IDs and data values and allow you to use any item’s or block’s name in scripts instead of having to use their IDs like many plugins force you to. Along with the ability to define enchanted items you can create some of the possibly most powerful ‘/item’ commands for Bukkit with just a few lines! (two example commands are included in the download)
Need help?
You can always ask for help on the forums, though it can be faster for you and easier for me if you first look through the available tutorials and examples.
If you get many «indentation error»s or «invalid line» errors you should read this explanation to understand what indentation is all about.
Tutorials
If you’re new to Skript you should read the basic tutorial. It explains how to write a new script step by step.
In the likely case that the basic tutorial was too short you can read the more exhaustive tutorial by DemonPenguin.
There are also some more official tutorials as well as user-created ones on the tutorials forum.
Documentation
To learn more about writing scripts please read the documentation on my website. There are also lists of all possible events, conditions, effects, expressions and types with examples for each of them.
The Team
Features
Future Features
Permissions
Skript works without permissions plugins, but It also provides some permission in case you use one:
skript.admin Grants access to the /skript command. skript.effectcommands Allows to use effects as commands if effect commands are enabled in the config.
You can also use the ‘
has/doesn’t have the permission «permission.here» ‘ condition in scripts to check whether a player has/doesn’t have a certain permission. You can even create your own permissions this way, but you should note that » mypermissions.* » does not give all permission that start with » mypermissions. » (The exception to this rule are other plugins’ » * » permissions and any permissions starting with » skript. «).
Download
To install or update Skript, download the latest Skript.jar and save it in your server’s plugin directory. If you’re installing Skript for the first time, start & stop your server once to generate the config files and some example scripts.
Please read the changelog when updating, and create a backup of your database(s) just to play it safe.
You can also download the newest aliases-english.sk and aliases-german.sk (updated to Minecraft 1.7.2).
The source code can be found on github.
Donations
If you like the plugin feel free to make a donation 🙂
Changelog
v2.1.1 (11 March 2014)
2.1 (17 December 2013)
Older changelog can be found in the respective files.
Comments
Please don’t use the comments to ask questions, report a bug or issue, or suggest a new feature, as comments can get extremely unorganized very quickly.
Use the help forum instead if you have a question, the suggestions forum for feature requests, or create a ticket to submit a bug report.
[Урок][Глава 1] Учимся писать плагин для сервера
Урок по написанию плагинов
Здравствуйте, в этой новости, я расскажу вам, как правильно сделать плагин с нуля. Начнем мы с вещей, которые нужны для его создания, и напишем маленькую систему. Давайте начнем
Инструменты для создания плагина
Создание проекта в Eclipse
Мы скачали программу и ядро, теперь делаем следующие
Создаем новый проект Java Project
Здесь мы вводим название нашего проекта и нажимаем Next
Здесь нажимаем Add External Jars и ищем свой JAR ядро (в моем случае bukkit 1.8), и отправляем сюда
Далее, мы создаем файл и начинаем редактировать его
Далее мы создаем Package в файле scr и в Package создаем Class. Все файлы называть как название плагина.
Когда вы создадите файл, вы должны добавить к 2 строке extends JavaPlugin, затем, навести на него курсор и нажать импорт. После чего, у вас появится строка с импортом для работы плагина
И так. Дабы не томить вас нудными скринами, составил вам сразу готовый код выдачи лога в консоль. Давайте же разберемся, а не тупо спишем.
Вы наверное спросите, зачем мы пишем < и >> Несколько раз?
Дело в том, что эти скобочки, открывают взаимодействие с пабликом. Если после ввода public void onEnable() поставить <, то все ниже коды будут выполняться тогда, когда паблик начнет их выполнять.
Чтобы закрыть паблик, нужно ввести >. Чтобы полностью закончить код, нужно в самом конце и в самом начале строке, написать еще раз >. Это означает, что паблик и код завершены
В сегодняшнем уроке, мы научились выставлять сообщение в консоль о запуске/выключении консоли.
Bukkit
Skript
Bukkit Plugins
Skript
Table of Contents
This version of Skript is not maintained any more (since 2014).
Please download new releases from the SkriptLang fork.
Updated documentation for can be found here.
More resources may be found on skUnity.
To get an idea of what is possible with Skript consider taking a look at the scripts forum where users of this plugin share the scripts they have written themselves, improving their servers without the need for a plugin developer. Skript can also be used to replace smaller plugins, allowing you to shorten your likely long plugin list. An incomplete list of replaceable plugins can be found on the replacers forum.
The latest version of Skript is 2.1.1 (11 March 2014)
Notice
I’m back from my hiatus, but I will likely not be able to update Skript until I can download a recent build of CraftBukkit to fix new bugs. Also, with the future of Bukkit uncertain and no official Minecraft API in sight, I don’t know how actively I’ll update this plugin.
Introduction
To write a script you simply have to write down what you want Skript to do when some conditions are met. This is a simple ‘event → condition(s) → effect(s)’ syntax, which could look like the following example:
Each script can contain many so-called triggers which each start with an event and have a list of as many conditions and effects as you want. The event determines when the conditions are checked, and if all are met, the effects are executed in order. Take a look at the following example which has everything:
Custom commands can be defined similarly, e.g. the following defines a powerful ‘ /item ‘ command that can be used like ‘ /item 5 diamond swords of sharpness 5 and a cake ‘:
Furthermore Skript also features more complex script elements like loops and conditional statements, which are described in the documentation. Skript also supports variables that can persistently store information globally, per player, per block, etc., and has a wide range of expressions that you can use in conditions, effects, messages and variable names.
A notable feature of Skript are aliases, which are names for Minecraft’s items and blocks. Each alias can consist of multiple IDs and data values and allow you to use any item’s or block’s name in scripts instead of having to use their IDs like many plugins force you to. Along with the ability to define enchanted items you can create some of the possibly most powerful ‘/item’ commands for Bukkit with just a few lines! (two example commands are included in the download)
Need help?
You can always ask for help on the forums, though it can be faster for you and easier for me if you first look through the available tutorials and examples.
If you get many «indentation error»s or «invalid line» errors you should read this explanation to understand what indentation is all about.
Tutorials
If you’re new to Skript you should read the basic tutorial. It explains how to write a new script step by step.
In the likely case that the basic tutorial was too short you can read the more exhaustive tutorial by DemonPenguin.
There are also some more official tutorials as well as user-created ones on the tutorials forum.
Documentation
To learn more about writing scripts please read the documentation on my website. There are also lists of all possible events, conditions, effects, expressions and types with examples for each of them.
The Team
Features
Future Features
Permissions
Skript works without permissions plugins, but It also provides some permission in case you use one:
skript.admin Grants access to the /skript command. skript.effectcommands Allows to use effects as commands if effect commands are enabled in the config.
You can also use the ‘
has/doesn’t have the permission «permission.here» ‘ condition in scripts to check whether a player has/doesn’t have a certain permission. You can even create your own permissions this way, but you should note that » mypermissions.* » does not give all permission that start with » mypermissions. » (The exception to this rule are other plugins’ » * » permissions and any permissions starting with » skript. «).
Download
To install or update Skript, download the latest Skript.jar and save it in your server’s plugin directory. If you’re installing Skript for the first time, start & stop your server once to generate the config files and some example scripts.
Please read the changelog when updating, and create a backup of your database(s) just to play it safe.
You can also download the newest aliases-english.sk and aliases-german.sk (updated to Minecraft 1.7.2).
The source code can be found on github.
Donations
If you like the plugin feel free to make a donation 🙂
Changelog
v2.1.1 (11 March 2014)
2.1 (17 December 2013)
Older changelog can be found in the respective files.
Comments
Please don’t use the comments to ask questions, report a bug or issue, or suggest a new feature, as comments can get extremely unorganized very quickly.
Use the help forum instead if you have a question, the suggestions forum for feature requests, or create a ticket to submit a bug report.
Getting Started with Skript
Tutorial by: eyesniper2
Hello and welcome to Skript!
This is a general «How to Skript» guide that will hopefully give you everything you need to get setup and begin writing your first script! This tutorial includes parts originally written by Demon on the original DBO forums and LimeGlass. This tutorial will assume that you are familiar with making a Bukkit servers, but not with programing. So lets get into it!
What is Skript?
Skript is a plugin for Bukkit/Spigot, a popular Minecraft server mod, that allows server admins to easily modify how Minecraft works without programming anything.
— Peter «Njolbrim» Güttinger
Skript was created by Peter Güttinger, also know as Njolbrim or Njol, and first released on Feb 16, 2012. The goal of Skript is to provide a simple way for non-programmers to make their own mini plugins (called scripts). Skript is designed as an event driven language.
This is achieved with triggers, whereof each is a collection of conditions and effects. Each time a trigger is called all conditions are checked, and if all are met, the effects are executed.
— Peter «Njolbrim» Güttinger
This means for any of your code to be run, something in the game or your server must happen. This is call an event or a trigger. These can include things like commands, a passage of time, or the actions of a player (mining a block or jumping). After something has happened, then the series of conditions and effects is run through for things to actually happen based on that event. A condition is a yes or no question your code asks the server. This can include things like: is the player online, is the player holding a pickaxe. An effect is then something that happens, these can include giving the player an item or moving the player. These building blocks combined with other elements you will learn later can be combined to produce powerful features for your server very quickly. These features will be discussed in depth later in this tutorial.
There is also a Skript IDE called SkIDE which offers a lot of nice features such as autocomplete and code highlighting.
A very basic example of a Skript can be found below:
Please note that #s are used for comments and will not do something
The script above sends the message «Welcome to Skript» to everyone on the server every time someone joins the server. You might notice that the script is very easy to understand, this is because scripts are meant to be very readable, English and easy to understand.
Setting up Skript
After setting up your base server, download the correct version of Skript from one of the sources below
Minecraft 1.9.4 to 1.14.x: bensku’s fork, 2.4x versions: https://github.com/SkriptLang/Skript/releases
Minecraft 1.8.x
bensku’s fork, 2.2-dev36 (Recommended): https://github.com/SkriptLang/Skript/releases/tag/dev36
⚠ This version is for 1.9, but should work on 1.8 too, but is not supported.
Notes
How to make a Script?
Now lets make your first script file!
Congrats you have just written your first script! How lets talk about loading it on the server.
How to load a Script?
Scripts are not loaded when you save their sk files. Instead they are loaded on the server startup or when you use the /sk reload command:
Go on try it! Now when joining your server «Welcome to Skript!» will be broadcast to all users!
Any errors with your script will be either shown in the chat to the user who typed the reload command or the server console. Unlike plugins, with scripts you don’t need to restart your server to add or update features. It can all happen through the reload command. However be careful as this can also cause a small freeze on your server that your players might experience when loading large scripts.
Now that you can create and load scripts, lets get into the core concepts of Skript!
Core Concepts of Skript
Events
Events are called when something happens. So when a player clicks on something, takes damage, dies, when a mob does something, or even when the environment does something else completely independent of entity interaction. This will allow you to make something happen when something else happens. For example:
Note the spacing. Every time there is a colon ( : ), then next line down is indented one more. You can either use a tab or spaces as indentation. Length of the indentation doesn’t matter, but an event must use the same indentation on each line. I prefer to use the tab key because I only need to hit it once per indent. The actual code is pretty simple. When an explosion happens, it gets cancelled. This would be useful if you don’t want TNT, creepers, or even the Ender Dragon to destroy stuff on your server. Keep in mind that this cancels the actual explosion event, meaning that players will not get hurt either. So when an explosion happens, it stops it from happening. You can easily change the outcome to be whatever you want. Another example could be as dramatic as killing all players on the server.
Conditionals
Conditionals are an essential part of any script. They are pieces of code that check to see if a condition is met before executing the rest of the script/trigger.
Structure of conditionals is as follows:
else if s and else are optional.
You can add as many else if as you want.
An example with permissions is below:
This will create an explosion that is slightly smaller than TNT, but it will only do so if the player has the correct permission. Conditionals can also be used to check things like if the player has an item in his/her inventory, or what a line on a sign says. You can even use multiple conditionals so that an event has to meet all of them before moving on.
In this script the player must right click on a sign with the first line of «[Shop]», have the correct permission, and 2 gold nuggets. Then the effects occur. In this case the player will loose 2 gold nuggets and receive some bread.
Commands
You can create commands with ease in Skript. Check out this tutorial: https://skripthub.net/tutorials/10
We will use some commands in the next examples.
Loops
Loops can be used to complete repetitive tasks that would otherwise be much more complicated. For example if you wanted to see if there was a chest near you, you would need to check every block in a certain distance to see if it was a chest. This can be done easily using a loop:
Here we also set a default value for the command, just in case the player didn’t enter one. In the loop expression we see the number has been replaced with an «argument» This means that whatever number you typed in the command will be put here instead. If a number was not entered in this command, then 3 will be used because it was set to be the default value. If you would like to see exactly how far a radius value is, then you can use this script to make a sphere out of blocks so you can visibly see the size.
The /clear command is so that you can easily delete the sphere that you made. Also because you will be at the center of the sphere, you will need a way to teleport yourself out. These Commands may cause a small amount of damage to your server if used close to the ground. Please use them while flying to get the full effect.
The parts of code with the curly brackets < >are called variables. You will learn about them in the next section.
While Loops
While loops are loops that runs the code as long as a specified condition is positive:
Please note that while loops don’t have a delay, so they are faster than a tick and will crash the server if you are using Minecraft stuff (like blocks) without at least a tick delay: wait a tick
Example usage:
Variables
Variables are used to store information under a name. Think of it like a box with a label on it. When you want to get the info you put in that box, you just go look for the one with the right label on it. Skript does the same thing with Variables, which are the computers equivalent of a box. You save information like this:
The reason for this is so that we can get this information later. So maybe we want to check if a command was performed by this player before. We would do it like so:
Every time a variable is used in a script you must must put it in curly brackets < >to tell Skript that you are using a variable. Above is a very simple home script. We store the location of the player in a variable called
Now if a player tries to do /home they will get an error message and then the rest of the trigger will stop. If you forget to stop the trigger, then the rest of the events not indented under the if statement will continue as normal. Also if the if statement is false, then none of the code indented under it will be read and the player will not get an error message.
The main problem with our current script is that if one person sets their home location under the
At the end, it looks like this:
list variable with expressions in variable names
Now the player’s name who set their home is in the variable. For example when it checks if the variable is set, it will check
Lets make some admin commands for our home system, using some benefits of list variables:
<_count>(with a underscore prefix) makes the variable local to the event. Local variables can’t be accessed from other events, and will be deleted at end of the current event.
When looping a list variable, loop-value will be value and loop-index will be index of the currently looped variable. In this case the index is a player UUID, the value is a location.
Functions
Functions are an useful way to make reusable sections of code. If you have a bunch of code that is often repeated, instead of copying and pasting the code in many places you can just put it in a function then call the function when you need to run the code.
Addons
Addons are separate plugins written by other developers to add more functionality to Skript. Addons are a massive part of the Skript community and you will see them discussed everywhere. For example you can use databases, make Discord bots, send web requests, manage other plugins like Citizens and WorldGuard, play various particle effects and much more with the addons. To use an addon, all you have to do is add the addon to your server’s ‘plugins’ directory with any addition plugins they might need. Then you can use their syntax in your scripts after you restart the server.
Where to find documentation/resources
Depending on your version of Skript, Njol’s website or Bensku’s website will have all the up to date «vanilla» syntax. However, other websites such as Skript Hub host not just Skripts documentation, but all of the addons documentation in one place! This means you can search every expression, condition, effect or event in one place. Links for both can be found below:
For vanilla Skript:
For vanilla Skript and addons