any guide about strings?

fa1thDEV

Baron
Customer
hello, someone could give me a code example or teach how works with strings in the codes? and how detect it the string_en?, thx!!

Is this way the correct?:

Code:

JavaScript:
import l2.gameserver.model.GameObjectsStorage;
import l2.gameserver.model.Player;

public class OnPlayerEnter_Flexible {

    public void sendWelcomeMessage(Player player) {
        String lang = player.getLang(); 
        String playerName = player.getName();
        int onlineCount = GameObjectsStorage.getAllPlayersCount();
        StringBuilder welcomeMessage = new StringBuilder();
        welcomeMessage.append(LanguageManager.format("welcome.title", lang, playerName)).append("\n");
        welcomeMessage.append(LanguageManager.get("welcome.separator", lang)).append("\n");
        welcomeMessage.append(LanguageManager.format("welcome.online", lang, onlineCount)).append("\n");
        welcomeMessage.append(LanguageManager.get("welcome.rules", lang)).append("\n");
        welcomeMessage.append(LanguageManager.get("welcome.command", lang)).append("\n");
        welcomeMessage.append(LanguageManager.get("welcome.enjoy", lang)).append("\n");
        welcomeMessage.append(LanguageManager.get("welcome.separator", lang));
        
        player.sendMessage(welcomeMessage.toString());
    }
}



Strings:

Code:
welcome.title=.................................................. Welcome to our server, {0}! ..................................................
welcome.online=There are currently {1} players online.
welcome.rules=Please, read the rules on our forum to avoid penalties.
welcome.command=Use the .menu command to see your options.
welcome.enjoy=We hope you enjoy your stay!
welcome.separator=......................................................................................................................................................
 
Last edited:
Fixed guys, I learn from Wedding.java in the decopiled version, I used String for messages of strings and not CustomMessage.

example: player.sendMessage(new CustomMessage("bbs.bossinformer.unknownCategory", player));

String_en:

bbs.bossinformer.unknownCategory=Unknown Raid Boss category.
 
Back
Top