mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
Merge remote-tracking branch 'origin/remapped' into remapped
This commit is contained in:
@@ -64,6 +64,9 @@ allprojects {
|
||||
// Eco-Suite/Auxilor Repo
|
||||
maven("https://repo.auxilor.io/repository/maven-public/")
|
||||
|
||||
// Triumph GUI
|
||||
maven("https://repo.triumphteam.dev/snapshots")
|
||||
|
||||
// Hibiscus Commons
|
||||
maven("https://repo.hibiscusmc.com/releases")
|
||||
}
|
||||
@@ -91,7 +94,7 @@ allprojects {
|
||||
testCompileOnly("org.projectlombok:lombok:1.18.36")
|
||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.36")
|
||||
|
||||
implementation("dev.triumphteam:triumph-gui:3.1.11") {
|
||||
implementation("dev.triumphteam:triumph-gui:3.1.12-SNAPSHOT") {
|
||||
exclude("net.kyori") // Already have adventure API
|
||||
}
|
||||
implementation("com.owen1212055:particlehelper:1.0.0-SNAPSHOT")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.hibiscusmc.hmccosmetics.cosmetic;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
@@ -27,15 +28,32 @@ public class CosmeticSlot {
|
||||
REGISTRY.put(name, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new slot with the given name. If a slot with the given name already exists, it will be returned.
|
||||
* @param name The name of the slot (This will automatically be converted into all UPPERCASE)
|
||||
* @return The slot that was registered or already exists.
|
||||
*/
|
||||
@NotNull
|
||||
public static CosmeticSlot register(@NotNull String name) {
|
||||
name = name.toUpperCase();
|
||||
return REGISTRY.computeIfAbsent(name, key -> new CosmeticSlot(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable map of all the slots that have been registered.
|
||||
* @return An unmodifiable map of all the slots that have been registered.
|
||||
*/
|
||||
@NotNull
|
||||
public static Map<String, CosmeticSlot> values() {
|
||||
return Collections.unmodifiableMap(REGISTRY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot with the given name.
|
||||
* @param name The name of the slot to get. This is automatically converted to all UPPERCASE.
|
||||
* @return The slot with the given name, or null if it does not exist.
|
||||
*/
|
||||
@Nullable
|
||||
public static CosmeticSlot valueOf(@NotNull String name) {
|
||||
name = name.toUpperCase();
|
||||
return REGISTRY.get(name);
|
||||
@@ -43,8 +61,8 @@ public class CosmeticSlot {
|
||||
|
||||
/**
|
||||
* Checks if the registry contains a slot with the given name.
|
||||
* @param name
|
||||
* @return
|
||||
* @param name The name of the slot to check for. This is automatically converted to all UPPERCASE.
|
||||
* @return True if the slot exists, false otherwise.
|
||||
*/
|
||||
public static boolean contains(@NotNull String name) {
|
||||
name = name.toUpperCase();
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.hibiscusmc.hmccosmetics.gui.type.types.TypeCosmetic;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
import dev.triumphteam.gui.builder.item.ItemBuilder;
|
||||
import dev.triumphteam.gui.components.GuiType;
|
||||
import dev.triumphteam.gui.components.InventoryProvider;
|
||||
import dev.triumphteam.gui.guis.Gui;
|
||||
import dev.triumphteam.gui.guis.GuiItem;
|
||||
import lombok.Getter;
|
||||
@@ -24,6 +26,7 @@ import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -141,7 +144,9 @@ public class Menu {
|
||||
final Component component = AdventureUtils.MINI_MESSAGE.deserialize(Hooks.processPlaceholders(player, this.title));
|
||||
Gui gui = Gui.gui()
|
||||
.title(component)
|
||||
.type(GuiType.CHEST)
|
||||
.rows(this.rows)
|
||||
.inventory((title, owner, rows) -> Bukkit.createInventory(owner, rows, title))
|
||||
.create();
|
||||
|
||||
gui.setDefaultClickAction(event -> event.setCancelled(true));
|
||||
|
||||
@@ -21,11 +21,11 @@ import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager;
|
||||
import com.hibiscusmc.hmccosmetics.user.manager.UserWardrobeManager;
|
||||
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||
import lombok.Getter;
|
||||
import me.lojosho.hibiscuscommons.hooks.Hooks;
|
||||
import me.lojosho.hibiscuscommons.util.InventoryUtils;
|
||||
import me.lojosho.hibiscuscommons.util.ServerUtils;
|
||||
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
@@ -270,7 +270,7 @@ public class CosmeticUser {
|
||||
}
|
||||
}
|
||||
if (items.isEmpty() || getEntity() == null) return;
|
||||
PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), items, ServerUtils.getViewers(getEntity()));
|
||||
PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), items, HMCCPacketManager.getViewers(getEntity().getLocation()));
|
||||
MessagesUtil.sendDebugMessages("updateCosmetic (All) - end - " + items.size());
|
||||
}
|
||||
|
||||
@@ -540,9 +540,9 @@ public class CosmeticUser {
|
||||
EquipmentSlot equipmentSlot = HMCCInventoryUtils.getEquipmentSlot(slot);
|
||||
if (equipmentSlot == null) return;
|
||||
if (getPlayer() != null) {
|
||||
PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), equipmentSlot, getPlayer().getInventory().getItem(equipmentSlot), ServerUtils.getViewers(getEntity()));
|
||||
PacketManager.equipmentSlotUpdate(getEntity().getEntityId(), equipmentSlot, getPlayer().getInventory().getItem(equipmentSlot), HMCCPacketManager.getViewers(getEntity().getLocation()));
|
||||
} else {
|
||||
HMCCPacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, ServerUtils.getViewers(getEntity()));
|
||||
HMCCPacketManager.equipmentSlotUpdate(getEntity().getEntityId(), this, slot, HMCCPacketManager.getViewers(getEntity().getLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ public class CosmeticUser {
|
||||
if (!isBalloonSpawned()) respawnBalloon();
|
||||
CosmeticBalloonType balloonType = (CosmeticBalloonType) getCosmetic(CosmeticSlot.BALLOON);
|
||||
getBalloonManager().addPlayerToModel(this, balloonType);
|
||||
List<Player> viewer = ServerUtils.getViewers(getEntity());
|
||||
List<Player> viewer = HMCCPacketManager.getViewers(getEntity().getLocation());
|
||||
HMCCPacketManager.sendLeashPacket(getBalloonManager().getPufferfishBalloonId(), getPlayer().getEntityId(), viewer);
|
||||
}
|
||||
if (hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.lojosho.hibiscuscommons.util.ServerUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -44,12 +43,12 @@ public class UserEntity {
|
||||
if (System.currentTimeMillis() - viewerLastUpdate <= 1000) return List.of(); //Prevents mass refreshes
|
||||
ArrayList<Player> newPlayers = new ArrayList<>();
|
||||
ArrayList<Player> removePlayers = new ArrayList<>();
|
||||
List<Player> players = HMCCPacketManager.getViewers(location);
|
||||
Player ownerPlayer = Bukkit.getPlayer(owner);
|
||||
if (ownerPlayer == null) {
|
||||
MessagesUtil.sendDebugMessages("Owner is null (refreshViewers), returning empty list");
|
||||
return List.of();
|
||||
}
|
||||
List<Player> players = ServerUtils.getViewers(ownerPlayer);
|
||||
|
||||
for (Player player : players) {
|
||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerRelEnt
|
||||
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
|
||||
Reference in New Issue
Block a user