Loading News/Text from file to Server
Ok i am going to teach you how to load News or any text from a .txt file into your server as a welcome message.
Step 1)Create a text file called "wmessage.txt"
Step 2)Open the txt file and add this
Code:
END OF WMESSAGE.TXT EDITING
-----------------------------------------------------------
START OF CLIENT.JAVA EDITING
Step 3) open client.java and search for this:
After you find that add the below code after the end of the public void
Code:
public void wmessage()
{
try
{
BufferedReader in = new BufferedReader(new FileReader("data/wmessage.txt"));
String data = null;
while ((data = in.readLine()) != null)
{
sendMessage(data);
}
}
catch (IOException e)
{
System.out.println("Critical error while reading welcome message file!");
e.printStackTrace();
}
}
Step 4) Search for: You should see something like this:
Code:
MainHelpMenu();
//openWelcomeScreen(201, false, 3, (127 << 24)+1, misc.random(10));
ResetBonus();
GetBonus();
WriteBonus();
Poisoned = false;
sendMessage("Welcome to (server name");
sendMessage("Type ::commands for list of useful commands!");
sendMessage("Train Combat on NPC's! ");
sendMessage("Type ::servermenu for help.");
sendMessage("S");
sendMessage("PLEASE DON'T ASK TO BECOME A PLAYER MOD!!!");
sendMessage("IT WONT WORK!!!!");
sendMessage("Ecto tokens are now a replacement to bloods due to server crashes.");
sendMessage("TYPE ::menuhelp FOR A LIST OF MENU's");
sendMessage("Before playing please read ::disclaimer");
Replace that with this:
Code:
wmessage(); //Read & Print welcome message from file
Now Save and compile.
Step 5)
Now open that .txt file you made before and you can put anything you want in, so when you log in your server, that txt would be displayed as a welcome message.
100% Credits to Public boolean