Skip to content

Commit 028ac1d

Browse files
Merge language.yml into config.yml under messages section
Consolidates configuration by moving all language strings from the separate language.yml file into the main config.yml under a 'messages:' section. This simplifies configuration management and reduces the number of files users need to maintain. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 3cf63ad commit 028ac1d

File tree

6 files changed

+27
-33
lines changed

6 files changed

+27
-33
lines changed

PistonChat/src/main/java/net/pistonmaster/pistonchat/PistonChat.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
@Getter
3636
public final class PistonChat extends JavaPlugin {
3737
private final ConfigManager configManager = new ConfigManager(this, "config.yml");
38-
private final ConfigManager languageManager = new ConfigManager(this, "language.yml");
3938
private final TempDataTool tempDataTool = new TempDataTool(this);
4039
private final SoftIgnoreTool softignoreTool = new SoftIgnoreTool(this);
4140
private final CacheTool cacheTool = new CacheTool(this);
@@ -65,7 +64,6 @@ public void onEnable() {
6564
log.info(ChatColor.DARK_GREEN + "Loading config");
6665
try {
6766
configManager.create();
68-
languageManager.create();
6967
} catch (IOException e) {
7068
e.printStackTrace();
7169
getServer().getPluginManager().disablePlugin(this);
@@ -168,10 +166,6 @@ public FileConfiguration getConfig() {
168166
return configManager.get();
169167
}
170168

171-
public FileConfiguration getLanguage() {
172-
return languageManager.get();
173-
}
174-
175169
public void runAsync(Runnable runnable) {
176170
foliaLib.getScheduler()
177171
.runAsync(task -> runnable.run())

PistonChat/src/main/java/net/pistonmaster/pistonchat/commands/MainCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
7575

7676
try {
7777
plugin.getConfigManager().create();
78-
plugin.getLanguageManager().create();
7978
} catch (IOException e) {
8079
plugin.getLogger().severe("Could not create config!");
8180
e.printStackTrace();

PistonChat/src/main/java/net/pistonmaster/pistonchat/tools/CommonTool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ private void sendReceiver(CommandSender sender, String message, CommandSender re
115115
}
116116

117117
public Component getLanguageMessage(String messageKey, boolean prefix, TagResolver... tagResolvers) {
118-
String messageString = plugin.getLanguage().getString(messageKey);
118+
String messageString = plugin.getConfig().getString("messages." + messageKey);
119119
Component messageComponent = MiniMessage.miniMessage().deserialize(messageString, tagResolvers);
120120

121121
if (!prefix) {
122122
return messageComponent;
123123
}
124124

125-
String formatString = plugin.getLanguage().getString("format");
125+
String formatString = plugin.getConfig().getString("messages.format");
126126

127127
TagResolver tagResolver = TagResolver.resolver(
128128
Placeholder.component("message", messageComponent)

PistonChat/src/main/resources/config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@ allow-pm-ignored: true
3232
only-hide-pms: true
3333

3434
ignore-list-size: 9
35+
36+
messages:
37+
# The prefix can also be set to just "&6"
38+
format: "[<dark_green>PistonChat</dark_green>] <gold><message>"
39+
help-header: "---[<dark_green>PistonChat</dark_green>]---"
40+
playeronly: "You need to be a player to do this."
41+
notonline: "This player is not online."
42+
nooneignored: "No players ignored."
43+
chaton: "Chat messages unhidden."
44+
chatoff: "Chat messages hidden."
45+
pmson: "Private messages unhidden."
46+
pmsoff: "Private messages hidden."
47+
pmself: "Please do not private message yourself."
48+
chatisoff: "You have toggled off chat"
49+
source-ignored: "This person ignores you!"
50+
target-ignored: "You ignore this person!"
51+
page-not-exists: "This page doesn't exist."
52+
not-a-number: "Not a number!"
53+
whispering-disabled: "This person has whispering disabled!"
54+
ignore: "<gold>Now ignoring <dark_aqua><player_name>"
55+
unignore: "<gold>No longer ignoring <dark_aqua><player_name>"
56+
ignorehard: "<gold>Permanently ignoring <player_name>. This is saved in <dark_red>/ignorelist</dark_red>."
57+
unignorehard: "<gold>No longer permanently ignoring <dark_aqua><player_name>"
58+
ignorelistcleared: "<gold>Ignore list cleared."
59+
3560
prefixes:
3661
green:
3762
prefix: ">"

PistonChat/src/main/resources/language.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

crowdin.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
files:
2-
- source: /src/main/resources/language.yml
3-
translation: /translations/language-%locale%.yml
42
- source: /src/main/resources/config.yml
53
translation: /translations/config-%locale%.yml

0 commit comments

Comments
 (0)