mirror of
https://github.com/GeyserExtensionists/GeyserModelEngine.git
synced 2025-12-19 15:09:18 +00:00
Updated playerJoinedCache to use UUID instead of player object
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -63,11 +63,13 @@ public class ModelListener implements Listener {
|
||||
//TODO Find out why we need this bc uh what?
|
||||
@EventHandler
|
||||
public void onPlayerLogin(PlayerJoinEvent event) {
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getPlayerManager().getPlayerJoinedCache().add(event.getPlayer()), 10);
|
||||
Player player = event.getPlayer();
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getPlayerManager().getPlayerJoinedCache().add(player.getUniqueId()), 10);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getPlayerManager().getPlayerJoinedCache().remove(event.getPlayer()), 10);
|
||||
Player player = event.getPlayer();
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin, scheduledTask -> plugin.getPlayerManager().getPlayerJoinedCache().remove(player.getUniqueId()), 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class EntityTaskManager {
|
||||
|
||||
private void sendSpawnPacket(ModelEntityData model, Player onlinePlayer) {
|
||||
EntityTaskRunnable task = model.getEntityTask();
|
||||
boolean firstJoined = !plugin.getPlayerManager().getPlayerJoinedCache().contains(onlinePlayer);
|
||||
boolean firstJoined = !plugin.getPlayerManager().getPlayerJoinedCache().contains(onlinePlayer.getUniqueId());
|
||||
|
||||
if (firstJoined) {
|
||||
task.sendEntityData(model, onlinePlayer, plugin.getConfigManager().getConfig().getInt("join-send-delay") / 50);
|
||||
@@ -113,7 +113,7 @@ public class EntityTaskManager {
|
||||
|
||||
public boolean canSee(Player player, PacketEntity entity) {
|
||||
if (!player.isOnline()) return false;
|
||||
if (!plugin.getPlayerManager().getPlayerJoinedCache().contains(player)) return false;
|
||||
if (!plugin.getPlayerManager().getPlayerJoinedCache().contains(player.getUniqueId())) return false;
|
||||
|
||||
Location playerLocation = player.getLocation().clone();
|
||||
Location entityLocation = entity.getLocation().clone();
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package re.imc.geysermodelengine.managers.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerManager {
|
||||
|
||||
private final HashSet<Player> playerJoinedCache = new HashSet<>();
|
||||
private final HashSet<UUID> playerJoinedCache = new HashSet<>();
|
||||
|
||||
public HashSet<Player> getPlayerJoinedCache() {
|
||||
public HashSet<UUID> getPlayerJoinedCache() {
|
||||
return playerJoinedCache;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user