Thanks you ate a legend!
This is a discussion on Gamma 1.0 - r63 [Java Emulator, Multithreaded] within the Habbo Releases forums, part of the Habbo Hotel category; Gamma The section get's shitty after a while from seeing so much customs, cms and C# releases. So I decided ...
Gamma
The section get's shitty after a while from seeing so much customs, cms and C# releases. So I decided to add in a little bit of spice by creating a multi-threaded JAVA server. It doesn't use Netty at all or any other addons.
Please read this important note:
Gamma is unfinished, do not use it for a hotel. It is only for educational purposes. Please do not ask for help in this thread or how to open it.
Features
- Hardcoded packet handling (thaaa best feature evarrr)
- Thread manager.
- Allows one ip per connection
- Multi-threaded
How does it work?
Well it's simple. Every time there is a new connection, a new thread is created to handle it. This allows multi-tasking when handling clients.
How do I change the port?
Go to environment.java and you'll see where to change it.
Can we see some code?
Code:package gamma.threading; import gamma.main.Environment; import java.net.Socket; import java.util.HashMap; import java.util.Map; public class GammaThreadManager { private Map<String, GammaThread> Clients; private Map<GammaThread, Thread> Threads; public GammaThreadManager() { this.Clients = new HashMap<String, GammaThread>(); this.Threads = new HashMap<GammaThread, Thread>(); } public void AcceptClient(Socket Client) { /* * Get existing thread if possible */ GammaThread _existingThread = Clients.get(this.getIp(Client)); /* * Check for existing ip address and dispose them */ if (_existingThread != null) { /* * Stop thread. */ Clients.get(this.getIp(Client)).Disposed = true; Threads.get(_existingThread).interrupt(); /* * Remove both */ Clients.remove(this.getIp(Client)); Threads.remove(_existingThread); } /* * Add client to map. */ GammaThread _gThread = new GammaThread(Client); this.Clients.put(this.getIp(Client), _gThread); /* * Add new thread to map. */ this.Threads.put(_gThread, new Thread(_gThread)); /* * Start thread. */ this.Threads.get(_gThread).start(); } public String getIp(Socket Socket) { return Socket.getLocalAddress().toString().replace("/", ""); } }
A picture
Download
Good release? Like or rep me <3
Last edited by Quackster; 09-05-12 at 06:07 AM.
Thanks you ate a legend!
Great release hope this will be used as supposed to, and that alot of great work will be based on this.
Would be very nice
+rep for u, very nice and a great help to the habbo section.
Thanks for a great time on here
NICE![]()
Mwaha you are funny ^.^
The keyboard on my Xperia Arc is not good. LOL
Does this work to Uber or Phoenix :)))))
Does this work for MAC-users aswell or just like C++, for Windows only?
Not sure, but I think Java is also compatible with Mac/Apple OS. U can also use it on Linux ;D
Multithreading can get a bit out of hand if you're not careful.
Anyway, decent release, good for newer programmers