Java Code Examples for net.minecraft.server.MinecraftServer#getServerInstance()

The following examples show how to use net.minecraft.server.MinecraftServer#getServerInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandWrapper.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
public static CommandSender toBukkitSender(ICommandSender sender) {
    if (sender instanceof MinecraftServer) {
        return MinecraftServer.getServerInstance().console;
    }
    if (sender instanceof RConConsoleSource) {
        return new CraftRemoteConsoleCommandSender((RConConsoleSource) sender);
    }
    if (sender instanceof CommandBlockBaseLogic) {
        return new CraftBlockCommandSender(sender);
    }
    if (sender instanceof FunctionManager.CustomFunctionListener) {
        return new CraftFunctionCommandSender(sender);
    }
    if (sender instanceof Entity) {
        return ((Entity) sender).getBukkitEntity();
    }
    return null;
}
 
Example 2
Source File: ServerAPI.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public static MinecraftServer getNMSServer() {
    return MinecraftServer.getServerInstance();
}
 
Example 3
Source File: AsyncCatcher.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public static void catchOp(String reason) {
    if (enabled && Thread.currentThread() != MinecraftServer.getServerInstance().primaryThread) {
        MinecraftServer.LOGGER.warn(reason + " called async on " + Thread.currentThread().getName()); // TacoSpigot - log
        throw new IllegalStateException("Asynchronous " + reason + " on thread " + Thread.currentThread().getName() + "!"); // TacoSpigot - give thread
    }
}