Thread: [Kronos] Saving Player Rank/Groups

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 [Kronos] Saving Player Rank/Groups 
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    First of all remove automatically being admin on first login

    io.ruin.utility > OfflineMode.java

    Find:

    Code:
    login.info.update(userId, login.info.name, saved, ListUtils.toList(PlayerGroup.ADMINISTRATOR.id), 0);
    Replace with:

    Code:
    login.info.update(userId, login.info.name, saved, 0);

    Now in io.ruin.api.protocol.login > LoginInfo.java add this method (There's another update method just place it under that one)

    Code:
        public void update(int userId, String name, String saved, int unreadPMs) {
            this.userId = userId;
            this.name = name;
            this.saved = saved;
            this.unreadPMs = unreadPMs;
        }
    Now make setGroups() method public in Player.java

    Code:
    private void setGroups(List<Integer> groupIds) {
    to


    Code:
    public void setGroups(List<Integer> groupIds) {
    While still in Player.java add @ Expose to the beginning of private PlayerGroup primaryGroup;

    Should look like this:

    Code:
    @ Expose private PlayerGroup primaryGroup;
    Now remove or comment out this line:

    Code:
    setGroups(info.groupIds);
    Now go to io.ruin.model.entity.player > PlayerFile.java

    Add this import at the top with the other imports:

    Code:
    import io.ruin.api.utils.ListUtils;
    Replace load method with this:

    Code:
       public static Player load(PlayerLogin login) {
            try {
                Player player;
                if(login.info.saved == null || login.info.saved.isEmpty())
                    player = new Player();
                else
                    player =  GSON_LOADER.fromJson(login.info.saved, Player.class);
                if(player.getPrimaryGroup() == null)
                    player.setGroups(ListUtils.toList(PlayerGroup.REGISTERED.id));
                else
                    player.setGroups(ListUtils.toList(player.getPrimaryGroup().id));
    
                Config.load(player);
                return player;
            } catch(Throwable t) {
                Server.logError("", t);
                return null;
            }
        }

    Now to fix client rank image (Disconnects client when typing something)

    Go to io.ruin.model.entity.player > PlayerGroup.java

    Find

    Code:
    REGISTERED(2, 0, -1, 0),
    Change it to

    Code:
    REGISTERED(2, 0, 0, 0),
    Now you can edit any json character file and it should have a field in there called "primaryGroup" and will look like this in the json file:

    Code:
    "primaryGroup":"REGISTERED"
    Change REGISTERED to any other rank you choose.

    You must use these rank titles which is seen in io.ruin.model.entity.player > PlayerGroup.java

    Code:
        OWNER
        DEVELOPER
        COMMUNITY_MANAGER
        ADMINISTRATOR
        MODERATOR
        FORUM_MODERATOR
        SUPPORT
        YOUTUBER
        BETA_TESTER
        ZENYTE
        ONYX
        DRAGONSTONE
        DIAMOND
        RUBY
        EMERALD
        SAPPHIRE
        REGISTERED
        BANNED
    Make sure to update your isGroup method in Player.java to this for command permissions and other permissions to work properly.

    Code:
        public boolean isGroup(PlayerGroup g) {
            return primaryGroup.equals(g);
        }
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    ♫ Musical Project ♫

    Natalie's Avatar
    Join Date
    Dec 2015
    Posts
    172
    Thanks given
    91
    Thanks received
    59
    Rep Power
    154
    I've tested out OWNER Rank, seems to disconnect. Most common ones seem fine. But thanks!!!
    Reply With Quote  
     

  4. #3  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by Natalynn View Post
    I've tested out OWNER Rank, seems to disconnect. Most common ones seem fine. But thanks!!!
    Try changing OWNER(100, 100, 100, 100), in PlayerGroup.java to OWNER(100, 100, 1, 100) (The 3rd number is always the client image id)
    Reply With Quote  
     

  5. #4  
    ♫ Musical Project ♫

    Natalie's Avatar
    Join Date
    Dec 2015
    Posts
    172
    Thanks given
    91
    Thanks received
    59
    Rep Power
    154
    Quote Originally Posted by Armo View Post
    Try changing OWNER(100, 100, 100, 100), in PlayerGroup.java to OWNER(100, 100, 1, 100) (The 3rd number is always the client image id)
    Tested, seems to still disconnect. But it's not that big of a issue.
    Reply With Quote  
     

  6. #5  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by Natalynn View Post
    Tested, seems to still disconnect. But it's not that big of a issue.
    https://www.rune-server.ee/runescape...at-crowns.html

    Quickly wrote this up, so ignore what I said
    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    ♫ Musical Project ♫

    Natalie's Avatar
    Join Date
    Dec 2015
    Posts
    172
    Thanks given
    91
    Thanks received
    59
    Rep Power
    154
    Quote Originally Posted by Armo View Post
    https://www.rune-server.ee/runescape...at-crowns.html

    Quickly wrote this up, so ignore what I said
    Nice , thanks! Also found another permission issue, seems like. Seems like even though your rank is registered, you can still do commands like, "god", "item", etc even if you aren't admin. I did find some OFFLINE mode stuff in the commands list, and removed the checks for that and still seems to do it.
    Reply With Quote  
     

  9. #7  
    RuneCasino


    Join Date
    Jul 2007
    Posts
    1,647
    Thanks given
    175
    Thanks received
    257
    Rep Power
    358
    Quote Originally Posted by Natalynn View Post
    Nice , thanks! Also found another permission issue, seems like. Seems like even though your rank is registered, you can still do commands like, "god", "item", etc even if you aren't admin. I did find some OFFLINE mode stuff in the commands list, and removed the checks for that and still seems to do it.
    Replace your isGroup method in Player.java with this:

    Code:
        public boolean isGroup(PlayerGroup g) {
            return primaryGroup.equals(g);
        }
    And for owner rank dcing when you type something:
    Code:
    OWNER(100, 2, 2, 100),
    Reply With Quote  
     

  10. Thankful user:


  11. #8  
    Registered Member
    Join Date
    Apr 2012
    Posts
    7
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I followed the above tutorial and replaced the isGroup method. Players with the rank registered can still use commands like ::god, ::b and spawn items. Did I miss something?
    Reply With Quote  
     

  12. #9  
    Extreme Donator


    Join Date
    Dec 2016
    Posts
    383
    Thanks given
    99
    Thanks received
    66
    Rep Power
    340
    not using kronos , but nice snippets you are helping people that using it
    Reply With Quote  
     

  13. #10  
    ♫ Musical Project ♫

    Natalie's Avatar
    Join Date
    Dec 2015
    Posts
    172
    Thanks given
    91
    Thanks received
    59
    Rep Power
    154
    Quote Originally Posted by Armo View Post
    Replace your isGroup method in Player.java with this:

    Code:
        public boolean isGroup(PlayerGroup g) {
            return primaryGroup.equals(g);
        }
    And for owner rank dcing when you type something:
    Code:
    OWNER(100, 2, 2, 100),
    Can confirm the commands do still work even with this change.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Player rank/group system
    By funkE in forum Snippets
    Replies: 12
    Last Post: 08-08-2015, 09:24 PM
  2. Replies: 7
    Last Post: 08-09-2011, 04:19 AM
  3. Better way of doing player ranks
    By tj007razor in forum Snippets
    Replies: 10
    Last Post: 06-02-2010, 06:27 AM
  4. Yell Command With [Player Ranks] Before Name
    By hypoharry in forum Snippets
    Replies: 8
    Last Post: 09-03-2009, 03:32 PM
  5. player rank only weapons?
    By Runebay™ in forum Help
    Replies: 2
    Last Post: 02-20-2009, 05:47 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •