-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed
permissionStyle
order not being respected
- Changed config version to 2, old configs should autoupdate
- Loading branch information
Showing
8 changed files
with
141 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/eu/pb4/styledchat/config/data/VersionConfigData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package eu.pb4.styledchat.config.data; | ||
|
||
import eu.pb4.styledchat.config.ConfigManager; | ||
|
||
public class VersionConfigData { | ||
public int CONFIG_VERSION_DONT_TOUCH_THIS = ConfigManager.VERSION; | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/eu/pb4/styledchat/config/data/old/ConfigDataV1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package eu.pb4.styledchat.config.data.old; | ||
|
||
import eu.pb4.placeholders.TextParser; | ||
import eu.pb4.styledchat.config.data.ChatStyleData; | ||
import eu.pb4.styledchat.config.data.ConfigData; | ||
|
||
import java.util.HashMap; | ||
import java.util.stream.Collectors; | ||
|
||
public class ConfigDataV1 { | ||
public int CONFIG_VERSION_DONT_TOUCH_THIS = 1; | ||
public String _comment = "Before changing anything, see https://github.com/Patbox/StyledChat#configuration"; | ||
public ChatStyleData defaultStyle = ChatStyleData.DEFAULT; | ||
public HashMap<String, ChatStyleData> permissionStyles = new HashMap<>(); | ||
public boolean legacyChatFormatting = false; | ||
public HashMap<String, Boolean> defaultEnabledFormatting = getDefaultFormatting(); | ||
|
||
|
||
private static HashMap<String, Boolean> getDefaultFormatting() { | ||
HashMap<String, Boolean> map = new HashMap<>(); | ||
for (String string : TextParser.getRegisteredTags().keySet()) { | ||
map.put(string, false); | ||
} | ||
map.put("item", true); | ||
return map; | ||
} | ||
|
||
public ConfigData updateToV2() { | ||
ConfigData data = new ConfigData(); | ||
data.defaultStyle = this.defaultStyle; | ||
data.legacyChatFormatting = this.legacyChatFormatting; | ||
data.defaultEnabledFormatting = this.defaultEnabledFormatting; | ||
|
||
data.permissionStyles = this.permissionStyles.entrySet().stream().map((entry) -> ConfigData.PermissionPriorityStyle.of(entry.getKey(), entry.getValue())).collect(Collectors.toList()); | ||
|
||
return data; | ||
} | ||
} |