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);
}