Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers

IServer

Importing the package

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import crafttweaker.server.IServer;

Extending ICommandSender

IServer extends ICommandSender, so all methods that are available for an ICommandSender object are also available for an IServer object.

Access the Server Handler

You can access the Server Handler using the server global keyword.
Alternatively you can get the server from any ICommandSender.

Check if a player is OP

You can use this to check if an IPlayer has the OP permission:

script.zs
server.isOp(player);

Get the command manager

You can use this to get the ICommandManager

script.zs
server.commandManager;