Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
frengor committed Oct 6, 2024
1 parent 82b3f71 commit ddf7a9d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main/java/com/fren_gor/lightInjector/LightInjector.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
* packet, see <a href="https://wiki.vg/Protocol_FAQ#What.27s_the_normal_login_sequence_for_a_client.3F">What's the normal login sequence for a client?</a>).
* <br>
* Very rarely, it may happen that some additional login packets get listened before that event is called. However, this
* shouldn't be an issue for most applications, since login packets aren't usually intercepted anyway.
* should not be an issue for most applications, since login packets are not usually intercepted anyway.
* <p>
* Do not (currently) listen to packets exchanged during status pings (i.e. server list pings).
* Does not listen to packets exchanged during status pings (i.e. server list pings).
* Use the {@link ServerListPingEvent} to change the ping information.
*
* @author fren_gor
Expand Down Expand Up @@ -130,7 +130,7 @@ public abstract class LightInjector {
* Initializes the injector and starts to listen to packets.
* <p>
* Note that, while it is possible to create more than one instance per plugin,
* it's more efficient and recommended to just have only one.
* it is more efficient and recommended to just have only one.
*
* @param plugin The {@link Plugin} which is instantiating this injector.
* @throws NullPointerException If the provided {@code plugin} is {@code null}.
Expand Down Expand Up @@ -345,7 +345,7 @@ private PacketHandler injectChannel(Channel channel) {
try {
channel.pipeline().addBefore("packet_handler", identifier, handler);
} catch (IllegalArgumentException ignored) {
plugin.getLogger().severe("[LightInjector] Couldn't inject a player, an handler with identifier '" + identifier + "' is already present");
plugin.getLogger().severe("[LightInjector] Could not inject a player, an handler with identifier '" + identifier + "' is already present");
}
}
});
Expand All @@ -365,7 +365,7 @@ private Object getNetworkManager(Player player) {
try {
return GET_NETWORK_MANAGER.get(GET_PLAYER_CONNECTION.get(GET_PLAYER_HANDLE.invoke(player)));
} catch (ReflectiveOperationException e) {
throw new RuntimeException("[LightInjector] Couldn't get player's network manager.", e);
throw new RuntimeException("[LightInjector] Could not get player's network manager.", e);
}
}

Expand All @@ -377,7 +377,7 @@ private Channel getChannel(Object networkManager) {
try {
return (Channel) NMS_CHANNEL_FROM_NM.get(networkManager);
} catch (ReflectiveOperationException e) {
throw new RuntimeException("[LightInjector] Couldn't get network manager's channel.", e);
throw new RuntimeException("[LightInjector] Could not get network manager's channel.", e);
}
}

Expand Down Expand Up @@ -548,7 +548,7 @@ private static Class<?> getNMSClass(String name, String mcPackage) {
try {
return Class.forName(path);
} catch (ClassNotFoundException exception) {
throw new RuntimeException("[LightInjector] Cannot find NMS Class! (" + path + ')', exception);
throw new RuntimeException("[LightInjector] Can not find NMS Class! (" + path + ')', exception);
}
}

Expand All @@ -557,7 +557,7 @@ private static Class<?> getCBClass(String name) {
try {
return Class.forName(clazz);
} catch (ClassNotFoundException exception) {
throw new RuntimeException("[LightInjector] Cannot find CB Class! (" + clazz + ')', exception);
throw new RuntimeException("[LightInjector] Can not find CB Class! (" + clazz + ')', exception);
}
}

Expand All @@ -567,7 +567,7 @@ private static Field getField(Class<?> clazz, String name) {
f.setAccessible(true);
return f;
} catch (ReflectiveOperationException exception) {
throw new RuntimeException("[LightInjector] Cannot find field! (" + clazz.getName() + '.' + name + ')', exception);
throw new RuntimeException("[LightInjector] Can not find field! (" + clazz.getName() + '.' + name + ')', exception);
}
}

Expand Down Expand Up @@ -604,7 +604,7 @@ private static Field getField(Class<?> clazz, Class<?> type, @Range(from = 1, to
index = savedIndex; // Reset index before running the loop again
}

String errorMsg = "[LightInjector] Cannot find field! (" + savedIndex + getOrdinal(savedIndex) + type.getName() + " in " + savedClazz.getName();
String errorMsg = "[LightInjector] Can not find field! (" + savedIndex + getOrdinal(savedIndex) + type.getName() + " in " + savedClazz.getName();
if (superClassesToTry > 0) {
errorMsg += " and in its " + superClassesToTry + (superClassesToTry == 1 ? " super class" : " super classes");
}
Expand All @@ -616,7 +616,7 @@ private static Field getField(Class<?> clazz, Class<?> type, @Range(from = 1, to
@Nullable
private static Field getPendingNetworkManagersFieldOrNull(Class<?> serverConnectionClass) {
try {
// The field's name shouldn't be obscured since it's been added by Paper
// The field's name shouldn't be obfuscated since it's been added by Paper
Field pending = getField(serverConnectionClass, "pending");
if (pending.getType() == Queue.class || pending.getType() == List.class) {
return pending;
Expand Down Expand Up @@ -646,7 +646,7 @@ private static Method getMethod(Class<?> clazz, String name, Class<?>... paramet
for (Class<?> p : parameters) {
params.add(p.getName());
}
throw new RuntimeException("[LightInjector] Cannot find method! (" + clazz.getName() + '.' + name + '(' + params.toString() + ')', exception);
throw new RuntimeException("[LightInjector] Can not find method! (" + clazz.getName() + '.' + name + '(' + params.toString() + ')', exception);
}
}

Expand All @@ -668,7 +668,7 @@ private static Method getMethod(Class<?> clazz, Class<?> returnType, @Range(from
}
}

throw new RuntimeException("[LightInjector] Cannot find method! (" + savedIndex + getOrdinal(savedIndex) + " returning " + returnType.getName() + " in " + clazz.getName() + ')');
throw new RuntimeException("[LightInjector] Can not find method! (" + savedIndex + getOrdinal(savedIndex) + " returning " + returnType.getName() + " in " + clazz.getName() + ')');
}

// Details are important =P
Expand Down

0 comments on commit ddf7a9d

Please sign in to comment.