Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 2d9507f

Browse files
committed
Merge branch 'feature/networking' of https://github.com/PatchworkMC/patchwork-api into feature/networking
� Conflicts: � patchwork-networking/src/main/java/net/minecraftforge/fml/network/NetworkRegistry.java
2 parents ec71381 + 63d70c7 commit 2d9507f

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

patchwork-networking/src/main/java/net/minecraftforge/fml/network/NetworkRegistry.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ public class NetworkRegistry {
5454
* Special value for clientAcceptedVersions and serverAcceptedVersions predicates indicating the other side lacks
5555
* this channel.
5656
*/
57-
@SuppressWarnings("RedundantStringConstructorCall")
58-
public static String ABSENT = new String("ABSENT \uD83E\uDD14");
59-
@SuppressWarnings("RedundantStringConstructorCall")
60-
public static String ACCEPTVANILLA = new String("ALLOWVANILLA \uD83D\uDC93\uD83D\uDC93\uD83D\uDC93");
57+
public static final String ABSENT = "ABSENT \uD83E\uDD14";
58+
public static final String ACCEPTVANILLA = "ALLOWVANILLA \uD83D\uDC93\uD83D\uDC93\uD83D\uDC93";
6159
private static Map<Identifier, NetworkInstance> instances = Collections.synchronizedMap(new HashMap<>());
6260
private static boolean lock = false;
6361

@@ -118,13 +116,13 @@ public static EventNetworkChannel newEventChannel(final Identifier name, Supplie
118116
*/
119117
private static NetworkInstance createInstance(Identifier name, Supplier<String> networkProtocolVersion, Predicate<String> clientAcceptedVersions, Predicate<String> serverAcceptedVersions) {
120118
if (lock) {
121-
LOGGER.error(NETREGISTRY, "Attempted to register channel {} even though registry phase is over", name);
119+
LOGGER.error(NETREGISTRY, "Attempted to register channel {} to a locked NetworkRegistry, the registry phase is over", name);
122120
throw new IllegalArgumentException("Registration of network channels is locked");
123121
}
124122

125123
if (instances.containsKey(name)) {
126-
LOGGER.error(NETREGISTRY, "NetworkDirection channel {} already registered.", name);
127-
throw new IllegalArgumentException("NetworkDirection Channel {" + name + "} already registered");
124+
LOGGER.error(NETREGISTRY, "Attempted to register a channel with the name {}, but there is already a channel registered with that name.", name);
125+
throw new IllegalArgumentException("Channel {" + name + "} already registered");
128126
}
129127

130128
final NetworkInstance networkInstance = new NetworkInstance(name, networkProtocolVersion, clientAcceptedVersions, serverAcceptedVersions);
@@ -135,7 +133,7 @@ private static NetworkInstance createInstance(Identifier name, Supplier<String>
135133
/**
136134
* Find the {@link NetworkInstance}, if possible.
137135
*
138-
* @param identifier The network instance to lookup
136+
* @param identifier The {@link Identifier} of the network instance to lookup
139137
* @return The {@link Nullable} {@link NetworkInstance}
140138
*/
141139
@Nullable

0 commit comments

Comments
 (0)