SinkScripts: Dynamic Groovy Scripting for Minecraft Servers

Unlocking Minecraft Server Customization with SinkScripts Minecraft’s true magic often lies beyond vanilla gameplay. For server administrators and tinkerers, plugins open doors to automation, custom mechanics, and interactive experiences that vanilla commands simply cannot match. SinkScripts is o...

Download SinkScripts for Minecraft 1.7.4

Original name: SinkScripts

Minecraft: 1.7.4

FileVersionLoaderSize
SinkScripts.jar1.7.4—3.5 МБDownload

Unlocking Minecraft Server Customization with SinkScripts

Minecraft’s true magic often lies beyond vanilla gameplay. For server administrators and tinkerers, plugins open doors to automation, custom mechanics, and interactive experiences that vanilla commands simply cannot match. SinkScripts is one such plugin that pushes the boundaries by bringing the power of Groovy scripting directly into your Minecraft server. If you’ve ever wished you could write real code on the fly while playing, this tool is a game-changer.

What is SinkScripts?

SinkScripts is a Bukkit plugin designed to execute, load, and save Groovy scripts within your Minecraft server environment. Groovy is a dynamic programming language that runs on the Java Virtual Machine and feels very similar to Java, making it accessible for anyone with basic coding knowledge. With SinkScripts, you can run scripts from chat, create persistent code histories, and even register event listeners—all without restarting the server or touching external files.

To use SinkScripts, you will need SinkLibrary version 1.9.7 or higher as a dependency. You can find it on the SinkLibrary resource page. Once both are installed, you unlock a world of real-time scripting possibilities. For those who prefer a streamlined setup, the foxygame.net launcher offers a convenient way to manage your mods and plugins—you can download and install SinkScripts directly from its menu, making server customization feel effortless.

Groovy Scripting in a Blocky World

At its core, SinkScripts interprets Groovy code that you write and run inside the game. Because Groovy is so similar to Java, you can leverage the entire Bukkit API to manipulate players, blocks, inventories, and more. The plugin pre-imports many essential packages, such as org.bukkit.*, org.bukkit.entity.*, and org.bukkit.inventory.*, so you can jump straight into coding without worrying about boilerplate imports.

Scripts are stored in a dedicated folder (plugins/SinkPlugins/scripts) and must have the .groovy extension. You can edit them externally or create them entirely in-game using the interactive console or command scripting.

Interactive Console: Code on the Fly

One of the standout features is the interactive console, which lets you write Groovy code directly in the chat. By typing /script with no arguments, you toggle the console on and off. While active, every chat message you send becomes a line of code, building up a code history. For example:

  • Enable console: /script
  • Type: int i = Bukkit.getOnlinePlayers().size()
  • Then: return "There are currently " + i + " players online!"
  • Execute with: .execute
  • Disable console: /script again

This live coding environment is perfect for testing quick ideas, debugging, or teaching others about server scripting without leaving the game.

Command Scripting and Pre-defined Variables

If you prefer not to toggle the interactive console, you can also run scripts directly using the /script command followed by your code snippet. For instance, /script int i = 5 adds that line to the code history, and /script .execute runs everything you’ve accumulated.

SinkScripts provides a set of pre-defined variables that make scripting incredibly intuitive. These are split into constants (which never change) and non-constants (which update on each execution):

  • Constants: me (User instance), plugin (JavaPlugin), player (Player), server (Bukkit)
  • Non-constants: x, y, z (coordinates), players (online Player array), users (User collection), at (block the sender is looking at)

You can immediately use these variables without declaring them. A simple script like:

for(Player p : players) {
    p.sendMessage(String.format("Hello World! I'm at X:%s, Y:%s and Z: %s! ", x, y, z));
}

will send a personalized message to every online player with the sender’s current location.

Real-World Examples

The true power of SinkScripts shines in more advanced scenarios. A basic script might check the server’s TPS (ticks per second) and heal all players:

double currentTPS = SinkLibrary.getSinkTimer().getAverageTPS();
String sendPlayers = "";
for (Player player : players) {
    player.sendMessage(ChatColor.AQUA + "Current TPS: " + currentTPS);
    player.setHealth(20);
    if (sendPlayers == "") {
        sendPlayers = player.getName();
    } else {
        sendPlayers += ", " + player.getName();
    }
}
return "Message has been sent to: " + sendPlayers + "!";

Even more impressively, you can register event listeners on the fly. The following script listens for an IRC message event (from SinkIRC) and echoes it back:

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import de.static_interface.sinklibrary.events.IrcReceiveMessageEvent;

class TestListener implements Listener {
    @EventHandler
    public void onIrcReceiveMessage(IrcReceiveMessageEvent event) {
        SinkLibrary.sendIrcMessage(event.getMessage());
    }
}

Bukkit.getPluginManager().registerEvents(new TestListener(), plugin);

This ability to dynamically add functionality without reloading or restarting the server is what makes SinkScripts a must-have for developers who love to experiment.

Permissions and Caution

With great power comes great responsibility. The only permission node is sinkscript.execute. Granting this permission essentially gives a player full control over the server, because Groovy scripts can execute arbitrary Java code, including op commands. Always be careful who you trust with this ability.

Conclusion

SinkScripts transforms your Minecraft server into a live coding playground. Whether you’re prototyping a minigame, automating administrative tasks, or teaching programming concepts, the plugin’s seamless integration of Groovy and the interactive console makes it an invaluable tool. The ability to save and load scripts, coupled with pre-defined variables, lowers the barrier to entry while still offering depth for advanced users. If you manage a server and crave more flexibility than standard plugins provide, SinkScripts is well worth exploring. Just remember to double-check your code—and your permission assignments—before hitting execute.