Sierra ~ Java // Netty // MySQL // BoneCP // Plugin System (Like Bukkit!)

Page 41 of 103 FirstFirst ... 3133343536373839404142434445464748495191 ... LastLast
Results 601 to 615 of 1536
  1. #601
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,476Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Shynoshy View Post
    Okay, some bugs i discovered for you Alex :

    * Walks threads are using same ressources when users walk same time -> Walk getting mad (fixed it making a new thread manager with own variables).
    * At login, you're making tons of new Habbo() or newHabbo() who call new Habbo() ... Not really a problem but i don't know if Java free unused / unsaved memory pointers, if not it could be a problem.
    * Problems with Room caching. You're caching room like it was Session, meaning that if user is not connected, his rooms are unseen to rest of connected, and that a bit weird i guess ? (Solved it by caching rooms at launch with an INNER JOIN query to retrive Owner name from rooms.ownerid, don't know if my sentence make sense but don't know how to explain in English ^^ )
    The first two aren't really big but the last one is that rooms are unloaded when owner of the room disconnects with no users in it. Or when the owner is offline and it waits until the last person is when the owner is offline until it unloads it.
    Understand?

  2. #602
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Quackster View Post
    The first two aren't really big but the last one is that rooms are unloaded when owner of the room disconnects with no users in it. Or when the owner is offline and it waits until the last person is when the owner is offline until it unloads it.
    Understand?
    Yep, totally and that's the point. If another user try to search / get room owned by a disconnected user, the rooms are inexistant for the emulator and the user who search for room get no rooms.

  3. #603
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,476Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Shynoshy View Post
    Yep, totally and that's the point. If another user try to search / get room owned by a disconnected user, the rooms are inexistant for the emulator and the user who search for room get no rooms.
    Then the rooms will be generated by MySQL and unload when the last one disconnects ;)

  4. #604
    Enthusiast Garrison is offline
    MemberRank
    May 2012 Join Date
    rLocation
    46Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    ShyNoShy & Quackster your work on the emulator is good so far, but I would like to point a bug out with stacking, when your on a tile and you place a stackable item you go on top of the item...

    P.S: If people make something like a code for wired/horses or what ever... can we post them to other users? cos sharing is caring... but if not don't worry :P

  5. #605
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,476Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Hey should I remove my plugin system or keep it?

    EDIT: Nevermind, removing it anyway.

  6. #606
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Quackster View Post
    Hey should I remove my plugin system or keep it?

    EDIT: Nevermind, removing it anyway.
    Why remove it?

  7. #607
    topkek amirite?? Leon is offline
    MemberRank
    May 2009 Join Date
    919Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Funixeh View Post
    Why remove it?
    I believe it was causing him hassle.

  8. #608
    Valued Member Shynoshy is offline
    MemberRank
    Jun 2007 Join Date
    103Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Garrison View Post
    ShyNoShy & Quackster your work on the emulator is good so far, but I would like to point a bug out with stacking, when your on a tile and you place a stackable item you go on top of the item...

    P.S: If people make something like a code for wired/horses or what ever... can we post them to other users? cos sharing is caring... but if not don't worry :P
    Guess it's normal behavior with stacking ?! Tried with Phoenix, and stacking work like that too.

  9. #609
    Enthusiast Garrison is offline
    MemberRank
    May 2012 Join Date
    rLocation
    46Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Shynoshy View Post
    Guess it's normal behavior with stacking ?! Tried with Phoenix, and stacking work like that too.
    Ahh Okay! =] lol

  10. #610
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Garrison View Post
    P.S: If people make something like a code for wired/horses or what ever... can we post them to other users? cos sharing is caring... but if not don't worry :P
    You mean so you can take it, put it into Sierra and call it Webbo Emu? Yeah, I know your game, we don't need people like you around here.


  11. #611
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    C-c-c-c-c-combo breaker!

  12. #612
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Yet another, C-c-c-c-c-combo breaker!

  13. #613
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,476Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Fixed a memory leak, instead of calling the remove function for sessions it would return the session thus not removing it, ever.
    And added a constant loop for Sessions with a success or a fail ping, it fails it will dispose your data and disconnect you.

    Code:
    package sierra.habbo;
    
    
    import java.util.concurrent.ConcurrentHashMap;
    import java.util.concurrent.ConcurrentMap;
    
    
    import org.jboss.netty.channel.Channel;
    
    
    public class SessionManager implements Runnable {
    
    
    	private Thread connectionThread;
    	private ConcurrentMap<Integer, Session> Sessions;
    
    
    	public SessionManager()
    	{
    		Sessions = new ConcurrentHashMap<Integer, Session>();
    
    
    		connectionThread = new Thread(this);
    		/*
    		 * Start ping event to check if the user is still connected.
    		 */
    		connectionThread.setPriority(Thread.NORM_PRIORITY);
    		connectionThread.start();
    	}
    
    
    	/*
    	 * Add session if the same session doesn't already exist
    	 */
    	public boolean addSession(Channel channel)
    	{
    		return Sessions.putIfAbsent(channel.getId(), new Session(channel)) == null;
    	}
    
    
    	/*
    	 * Remove the session.
    	 */
    	public void removeSession(Channel channel)
    	{
    		try {
    			Sessions.remove(channel.getId());
    		} catch (Exception e) {
    		}
    	}
    
    
    	/*
    	 * Grab user by channel id.
    	 */
    	public Session GetUserByChannel(Channel channel)
    	{
    		return Sessions.get(channel.getId());
    	}
    
    
    	/*
    	 * Return a collection of sessions
    	 */
    	public ConcurrentMap<Integer, Session> getSessions()
    	{
    		return Sessions;
    	}
    
    
    	/*
    	 * Return a true/false if the session exists in the collection
    	 */
    	public boolean hasSession(Channel channel)
    	{
    		return Sessions.containsKey(channel.getId());
    	}
    
    
    
    
    	public boolean UserByIdOnline(int id)
    	{
    		for (Session Session : Sessions.values())
    			if (Session.getHabbo() != null)
    				if (Session.getHabbo().Id == id)
    					return true;
    		return false;
    	}
    	public Session GetUserByName(String Name)
    	{
    		for (Session Session : Sessions.values())
    			if (Session.getHabbo() != null)
    				if (Session.getHabbo().Username.equals(Name))
    					return Session;
    		return null;
    	}
    	public Session GetUserById(int UserId)
    	{
    		for (Session Session : Sessions.values())
    			if (Session.getHabbo() != null)
    				if (Session.getHabbo().Id == UserId)
    					return Session;
    		return null;
    	}
    
    
    	/*
    	 * Thread loop for checking if Sessions have disconnected.
    	 */
    	@Override
    	public void run()
    	{
    		while (true)
    		{
    			for (Session Session : Sessions.values())
    			{
    				if (!Session.PingOK)
    				{
    					Session.dispose();
    					removeSession(Session.getChannel());
    				}
    			}
    		}
    	}
    }

  14. #614
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,476Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Coded fuse rights, instead of rank checking, this allows you to customize the permissions even more!

    Code:
    package sierra.habbohotel.fuserights;
    
    
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import java.util.Map.Entry;
    
    
    import sierra.Sierra;
    
    
    public class FuserightEngine
    {
        private static Map<Integer, List<String>> Fuserights = new HashMap<Integer, List<String>>();
        
        public static void LoadAll()
        {
            try
            {
                PreparedStatement Statement = Sierra.getDatabase().ExecuteQuery("SELECT * FROM `fuserights`");
                
                ResultSet Row = Statement.executeQuery();
    
    
                while (Row.next())
                {
                    Integer Rank = Row.getInt("rank");
                    
                    if (Fuserights.containsKey(Rank) == false)
                    {
                        Fuserights.put(Rank, new ArrayList<String>());
                        fillFuses(Rank);
                    }
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        public static void fillFuses(int Rank)
        {
            try
            {
                ResultSet Row = Sierra.getDatabase().ReadTable("SELECT * FROM fuserights WHERE rank = '" + Rank + "'");
    
    
                while (Row.next())
                {
                    Fuserights.get(Rank).add(Row.getString("fuse"));
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        
        public static List<String> getFusesrightsByRank(int Rank)
        {
            List<String> LoadedFuses = new ArrayList<String>();
            
            for (Entry<Integer, List<String>> KeyValue : Fuserights.entrySet())
            {
                if (KeyValue.getKey().equals(Rank) || KeyValue.getKey() < Rank)
                {
                    for (String fuse : KeyValue.getValue())
                    {
                        LoadedFuses.add(fuse);
                    }
                }
            }
            return LoadedFuses;
        }
    }
    Code:
    public Boolean hasStaffPermission(String Fuse)
    	{
    		return FuserightEngine.getFusesrightsByRank(Rank).contains(Fuse);
    	}

  15. #615
    Account Upgraded | Title Enabled! George2000 is offline
    MemberRank
    Jul 2011 Join Date
    The NetherlandsLocation
    1,150Posts

    Re: Sierra [R63, JAVA, MySQL (JDBC), Netty]

    Quote Originally Posted by Quackster View Post
    Coded fuse rights, instead of rank checking, this allows you to customize the permissions even more!

    Code:
    package sierra.habbohotel.fuserights;
    
    
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import java.util.Map.Entry;
    
    
    import sierra.Sierra;
    
    
    public class FuserightEngine
    {
        private static Map<Integer, List<String>> Fuserights = new HashMap<Integer, List<String>>();
        
        public static void LoadAll()
        {
            try
            {
                PreparedStatement Statement = Sierra.getDatabase().ExecuteQuery("SELECT * FROM `fuserights`");
                
                ResultSet Row = Statement.executeQuery();
    
    
                while (Row.next())
                {
                    Integer Rank = Row.getInt("rank");
                    
                    if (Fuserights.containsKey(Rank) == false)
                    {
                        Fuserights.put(Rank, new ArrayList<String>());
                        fillFuses(Rank);
                    }
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        public static void fillFuses(int Rank)
        {
            try
            {
                ResultSet Row = Sierra.getDatabase().ReadTable("SELECT * FROM fuserights WHERE rank = '" + Rank + "'");
    
    
                while (Row.next())
                {
                    Fuserights.get(Rank).add(Row.getString("fuse"));
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        
        public static List<String> getFusesrightsByRank(int Rank)
        {
            List<String> LoadedFuses = new ArrayList<String>();
            
            for (Entry<Integer, List<String>> KeyValue : Fuserights.entrySet())
            {
                if (KeyValue.getKey().equals(Rank) || KeyValue.getKey() < Rank)
                {
                    for (String fuse : KeyValue.getValue())
                    {
                        LoadedFuses.add(fuse);
                    }
                }
            }
            return LoadedFuses;
        }
    }
    Code:
    public Boolean hasStaffPermission(String Fuse)
    	{
    		return FuserightEngine.getFusesrightsByRank(Rank).contains(Fuse);
    	}
    Looks good, nice idea to use fuserights, rather then rank checking.
    Next thing: special user fuserights (so you can apply a fuserank to one user, as given away in a competition or something)



Advertisement