Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-08 22:02:50 +02:00
Use logger instead of System.out
Dieser Commit ist enthalten in:
Ursprung
10a2df5a7d
Commit
1c584040ca
@ -122,7 +122,7 @@ public class BukkitViaInjector implements ViaInjector {
|
|||||||
ReflectionUtil.set(bootstrapAcceptor, "childHandler", ((BukkitChannelInitializer) oldInit).getOriginal());
|
ReflectionUtil.set(bootstrapAcceptor, "childHandler", ((BukkitChannelInitializer) oldInit).getOriginal());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Failed to remove injection handler, reload won't work with connections, please reboot!");
|
Via.getPlatform().getLogger().severe("Failed to remove injection handler, reload won't work with connections, please reboot!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
injectedFutures.clear();
|
injectedFutures.clear();
|
||||||
@ -134,7 +134,7 @@ public class BukkitViaInjector implements ViaInjector {
|
|||||||
pair.getKey().set(pair.getValue(), ((ListWrapper) o).getOriginalList());
|
pair.getKey().set(pair.getValue(), ((ListWrapper) o).getOriginalList());
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
System.out.println("Failed to remove injection, reload won't work with connections, please reboot!");
|
Via.getPlatform().getLogger().severe("Failed to remove injection, reload won't work with connections, please reboot!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class BukkitViaLoader implements ViaPlatformLoader {
|
|||||||
}
|
}
|
||||||
}).get(10, TimeUnit.SECONDS);
|
}).get(10, TimeUnit.SECONDS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Error fetching hand item: " + e.getClass().getName());
|
Via.getPlatform().getLogger().severe("Error fetching hand item: " + e.getClass().getName());
|
||||||
if (Via.getManager().isDebug())
|
if (Via.getManager().isDebug())
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package us.myles.ViaVersion.bungee.commands;
|
package us.myles.ViaVersion.bungee.commands;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.bungee.commands.subs.ProbeSubCmd;
|
import us.myles.ViaVersion.bungee.commands.subs.ProbeSubCmd;
|
||||||
import us.myles.ViaVersion.commands.ViaCommandHandler;
|
import us.myles.ViaVersion.commands.ViaCommandHandler;
|
||||||
|
|
||||||
@ -8,7 +9,7 @@ public class BungeeCommandHandler extends ViaCommandHandler {
|
|||||||
try {
|
try {
|
||||||
registerSubCommand(new ProbeSubCmd());
|
registerSubCommand(new ProbeSubCmd());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Failed to register Bungee subcommands");
|
Via.getPlatform().getLogger().severe("Failed to register Bungee subcommands");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package us.myles.ViaVersion.bungee.providers;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
import us.myles.ViaVersion.protocols.base.VersionProvider;
|
import us.myles.ViaVersion.protocols.base.VersionProvider;
|
||||||
@ -16,7 +17,7 @@ public class BungeeVersionProvider extends VersionProvider {
|
|||||||
try {
|
try {
|
||||||
ref = Class.forName("net.md_5.bungee.protocol.ProtocolConstants");
|
ref = Class.forName("net.md_5.bungee.protocol.ProtocolConstants");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Could not detect the ProtocolConstants class");
|
Via.getPlatform().getLogger().severe("Could not detect the ProtocolConstants class");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,7 +46,7 @@ public class BungeeVersionProvider extends VersionProvider {
|
|||||||
return protocol;
|
return protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Panic, no protocol id found for " + info.getProtocolVersion());
|
Via.getPlatform().getLogger().severe("Panic, no protocol id found for " + info.getProtocolVersion());
|
||||||
return info.getProtocolVersion();
|
return info.getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -20,14 +21,12 @@ public class BungeePipelineUtil {
|
|||||||
DECODE_METHOD.setAccessible(true);
|
DECODE_METHOD.setAccessible(true);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("Netty issue?");
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ENCODE_METHOD = MessageToByteEncoder.class.getDeclaredMethod("encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
ENCODE_METHOD = MessageToByteEncoder.class.getDeclaredMethod("encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
||||||
ENCODE_METHOD.setAccessible(true);
|
ENCODE_METHOD.setAccessible(true);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("Netty issue?");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class PacketWrapper {
|
|||||||
if (type instanceof TypeConverter) {
|
if (type instanceof TypeConverter) {
|
||||||
value = (T) ((TypeConverter) type).from(value);
|
value = (T) ((TypeConverter) type).from(value);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Possible type mismatch: " + value.getClass().getName() + " -> " + type.getOutputClass());
|
Via.getPlatform().getLogger().warning("Possible type mismatch: " + value.getClass().getName() + " -> " + type.getOutputClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ public class PacketWrapper {
|
|||||||
if (packetValue.getKey() instanceof TypeConverter) {
|
if (packetValue.getKey() instanceof TypeConverter) {
|
||||||
value = ((TypeConverter) packetValue.getKey()).from(value);
|
value = ((TypeConverter) packetValue.getKey()).from(value);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Possible type mismatch: " + value.getClass().getName() + " -> " + packetValue.getKey().getOutputClass());
|
Via.getPlatform().getLogger().warning("Possible type mismatch: " + value.getClass().getName() + " -> " + packetValue.getKey().getOutputClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ public class MetadataRewriter {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
||||||
System.out.println("An error occurred with entity type rewriter");
|
Via.getPlatform().getLogger().warning("An error occurred with entity type rewriter");
|
||||||
System.out.println("Metadata: " + metadata);
|
Via.getPlatform().getLogger().warning("Metadata: " + metadata);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,8 +195,8 @@ public class MetadataRewriter {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
metadatas.remove(metadata);
|
metadatas.remove(metadata);
|
||||||
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
||||||
System.out.println("An error occurred with entity metadata handler");
|
Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler");
|
||||||
System.out.println("Metadata: " + metadata);
|
Via.getPlatform().getLogger().warning("Metadata: " + metadata);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class BlockEntity {
|
|||||||
updateBlockEntity(pos, (short) newId, tag, connection);
|
updateBlockEntity(pos, (short) newId, tag, connection);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (Via.getManager().isDebug()) {
|
if (Via.getManager().isDebug()) {
|
||||||
System.out.println("Block Entity: " + e.getMessage() + ": " + tag);
|
Via.getPlatform().getLogger().warning("Block Entity: " + e.getMessage() + ": " + tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class Protocol1_9TO1_8 extends Protocol {
|
|||||||
if (Via.getConfig().isForceJsonTransform()) {
|
if (Via.getConfig().isForceJsonTransform()) {
|
||||||
return constructJson(line);
|
return constructJson(line);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Invalid JSON String: \"" + line + "\" Please report this issue to the ViaVersion Github: " + e.getMessage());
|
Via.getPlatform().getLogger().warning("Invalid JSON String: \"" + line + "\" Please report this issue to the ViaVersion Github: " + e.getMessage());
|
||||||
return "{\"text\":\"\"}";
|
return "{\"text\":\"\"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class MetadataRewriter {
|
|||||||
entry.setValue(value);
|
entry.setValue(value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println("[Out] Unhandled MetaDataType: " + metaIndex.getNewType());
|
Via.getPlatform().getLogger().warning("[Out] Unhandled MetaDataType: " + metaIndex.getNewType());
|
||||||
list.remove(entry);
|
list.remove(entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_9to1_8.packets;
|
package us.myles.ViaVersion.protocols.protocol1_9to1_8.packets;
|
||||||
|
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_10Types;
|
import us.myles.ViaVersion.api.entities.Entity1_10Types;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
@ -216,7 +217,7 @@ public class SpawnPackets {
|
|||||||
if (tracker.getClientEntityTypes().containsKey(entityID)) {
|
if (tracker.getClientEntityTypes().containsKey(entityID)) {
|
||||||
MetadataRewriter.transform(tracker.getClientEntityTypes().get(entityID), metadataList);
|
MetadataRewriter.transform(tracker.getClientEntityTypes().get(entityID), metadataList);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Unable to find entity for metadata, entity ID: " + entityID);
|
Via.getPlatform().getLogger().warning("Unable to find entity for metadata, entity ID: " + entityID);
|
||||||
metadataList.clear();
|
metadataList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,7 +297,6 @@ public class SpawnPackets {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
short item = wrapper.read(Type.SHORT);
|
short item = wrapper.read(Type.SHORT);
|
||||||
// System.out.println(item);
|
|
||||||
if (item != 0) {
|
if (item != 0) {
|
||||||
PacketWrapper packet = new PacketWrapper(0x3C, null, wrapper.user());
|
PacketWrapper packet = new PacketWrapper(0x3C, null, wrapper.user());
|
||||||
packet.write(Type.VAR_INT, wrapper.get(Type.VAR_INT, 0));
|
packet.write(Type.VAR_INT, wrapper.get(Type.VAR_INT, 0));
|
||||||
@ -322,7 +322,7 @@ public class SpawnPackets {
|
|||||||
if (tracker.getClientEntityTypes().containsKey(entityID)) {
|
if (tracker.getClientEntityTypes().containsKey(entityID)) {
|
||||||
MetadataRewriter.transform(tracker.getClientEntityTypes().get(entityID), metadataList);
|
MetadataRewriter.transform(tracker.getClientEntityTypes().get(entityID), metadataList);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Unable to find entity for metadata, entity ID: " + entityID);
|
Via.getPlatform().getLogger().warning("Unable to find entity for metadata, entity ID: " + entityID);
|
||||||
metadataList.clear();
|
metadataList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,12 @@ public class PipelineUtil {
|
|||||||
DECODE_METHOD.setAccessible(true);
|
DECODE_METHOD.setAccessible(true);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("Netty issue?");
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ENCODE_METHOD = MessageToByteEncoder.class.getDeclaredMethod("encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
ENCODE_METHOD = MessageToByteEncoder.class.getDeclaredMethod("encode", ChannelHandlerContext.class, Object.class, ByteBuf.class);
|
||||||
ENCODE_METHOD.setAccessible(true);
|
ENCODE_METHOD.setAccessible(true);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("Netty issue?");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public class SpongeViaInjector implements ViaInjector {
|
|||||||
ReflectionUtil.set(bootstrapAcceptor, "childHandler", ((SpongeChannelInitializer) oldInit).getOriginal());
|
ReflectionUtil.set(bootstrapAcceptor, "childHandler", ((SpongeChannelInitializer) oldInit).getOriginal());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Failed to remove injection handler, reload won't work with connections, please reboot!");
|
Via.getPlatform().getLogger().severe("Failed to remove injection handler, reload won't work with connections, please reboot!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
injectedFutures.clear();
|
injectedFutures.clear();
|
||||||
@ -126,7 +126,7 @@ public class SpongeViaInjector implements ViaInjector {
|
|||||||
pair.getKey().set(pair.getValue(), ((ListWrapper) o).getOriginalList());
|
pair.getKey().set(pair.getValue(), ((ListWrapper) o).getOriginalList());
|
||||||
}
|
}
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
System.out.println("Failed to remove injection, reload won't work with connections, please reboot!");
|
Via.getPlatform().getLogger().severe("Failed to remove injection, reload won't work with connections, please reboot!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren