BungeeCord connection messages

Discussion in 'BungeeCord Plugin Help' started by GeXyd, Jan 30, 2017.

  1. Hi!
    Is there any way to modify the Bungee messages? Examples:

    /server:
    You are on {server}
    /glist
    Server 1: players
    Server 2: Players
    Connection:
    Connecting to {server}
    Connected:
    Connected to {server}!
     
  2. Yes if you decompile it with 7-ZIP or something and edit them in the messages.properties.
     
  3. That's not decompilation, that's unpacking the .jar file
     
  4. I already know about messages.properties, any other way? That doesn't include the things I wanted.
     
  5. No you would need to decompile bungeecord itself to do so.
     
  6. Or get the BungeeCord source and compile it to the way you want it
     
    • Agree Agree x 1
  7. Can you provide me with instructions through a PM?
     
  8. Err, PM with the custom messages you want and I will compile it for you
     
  9. Okay, but I would like to know how to do it myself.
     
  10. Umm... Ok, lemme type up my instructions
     
  11. Actually, now that I think about it. There is this cool plugin called BungeeEssentials
     
  12. I've tried, it, causes too much lag.
     
  13. Ok, editing the /server Module and the /glist Module is hecka complicated unless you are a Java dev. I will try to explain my best
     
  14. So, when you get the BungeeCord Source code, find the source code for the module Server. Should look like this:
    Code (Text):

    package net.md_5.bungee.module.cmd.server;

    import com.google.common.base.Function;
    import com.google.common.base.Predicate;
    import com.google.common.collect.Iterables;
    import java.util.Collections;
    import java.util.Map;
    import net.md_5.bungee.api.CommandSender;
    import net.md_5.bungee.api.ProxyServer;
    import net.md_5.bungee.api.config.ServerInfo;
    import net.md_5.bungee.api.connection.ProxiedPlayer;
    import net.md_5.bungee.api.plugin.Command;
    import net.md_5.bungee.api.plugin.TabExecutor;
    import net.md_5.bungee.api.ChatColor;
    import net.md_5.bungee.api.chat.ClickEvent;
    import net.md_5.bungee.api.chat.ComponentBuilder;
    import net.md_5.bungee.api.chat.HoverEvent;
    import net.md_5.bungee.api.chat.TextComponent;

    /**
     * Command to list and switch a player between available servers.
     */
    public class CommandServer extends Command implements TabExecutor
    {

        public CommandServer()
        {
            super( "server", "bungeecord.command.server" );
        }

        @Override
        public void execute(CommandSender sender, String[] args)
        {
            if ( !( sender instanceof ProxiedPlayer ) )
            {
                return;
            }
            ProxiedPlayer player = (ProxiedPlayer) sender;
            Map<String, ServerInfo> servers = ProxyServer.getInstance().getServers();
            if ( args.length == 0 )
            {
                player.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", player.getServer().getInfo().getName() ) );
                TextComponent serverList = new TextComponent( ProxyServer.getInstance().getTranslation( "server_list" ) );
                serverList.setColor( ChatColor.GOLD );
                boolean first = true;
                for ( ServerInfo server : servers.values() )
                {
                    if ( server.canAccess( player ) )
                    {
                        TextComponent serverTextComponent = new TextComponent( first ? server.getName() : ", " + server.getName() );
                        int count = server.getPlayers().size();
                        serverTextComponent.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
                                new ComponentBuilder( count + ( count == 1 ? " player" : " players" ) + "\n" )
                                .append( "Click to connect to the server" ).italic( true )
                                .create() ) );
                        serverTextComponent.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/server " + server.getName() ) );
                        serverList.addExtra( serverTextComponent );
                        first = false;
                    }
                }
                player.sendMessage( serverList );
            } else
            {
                ServerInfo server = servers.get( args[0] );
                if ( server == null )
                {
                    player.sendMessage( ProxyServer.getInstance().getTranslation( "no_server" ) );
                } else if ( !server.canAccess( player ) )
                {
                    player.sendMessage( ProxyServer.getInstance().getTranslation( "no_server_permission" ) );
                } else
                {
                    player.connect( server );
                }
            }
        }

        @Override
        public Iterable<String> onTabComplete(final CommandSender sender, final String[] args)
        {
            return ( args.length > 1 ) ? Collections.EMPTY_LIST : Iterables.transform( Iterables.filter( ProxyServer.getInstance().getServers().values(), new Predicate<ServerInfo>()
            {
                private final String lower = ( args.length == 0 ) ? "" : args[0].toLowerCase();

                @Override
                public boolean apply(ServerInfo input)
                {
                    return input.getName().toLowerCase().startsWith( lower ) && input.canAccess( sender );
                }
            } ), new Function<ServerInfo, String>()
            {
                @Override
                public String apply(ServerInfo input)
                {
                    return input.getName();
                }
            } );
        }
    }
     
     
  15. This line of code:
    Code (Text):

    player.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", player.getServer().getInfo().getName() ) );
     
    Sends a message that only the player who executed the /server command
     
  16. Okay, I found that.
     
  17. How would I change that to &aAwesomeness: &9You were connected to {server}
     
  18. Ok, I am not sure about that
     
  19. Now you know where that is sent to. Open up the messages.properties file
    Code (Text):

    alert=\u00a78[\u00a74Alert\u00a78]\u00a7r
    already_connected=\u00a7cYou are already connected to this server!
    already_connected_proxy=\u00a7cYou are already connected to this proxy!
    already_connecting=\u00a7cAlready connecting to this server!
    command_list=\u00a7a[{0}] \u00a7e({1}): \u00a7r{2}
    connect_kick=\u00a7cKicked whilst connecting to {0}: {1}
    current_server=\u00a76You are currently connected to {0}.
    fallback_kick=\u00a7cCould not connect to a default or fallback server, please try again later: {0}
    fallback_lobby=\u00a7cCould not connect to target server, you have been moved to a fallback server.
    lost_connection=[Proxy] Lost connection to server.
    mojang_fail=Error occurred while contacting login servers, are they down?
    no_permission=\u00a7cYou do not have permission to execute this command!
    no_server=\u00a7cThe specified server does not exist.
    no_server_permission=\u00a7cYou don't have permission to access this server.
    outdated_client=Outdated Client!
    outdated_server=Outdated Server!
    proxy_full=Server is full!
    restart=[Proxy] Proxy restarting.
    server_kick=[Kicked]
    server_list=\u00a76You may connect to the following servers at this time:
    server_went_down=\u00a7cThe server you were previously on went down, you have been connected to a fallback server
    total_players=Total players online: {0}
    name_too_long=Cannot have username longer than 16 characters
    name_invalid=Username contains invalid characters.
    ping_cannot_connect=\u00a7c[Bungee] Can't connect to server.
    join_throttle_kick=You have connected too fast. You must wait at least {0} seconds between connections.
    offline_mode_player=Not authenticated with Minecraft.net
     
    Should look like this