Suggestion Replace RS3Event and OSRSEvent enums with RSEvents class

Discussion in 'Client & Site Suggestions' started by Cloud, Nov 7, 2014.

  1. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    The OSRSEvent and RS3Event enums are the two most branched parts of our API and I really don't like that. I want to consolidate the OSRSEvent and RS3Event enums into a single RSEvents class. The downside to this is it would no longer be an enum, which means that getting instances of RSEvent to disable/enable would require you to pass in the event name. I can make it easier for you to get the event name by providing a mapping in the javadocs.

    Your code would probably change from
    Code (Text):
    1.  
    2. if(Environment.isRS3()){
    3. RS3Event.LOBBY_HANDLER.disable();
    4. }else{
    5. OSRSEvent.LOBBY_HANDLER.disable();
    6. }
    7.  
    To a single statement of
    Code (Text):
    1.  
    2. RSEvents.get("Lobby Handler").disable();
    3.  
    Any thoughts or suggestions on it?
     
  2. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,619
    Likes Received:
    992
    I don't see any problem with that :p
     
  3. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    The biggest problem that I could think of is that instead of having absolute enum values, you'd have to figure out the string for the event.
     
  4. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,619
    Likes Received:
    992
    you could have an enum thats just a list of the events and we just parse that?
     
  5. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    That's not doable though because OSRS and RS3 have very different events. If it was possible, I would have just done that from the beginning lol
     
  6. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,619
    Likes Received:
    992
    Well the only difference would be we'd be putting the enum value instead of a string. The enum would only be there to store the strings that we wouldn't otherwise know.
     

Share This Page

Loading...