Basics¶
By now you've made a few plugins, so Basics is where you learn how to make them do more. It covers the things nearly every plugin needs, and it also shows you how to find everything else on your own, because Spigot is far too big for any wiki to cover in full.
Each topic works like your first plugin did. We build something one part at a time, explain each part as we go, and put it all together into one working plugin at the end. The topics build on each other, so it's best to go in order.
Commands¶
You'll learn how to read what a player types after a command, how to tell a player from the console, and how to reply with a helpful message. You'll finish with a /heal that works from the console too and can heal other players.
Events¶
You'll learn how to see what an event gives you and how to cancel one so the thing never happens. You'll finish with a plugin that stops players from breaking certain blocks.
Messages and colors¶
You'll learn how to add color to messages and how to send one to a single player or to everyone on the server. You'll finish with an announcement command that broadcasts a colorful message.
Working with players¶
You'll learn how to find a player by name and how to change things about them, like their game mode or where they are. You'll finish with a few handy admin commands.
Reading the Spigot docs¶
You'll learn how to open the Spigot documentation, find the thing you need, read what it expects, and turn it into Lua. You'll finish by using a method you looked up yourself.
Config files¶
You'll learn how to keep settings in a config.yml that the server owner can edit, and how to set defaults and read values. You'll also learn how to update an old config when your plugin changes, so server owners don't lose their settings. You'll finish with a welcome plugin whose message can be changed without touching any code.
Saving data¶
You'll learn how to save your plugin's own data to a file so it's still there after a restart, and how to update old saved data when your plugin changes. You'll finish with a plugin that remembers how many times each player has joined.