Throw a more descriptive error of a packet type hasn't got a class.
Dieser Commit ist enthalten in:
Ursprung
6e3583b300
Commit
96cc518fb0
@ -60,7 +60,12 @@ public class StructureCache {
|
|||||||
*/
|
*/
|
||||||
public static Object newPacket(PacketType type) {
|
public static Object newPacket(PacketType type) {
|
||||||
try {
|
try {
|
||||||
return PacketRegistry.getPacketClassFromType(type, true).newInstance();
|
Class<?> clazz = PacketRegistry.getPacketClassFromType(type, true);
|
||||||
|
|
||||||
|
// Check the return value
|
||||||
|
if (clazz != null)
|
||||||
|
return clazz.newInstance();
|
||||||
|
throw new IllegalArgumentException("Cannot find associated packet class: " + type);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
return null;
|
return null;
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren