mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-25 09:59:28 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e378732d44 | ||
|
|
74eb5dd85a | ||
|
|
c9ba396c33 | ||
|
|
3967ac4fa5 | ||
|
|
b1a35df7b5 | ||
|
|
0e1c9b3f7e | ||
|
|
0238ac8fc4 | ||
|
|
4d6baf0b0c | ||
|
|
157fab6309 | ||
|
|
0a488a6791 | ||
|
|
1c9989e64a | ||
|
|
fb8dcf53e3 | ||
|
|
17179cbe35 | ||
|
|
f589696d19 | ||
|
|
68e87cba6f | ||
|
|
63a0bdd0d5 | ||
|
|
a01f35c53d | ||
|
|
a607f2dcbd | ||
|
|
7a9a002e25 | ||
|
|
fd50cd058a | ||
|
|
970ca8227b |
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.2.0"
|
version = "2.2.2"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public class Settings {
|
|||||||
private static final String PARTICLE_COUNT = "particle-count";
|
private static final String PARTICLE_COUNT = "particle-count";
|
||||||
private static final String DYE_MENU_PATH = "dye-menu";
|
private static final String DYE_MENU_PATH = "dye-menu";
|
||||||
private static final String DYE_MENU_NAME = "title";
|
private static final String DYE_MENU_NAME = "title";
|
||||||
|
private static final String DYE_MENU_INPUT_SLOT = "input-slot";
|
||||||
|
private static final String DYE_MENU_OUTPUT_SLOT = "output-slot";
|
||||||
private static final String DEBUG_ENABLE_PETH = "debug-mode";
|
private static final String DEBUG_ENABLE_PETH = "debug-mode";
|
||||||
private static final String TICK_PERIOD_PATH = "tick-period";
|
private static final String TICK_PERIOD_PATH = "tick-period";
|
||||||
private static final String UNAPPLY_DEATH_PATH = "unapply-on-death";
|
private static final String UNAPPLY_DEATH_PATH = "unapply-on-death";
|
||||||
@@ -33,6 +35,8 @@ public class Settings {
|
|||||||
|
|
||||||
private static String defaultMenu;
|
private static String defaultMenu;
|
||||||
private static String dyeMenuName;
|
private static String dyeMenuName;
|
||||||
|
private static int dyeMenuInputSlot;
|
||||||
|
private static int dyeMenuOutputSlot;
|
||||||
private static int configVersion;
|
private static int configVersion;
|
||||||
private static boolean requireEmptyHelmet;
|
private static boolean requireEmptyHelmet;
|
||||||
private static boolean requireEmptyOffHand;
|
private static boolean requireEmptyOffHand;
|
||||||
@@ -85,6 +89,8 @@ public class Settings {
|
|||||||
ConfigurationNode dyeMenuSettings = source.node(DYE_MENU_PATH);
|
ConfigurationNode dyeMenuSettings = source.node(DYE_MENU_PATH);
|
||||||
|
|
||||||
dyeMenuName = dyeMenuSettings.node(DYE_MENU_NAME).getString("Dye Menu");
|
dyeMenuName = dyeMenuSettings.node(DYE_MENU_NAME).getString("Dye Menu");
|
||||||
|
dyeMenuInputSlot = dyeMenuSettings.node(DYE_MENU_INPUT_SLOT).getInt(19);
|
||||||
|
dyeMenuOutputSlot = dyeMenuSettings.node(DYE_MENU_OUTPUT_SLOT).getInt(25);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector loadVector(final ConfigurationNode config) {
|
private static Vector loadVector(final ConfigurationNode config) {
|
||||||
@@ -178,6 +184,8 @@ public class Settings {
|
|||||||
public static String getDyeMenuName() {
|
public static String getDyeMenuName() {
|
||||||
return dyeMenuName;
|
return dyeMenuName;
|
||||||
}
|
}
|
||||||
|
public static int getDyeMenuInputSlot() { return dyeMenuInputSlot; }
|
||||||
|
public static int getDyeMenuOutputSlot() { return dyeMenuOutputSlot; }
|
||||||
|
|
||||||
public static boolean isDebugEnabled() {
|
public static boolean isDebugEnabled() {
|
||||||
return debugMode;
|
return debugMode;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ public class DyeMenu {
|
|||||||
Player player = user.getPlayer();
|
Player player = user.getPlayer();
|
||||||
Gui gui = HMCColorApi.INSTANCE.colorMenu();
|
Gui gui = HMCColorApi.INSTANCE.colorMenu();
|
||||||
gui.updateTitle(Placeholder.applyPapiPlaceholders(player, Settings.getDyeMenuName()));
|
gui.updateTitle(Placeholder.applyPapiPlaceholders(player, Settings.getDyeMenuName()));
|
||||||
gui.setItem(19, new GuiItem(originalItem));
|
gui.setItem(Settings.getDyeMenuInputSlot(), new GuiItem(originalItem));
|
||||||
gui.setDefaultTopClickAction(event -> {
|
gui.setDefaultTopClickAction(event -> {
|
||||||
if (event.getSlot() == 25) {
|
if (event.getSlot() == Settings.getDyeMenuOutputSlot()) {
|
||||||
ItemStack item = event.getInventory().getItem(25);
|
ItemStack item = event.getInventory().getItem(Settings.getDyeMenuOutputSlot());
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta == null) return;
|
if (meta == null) return;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class Hooks {
|
|||||||
private static HashMap<String, Hook> hooks = new HashMap<>();
|
private static HashMap<String, Hook> hooks = new HashMap<>();
|
||||||
private static HookOraxen ORAXEN_HOOK = new HookOraxen();
|
private static HookOraxen ORAXEN_HOOK = new HookOraxen();
|
||||||
private static HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
private static HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
||||||
|
private static HookLooty LOOTY_HOOK = new HookLooty();
|
||||||
private static HookMythic MYTHIC_HOOK = new HookMythic();
|
private static HookMythic MYTHIC_HOOK = new HookMythic();
|
||||||
private static HookHMCCosmetics HMCCOSMETIC_HOOK = new HookHMCCosmetics();
|
private static HookHMCCosmetics HMCCOSMETIC_HOOK = new HookHMCCosmetics();
|
||||||
private static HookPlaceholderAPI PAPI_HOOK = new HookPlaceholderAPI();
|
private static HookPlaceholderAPI PAPI_HOOK = new HookPlaceholderAPI();
|
||||||
@@ -65,7 +66,8 @@ public class Hooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isActiveHook(String id) {
|
public static boolean isActiveHook(String id) {
|
||||||
if (!hooks.containsKey(getHook(id))) return false;
|
Hook hook = getHook(id);
|
||||||
return hooks.get(getHook(id)).getActive();
|
if (hook == null) return false;
|
||||||
|
return hook.getActive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.hibiscusmc.hmccosmetics.hooks.Hook;
|
|||||||
public class HookPlaceholderAPI extends Hook {
|
public class HookPlaceholderAPI extends Hook {
|
||||||
|
|
||||||
public HookPlaceholderAPI() {
|
public HookPlaceholderAPI() {
|
||||||
super("placeholderapi");
|
super("PlaceholderAPI");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ dye-menu:
|
|||||||
# If you use ItemsAdder, set this to "§f:offset_-8::cosmetics_gui:"
|
# If you use ItemsAdder, set this to "§f:offset_-8::cosmetics_gui:"
|
||||||
# If you use Oraxen, set this to "<glyph:neg_shift_8><glyph:dye_menu>"
|
# If you use Oraxen, set this to "<glyph:neg_shift_8><glyph:dye_menu>"
|
||||||
title: "§f"
|
title: "§f"
|
||||||
|
input-slot: 19
|
||||||
|
output-slot: 25
|
||||||
wardrobe:
|
wardrobe:
|
||||||
# spawn static wardrobe if in this radius of wardrobe-location
|
# spawn static wardrobe if in this radius of wardrobe-location
|
||||||
static-radius: 10
|
static-radius: 10
|
||||||
@@ -81,4 +83,4 @@ wardrobe:
|
|||||||
y: 5
|
y: 5
|
||||||
z: 5
|
z: 5
|
||||||
yaw: 0
|
yaw: 0
|
||||||
pitch: 0
|
pitch: 0
|
||||||
|
|||||||
@@ -101,4 +101,13 @@ meditate:
|
|||||||
animation: meditate
|
animation: meditate
|
||||||
thinking:
|
thinking:
|
||||||
slot: EMOTE
|
slot: EMOTE
|
||||||
animation: thinking
|
animation: thinking
|
||||||
|
explorer_backpack:
|
||||||
|
slot: BACKPACK
|
||||||
|
permission: "hmccosmetics.explorer_backpack"
|
||||||
|
dyeable: true
|
||||||
|
item:
|
||||||
|
material: LEATHER_HORSE_ARMOR
|
||||||
|
model-data: 3
|
||||||
|
name: "<white>Explorer's Backpack"
|
||||||
|
amount: 1
|
||||||
@@ -156,4 +156,15 @@ items:
|
|||||||
material: PAPER
|
material: PAPER
|
||||||
name: "<blue>Thinking Emote"
|
name: "<blue>Thinking Emote"
|
||||||
type: cosmetic
|
type: cosmetic
|
||||||
cosmetic: thinking
|
cosmetic: thinking
|
||||||
|
explorer_backpack:
|
||||||
|
slots:
|
||||||
|
- 15
|
||||||
|
item:
|
||||||
|
material: hmccosmetics:explorer_backpack
|
||||||
|
lore:
|
||||||
|
- ""
|
||||||
|
- "<gray>Enabled: <#6D9DC5>%HMCCosmetics_equipped_explorer_backpack%"
|
||||||
|
- "<gray>Allowed: <#6D9DC5>%HMCCosmetics_unlocked_explorer_backpack%"
|
||||||
|
type: cosmetic
|
||||||
|
cosmetic: explorer_backpack
|
||||||
@@ -4,6 +4,7 @@ pluginManagement {
|
|||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "HMCCosmetics"
|
rootProject.name = "HMCCosmetics"
|
||||||
include(
|
include(
|
||||||
"common",
|
"common",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("io.papermc.paperweight.userdev") version "1.3.8"
|
id("io.papermc.paperweight.userdev") version "1.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("io.papermc.paperweight.userdev") version "1.3.8"
|
id("io.papermc.paperweight.userdev") version "1.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("io.papermc.paperweight.userdev") version "1.3.8"
|
id("io.papermc.paperweight.userdev") version "1.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("io.papermc.paperweight.userdev") version "1.3.8"
|
id("io.papermc.paperweight.userdev") version "1.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
Reference in New Issue
Block a user