Updates
NOTE: All normal features will be coded, this just gives you the ability to code cool addons! :D
I would like to present a major feature that Sierra now has. You can now create a plugin for Sierra instead of editing the actual source of Sierra. The system is similar to Bukkit, imports jars from the plugins folder and it's called upon whenever a packet is received or by command.
It has access to all the classes Sierra uses, simply by creating the whole Sierra project to a JAR file, (not runnable jar, oh god, just don't -- that's only for running it by command prompt) and importing Sierra.jar as a library file.
Example of a plugin;
Code:
package net.quackster.mycredits;
import sierra.*;
import sierra.composers.*;
import sierra.packethelper.*;
import sierra.plugin.*;
import sierra.network.clients.Session;
public class MyCredits implements ISierraPlugin
{
/*
* Private variables
*/
private PluginData mPluginData;
@Override
public int onHeader() {
return Incoming.GetCredits;
}
@Override
public void onEnable()
{
/*
* Get the plugin data from configuration
*/
this.mPluginData = SierraEnvironment.getPluginManager().getPlugins().get(this);
/*
* Log start up
*/
this.log("Starting up " + mPluginData.getPluginName() + "...");
this.log("Created by Quackster!");
}
@Override
public void onHandlePacket(Session Session, ClientMessage Request) {
ServerMessage Message = new ServerMessage();
Message.Initialize(Outgoing.Alert);
Message.AppendString("You currently have " + Session.GetHabbo().Credits + " credits!");
Message.AppendString("");
Session.Send(Message);
}
@Override
public Boolean onCommand(Session Session, String Command, String[] Args)
{
if (Command.equals(":jajaja"))
{
ServerMessage Message = new ServerMessage();
Message.Initialize(Outgoing.Talk);
Message.AppendInt32(Session.GetHabbo().Id);
Message.AppendString("ja ja ja");
Message.AppendInt32(0);
Message.AppendInt32(0);
Message.AppendInt32(0);
Session.Send(Message);
return true;
}
return false;
}
/*
* Logger void
*/
public void log(Object Text) {
Logging.writeLine("[" + mPluginData.getPluginName() + "] " + Text);
}
}
I'll push all updates on GitHub. Thanks for reading.
Oh and once you create the following plugin, you need to create the a folder the same name as the jar file without the extension and create the file, pluginFile.ini
Code:
plugin.class.path=net.quackster.mycredits.MyCredits
plugin.version=0.1
plugin.name=MyCredits