Home›Java›Mods›SimpleServerCommand
SimpleServerCommand
ModsJava

SimpleServerCommand

Java mod listed for Minecraft 1.10–1.12. Downloads from the MC Java Mods app on Android.

SimpleServerCommand What does it do: Adds a /server <server> command to bukkit. This can then be used to have a player change servers from the bukkit…

⬇ Download on Spigot
SimpleServerCommand
What does it do:

Adds a /server <server> command to bukkit. This can then be used to have a player change servers from the bukkit console or from a bukkit-plugin that runs a command for the player.

Normally, players are able to run /server <server> themselves and the bungee would pick that up and have them switch servers. Unfortunately, if you run a command like /sudo <player> /server <server>, this would not be picked up by the bungee, since the player never actually 'send' the command himself, its just the bukkit server thinking he did.

Command:
/server <server-name>

Permission:
bukkit.server.connect (or OP)

How to install:
Drop it in your /plugins folder.

How does it work:
Spoiler: (Very simple) Source Code
Code (Text):
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;

public class Main extends JavaPlugin {

    public void onEnable() {
        this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!label.equalsIgnoreCase("server")) {
            return true;
        }
        if (!sender.hasPermission("bukkit.server.connect") || !sender.isOp()) {
            sender.sendMessage("§cYou do not have permission.");
            return true;
        } else {
            if (sender instanceof Player) {
                if (args.length != 1) {
                    sender.sendMessage("§cUsage: /server <server>");
                    return true;
                }
                String server = args[0];
                Player player = (Player) sender;
                ByteArrayDataOutput out = ByteStreams.newDataOutput();
                out.writeUTF("Connect");
                out.writeUTF(server);
                player.sendMessage("§aAttempting to send you to " + server);
                player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
                return true;
            } else {
                sender.sendMessage("§cThis command can only be run by a player.");
                return true;
            }
        }
    }

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

SimpleServerCommand is a free Minecraft Java mod. Compatible with Minecraft 1.10, 1.11, 1.12. Downloaded 191 times (via Spigot). Download it and open it directly in the game.

Explore more