mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-22 16:39:21 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e378732d44 | ||
|
|
74eb5dd85a | ||
|
|
c9ba396c33 | ||
|
|
3967ac4fa5 | ||
|
|
b1a35df7b5 | ||
|
|
0e1c9b3f7e | ||
|
|
0238ac8fc4 | ||
|
|
4d6baf0b0c | ||
|
|
157fab6309 | ||
|
|
fb8dcf53e3 | ||
|
|
a01f35c53d |
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.2.1"
|
version = "2.2.2"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -10,21 +10,22 @@ import org.spongepowered.configurate.ConfigurationNode;
|
|||||||
|
|
||||||
public class CosmeticBackpackType extends Cosmetic {
|
public class CosmeticBackpackType extends Cosmetic {
|
||||||
|
|
||||||
ConfigurationNode config;
|
private String modelName;
|
||||||
|
private ConfigurationNode config;
|
||||||
|
|
||||||
public CosmeticBackpackType(String id, ConfigurationNode config) {
|
public CosmeticBackpackType(String id, ConfigurationNode config) {
|
||||||
super(id, config);
|
super(id, config);
|
||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
modelName = config.node("model").getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(CosmeticUser user) {
|
public void update(CosmeticUser user) {
|
||||||
Player player = Bukkit.getPlayer(user.getUniqueId());
|
Player player = Bukkit.getPlayer(user.getUniqueId());
|
||||||
Location loc = player.getLocation().clone();
|
Location loc = player.getLocation().clone().add(0, 2, 0);
|
||||||
|
|
||||||
if (user.isInWardrobe()) return;
|
|
||||||
|
|
||||||
|
if (user.isInWardrobe() || !user.isBackupSpawned()) return;
|
||||||
if (loc.getWorld() != user.getUserBackpackManager().getArmorstand().getWorld()) {
|
if (loc.getWorld() != user.getUserBackpackManager().getArmorstand().getWorld()) {
|
||||||
user.getUserBackpackManager().getArmorstand().teleport(loc);
|
user.getUserBackpackManager().getArmorstand().teleport(loc);
|
||||||
}
|
}
|
||||||
@@ -36,4 +37,8 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
user.getUserBackpackManager().getArmorstand().setRotation(loc.getYaw(), loc.getPitch());
|
user.getUserBackpackManager().getArmorstand().setRotation(loc.getYaw(), loc.getPitch());
|
||||||
user.getUserBackpackManager().showBackpack();
|
user.getUserBackpackManager().showBackpack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getModelName() {
|
||||||
|
return modelName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.hibiscusmc.hmccosmetics.config.Settings;
|
|||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
||||||
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticEmoteType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticEmoteType;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||||
@@ -28,12 +29,10 @@ import org.bukkit.NamespacedKey;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Pose;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
|
||||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
@@ -157,14 +156,34 @@ public class PlayerGameListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLook(PlayerMoveEvent event) {
|
public void onPlayerLook(PlayerMoveEvent event) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
|
Player player = event.getPlayer();
|
||||||
// TODO: Move to packets
|
// TODO: Move to packets
|
||||||
CosmeticUser user = CosmeticUsers.getUser(event.getPlayer().getUniqueId());
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
if (user == null) return;
|
if (user == null) return;
|
||||||
// Really need to look into optimization of this
|
// Really need to look into optimization of this
|
||||||
user.updateCosmetic(CosmeticSlot.BACKPACK);
|
user.updateCosmetic(CosmeticSlot.BACKPACK);
|
||||||
user.updateCosmetic(CosmeticSlot.BALLOON);
|
user.updateCosmetic(CosmeticSlot.BALLOON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerPoseChange(EntityPoseChangeEvent event) {
|
||||||
|
if (!(event.getEntity() instanceof Player)) return;
|
||||||
|
Player player = ((Player) event.getEntity()).getPlayer();
|
||||||
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
|
if (user == null) return;
|
||||||
|
if (!user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) return;
|
||||||
|
Pose pose = event.getPose();
|
||||||
|
if (pose.equals(Pose.STANDING)) {
|
||||||
|
if (!user.isBackupSpawned()) {
|
||||||
|
user.spawnBackpack((CosmeticBackpackType) user.getCosmetic(CosmeticSlot.BACKPACK));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pose.equals(Pose.SLEEPING) || pose.equals(Pose.SWIMMING) || pose.equals(Pose.FALL_FLYING)) {
|
||||||
|
user.despawnBackpack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerArmorDamage(PlayerItemDamageEvent event) {
|
public void onPlayerArmorDamage(PlayerItemDamageEvent event) {
|
||||||
// Possibly look into cancelling the event, then handling the damage on our own.
|
// Possibly look into cancelling the event, then handling the damage on our own.
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ public class CosmeticUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
|
if (this.userBackpackManager != null) return;
|
||||||
this.userBackpackManager = new UserBackpackManager(this);
|
this.userBackpackManager = new UserBackpackManager(this);
|
||||||
userBackpackManager.spawnBackpack(cosmeticBackpackType);
|
userBackpackManager.spawnBackpack(cosmeticBackpackType);
|
||||||
}
|
}
|
||||||
@@ -296,7 +297,10 @@ public class CosmeticUser {
|
|||||||
userBackpackManager = null;
|
userBackpackManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBackupSpawned() {
|
||||||
|
if (this.userBackpackManager == null) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) {
|
public void spawnBalloon(CosmeticBalloonType cosmeticBalloonType) {
|
||||||
Player player = Bukkit.getPlayer(getUniqueId());
|
Player player = Bukkit.getPlayer(getUniqueId());
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.user.manager;
|
package com.hibiscusmc.hmccosmetics.user.manager;
|
||||||
|
|
||||||
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBackpackType;
|
||||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
|
import com.ticxo.modelengine.api.ModelEngineAPI;
|
||||||
|
import com.ticxo.modelengine.api.model.ActiveModel;
|
||||||
|
import com.ticxo.modelengine.api.model.ModeledEntity;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class UserBackpackManager {
|
public class UserBackpackManager {
|
||||||
|
|
||||||
private boolean hideBackpack;
|
private boolean hideBackpack;
|
||||||
@@ -36,6 +42,16 @@ public class UserBackpackManager {
|
|||||||
|
|
||||||
this.invisibleArmorstand = (ArmorStand) NMSHandlers.getHandler().spawnBackpack(user, cosmeticBackpackType);
|
this.invisibleArmorstand = (ArmorStand) NMSHandlers.getHandler().spawnBackpack(user, cosmeticBackpackType);
|
||||||
|
|
||||||
|
if (cosmeticBackpackType.getModelName() != null && HMCCosmeticsPlugin.hasModelEngine()) {
|
||||||
|
if (ModelEngineAPI.api.getModelRegistry().getBlueprint(cosmeticBackpackType.getModelName()) == null) {
|
||||||
|
MessagesUtil.sendDebugMessages("Invalid Model Engine Blueprint " + cosmeticBackpackType.getModelName(), Level.SEVERE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ModeledEntity modeledEntity = ModelEngineAPI.getOrCreateModeledEntity(invisibleArmorstand);
|
||||||
|
ActiveModel model = ModelEngineAPI.createActiveModel(ModelEngineAPI.getBlueprint(cosmeticBackpackType.getModelName()));
|
||||||
|
model.setCanHurt(false);
|
||||||
|
modeledEntity.addModel(model, false);
|
||||||
|
}
|
||||||
|
|
||||||
MessagesUtil.sendDebugMessages("spawnBackpack Bukkit - Finish");
|
MessagesUtil.sendDebugMessages("spawnBackpack Bukkit - Finish");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class UserWardrobeManager {
|
|||||||
private UUID WARDROBE_UUID;
|
private UUID WARDROBE_UUID;
|
||||||
private int ARMORSTAND_ID;
|
private int ARMORSTAND_ID;
|
||||||
private GameMode originalGamemode;
|
private GameMode originalGamemode;
|
||||||
private CosmeticUser VIEWER;
|
private CosmeticUser user;
|
||||||
private Location viewingLocation;
|
private Location viewingLocation;
|
||||||
private Location npcLocation;
|
private Location npcLocation;
|
||||||
private Location exitLocation;
|
private Location exitLocation;
|
||||||
@@ -46,7 +46,7 @@ public class UserWardrobeManager {
|
|||||||
NPC_ID = NMSHandlers.getHandler().getNextEntityId();
|
NPC_ID = NMSHandlers.getHandler().getNextEntityId();
|
||||||
ARMORSTAND_ID = NMSHandlers.getHandler().getNextEntityId();
|
ARMORSTAND_ID = NMSHandlers.getHandler().getNextEntityId();
|
||||||
WARDROBE_UUID = UUID.randomUUID();
|
WARDROBE_UUID = UUID.randomUUID();
|
||||||
VIEWER = user;
|
this.user = user;
|
||||||
|
|
||||||
exitLocation = WardrobeSettings.getLeaveLocation();
|
exitLocation = WardrobeSettings.getLeaveLocation();
|
||||||
viewingLocation = WardrobeSettings.getViewerLocation();
|
viewingLocation = WardrobeSettings.getViewerLocation();
|
||||||
@@ -59,7 +59,7 @@ public class UserWardrobeManager {
|
|||||||
NPC_ID = NMSHandlers.getHandler().getNextEntityId();
|
NPC_ID = NMSHandlers.getHandler().getNextEntityId();
|
||||||
ARMORSTAND_ID = NMSHandlers.getHandler().getNextEntityId();
|
ARMORSTAND_ID = NMSHandlers.getHandler().getNextEntityId();
|
||||||
WARDROBE_UUID = UUID.randomUUID();
|
WARDROBE_UUID = UUID.randomUUID();
|
||||||
VIEWER = user;
|
this.user = user;
|
||||||
|
|
||||||
this.exitLocation = exitLocation;
|
this.exitLocation = exitLocation;
|
||||||
this.viewingLocation = viewingLocation;
|
this.viewingLocation = viewingLocation;
|
||||||
@@ -70,14 +70,14 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
setWardrobeStatus(WardrobeStatus.STARTING);
|
setWardrobeStatus(WardrobeStatus.STARTING);
|
||||||
Player player = VIEWER.getPlayer();
|
Player player = user.getPlayer();
|
||||||
|
|
||||||
this.originalGamemode = player.getGameMode();
|
this.originalGamemode = player.getGameMode();
|
||||||
if (WardrobeSettings.isReturnLastLocation()) {
|
if (WardrobeSettings.isReturnLastLocation()) {
|
||||||
this.exitLocation = player.getLocation().clone();
|
this.exitLocation = player.getLocation().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
VIEWER.hidePlayer();
|
user.hidePlayer();
|
||||||
List<Player> viewer = List.of(player);
|
List<Player> viewer = List.of(player);
|
||||||
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
||||||
outsideViewers.remove(player);
|
outsideViewers.remove(player);
|
||||||
@@ -113,17 +113,18 @@ public class UserWardrobeManager {
|
|||||||
PacketManager.sendRotationPacket(NPC_ID, npcLocation, true, viewer);
|
PacketManager.sendRotationPacket(NPC_ID, npcLocation, true, viewer);
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
PacketManager.ridingMountPacket(NPC_ID, VIEWER.getUserBackpackManager().getFirstArmorstandId(), viewer);
|
user.getUserBackpackManager().getArmorstand().teleport(npcLocation.clone().add(0, 2, 0));
|
||||||
|
PacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorstandId(), viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
||||||
PacketManager.sendLeashPacket(VIEWER.getBalloonManager().getPufferfishBalloonId(), -1, viewer);
|
PacketManager.sendLeashPacket(user.getBalloonManager().getPufferfishBalloonId(), -1, viewer);
|
||||||
PacketManager.sendLeashPacket(VIEWER.getBalloonManager().getPufferfishBalloonId(), NPC_ID, viewer); // This needs a possible fix
|
PacketManager.sendLeashPacket(user.getBalloonManager().getPufferfishBalloonId(), NPC_ID, viewer); // This needs a possible fix
|
||||||
//PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getModelId(), NPC_ID, viewer);
|
//PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getModelId(), NPC_ID, viewer);
|
||||||
|
|
||||||
PacketManager.sendTeleportPacket(VIEWER.getBalloonManager().getPufferfishBalloonId(), npcLocation.clone().add(Settings.getBalloonOffset()), false, viewer);
|
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), npcLocation.clone().add(Settings.getBalloonOffset()), false, viewer);
|
||||||
VIEWER.getBalloonManager().getModelEntity().teleport(npcLocation.clone().add(Settings.getBalloonOffset()));
|
user.getBalloonManager().getModelEntity().teleport(npcLocation.clone().add(Settings.getBalloonOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WardrobeSettings.getEnabledBossbar()) {
|
if (WardrobeSettings.getEnabledBossbar()) {
|
||||||
@@ -144,7 +145,7 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
if (WardrobeSettings.isEnabledTransition()) {
|
if (WardrobeSettings.isEnabledTransition()) {
|
||||||
MessagesUtil.sendTitle(
|
MessagesUtil.sendTitle(
|
||||||
VIEWER.getPlayer(),
|
user.getPlayer(),
|
||||||
WardrobeSettings.getTransitionText(),
|
WardrobeSettings.getTransitionText(),
|
||||||
WardrobeSettings.getTransitionFadeIn(),
|
WardrobeSettings.getTransitionFadeIn(),
|
||||||
WardrobeSettings.getTransitionStay(),
|
WardrobeSettings.getTransitionStay(),
|
||||||
@@ -159,7 +160,7 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
public void end() {
|
public void end() {
|
||||||
setWardrobeStatus(WardrobeStatus.STOPPING);
|
setWardrobeStatus(WardrobeStatus.STOPPING);
|
||||||
Player player = VIEWER.getPlayer();
|
Player player = user.getPlayer();
|
||||||
|
|
||||||
List<Player> viewer = List.of(player);
|
List<Player> viewer = List.of(player);
|
||||||
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
||||||
@@ -171,7 +172,7 @@ public class UserWardrobeManager {
|
|||||||
this.active = false;
|
this.active = false;
|
||||||
|
|
||||||
// NPC
|
// NPC
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BALLOON)) PacketManager.sendLeashPacket(VIEWER.getBalloonManager().getModelId(), -1, viewer);
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) PacketManager.sendLeashPacket(user.getBalloonManager().getModelId(), -1, viewer);
|
||||||
PacketManager.sendEntityDestroyPacket(NPC_ID, viewer); // Success
|
PacketManager.sendEntityDestroyPacket(NPC_ID, viewer); // Success
|
||||||
PacketManager.sendRemovePlayerPacket(player, WARDROBE_UUID, viewer); // Success
|
PacketManager.sendRemovePlayerPacket(player, WARDROBE_UUID, viewer); // Success
|
||||||
|
|
||||||
@@ -184,15 +185,15 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
//PacketManager.sendEntityDestroyPacket(player.getEntityId(), viewer); // Success
|
//PacketManager.sendEntityDestroyPacket(player.getEntityId(), viewer); // Success
|
||||||
player.setGameMode(this.originalGamemode);
|
player.setGameMode(this.originalGamemode);
|
||||||
VIEWER.showPlayer();
|
user.showPlayer();
|
||||||
|
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
VIEWER.respawnBackpack();
|
user.respawnBackpack();
|
||||||
//PacketManager.ridingMountPacket(player.getEntityId(), VIEWER.getBackpackEntity().getEntityId(), viewer);
|
//PacketManager.ridingMountPacket(player.getEntityId(), VIEWER.getBackpackEntity().getEntityId(), viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
||||||
VIEWER.respawnBalloon();
|
user.respawnBalloon();
|
||||||
//PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getPufferfishBalloonId(), player.getEntityId(), viewer);
|
//PacketManager.sendLeashPacket(VIEWER.getBalloonEntity().getPufferfishBalloonId(), player.getEntityId(), viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +204,7 @@ public class UserWardrobeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (WardrobeSettings.isEquipPumpkin()) {
|
if (WardrobeSettings.isEquipPumpkin()) {
|
||||||
NMSHandlers.getHandler().equipmentSlotUpdate(VIEWER.getPlayer().getEntityId(), EquipmentSlot.HEAD, player.getInventory().getHelmet(), viewer);
|
NMSHandlers.getHandler().equipmentSlotUpdate(user.getPlayer().getEntityId(), EquipmentSlot.HEAD, player.getInventory().getHelmet(), viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WardrobeSettings.getEnabledBossbar()) {
|
if (WardrobeSettings.getEnabledBossbar()) {
|
||||||
@@ -212,7 +213,7 @@ public class UserWardrobeManager {
|
|||||||
target.hideBossBar(bossBar);
|
target.hideBossBar(bossBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
VIEWER.updateCosmetic();
|
user.updateCosmetic();
|
||||||
};
|
};
|
||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
@@ -223,22 +224,22 @@ public class UserWardrobeManager {
|
|||||||
BukkitRunnable runnable = new BukkitRunnable() {
|
BukkitRunnable runnable = new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (active == false || VIEWER.getPlayer() == null) {
|
if (active == false || user.getPlayer() == null) {
|
||||||
MessagesUtil.sendDebugMessages("Active is false");
|
MessagesUtil.sendDebugMessages("Active is false");
|
||||||
this.cancel();
|
this.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessagesUtil.sendDebugMessages("Update ");
|
MessagesUtil.sendDebugMessages("Update ");
|
||||||
List<Player> viewer = List.of(VIEWER.getPlayer());
|
List<Player> viewer = List.of(user.getPlayer());
|
||||||
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
List<Player> outsideViewers = PacketManager.getViewers(viewingLocation);
|
||||||
outsideViewers.remove(VIEWER.getPlayer());
|
outsideViewers.remove(user.getPlayer());
|
||||||
|
|
||||||
Location location = WardrobeSettings.getWardrobeLocation().clone();
|
Location location = WardrobeSettings.getWardrobeLocation().clone();
|
||||||
int yaw = data.get();
|
int yaw = data.get();
|
||||||
location.setYaw(yaw);
|
location.setYaw(yaw);
|
||||||
|
|
||||||
PacketManager.sendLookPacket(NPC_ID, location, viewer);
|
PacketManager.sendLookPacket(NPC_ID, location, viewer);
|
||||||
VIEWER.hidePlayer();
|
user.hidePlayer();
|
||||||
int rotationSpeed = WardrobeSettings.getRotationSpeed();
|
int rotationSpeed = WardrobeSettings.getRotationSpeed();
|
||||||
location.setYaw(ServerUtils.getNextYaw(yaw - 30, rotationSpeed));
|
location.setYaw(ServerUtils.getNextYaw(yaw - 30, rotationSpeed));
|
||||||
PacketManager.sendRotationPacket(NPC_ID, location, true, viewer);
|
PacketManager.sendRotationPacket(NPC_ID, location, true, viewer);
|
||||||
@@ -246,26 +247,26 @@ public class UserWardrobeManager {
|
|||||||
data.set(nextyaw);
|
data.set(nextyaw);
|
||||||
|
|
||||||
for (CosmeticSlot slot : CosmeticSlot.values()) {
|
for (CosmeticSlot slot : CosmeticSlot.values()) {
|
||||||
PacketManager.equipmentSlotUpdate(NPC_ID, VIEWER, slot, viewer);
|
PacketManager.equipmentSlotUpdate(NPC_ID, user, slot, viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
PacketManager.sendTeleportPacket(VIEWER.getUserBackpackManager().getFirstArmorstandId(), location, false, viewer);
|
PacketManager.sendTeleportPacket(user.getUserBackpackManager().getFirstArmorstandId(), location, false, viewer);
|
||||||
PacketManager.ridingMountPacket(NPC_ID, VIEWER.getUserBackpackManager().getFirstArmorstandId(), viewer);
|
PacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorstandId(), viewer);
|
||||||
VIEWER.getUserBackpackManager().getArmorstand().setRotation(nextyaw, 0);
|
user.getUserBackpackManager().getArmorstand().setRotation(nextyaw, 0);
|
||||||
PacketManager.sendEntityDestroyPacket(VIEWER.getUserBackpackManager().getFirstArmorstandId(), outsideViewers);
|
PacketManager.sendEntityDestroyPacket(user.getUserBackpackManager().getFirstArmorstandId(), outsideViewers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIEWER.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) {
|
||||||
PacketManager.sendTeleportPacket(VIEWER.getBalloonManager().getPufferfishBalloonId(), WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset()), false, viewer);
|
PacketManager.sendTeleportPacket(user.getBalloonManager().getPufferfishBalloonId(), WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset()), false, viewer);
|
||||||
VIEWER.getBalloonManager().getModelEntity().teleport(WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset()));
|
user.getBalloonManager().getModelEntity().teleport(WardrobeSettings.getWardrobeLocation().add(Settings.getBalloonOffset()));
|
||||||
PacketManager.sendLeashPacket(VIEWER.getBalloonManager().getPufferfishBalloonId(), -1, outsideViewers);
|
PacketManager.sendLeashPacket(user.getBalloonManager().getPufferfishBalloonId(), -1, outsideViewers);
|
||||||
PacketManager.sendEntityDestroyPacket(VIEWER.getBalloonManager().getModelId(), outsideViewers);
|
PacketManager.sendEntityDestroyPacket(user.getBalloonManager().getModelId(), outsideViewers);
|
||||||
PacketManager.sendLeashPacket(VIEWER.getBalloonManager().getPufferfishBalloonId(), NPC_ID, viewer); // Pufferfish goes away for some reason?
|
PacketManager.sendLeashPacket(user.getBalloonManager().getPufferfishBalloonId(), NPC_ID, viewer); // Pufferfish goes away for some reason?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WardrobeSettings.isEquipPumpkin()) {
|
if (WardrobeSettings.isEquipPumpkin()) {
|
||||||
NMSHandlers.getHandler().equipmentSlotUpdate(VIEWER.getPlayer().getEntityId(), EquipmentSlot.HEAD, new ItemStack(Material.CARVED_PUMPKIN), viewer);
|
NMSHandlers.getHandler().equipmentSlotUpdate(user.getPlayer().getEntityId(), EquipmentSlot.HEAD, new ItemStack(Material.CARVED_PUMPKIN), viewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user