Skip to content

Commit

Permalink
Changed config and adjusted version
Browse files Browse the repository at this point in the history
Reverted to 1.0.0 as a first release
Renamed teamMap in config to teamCommands
  • Loading branch information
Raxdiam committed Jun 20, 2020
1 parent 5813319 commit d7e93d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.8.8+build.202

# Mod Properties
mod_version = 1.0.1-1.16-rc1
mod_version = 1.0.0-1.16-rc1
maven_group = com.raxdiam
archives_base_name = teamperms

Expand Down
10 changes: 1 addition & 9 deletions src/main/java/com/raxdiam/teamperms/TeamPerms.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void onServerStart(MinecraftServer minecraftServer) {
COMMAND_MANAGER = minecraftServer.getCommandManager();
PLAYER_MANAGER = minecraftServer.getPlayerManager();
var rootNode = COMMAND_MANAGER.getDispatcher().getRoot();
CONFIG.teamMap.forEach((team, cmds) -> cmds.forEach(cmd -> {
CONFIG.teamCommands.forEach((team, cmds) -> cmds.forEach(cmd -> {
CommandNodeHelper.changeRequirement(rootNode, cmd, createTeamPredicate(team));
}));

Expand All @@ -43,14 +43,6 @@ private void onServerStart(MinecraftServer minecraftServer) {
return false;
};

// Didn't realize until now that you can't change the name of a team, so there's no need for this ¯\_(ツ)_/¯
/*ScoreboardCallbacks.TEAM_UPDATE.register(team -> {
var players = team.getPlayerList();
for (var playerName : players) {
safeSendCommandTree(playerName, PLAYER_MANAGER, COMMAND_MANAGER);
}
return false;
});*/
ScoreboardCallbacks.TEAM_JOIN.register(leaveJoinCallback);
ScoreboardCallbacks.TEAM_LEAVE.register(leaveJoinCallback);
ScoreboardCallbacks.TEAM_REMOVE_AFTER.register(team -> {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/raxdiam/teamperms/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public Config() {

private Config(boolean useDefault) {
if (useDefault) {
teamMap = createDefaultTeamMap();
teamCommands = createDefaultTeamMap();
}
}

public short configVersion = 1;

public LinkedHashMap<String, List<String>> teamMap;
public LinkedHashMap<String, List<String>> teamCommands;

public void save() {
save(this);
Expand All @@ -43,6 +43,7 @@ public static Config load() {
var config = GSON.fromJson(fr, Config.class);
if (config.configVersion != DEFAULT.configVersion) {
file.delete();
save(config);
return load();
}
return config;
Expand Down

0 comments on commit d7e93d2

Please sign in to comment.