Go back to Hub with /hub

Discussion in 'BungeeCord Plugin Development' started by Woodenplanks320, Jul 14, 2013.

  1. Hello forum,
    I want to make a command to change to the hub server.
    Can somebody help me?
     
  2. joehot200

    Supporter

    You could always just get a bit of code to make people switch servers, like BungeePortals, or MicroJump, then just put that into your own plugin with the command /hub.

    Obviously releasing it would be stealing code, however in my opinion it is fine to use others code for private use.
    You could always ask the authors if you could use their code if you dont just want to decompile/take it :p
     
  3. Code (Text):
    package me.Woodenplanks320.TroubleInMineVille.Commands;
     
    import java.io.ByteArrayOutputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
     
    import me.Woodenplanks320.TroubleInMineVille.TroubleInMineVille;
     
    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
     
    public class CommandHub implements CommandExecutor{
     
        @Override
        public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
           
            Player p = (Player) cs;
           
            if(cs instanceof Player){
                ByteArrayOutputStream b = new ByteArrayOutputStream();
                DataOutputStream out = new DataOutputStream(b);
                try {
                    out.writeUTF("Connect");
                    out.writeUTF("Hub");
                } catch (IOException eee) {
                    Bukkit.getLogger().info("You'll never see me!");
                }
                p.sendPluginMessage(TroubleInMineVille.plugin, "BungeeCord", b.toByteArray());
            }
            return false;
        }
     
    }
     
    In does not work.
     
  4. but i want to code this by myself
     
  5. @Woodenplank320
    Your plugin instance is null.
     
  6. anyone an idear, who don't want money from me?
     
  7. Scrayos

    Supporter

    Any errors in the Log?