Skip to content

Commit 6aaed57

Browse files
committed
fix backwards compatibility again
1 parent b6c3493 commit 6aaed57

6 files changed

Lines changed: 114 additions & 85 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = "simplexity"
8-
version = "3.0.2"
8+
version = "3.0.3"
99

1010
dependencies {
1111
paperweight.devBundle("org.purpurmc.purpur", "1.20-R0.1-SNAPSHOT")

src/main/java/simplexity/villagerinfo/VillagerInfo.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import simplexity.villagerinfo.interaction.logic.HighlightLogic;
2222

2323
import java.util.HashMap;
24+
import java.util.List;
2425
import java.util.Objects;
2526
import java.util.logging.Logger;
2627

@@ -34,8 +35,11 @@ public static VillagerInfo getInstance() {
3435
}
3536

3637
private final MiniMessage miniMessage = MiniMessage.miniMessage();
38+
private final List<String> legacyVersions = List.of("1.19", "1.19.1", "1.19.2", "1.19.3");
39+
private final List<String> nmsSupportedVersions = List.of("1.20", "1.20.1");
3740
private boolean usingPurpur = true;
3841
private boolean legacyVersion = false;
42+
private boolean nmsUnsupported = false;
3943

4044
@Override
4145
public void onEnable() {
@@ -53,12 +57,16 @@ public void onEnable() {
5357
usingPurpur = false;
5458
}
5559
String serverVersion = this.getServer().getMinecraftVersion();
56-
if (serverVersion.equalsIgnoreCase("1.19") || serverVersion.equalsIgnoreCase("1.19.1") || serverVersion.equalsIgnoreCase("1.19.2") || serverVersion.equalsIgnoreCase("1.19.3")) {
60+
if (legacyVersions.contains(serverVersion)) {
5761
legacyVersion = true;
5862
this.getVillagerInfoLogger().severe("You are on an old version, some options will not work as intended. Please update to the current minecraft version for full config options. Unsupported options in your version: ");
5963
this.getVillagerInfoLogger().warning("RGB Highlighting on workstations (1.19.4 implementation)");
6064
this.getVillagerInfoLogger().warning("Block displays for workstations (1.19.4 implementation)");
6165
}
66+
if (!nmsSupportedVersions.contains(serverVersion)) {
67+
nmsUnsupported = true;
68+
this.getVillagerInfoLogger().warning("Please note that the VillagerInfo version you are running is coded to run on Minecraft version " + nmsSupportedVersions + ". Methods that rely on NMS will be set to use legacy methods.");
69+
}
6270
reloadVillInfoConfigs();
6371
registerCommands();
6472
}
@@ -101,6 +109,9 @@ public MiniMessage getMiniMessage() {
101109
public boolean isLegacyVersion() {
102110
return legacyVersion;
103111
}
112+
public boolean isNmsUnsupported() {
113+
return nmsUnsupported;
114+
}
104115

105116
public HashMap<Villager, FallingBlock> getLegacyCurrentlyHighlighted() {
106117
return legacyCurrentlyHighlighted;
@@ -118,4 +129,6 @@ public boolean isUsingPurpur() {
118129
public void onDisable() {
119130
HighlightLogic.getInstance().clearAllCurrentHighlights();
120131
}
132+
133+
121134
}

src/main/java/simplexity/villagerinfo/configurations/locale/ServerMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public enum ServerMessage {
1616
HELP_TOGGLE_HIGHLIGHT("\n<#4dd5ff><click:suggest_command:'/vi toggle highlight'><hover:show_text:'<#4dd5ff>/vi toggle highlight'><u> • /vi toggle highlight</u>\n<grey>Sets your preference on whether or not you would like the plugin to highlight a villager's workstation when you crouch-interact with them"),
1717
HELP_TOGGLE_SOUND("\n<#4dd5ff><click:suggest_command:'/vi toggle sound'><hover:show_text:'<#4dd5ff>/vi toggle sound'><u> • /vi toggle sound</u></hover></click>\n<grey>Sets your preference on whether or not you would like a sound to play when you crouch-interact with a villager"),
1818
HELP_TOGGLE_OUTPUT("\n<#4dd5ff><click:suggest_command:'/vi toggle output'><hover:show_text:'<#4dd5ff>/vi toggle output'><u> • /vi toggle output</u></hover></click>\n<grey>Sets your preference on whether or not you would like text output to display when you crouch-interact with a villager"),
19-
NOT_A_PLAYER("<plugin_prefix> <red>Sorry, you must be a player to use this command"),
19+
NOT_A_PLAYER("<red>Sorry, you must be a player to use this command"),
2020
CONFIGURATION_ERROR_PREFIX("Configuration Error: "),
2121
CONFIGURED_SOUND_ERROR(" is not a valid sound! Setting sound to 'BLOCK_AMETHYST_BLOCK_BREAK' until a valid sound is provided"),
2222
CONFIGURED_HIGHLIGHT_TIME_ERROR("Invalid highlight time. If you would like to disable this feature, please set 'highlight-workstation' to 'false'. Otherwise please use an integer greater than zero. Setting value to 10s until a valid number is supplied"),

0 commit comments

Comments
 (0)