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

Merge pull request #79 from Craftinators/remapped

`CosmeticUser.getCosmetics()` changes
This commit is contained in:
LoJoSho
2023-03-14 14:36:56 -05:00
committed by GitHub
6 changed files with 13 additions and 7 deletions

View File

@@ -28,7 +28,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Set; import java.util.Set;
public class CosmeticCommand implements CommandExecutor { public class CosmeticCommand implements CommandExecutor {
@@ -333,7 +332,7 @@ public class CosmeticCommand implements CommandExecutor {
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) { if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
player.sendMessage("Backpack Location -> " + user.getUserBackpackManager().getArmorStand().getLocation()); player.sendMessage("Backpack Location -> " + user.getUserBackpackManager().getArmorStand().getLocation());
} }
player.sendMessage("Cosmetics -> " + user.getCosmetic()); player.sendMessage("Cosmetics -> " + user.getCosmetics());
player.sendMessage("EntityId -> " + player.getEntityId()); player.sendMessage("EntityId -> " + player.getEntityId());
return true; return true;
} }

View File

@@ -56,7 +56,7 @@ public class CosmeticCommandTabComplete implements TabCompleter {
completions.addAll(applyCommandComplete(user, args)); completions.addAll(applyCommandComplete(user, args));
} }
case "unapply" -> { case "unapply" -> {
for (Cosmetic cosmetic : user.getCosmetic()) { for (Cosmetic cosmetic : user.getCosmetics()) {
completions.add(cosmetic.getSlot().toString().toUpperCase()); completions.add(cosmetic.getSlot().toString().toUpperCase());
} }
completions.add("ALL"); completions.add("ALL");

View File

@@ -37,7 +37,7 @@ public abstract class Data {
data = "HIDDEN=" + user.getHiddenReason(); data = "HIDDEN=" + user.getHiddenReason();
} }
} }
for (Cosmetic cosmetic : user.getCosmetic()) { for (Cosmetic cosmetic : user.getCosmetics()) {
Color color = user.getCosmeticColor(cosmetic.getSlot()); Color color = user.getCosmeticColor(cosmetic.getSlot());
String input = cosmetic.getSlot() + "=" + cosmetic.getId(); String input = cosmetic.getSlot() + "=" + cosmetic.getId();
if (color != null) input = input + "&" + color.asRGB(); if (color != null) input = input + "&" + color.asRGB();

View File

@@ -347,7 +347,7 @@ public class PlayerGameListener implements Listener {
HashMap<Integer, ItemStack> items = new HashMap<>(); HashMap<Integer, ItemStack> items = new HashMap<>();
for (Cosmetic cosmetic : user.getCosmetic()) { for (Cosmetic cosmetic : user.getCosmetics()) {
if ((cosmetic instanceof CosmeticArmorType cosmeticArmorType)) { if ((cosmetic instanceof CosmeticArmorType cosmeticArmorType)) {
items.put(InventoryUtils.getPacketArmorSlot(cosmeticArmorType.getEquipSlot()), user.getUserCosmeticItem(cosmeticArmorType)); items.put(InventoryUtils.getPacketArmorSlot(cosmeticArmorType.getEquipSlot()), user.getUserCosmeticItem(cosmeticArmorType));
} }

View File

@@ -1,5 +1,7 @@
package com.hibiscusmc.hmccosmetics.user; package com.hibiscusmc.hmccosmetics.user;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin; import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
import com.hibiscusmc.hmccosmetics.api.*; import com.hibiscusmc.hmccosmetics.api.*;
import com.hibiscusmc.hmccosmetics.config.Settings; import com.hibiscusmc.hmccosmetics.config.Settings;
@@ -77,10 +79,15 @@ public class CosmeticUser {
return playerCosmetics.get(slot); return playerCosmetics.get(slot);
} }
@Deprecated
public Collection<Cosmetic> getCosmetic() { public Collection<Cosmetic> getCosmetic() {
return playerCosmetics.values(); return playerCosmetics.values();
} }
public ImmutableCollection<Cosmetic> getCosmetics() {
return ImmutableList.copyOf(playerCosmetics.values());
}
public void addPlayerCosmetic(Cosmetic cosmetic) { public void addPlayerCosmetic(Cosmetic cosmetic) {
addPlayerCosmetic(cosmetic, null); addPlayerCosmetic(cosmetic, null);
} }
@@ -358,7 +365,7 @@ public class CosmeticUser {
public List<CosmeticSlot> getDyeableSlots() { public List<CosmeticSlot> getDyeableSlots() {
ArrayList<CosmeticSlot> dyableSlots = new ArrayList(); ArrayList<CosmeticSlot> dyableSlots = new ArrayList();
for (Cosmetic cosmetic : getCosmetic()) { for (Cosmetic cosmetic : getCosmetics()) {
if (cosmetic.isDyable()) dyableSlots.add(cosmetic.getSlot()); if (cosmetic.isDyable()) dyableSlots.add(cosmetic.getSlot());
} }

View File

@@ -200,7 +200,7 @@ public class UserWardrobeManager {
} }
// For Wardrobe Temp Cosmetics // For Wardrobe Temp Cosmetics
for (Cosmetic cosmetic : user.getCosmetic()) { for (Cosmetic cosmetic : user.getCosmetics()) {
if (cosmetic.requiresPermission()) { if (cosmetic.requiresPermission()) {
if (!player.hasPermission(cosmetic.getPermission())) user.removeCosmeticSlot(cosmetic.getSlot()); if (!player.hasPermission(cosmetic.getPermission())) user.removeCosmeticSlot(cosmetic.getSlot());
} }