My problem is that I read the tutorial and i still couldn't understand how to use java extensions.
I mean:
I wrote a simple java extension following this template:
Code: Select all
import it.gotoandplay.smartfoxserver.data.*;
import it.gotoandplay.smartfoxserver.extensions.*;
import it.gotoandplay.smartfoxserver.lib.ActionscriptObject;
import it.gotoandplay.smartfoxserver.events.InternalEventObject;
import org.json.JSONObject;
public class ExtensionTemplate extends AbstractExtension
{
public void init()
{
//Initialization
}
public void destroy()
{
//Called when the extension is destroyed
}
public void handleRequest(String cmd, ActionscriptObject ao, User u, int fromRoom)
{
// Your code here, handles XML-based requests
}
public void handleRequest(String cmd, JSONObject jso, User u, int fromRoom)
{
// Your code here, handles JSON-based requests
}
public void handleRequest(String cmd, String params[], User u, int fromRoom)
{
// Your code here, handles String-based requests
}
public void handleInternalEvent(InternalEventObject ieo)
{
// Your code here, handles server events
}
public Object handleInternalRequest(Object param)
{
// (Optional) Your code here, handles an internal request
return param;
}
}
Then i opened the config.xml file and i added in a room this piece of XML:
Code: Select all
<Extensions>
<extension name="ExtensionTemplate" className="ExtensionTemplate.class" type="script" />
</Extensions>
If i try to put my class in that folder the server finds it but it gives me an error about a wrong character at line xxx.
So, of course i'm missing something and i ask you if you can give me some simple instructions to make this extension work.
Thank you!