9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

fix: adjust several methods to properly use entity rather than assuming all entities are players

This commit is contained in:
LoJoSho
2025-02-28 11:34:21 -06:00
parent 6b19bf442a
commit ea72499826
2 changed files with 3 additions and 2 deletions

View File

@@ -646,7 +646,7 @@ public class CosmeticUser {
if (isInWardrobe() && !ignoreWardrobe) {
if (WardrobeSettings.isTryCosmeticsInWardrobe() && userWardrobeManager.getWardrobeStatus().equals(UserWardrobeManager.WardrobeStatus.RUNNING)) return true;
}
return getPlayer().hasPermission(cosmetic.getPermission());
return getEntity().hasPermission(cosmetic.getPermission());
}
public void hidePlayer() {

View File

@@ -10,6 +10,7 @@ import lombok.Getter;
import lombok.Setter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@@ -44,7 +45,7 @@ public class UserEntity {
ArrayList<Player> newPlayers = new ArrayList<>();
ArrayList<Player> removePlayers = new ArrayList<>();
List<Player> players = HMCCPacketManager.getViewers(location);
Player ownerPlayer = Bukkit.getPlayer(owner);
Entity ownerPlayer = Bukkit.getEntity(owner);
if (ownerPlayer == null) {
MessagesUtil.sendDebugMessages("Owner is null (refreshViewers), returning empty list");
return List.of();