Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulloy2 committed Jun 7, 2024
1 parent d614f33 commit 03a6f62
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,25 @@

package com.comphenix.protocol.events;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

import com.comphenix.protocol.reflect.accessors.Accessors;
import com.comphenix.protocol.reflect.accessors.MethodAccessor;
import com.comphenix.protocol.utility.ByteBuddyFactory;
import com.comphenix.protocol.utility.Util;

import net.bytebuddy.description.ByteCodeElement;
import net.bytebuddy.description.modifier.Visibility;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
Expand All @@ -35,27 +50,19 @@
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.matcher.ElementMatchers;
import org.bukkit.*;
import org.bukkit.BanEntry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Statistic;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.profile.PlayerProfile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
* Represents a player object that can be serialized by Java.
*
Expand Down Expand Up @@ -291,18 +298,6 @@ public void setWhitelisted(boolean whitelisted) {
this.whitelisted = whitelisted;
}

@Nullable
@Override
public Location getRespawnLocation() {
return null;
}

@Nullable
@Override
public Location getLocation() {
return null;
}

private void writeObject(ObjectOutputStream output) throws IOException {
output.defaultWriteObject();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ public class StructureCache {

public static Object newPacket(Class<?> packetClass) {
Supplier<Object> packetConstructor = PACKET_INSTANCE_CREATORS.computeIfAbsent(packetClass, packetClassKey -> {
PacketCreator creator = PacketCreator.forPacket(packetClassKey);
if (creator.get() != null) {
return creator;
try {
PacketCreator creator = PacketCreator.forPacket(packetClassKey);
if (creator.get() != null) {
return creator;
}
} catch (Exception ignored) {
}

WrappedStreamCodec streamCodec = PacketRegistry.getStreamCodec(packetClassKey);
Expand Down

0 comments on commit 03a6f62

Please sign in to comment.