Fixed the mod version pattern and allowing dev builds to work with non dev builds.

This commit is contained in:
2022-01-18 17:51:30 +00:00
parent de2b214bc7
commit c53236d0e6

View File

@ -12,7 +12,7 @@ import java.util.regex.Pattern;
public class Network {
public static final String VERSION = TotemOfReviving.MOD_ID + "-net-1";
private static final Pattern NET_VERSION_PATTERN = Pattern.compile(TotemOfReviving.MOD_ID + "-net-\\d+$");
private static final Pattern MOD_VERSION_PATTERN = Pattern.compile("Forge-^\\d+\\.\\d+\\.\\d+$-^\\d+\\.\\d+\\.\\d+$");
private static final Pattern MOD_VERSION_PATTERN = Pattern.compile("Forge-\\d+\\.\\d+\\.\\d+-\\d+\\.\\d+\\.\\d+$");
public static SimpleChannel channel;
@ -54,7 +54,8 @@ public class Network {
String clientNetVersion = (senderIsServer) ? VERSION : readNetVersion(buffer);
String clientModVersion = (senderIsServer) ? TotemOfReviving.getVersion() : readModVersion(buffer);
if (!serverNetVersion.equals(clientNetVersion) || !serverModVersion.equals(clientModVersion)) {
if (!serverNetVersion.equals(clientNetVersion) ||
!serverModVersion.equals(clientModVersion) && !serverModVersion.equals("NONE") && !clientModVersion.equals("NONE")) {
throw new MismatchedVersionException(
String.format("The server and client are running different versions of [Micle's Totem of Reviving]." +
"Try updating this mod on either the client and or the server." +