Skip to content

Commit

Permalink
move protocol-names to messages.yml and add newer version names
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgeiss0702 committed Oct 21, 2023
1 parent f997839 commit f334942
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 40 deletions.
52 changes: 50 additions & 2 deletions common/src/main/java/us/ajg0702/queue/common/QueueMain.java
Expand Up @@ -190,8 +190,6 @@ public QueueMain(Implementation implementation, QueueLogger logger, PlatformMeth
this.platformMethods = platformMethods;
this.dataFolder = dataFolder;

constructMessages();

try {
config = new Config(dataFolder, new LogConverter(logger));
} catch (ConfigurateException e) {
Expand All @@ -200,6 +198,8 @@ public QueueMain(Implementation implementation, QueueLogger logger, PlatformMeth
return;
}

constructMessages();

logic = logicGetter.constructLogic();
aliasManager = logicGetter.constructAliasManager(config);

Expand Down Expand Up @@ -336,6 +336,54 @@ private void constructMessages() {
d.put("updater.fail", "<red>An error occurred while downloading the update. Check the console for more info.");
d.put("updater.already-downloaded", "<red>The update has already been downloaded.");

List<String> oldProtocolNames = config.getStringList("protocol-names");
for (String oldProtocolName : oldProtocolNames) {
String[] parts = oldProtocolName.split(":");
String protocol = parts[0];
String name = parts[1];

d.put("protocol-names." + protocol, name);
}


d.putIfAbsent("protocol-names.763", "1.20.1");
d.putIfAbsent("protocol-names.762", "1.19.4");
d.putIfAbsent("protocol-names.761", "1.19.3");
d.putIfAbsent("protocol-names.760", "1.19.2");
d.putIfAbsent("protocol-names.759", "1.19");
d.putIfAbsent("protocol-names.758", "1.18.2");
d.putIfAbsent("protocol-names.757", "1.18.1");
d.putIfAbsent("protocol-names.756", "1.17.1");
d.putIfAbsent("protocol-names.755", "1.17");
d.putIfAbsent("protocol-names.754", "1.16.5");
d.putIfAbsent("protocol-names.753", "1.16.3");
d.putIfAbsent("protocol-names.751", "1.16.2");
d.putIfAbsent("protocol-names.736", "1.16.1");
d.putIfAbsent("protocol-names.735", "1.16");
d.putIfAbsent("protocol-names.578", "1.15.2");
d.putIfAbsent("protocol-names.575", "1.15.1");
d.putIfAbsent("protocol-names.573", "1.15");
d.putIfAbsent("protocol-names.498", "1.14.4");
d.putIfAbsent("protocol-names.490", "1.14.3");
d.putIfAbsent("protocol-names.485", "1.14.2");
d.putIfAbsent("protocol-names.480", "1.14.1");
d.putIfAbsent("protocol-names.477", "1.14");
d.putIfAbsent("protocol-names.404", "1.13.2");
d.putIfAbsent("protocol-names.401", "1.13.1");
d.putIfAbsent("protocol-names.393", "1.13");
d.putIfAbsent("protocol-names.340", "1.12.2");
d.putIfAbsent("protocol-names.338", "1.12.1");
d.putIfAbsent("protocol-names.335", "1.12");
d.putIfAbsent("protocol-names.316", "1.11.2");
d.putIfAbsent("protocol-names.315", "1.11");
d.putIfAbsent("protocol-names.210", "1.10.2");
d.putIfAbsent("protocol-names.110", "1.9.4");
d.putIfAbsent("protocol-names.109", "1.9.2");
d.putIfAbsent("protocol-names.108", "1.9.1");
d.putIfAbsent("protocol-names.107", "1.9");
d.putIfAbsent("protocol-names.47", "1.8.9");
d.putIfAbsent("protocol-names.5", "1.7.10");

messages = new Messages(dataFolder, new LogConverter(logger), d);
}
}
44 changes: 6 additions & 38 deletions common/src/main/resources/config.yml
Expand Up @@ -326,43 +326,6 @@ priority-queue-debug: false
supported-protocols:
- "1.17:755,756"

# These are the protocol names the plugin should use.
# If you are on velocity, if the protocol is not listed here then the velocity
# api will be used to find the name of the protocol.
# If you are on bungee, only this list can be used.
protocol-names:
- "757:1.18.1"
- "756:1.17.1"
- "755:1.17"
- "754:1.16.5"
- "753:1.16.3"
- "751:1.16.2"
- "736:1.16.1"
- "735:1.16"
- "578:1.15.2"
- "575:1.15.1"
- "573:1.15"
- "498:1.14.4"
- "490:1.14.3"
- "485:1.14.2"
- "480:1.14.1"
- "477:1.14"
- "404:1.13.2"
- "401:1.13.1"
- "393:1.13"
- "340:1.12.2"
- "338:1.12.1"
- "335:1.12"
- "316:1.11.2"
- "315:1.11"
- "210:1.10.2"
- "110:1.9.4"
- "109:1.9.2"
- "108:1.9.1"
- "107:1.9"
- "47:1.8.9"
- "5:1.7.10"

# Should the updater be enabled?
enable-updater: true

Expand Down Expand Up @@ -404,4 +367,9 @@ debug: false


# Don't touch this number please
config-version: 40
config-version: 41


# This is ONLY here so that they can be moved to messages.yml. Please edit these in messages.yml!
protocol-names: []
# ^ only edit these in messages.yml

0 comments on commit f334942

Please sign in to comment.