3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Replace printStackTrace usages with proper logging (#3741)

Dieser Commit ist enthalten in:
EnZaXD 2024-03-09 13:57:41 +01:00 committet von GitHub
Ursprung 3442cda8ce
Commit 7b0c2fb51a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
30 geänderte Dateien mit 74 neuen und 40 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.ArmorType;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_9;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
@ -71,7 +72,7 @@ public class ArmorListener extends ViaBukkitListener {
wrapper.scheduleSend(Protocol1_9To1_8.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send armor update", e);
}
}

Datei anzeigen

@ -30,6 +30,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.Plugin;
import java.util.logging.Level;
public class DeathListener extends ViaBukkitListener {
@ -66,7 +67,7 @@ public class DeathListener extends ViaBukkitListener {
wrapper.scheduleSend(Protocol1_9To1_8.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send death message", e);
}
}
});

Datei anzeigen

@ -19,6 +19,8 @@ package com.viaversion.viaversion.bukkit.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import com.viaversion.viaversion.api.Via;
import org.bukkit.entity.Player;
public final class ProtocolSupportUtil {
@ -46,7 +48,7 @@ public final class ProtocolSupportUtil {
Object version = PROTOCOL_VERSION_METHOD.invoke(null, player);
return (int) GET_ID_METHOD.invoke(version);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to get ProtocolSupport version", e);
}
return -1;
}

Datei anzeigen

@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.WeakHashMap;
import java.util.logging.Level;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -148,7 +149,7 @@ public class PlayerSneakListener extends ViaBukkitListener {
try {
setSize.invoke(getHandle.invoke(player), DEFAULT_WIDTH, height);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to set player height", e);
}
}
}

Datei anzeigen

@ -18,6 +18,7 @@
package com.viaversion.viaversion.bukkit.listeners.protocol1_15to1_14_4;
import com.viaversion.viaversion.ViaVersionPlugin;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
@ -26,6 +27,7 @@ import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener;
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15;
import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
import java.util.Arrays;
import java.util.logging.Level;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -84,7 +86,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener {
packet.write(Types1_14.METADATA_LIST, Arrays.asList(new Metadata(0, Types1_14.META_TYPES.byteType, bitmask)));
packet.scheduleSend(Protocol1_15To1_14_4.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send entity glide fix metadata", e);
}
}
}

Datei anzeigen

@ -18,6 +18,7 @@
package com.viaversion.viaversion.bukkit.platform;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer;
import com.viaversion.viaversion.bukkit.util.NMSUtil;
import com.viaversion.viaversion.platform.LegacyViaInjector;
@ -30,6 +31,7 @@ import io.netty.channel.ChannelInitializer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginDescriptionFile;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -217,7 +219,7 @@ public class BukkitViaInjector extends LegacyViaInjector {
}
}
} catch (ReflectiveOperationException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to check if ViaVersion is binded", e);
}
return false;
}

Datei anzeigen

@ -153,7 +153,7 @@ public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider
// send
packetMethod.invoke(playerConnection, packet);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to send packet to server", e);
return false;
}
return true;

Datei anzeigen

@ -25,6 +25,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.MovementTrac
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import com.viaversion.viaversion.util.PipelineUtil;
import io.netty.channel.ChannelHandlerContext;
@ -109,7 +110,7 @@ public class BukkitViaMovementTransmitter extends MovementTransmitterProvider {
info.get(MovementTracker.class).incrementIdlePacket();
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to handle idle packet", e);
}
}
} else {

Datei anzeigen

@ -17,12 +17,14 @@
*/
package com.viaversion.viaversion.bukkit.tasks.protocol1_19to1_18_2;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.ClientboundPackets1_19;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.storage.SequenceStorage;
import java.util.logging.Level;
public final class AckSequenceTask implements Runnable {
@ -42,7 +44,7 @@ public final class AckSequenceTask implements Runnable {
ackPacket.write(Type.VAR_INT, sequence);
ackPacket.scheduleSend(Protocol1_19To1_18_2.class);
} catch (final Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send block changed ack packet", e);
}
}
}

Datei anzeigen

@ -17,12 +17,14 @@
*/
package com.viaversion.viaversion.bungee.handlers;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.connection.UserConnectionImpl;
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import java.lang.reflect.Method;
import java.util.logging.Level;
public class BungeeChannelInitializer extends ChannelInitializer<Channel> {
private final ChannelInitializer<Channel> original;
@ -34,7 +36,7 @@ public class BungeeChannelInitializer extends ChannelInitializer<Channel> {
this.method = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class);
this.method.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to get initChannel method", e);
}
}

Datei anzeigen

@ -44,6 +44,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.ServerConnectEvent;
@ -108,7 +109,7 @@ public class BungeeServerHandler implements Listener {
Object handshake = getHandshake.invoke(event.getPlayer().getPendingConnection());
setProtocol.invoke(handshake, protocols == null ? clientProtocolVersion : serverProtocolVersion);
} catch (InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Error setting handshake version", e);
}
}
@ -117,7 +118,7 @@ public class BungeeServerHandler implements Listener {
try {
checkServerChange(event, Via.getManager().getConnectionManager().getConnectedClient(event.getPlayer().getUniqueId()));
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to handle server switch", e);
}
}

Datei anzeigen

@ -28,6 +28,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.ClientboundPackets1_
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9;
import java.util.Collections;
import java.util.logging.Level;
import net.md_5.bungee.api.event.ServerConnectedEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
@ -56,7 +57,7 @@ public class ElytraPatch implements Listener {
wrapper.scheduleSend(Protocol1_9To1_8.class);
}
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send elytra patch metadata packet!", e);
}
}
}

Datei anzeigen

@ -17,11 +17,13 @@
*/
package com.viaversion.viaversion.bungee.providers;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.ProtocolInfo;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MainHandProvider;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -52,7 +54,7 @@ public class BungeeMainHandProvider extends MainHandProvider {
setMainHand.invoke(settings, hand);
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to set main hand for " + player.getName(), e);
}
}
}

Datei anzeigen

@ -68,10 +68,9 @@ public class BungeeVersionProvider extends BaseVersionProvider {
try {
list = ReflectionUtil.getStatic(ProtocolConstants.class, "SUPPORTED_VERSION_IDS", List.class);
return list.get(0);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
} catch (NoSuchFieldException | IllegalAccessException ignored) {
// Fallback
return ProxyServer.getInstance().getProtocolVersion();
}
}
}

Datei anzeigen

@ -17,11 +17,13 @@
*/
package com.viaversion.viaversion.bungee.storage;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.StorableObject;
import java.lang.reflect.Field;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class BungeeStorage implements StorableObject {
@ -52,7 +54,7 @@ public class BungeeStorage implements StorableObject {
try {
bossbar = (Set<UUID>) bossField.get(player);
} catch (IllegalAccessException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to get bossbar list", e);
}
}
}

Datei anzeigen

@ -36,6 +36,7 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
public class CommonBoss implements BossBar {
private final UUID uuid;
@ -233,7 +234,7 @@ public class CommonBoss implements BossBar {
try {
wrapper.scheduleSend(Protocol1_9To1_8.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send bossbar packet", e);
}
}
@ -269,7 +270,7 @@ public class CommonBoss implements BossBar {
return wrapper;
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to create bossbar packet", e);
}
return null;
}

Datei anzeigen

@ -110,7 +110,7 @@ public class BaseProtocol1_7 extends AbstractProtocol {
wrapper.set(Type.STRING, 0, GsonUtil.getGson().toJson(json)); // Update value
} catch (JsonParseException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Error handling StatusResponse", e);
}
});
}

Datei anzeigen

@ -125,7 +125,7 @@ public class MetadataRewriter1_11To1_10 extends EntityRewriter<ClientboundPacket
wrapper.send(Protocol1_11To1_10.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to update hologram position", e);
}
}
}

Datei anzeigen

@ -48,6 +48,7 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPac
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPackets1_9_3;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import com.viaversion.viaversion.rewriter.SoundRewriter;
import java.util.logging.Level;
public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9_3, ClientboundPackets1_12, ServerboundPackets1_9_3, ServerboundPackets1_12> {
@ -105,7 +106,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
wrapper.set(Type.COMPONENT, 0, obj);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Error converting 1.11.2 -> 1.12 chat item", e);
}
});

Datei anzeigen

@ -69,6 +69,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_12_1, ClientboundPackets1_13, ServerboundPackets1_12_1, ServerboundPackets1_13> {
@ -182,7 +183,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
}
wrapper.set(Type.STRING, 0, GsonUtil.getGson().toJson(json));
} catch (JsonParseException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Error transforming status response", e);
}
});
}

Datei anzeigen

@ -19,6 +19,7 @@ package com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data;
import com.google.common.collect.ObjectArrays;
import com.google.gson.reflect.TypeToken;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.util.GsonUtil;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ -27,6 +28,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
public class BlockIdData {
public static final String[] PREVIOUS = new String[0];
@ -52,7 +54,7 @@ public class BlockIdData {
}
}
} catch (IOException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to load block id mappings (1.12.2 -> 1.13)", e);
}
InputStream blockS = MappingData.class.getClassLoader()
@ -65,7 +67,7 @@ public class BlockIdData {
);
numberIdToString = new Int2ObjectOpenHashMap<>(map);
} catch (IOException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to load block number to string mappings (1.12.2)", e);
}
// Ignored
}

Datei anzeigen

@ -26,6 +26,7 @@ import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ServerboundPackets1_12_1;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import java.util.logging.Level;
public class TabCompleteTracker implements StorableObject {
private int transactionId;
@ -43,7 +44,7 @@ public class TabCompleteTracker implements StorableObject {
try {
wrapper.scheduleSendToServer(Protocol1_13To1_12_2.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send tab complete packet", e);
}
lastTabComplete = null;
}

Datei anzeigen

@ -36,6 +36,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.Compressio
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MainHandProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.ClientChunks;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9;
import java.util.logging.Level;
public class PlayerPackets {
public static void register(Protocol1_9To1_8 protocol) {
@ -43,14 +44,14 @@ public class PlayerPackets {
@Override
public void register() {
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 0 - Chat Message (json)
map(Type.BYTE); // 1 - Chat Positon
map(Type.BYTE); // 1 - Chat Position
handler(wrapper -> {
try {
JsonObject obj = (JsonObject) wrapper.get(Type.COMPONENT, 0);
ChatRewriter.toClient(obj, wrapper.user());
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to transform chat component", e);
}
});
}

Datei anzeigen

@ -38,6 +38,7 @@ import com.viaversion.viaversion.protocols.protocol1_9to1_8.metadata.MetadataRew
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.EntityTracker1_9;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
public class SpawnPackets {
public static final ValueTransformer<Integer, Double> toNewDouble = new ValueTransformer<Integer, Double>(Type.DOUBLE) {
@ -275,7 +276,7 @@ public class SpawnPackets {
try {
packet.send(Protocol1_9To1_8.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to send entity equipment packet", e);
}
}
});

Datei anzeigen

@ -48,6 +48,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import space.vectrix.flare.fastutil.Int2ObjectSyncMap;
public class EntityTracker1_9 extends EntityTrackerBase {
@ -99,7 +100,7 @@ public class EntityTracker1_9 extends EntityTrackerBase {
try {
wrapper.scheduleSend(Protocol1_9To1_8.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send second hand item", e);
}
}
@ -327,7 +328,7 @@ public class EntityTracker1_9 extends EntityTrackerBase {
wrapper.scheduleSend(Protocol1_9To1_8.class);
}
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send team packet", e);
}
}
@ -353,7 +354,7 @@ public class EntityTracker1_9 extends EntityTrackerBase {
try {
wrapper.scheduleSend(Protocol1_9To1_8.class);
} catch (Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to send metadata", e);
}
}
metadataBuffer.remove(entityId);

Datei anzeigen

@ -28,6 +28,7 @@ import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Locale;
import java.util.UUID;
import java.util.logging.Level;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class UpdateUtil {
@ -105,7 +106,7 @@ public final class UpdateUtil {
try {
statistics = GsonUtil.getGson().fromJson(builder.toString(), JsonObject.class);
} catch (JsonParseException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to parse update response", e);
return null;
}
return statistics.get("name").getAsString();

Datei anzeigen

@ -29,6 +29,7 @@ import it.unimi.dsi.fastutil.ints.IntLinkedOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSortedSet;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import org.jetbrains.annotations.Nullable;
@ -39,7 +40,7 @@ public class VelocityViaInjector implements ViaInjector {
try {
return Class.forName("com.velocitypowered.proxy.config.VelocityConfiguration").getMethod("getPlayerInfoForwardingMode");
} catch (NoSuchMethodException | ClassNotFoundException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to get getPlayerInfoForwardingMode method from Velocity, please report this issue on our GitHub.", e);
return null;
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import com.viaversion.viaversion.velocity.platform.VelocityViaInjector;
import io.netty.channel.ChannelHandler;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.stream.IntStream;
import org.jetbrains.annotations.Nullable;
@ -37,7 +38,7 @@ public class VelocityVersionProvider extends BaseVersionProvider {
try {
return Class.forName("com.velocitypowered.proxy.connection.MinecraftConnection").getMethod("getAssociation");
} catch (NoSuchMethodException | ClassNotFoundException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to get association method from Velocity, please report this issue on our GitHub.", e);
return null;
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
public final class ProtocolDetectorService extends AbstractProtocolDetectorService {
@ -90,7 +91,7 @@ public final class ProtocolDetectorService extends AbstractProtocolDetectorServi
try {
return ProtocolVersion.getProtocol(Via.getManager().getInjector().getServerProtocolVersion()).getVersion();
} catch (final Exception e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to get lowest supported protocol version", e);
return ProtocolVersion.v1_8.getVersion();
}
}

Datei anzeigen

@ -18,6 +18,7 @@
package com.viaversion.viaversion.velocity.storage;
import com.velocitypowered.api.proxy.Player;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.StorableObject;
import com.viaversion.viaversion.util.ReflectionUtil;
import java.lang.reflect.InvocationTargetException;
@ -25,6 +26,7 @@ import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.logging.Level;
public class VelocityStorage implements StorableObject {
private final Player player;
@ -42,7 +44,7 @@ public class VelocityStorage implements StorableObject {
getMinecraftConnection = Class.forName("com.velocitypowered.proxy.connection.client.ConnectedPlayer")
.getDeclaredMethod("getMinecraftConnection");
} catch (NoSuchMethodException | ClassNotFoundException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to initialize Velocity bossbar support, bossbars will not work.", e);
}
}
@ -64,7 +66,7 @@ public class VelocityStorage implements StorableObject {
cachedBossbar = (List<UUID>) getServerBossBars.invoke(sessionHandler);
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to get bossbar list", e);
}
}
return cachedBossbar;