Fixed the messenger, now to code friend requests and shizz, (removed staff category due to errors, but it will come back in future)
Code:package sierra.messages.console; import sierra.SierraEnvironment; import sierra.composers.Outgoing; import sierra.messages.MessageEvent; import sierra.network.clients.Session; import sierra.network.clients.SessionManager; import sierra.packethelper.ClientMessage; import sierra.packethelper.ServerMessage; import sierra.utils.UserInputFilter; public class SendMessage implements MessageEvent { @Override public void Parse(Session Session, ClientMessage Request) { /* * Get friend id */ int FriendId = Request.popInt(); /* * Get console message */ String ConsoleMessage = UserInputFilter.filterString(Request.popFixedString(), true); /* * New server message instance */ ServerMessage Message = new ServerMessage(); /* * Build packet */ SessionManager Sessions = SierraEnvironment.getConnections().GetConnections(); if (Sessions.UserByIdOnline(FriendId)) { Message.Initialize(Outgoing.TalkOnChat); Message.AppendInt32(Session.GetHabbo().Id); Message.AppendString(ConsoleMessage); Sessions.GetUserById(FriendId).Send(Message); } else { Message.Initialize(Outgoing.TalkOnChat); Message.AppendInt32(FriendId); Message.AppendString("Your friend is offline."); Session.Send(Message); } } }
Nice work Alex, And yes the code does remind me of craftbukkit.
Nice plugin idea, maybe you could take a modular approach to design? (E.g what Nillus did with his openholo(?) server) So if someone wanted to switch to the b64 and vl64 encoding, they could load a jar with classes specific to that encoding protocol.
Updates
- Friends coming online and offline is now 100% detectable and it will not fail.
- Re-wrote my logging formatter.
That will not be added as Sierra will have all normal hotel functions coded, but this plugin system gives users a chance to create addons without editing Sierra itself.
Quack just as i've posted previously at Aaron's developement, are you capeable to keep starting developements when behalf of them are not released yet nor finished, good luck,
Sorry for the lack of updates. This plugin system is really... really annoying. I might consider getting rid of it. Unless I figure out a way to register events like Bukkit has.
How do you handle the shuffle headers?
Pros
- No actual physical editing of Sierra itself.
- People would learn more if they wanted to code for Sierra
- Makes the source really dynamic
- The emulator is more unique with such a system
- You can just remove a plugin to disable that from being handled
Cons
- You'd need a lot of memory to store heaps of plugins
- Slower boot up
Well, looks at the pros, is not that bad at all.
The cons are not that much of a serious issue, since a decent 2gb ram with standard cpu could be able to handle that.
Slower Boot Up? Well, doesn't matter, your only booting once or twice a day, (Depends what the user is doing)
But i guess it will be more work for you, porting all them plugins.