mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-20 23:49:18 +00:00
Compare commits
7 Commits
display-en
...
v2.7.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8b7430998 | ||
|
|
42de76d84d | ||
|
|
5102fd77b7 | ||
|
|
9c66d4ee81 | ||
|
|
7ade2d9227 | ||
|
|
7b43b42740 | ||
|
|
25f050f387 |
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.hibiscusmc"
|
group = "com.hibiscusmc"
|
||||||
version = "2.7.3-DEV"
|
version = "2.7.3"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
@@ -69,7 +69,6 @@ allprojects {
|
|||||||
|
|
||||||
// Hibiscus Commons
|
// Hibiscus Commons
|
||||||
maven("https://repo.hibiscusmc.com/releases")
|
maven("https://repo.hibiscusmc.com/releases")
|
||||||
mavenLocal()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -78,13 +77,13 @@ allprojects {
|
|||||||
//compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
//compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
|
||||||
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
|
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
|
||||||
compileOnly("org.jetbrains:annotations:24.1.0")
|
compileOnly("org.jetbrains:annotations:24.1.0")
|
||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
|
compileOnly("com.comphenix.protocol:ProtocolLib:5.3.0-SNAPSHOT")
|
||||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||||
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.2")
|
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.2")
|
||||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.1.0-SNAPSHOT")
|
||||||
compileOnly("it.unimi.dsi:fastutil:8.5.13")
|
compileOnly("it.unimi.dsi:fastutil:8.5.13")
|
||||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||||
compileOnly("me.lojosho:HibiscusCommons:0.4.7")
|
compileOnly("me.lojosho:HibiscusCommons:0.4.1")
|
||||||
|
|
||||||
// Handled by Spigot Library Loader
|
// Handled by Spigot Library Loader
|
||||||
compileOnly("net.kyori:adventure-api:4.17.0")
|
compileOnly("net.kyori:adventure-api:4.17.0")
|
||||||
@@ -140,7 +139,7 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
archiveFile.get().asFile.copyTo(File("D:\\Server\\Paper1_21\\plugins\\${project.name}-${project.version}.jar"), true)
|
archiveFile.get().asFile.copyTo(layout.projectDirectory.file("run/plugins/HMCCosmeticsRemapped.jar").asFile, true)
|
||||||
println("If you use the plugin, consider buying it for: ")
|
println("If you use the plugin, consider buying it for: ")
|
||||||
println("The custom resource pack, Oraxen + ItemAdder configurations, and Discord support!")
|
println("The custom resource pack, Oraxen + ItemAdder configurations, and Discord support!")
|
||||||
println("Polymart: https://polymart.org/resource/1879")
|
println("Polymart: https://polymart.org/resource/1879")
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ public class Settings {
|
|||||||
private static final String COSMETIC_DISABLED_WORLDS_PATH = "disabled-worlds";
|
private static final String COSMETIC_DISABLED_WORLDS_PATH = "disabled-worlds";
|
||||||
private static final String COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH = "entity-cooldown-teleport-packet";
|
private static final String COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH = "entity-cooldown-teleport-packet";
|
||||||
private static final String COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH = "backpack-force-riding-packet";
|
private static final String COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH = "backpack-force-riding-packet";
|
||||||
private static final String COSMETIC_BACKPACK_LIGHT_EMINATION_PATH = "backpack-light-emination";
|
|
||||||
private static final String COSMETIC_BACKPACK_LIGHT_BLOCK_DETECTION = "backpack-block-detection";
|
|
||||||
private static final String COSMETIC_DESTROY_LOOSE_COSMETIC_PATH = "destroy-loose-cosmetics";
|
private static final String COSMETIC_DESTROY_LOOSE_COSMETIC_PATH = "destroy-loose-cosmetics";
|
||||||
private static final String COSMETIC_BALLOON_HEAD_FORWARD_PATH = "balloon-head-forward";
|
private static final String COSMETIC_BALLOON_HEAD_FORWARD_PATH = "balloon-head-forward";
|
||||||
private static final String MENU_SETTINGS_PATH = "menu-settings";
|
private static final String MENU_SETTINGS_PATH = "menu-settings";
|
||||||
@@ -107,10 +105,6 @@ public class Settings {
|
|||||||
@Getter
|
@Getter
|
||||||
private static boolean backpackForceRidingEnabled;
|
private static boolean backpackForceRidingEnabled;
|
||||||
@Getter
|
@Getter
|
||||||
private static boolean backpackLightEmination;
|
|
||||||
@Getter
|
|
||||||
private static boolean backpackBlockDetection;
|
|
||||||
@Getter
|
|
||||||
private static boolean emotesEnabled;
|
private static boolean emotesEnabled;
|
||||||
@Getter
|
@Getter
|
||||||
private static boolean disabledGamemodesEnabled;
|
private static boolean disabledGamemodesEnabled;
|
||||||
@@ -202,8 +196,6 @@ public class Settings {
|
|||||||
emoteInvincible = cosmeticSettings.node(COSMETIC_EMOTE_INVINCIBLE_PATH).getBoolean(false);
|
emoteInvincible = cosmeticSettings.node(COSMETIC_EMOTE_INVINCIBLE_PATH).getBoolean(false);
|
||||||
destroyLooseCosmetics = cosmeticSettings.node(COSMETIC_DESTROY_LOOSE_COSMETIC_PATH).getBoolean(false);
|
destroyLooseCosmetics = cosmeticSettings.node(COSMETIC_DESTROY_LOOSE_COSMETIC_PATH).getBoolean(false);
|
||||||
backpackForceRidingEnabled = cosmeticSettings.node(COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH).getBoolean(false);
|
backpackForceRidingEnabled = cosmeticSettings.node(COSMETIC_BACKPACK_FORCE_RIDING_PACKET_PATH).getBoolean(false);
|
||||||
backpackLightEmination = cosmeticSettings.node(COSMETIC_BACKPACK_LIGHT_EMINATION_PATH).getBoolean(true);
|
|
||||||
backpackBlockDetection = cosmeticSettings.node(COSMETIC_BACKPACK_LIGHT_BLOCK_DETECTION).getBoolean(true);
|
|
||||||
|
|
||||||
cosmeticSettings.node(SLOT_OPTIONS_PATH).childrenMap().forEach((key, value) -> {
|
cosmeticSettings.node(SLOT_OPTIONS_PATH).childrenMap().forEach((key, value) -> {
|
||||||
EquipmentSlot slot = convertConfigToEquipment(key.toString().toLowerCase());
|
EquipmentSlot slot = convertConfigToEquipment(key.toString().toLowerCase());
|
||||||
|
|||||||
@@ -2,23 +2,16 @@ package com.hibiscusmc.hmccosmetics.cosmetic;
|
|||||||
|
|
||||||
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.hibiscusmc.hmccosmetics.util.misc.ItemDisplayMetadata;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.lojosho.hibiscuscommons.config.serializer.ItemSerializer;
|
import me.lojosho.hibiscuscommons.config.serializer.ItemSerializer;
|
||||||
import me.lojosho.shaded.configurate.ConfigurationNode;
|
import me.lojosho.shaded.configurate.ConfigurationNode;
|
||||||
import me.lojosho.shaded.configurate.serialize.SerializationException;
|
import me.lojosho.shaded.configurate.serialize.SerializationException;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Display;
|
|
||||||
import org.bukkit.entity.ItemDisplay;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.joml.Quaternionf;
|
|
||||||
import org.joml.Vector3f;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public abstract class Cosmetic {
|
public abstract class Cosmetic {
|
||||||
@@ -83,52 +76,4 @@ public abstract class Cosmetic {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemDisplayMetadata generateItemDisplayMetadata(ConfigurationNode config) {
|
|
||||||
ItemDisplayMetadata metadata = new ItemDisplayMetadata();
|
|
||||||
if (!config.virtual()) {
|
|
||||||
ConfigurationNode translationNode = config.node("translation");
|
|
||||||
ConfigurationNode scaleNode = config.node("scale");
|
|
||||||
ConfigurationNode rotationLeftNode = config.node("rotation-left");
|
|
||||||
ConfigurationNode rotationRightNode = config.node("rotation-right");
|
|
||||||
ConfigurationNode skyLightNode = config.node("sky-light");
|
|
||||||
ConfigurationNode viewRangeNode = config.node("viewrange");
|
|
||||||
ConfigurationNode widthNode = config.node("width");
|
|
||||||
ConfigurationNode heightNode = config.node("height");
|
|
||||||
ConfigurationNode displayTransformNode = config.node("display-transform");
|
|
||||||
ConfigurationNode itemstackNode = config.node("item");
|
|
||||||
|
|
||||||
if (!translationNode.virtual()) metadata.translation = stringToVector(translationNode.getString("0,0,0"));
|
|
||||||
if (!scaleNode.virtual()) metadata.scale = stringToVector(scaleNode.getString("1,1,1"));
|
|
||||||
if (!rotationLeftNode.virtual()) metadata.rotationLeft = stringToQuaternion(rotationLeftNode.getString("0,0,0,1"));
|
|
||||||
if (!rotationRightNode.virtual()) metadata.rotationRight = stringToQuaternion(rotationRightNode.getString("0,0,0,1"));
|
|
||||||
if (!skyLightNode.virtual()) metadata.skyLight = skyLightNode.getInt(15);
|
|
||||||
if (!viewRangeNode.virtual()) metadata.viewRange = viewRangeNode.getFloat(1);
|
|
||||||
if (!widthNode.virtual()) metadata.width = widthNode.getFloat(0);
|
|
||||||
if (!heightNode.virtual()) metadata.height = heightNode.getFloat(0);
|
|
||||||
if (!displayTransformNode.virtual()) try {
|
|
||||||
metadata.displayTransform = ItemDisplay.ItemDisplayTransform.valueOf(displayTransformNode.getString());
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
if (!itemstackNode.virtual()) try {
|
|
||||||
metadata.itemStack = ItemSerializer.INSTANCE.deserialize(ItemStack.class, itemstackNode);
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Vector3f stringToVector(String string) {
|
|
||||||
List<String> vector = Arrays.stream(string.replace(" ", "").split(",", 3)).toList();
|
|
||||||
while (vector.size() < 3) vector.add("0");
|
|
||||||
float x = Float.parseFloat(vector.get(0)), y = Float.parseFloat(vector.get(1)), z = Float.parseFloat(vector.get(2));
|
|
||||||
return new Vector3f(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Quaternionf stringToQuaternion(String string) {
|
|
||||||
List<String> vector = Arrays.stream(string.replace(" ", "").split(",", 4)).toList();
|
|
||||||
while (vector.size() < 3) vector.add("0");
|
|
||||||
if (vector.size() < 4) vector.add("1");
|
|
||||||
float x = Float.parseFloat(vector.get(0)), y = Float.parseFloat(vector.get(1)), z = Float.parseFloat(vector.get(2)), w = Float.parseFloat(vector.get(3));
|
|
||||||
return new Quaternionf(x, y, z, w);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,17 @@ package com.hibiscusmc.hmccosmetics.cosmetic.types;
|
|||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserBackpackManager;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.misc.ItemDisplayMetadata;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||||
import me.lojosho.shaded.configurate.ConfigurationNode;
|
import me.lojosho.shaded.configurate.ConfigurationNode;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
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.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -30,24 +29,16 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
@Getter
|
@Getter
|
||||||
private int height = -1;
|
private int height = -1;
|
||||||
private ItemStack firstPersonBackpack;
|
private ItemStack firstPersonBackpack;
|
||||||
@Getter @Setter
|
|
||||||
private ItemDisplayMetadata metadata;
|
|
||||||
@Getter @Setter
|
|
||||||
private ItemDisplayMetadata firstPersonMetadata;
|
|
||||||
|
|
||||||
public CosmeticBackpackType(String id, ConfigurationNode config) {
|
public CosmeticBackpackType(String id, ConfigurationNode config) {
|
||||||
super(id, config);
|
super(id, config);
|
||||||
|
|
||||||
modelName = config.node("model").getString();
|
modelName = config.node("model").getString();
|
||||||
|
|
||||||
ConfigurationNode firstPersonNode = config.node("firstperson-item");
|
if (!config.node("firstperson-item").virtual()) {
|
||||||
if (!firstPersonNode.virtual()) {
|
this.firstPersonBackpack = generateItemStack(config.node("firstperson-item"));
|
||||||
this.firstPersonBackpack = generateItemStack(firstPersonNode);
|
|
||||||
this.height = config.node("height").getInt(5);
|
this.height = config.node("height").getInt(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.firstPersonMetadata = generateItemDisplayMetadata(config.node("firstperson-metadata")).setVertical();
|
|
||||||
this.metadata = generateItemDisplayMetadata(config.node("metadata")).setFixed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -55,7 +46,7 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
Entity entity = Bukkit.getEntity(user.getUniqueId());
|
Entity entity = Bukkit.getEntity(user.getUniqueId());
|
||||||
if (entity == null) return;
|
if (entity == null) return;
|
||||||
|
|
||||||
Location loc = entity.getLocation();
|
Location loc = entity.getLocation().clone().add(0, 2, 0);
|
||||||
|
|
||||||
if (user.isInWardrobe() || !user.isBackpackSpawned()) return;
|
if (user.isInWardrobe() || !user.isBackpackSpawned()) return;
|
||||||
if (user.isHidden()) {
|
if (user.isHidden()) {
|
||||||
@@ -65,20 +56,20 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
}
|
}
|
||||||
List<Player> outsideViewers = user.getUserBackpackManager().getEntityManager().refreshViewers(loc);
|
List<Player> outsideViewers = user.getUserBackpackManager().getEntityManager().refreshViewers(loc);
|
||||||
|
|
||||||
UserBackpackManager backpackManager = user.getUserBackpackManager();
|
user.getUserBackpackManager().getEntityManager().teleport(loc);
|
||||||
//backpackManager.getEntityManager().setRotation((int) loc.getYaw(), false);
|
user.getUserBackpackManager().getEntityManager().setRotation((int) loc.getYaw(), isFirstPersonCompadible());
|
||||||
|
|
||||||
HMCCPacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), backpackManager.getFirstItemDisplayId(), EntityType.ITEM_DISPLAY, UUID.randomUUID(), outsideViewers);
|
HMCCPacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), user.getUserBackpackManager().getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), outsideViewers);
|
||||||
//metadata.rotationLeft.rotateY((float) Math.toRadians(loc.getYaw()));
|
HMCCPacketManager.sendArmorstandMetadata(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(backpackManager.getFirstItemDisplayId(), metadata, user.getUserCosmeticItem(this, getItem()), outsideViewers);
|
PacketManager.equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, getItem()), outsideViewers);
|
||||||
// If true, it will send the riding packet to all players. If false, it will send the riding packet only to new players
|
// If true, it will send the riding packet to all players. If false, it will send the riding packet only to new players
|
||||||
if (Settings.isBackpackForceRidingEnabled()) HMCCPacketManager.sendRidingPacket(entity.getEntityId(), backpackManager.getFirstItemDisplayId(), backpackManager.getEntityManager().getViewers());
|
if (Settings.isBackpackForceRidingEnabled()) HMCCPacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), user.getUserBackpackManager().getEntityManager().getViewers());
|
||||||
else HMCCPacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstItemDisplayId(), outsideViewers);
|
else HMCCPacketManager.sendRidingPacket(entity.getEntityId(), user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
|
|
||||||
if (!user.isInWardrobe() && isFirstPersonCompatible() && user.getPlayer() != null) {
|
if (!user.isInWardrobe() && isFirstPersonCompadible() && user.getPlayer() != null) {
|
||||||
List<Player> owner = List.of(user.getPlayer());
|
List<Player> owner = List.of(user.getPlayer());
|
||||||
|
|
||||||
ArrayList<Integer> particleCloud = backpackManager.getAreaEffectEntityId();
|
ArrayList<Integer> particleCloud = user.getUserBackpackManager().getAreaEffectEntityId();
|
||||||
for (int i = 0; i < particleCloud.size(); i++) {
|
for (int i = 0; i < particleCloud.size(); i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
HMCCPacketManager.sendRidingPacket(entity.getEntityId(), particleCloud.get(i), owner);
|
HMCCPacketManager.sendRidingPacket(entity.getEntityId(), particleCloud.get(i), owner);
|
||||||
@@ -86,18 +77,19 @@ public class CosmeticBackpackType extends Cosmetic {
|
|||||||
HMCCPacketManager.sendRidingPacket(particleCloud.get(i - 1), particleCloud.get(i) , owner);
|
HMCCPacketManager.sendRidingPacket(particleCloud.get(i - 1), particleCloud.get(i) , owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HMCCPacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), backpackManager.getFirstItemDisplayId(), owner);
|
HMCCPacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), user.getUserBackpackManager().getFirstArmorStandId(), owner);
|
||||||
if (!user.isHidden()) {
|
if (!user.isHidden()) {
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(backpackManager.getFirstItemDisplayId(), firstPersonMetadata, user.getUserCosmeticItem(this, firstPersonBackpack), owner);
|
//if (loc.getPitch() < -70) NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, new ItemStack(Material.AIR), owner);
|
||||||
|
//else NMSHandlers.getHandler().equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, firstPersonBackpack, owner);
|
||||||
|
PacketManager.equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(this, firstPersonBackpack), owner);
|
||||||
}
|
}
|
||||||
MessagesUtil.sendDebugMessages("First Person Backpack Update[owner=" + user.getUniqueId() + ",player_location=" + loc + "]!", Level.INFO);
|
MessagesUtil.sendDebugMessages("First Person Backpack Update[owner=" + user.getUniqueId() + ",player_location=" + loc + "]!", Level.INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
//MessagesUtil.sendDebugMessages("TTTTTTT " + backpackManager.refreshBlock(backpackManager.getEntityManager().getViewers()));
|
user.getUserBackpackManager().showBackpack();
|
||||||
backpackManager.showBackpack();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFirstPersonCompatible() {
|
public boolean isFirstPersonCompadible() {
|
||||||
return firstPersonBackpack != null;
|
return firstPersonBackpack != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,9 @@ public class WGListener implements Listener {
|
|||||||
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticEnableFlag())) {
|
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticEnableFlag())) {
|
||||||
if (protectedRegion.getFlags().get(WGHook.getCosmeticEnableFlag()).toString().equalsIgnoreCase("ALLOW")) {
|
if (protectedRegion.getFlags().get(WGHook.getCosmeticEnableFlag()).toString().equalsIgnoreCase("ALLOW")) {
|
||||||
user.showCosmetics(CosmeticUser.HiddenReason.WORLDGUARD);
|
user.showCosmetics(CosmeticUser.HiddenReason.WORLDGUARD);
|
||||||
return;
|
} else {
|
||||||
|
user.hideCosmetics(CosmeticUser.HiddenReason.WORLDGUARD);
|
||||||
}
|
}
|
||||||
user.hideCosmetics(CosmeticUser.HiddenReason.WORLDGUARD);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticWardrobeFlag())) {
|
if (protectedRegion.getFlags().containsKey(WGHook.getCosmeticWardrobeFlag())) {
|
||||||
if (!WardrobeSettings.getWardrobeNames().contains(protectedRegion.getFlags().get(WGHook.getCosmeticWardrobeFlag()).toString())) return;
|
if (!WardrobeSettings.getWardrobeNames().contains(protectedRegion.getFlags().get(WGHook.getCosmeticWardrobeFlag()).toString())) return;
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ public class CosmeticUser {
|
|||||||
|
|
||||||
// Cosmetic Settings/Toggles
|
// Cosmetic Settings/Toggles
|
||||||
private final ArrayList<HiddenReason> hiddenReason = new ArrayList<>();
|
private final ArrayList<HiddenReason> hiddenReason = new ArrayList<>();
|
||||||
private final HashMap<CosmeticSlot, ItemStack> cachedCosmeticItems = new HashMap<>();
|
|
||||||
private final HashMap<CosmeticSlot, Color> colors = new HashMap<>();
|
private final HashMap<CosmeticSlot, Color> colors = new HashMap<>();
|
||||||
|
|
||||||
public CosmeticUser(UUID uuid) {
|
public CosmeticUser(UUID uuid) {
|
||||||
@@ -157,7 +156,6 @@ public class CosmeticUser {
|
|||||||
if (slot == CosmeticSlot.EMOTE) {
|
if (slot == CosmeticSlot.EMOTE) {
|
||||||
if (getUserEmoteManager().isPlayingEmote()) getUserEmoteManager().stopEmote(UserEmoteManager.StopEmoteReason.UNEQUIP);
|
if (getUserEmoteManager().isPlayingEmote()) getUserEmoteManager().stopEmote(UserEmoteManager.StopEmoteReason.UNEQUIP);
|
||||||
}
|
}
|
||||||
cachedCosmeticItems.remove(slot);
|
|
||||||
colors.remove(slot);
|
colors.remove(slot);
|
||||||
playerCosmetics.remove(slot);
|
playerCosmetics.remove(slot);
|
||||||
removeArmor(slot);
|
removeArmor(slot);
|
||||||
@@ -229,10 +227,6 @@ public class CosmeticUser {
|
|||||||
if (cosmetic instanceof CosmeticBackpackType || cosmetic instanceof CosmeticBalloonType) return new ItemStack(Material.AIR);
|
if (cosmetic instanceof CosmeticBackpackType || cosmetic instanceof CosmeticBalloonType) return new ItemStack(Material.AIR);
|
||||||
return getPlayer().getInventory().getItem(HMCCInventoryUtils.getEquipmentSlot(cosmetic.getSlot()));
|
return getPlayer().getInventory().getItem(HMCCInventoryUtils.getEquipmentSlot(cosmetic.getSlot()));
|
||||||
}
|
}
|
||||||
// Check if the item is cached. This helps with performance as we don't need to keep recreating the item
|
|
||||||
if (cachedCosmeticItems.containsKey(cosmetic.getSlot())) {
|
|
||||||
return cachedCosmeticItems.get(cosmetic.getSlot());
|
|
||||||
}
|
|
||||||
if (cosmetic instanceof CosmeticArmorType armorType) {
|
if (cosmetic instanceof CosmeticArmorType armorType) {
|
||||||
item = armorType.getItem(this, cosmetic.getItem());
|
item = armorType.getItem(this, cosmetic.getItem());
|
||||||
}
|
}
|
||||||
@@ -255,10 +249,6 @@ public class CosmeticUser {
|
|||||||
//MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null");
|
//MessagesUtil.sendDebugMessages("GetUserCosemticUser Item is null");
|
||||||
return new ItemStack(Material.AIR);
|
return new ItemStack(Material.AIR);
|
||||||
}
|
}
|
||||||
// Check if the item is cached. This helps with performance as we don't need to keep recreating the item
|
|
||||||
if (cachedCosmeticItems.containsKey(cosmetic.getSlot())) {
|
|
||||||
return cachedCosmeticItems.get(cosmetic.getSlot());
|
|
||||||
}
|
|
||||||
if (item.hasItemMeta()) {
|
if (item.hasItemMeta()) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
|
||||||
@@ -322,7 +312,6 @@ public class CosmeticUser {
|
|||||||
|
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
cachedCosmeticItems.put(cosmetic.getSlot(), item);
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,24 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.user.manager;
|
package com.hibiscusmc.hmccosmetics.user.manager;
|
||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
|
||||||
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.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.misc.ItemDisplayMetadata;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import com.ticxo.modelengine.api.ModelEngineAPI;
|
import com.ticxo.modelengine.api.ModelEngineAPI;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.lojosho.hibiscuscommons.hooks.Hooks;
|
import me.lojosho.hibiscuscommons.hooks.Hooks;
|
||||||
import me.lojosho.hibiscuscommons.util.ServerUtils;
|
import me.lojosho.hibiscuscommons.util.ServerUtils;
|
||||||
import org.bukkit.Location;
|
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
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.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@@ -31,26 +27,23 @@ public class UserBackpackManager {
|
|||||||
@Getter
|
@Getter
|
||||||
private boolean backpackHidden;
|
private boolean backpackHidden;
|
||||||
@Getter
|
@Getter
|
||||||
private int itemDisplayId;
|
private int invisibleArmorStand;
|
||||||
private ArrayList<Integer> particleCloud = new ArrayList<>();
|
private ArrayList<Integer> particleCloud = new ArrayList<>();
|
||||||
@Getter
|
@Getter
|
||||||
private final CosmeticUser user;
|
private final CosmeticUser user;
|
||||||
@Getter
|
@Getter
|
||||||
private UserEntity entityManager;
|
private UserEntity entityManager;
|
||||||
//@Getter @Setter
|
|
||||||
//private boolean inBlock;
|
|
||||||
|
|
||||||
public UserBackpackManager(CosmeticUser user) {
|
public UserBackpackManager(CosmeticUser user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.backpackHidden = false;
|
this.backpackHidden = false;
|
||||||
//this.inBlock = false;
|
this.invisibleArmorStand = ServerUtils.getNextEntityId();
|
||||||
this.itemDisplayId = ServerUtils.getNextEntityId();
|
|
||||||
this.entityManager = new UserEntity(user.getUniqueId());
|
this.entityManager = new UserEntity(user.getUniqueId());
|
||||||
if (user.getEntity() != null) this.entityManager.refreshViewers(user.getEntity().getLocation()); // Fixes an issue where a player, who somehow removes their potions, but doesn't have an entity produces an NPE (it's dumb)
|
if (user.getEntity() != null) this.entityManager.refreshViewers(user.getEntity().getLocation()); // Fixes an issue where a player, who somehow removes their potions, but doesn't have an entity produces an NPE (it's dumb)
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFirstItemDisplayId() {
|
public int getFirstArmorStandId() {
|
||||||
return itemDisplayId;
|
return invisibleArmorStand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
public void spawnBackpack(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
@@ -60,12 +53,11 @@ public class UserBackpackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawn(CosmeticBackpackType cosmeticBackpackType) {
|
private void spawn(CosmeticBackpackType cosmeticBackpackType) {
|
||||||
Location entityLoc = user.getEntity().getLocation();
|
getEntityManager().setIds(List.of(invisibleArmorStand));
|
||||||
entityLoc.setPitch(0f);
|
getEntityManager().teleport(user.getEntity().getLocation());
|
||||||
getEntityManager().setIds(List.of(itemDisplayId));
|
|
||||||
getEntityManager().teleport(entityLoc);
|
|
||||||
List<Player> outsideViewers = getEntityManager().getViewers();
|
List<Player> outsideViewers = getEntityManager().getViewers();
|
||||||
HMCCPacketManager.sendEntitySpawnPacket(entityLoc, getFirstItemDisplayId(), EntityType.ITEM_DISPLAY, UUID.randomUUID(), getEntityManager().getViewers());
|
HMCCPacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), getFirstArmorStandId(), EntityType.ARMOR_STAND, UUID.randomUUID(), getEntityManager().getViewers());
|
||||||
|
HMCCPacketManager.sendArmorstandMetadata(getFirstArmorStandId(), outsideViewers);
|
||||||
|
|
||||||
Entity entity = user.getEntity();
|
Entity entity = user.getEntity();
|
||||||
|
|
||||||
@@ -75,12 +67,12 @@ public class UserBackpackManager {
|
|||||||
passengerIDs[i] = entity.getPassengers().get(i).getEntityId();
|
passengerIDs[i] = entity.getPassengers().get(i).getEntityId();
|
||||||
}
|
}
|
||||||
|
|
||||||
passengerIDs[passengerIDs.length - 1] = this.getFirstItemDisplayId();
|
passengerIDs[passengerIDs.length - 1] = this.getFirstArmorStandId();
|
||||||
|
|
||||||
ArrayList<Player> owner = new ArrayList<>();
|
ArrayList<Player> owner = new ArrayList<>();
|
||||||
if (user.getPlayer() != null) owner.add(user.getPlayer());
|
if (user.getPlayer() != null) owner.add(user.getPlayer());
|
||||||
|
|
||||||
if (cosmeticBackpackType.isFirstPersonCompatible()) {
|
if (cosmeticBackpackType.isFirstPersonCompadible()) {
|
||||||
for (int i = particleCloud.size(); i < cosmeticBackpackType.getHeight(); i++) {
|
for (int i = particleCloud.size(); i < cosmeticBackpackType.getHeight(); i++) {
|
||||||
int entityId = ServerUtils.getNextEntityId();
|
int entityId = ServerUtils.getNextEntityId();
|
||||||
HMCCPacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), entityId, EntityType.AREA_EFFECT_CLOUD, UUID.randomUUID());
|
HMCCPacketManager.sendEntitySpawnPacket(user.getEntity().getLocation(), entityId, EntityType.AREA_EFFECT_CLOUD, UUID.randomUUID());
|
||||||
@@ -92,11 +84,10 @@ public class UserBackpackManager {
|
|||||||
if (i == 0) HMCCPacketManager.sendRidingPacket(entity.getEntityId(), particleCloud.get(i), owner);
|
if (i == 0) HMCCPacketManager.sendRidingPacket(entity.getEntityId(), particleCloud.get(i), owner);
|
||||||
else HMCCPacketManager.sendRidingPacket(particleCloud.get(i - 1), particleCloud.get(i) , owner);
|
else HMCCPacketManager.sendRidingPacket(particleCloud.get(i - 1), particleCloud.get(i) , owner);
|
||||||
}
|
}
|
||||||
HMCCPacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1),getFirstItemDisplayId(), owner);
|
HMCCPacketManager.sendRidingPacket(particleCloud.get(particleCloud.size() - 1), user.getUserBackpackManager().getFirstArmorStandId(), owner);
|
||||||
if (!user.isHidden()) HMCCPacketManager.sendItemDisplayMetadata(getFirstItemDisplayId(), cosmeticBackpackType.getFirstPersonMetadata(), user.getUserCosmeticItem(cosmeticBackpackType, cosmeticBackpackType.getFirstPersonBackpack()), outsideViewers);
|
if (!user.isHidden()) PacketManager.equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(cosmeticBackpackType, cosmeticBackpackType.getFirstPersonBackpack()), owner);
|
||||||
}
|
}
|
||||||
|
PacketManager.equipmentSlotUpdate(getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(cosmeticBackpackType), outsideViewers);
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(getFirstItemDisplayId(), cosmeticBackpackType.getMetadata(), user.getUserCosmeticItem(cosmeticBackpackType), outsideViewers);
|
|
||||||
HMCCPacketManager.sendRidingPacket(entity.getEntityId(), passengerIDs, outsideViewers);
|
HMCCPacketManager.sendRidingPacket(entity.getEntityId(), passengerIDs, outsideViewers);
|
||||||
|
|
||||||
// No one should be using ME because it barely works but some still use it, so it's here
|
// No one should be using ME because it barely works but some still use it, so it's here
|
||||||
@@ -117,13 +108,13 @@ public class UserBackpackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void despawnBackpack() {
|
public void despawnBackpack() {
|
||||||
IntList entityIds = IntArrayList.of(itemDisplayId);
|
HMCCPacketManager.sendEntityDestroyPacket(invisibleArmorStand, getEntityManager().getViewers());
|
||||||
if (particleCloud != null) {
|
if (particleCloud != null) {
|
||||||
entityIds.addAll(particleCloud);
|
for (Integer entityId : particleCloud) {
|
||||||
|
HMCCPacketManager.sendEntityDestroyPacket(entityId, getEntityManager().getViewers());
|
||||||
|
}
|
||||||
this.particleCloud = null;
|
this.particleCloud = null;
|
||||||
}
|
}
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(entityIds, getEntityManager().getViewers());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideBackpack() {
|
public void hideBackpack() {
|
||||||
@@ -149,42 +140,11 @@ public class UserBackpackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(ItemStack item) {
|
public void setItem(ItemStack item) {
|
||||||
ItemDisplayMetadata metadata = Optional.ofNullable((CosmeticBackpackType) user.getCosmetic(CosmeticSlot.BACKPACK)).map(CosmeticBackpackType::getMetadata).orElse(new ItemDisplayMetadata());
|
PacketManager.equipmentSlotUpdate(getFirstArmorStandId(), EquipmentSlot.HEAD, item, getEntityManager().getViewers());
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(getFirstItemDisplayId(), metadata, item, getEntityManager().getViewers());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearItems() {
|
public void clearItems() {
|
||||||
ItemStack item = new ItemStack(Material.AIR);
|
ItemStack item = new ItemStack(Material.AIR);
|
||||||
//PacketManager.equipmentSlotUpdate(getFirstItemDisplayId(), EquipmentSlot.HEAD, item, getEntityManager().getViewers());
|
PacketManager.equipmentSlotUpdate(getFirstArmorStandId(), EquipmentSlot.HEAD, item, getEntityManager().getViewers());
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(getFirstItemDisplayId(), item, getEntityManager().getViewers());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Refreshes the block detection for the backpack
|
|
||||||
* @param outsideViewers
|
|
||||||
* @return true if the entity was updated, false if not
|
|
||||||
*//*
|
|
||||||
public boolean refreshBlock(List<Player> outsideViewers) {
|
|
||||||
if (Settings.isBackpackBlockDetection()) {
|
|
||||||
if (isInBlock() && checkBlock()) {
|
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(getFirstItemDisplayId(), false, outsideViewers);
|
|
||||||
setInBlock(false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!isInBlock() && !checkBlock()) {
|
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(getFirstItemDisplayId(), true, outsideViewers);
|
|
||||||
setInBlock(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkBlock() {
|
|
||||||
if (Settings.isBackpackBlockDetection()) {
|
|
||||||
Block block = getEntityManager().getLocation().clone().add(0, 1.5, 0).getBlock();
|
|
||||||
return block.getType().isAir();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ public class UserEmoteModel extends PlayerModel {
|
|||||||
|
|
||||||
private final CosmeticUser user;
|
private final CosmeticUser user;
|
||||||
private String emotePlaying;
|
private String emotePlaying;
|
||||||
private final int itemDisplayId;
|
private final int armorStandId;
|
||||||
private GameMode originalGamemode;
|
private GameMode originalGamemode;
|
||||||
|
|
||||||
public UserEmoteModel(@NotNull CosmeticUser user) {
|
public UserEmoteModel(@NotNull CosmeticUser user) {
|
||||||
super(user.getPlayer());
|
super(user.getPlayer());
|
||||||
this.user = user;
|
this.user = user;
|
||||||
itemDisplayId = ServerUtils.getNextEntityId();
|
armorStandId = ServerUtils.getNextEntityId();
|
||||||
getRangeManager().setRenderDistance(Settings.getViewDistance());
|
getRangeManager().setRenderDistance(Settings.getViewDistance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,12 +75,12 @@ public class UserEmoteModel extends PlayerModel {
|
|||||||
MessagesUtil.sendMessage(player, "emote-blocked");
|
MessagesUtil.sendMessage(player, "emote-blocked");
|
||||||
}
|
}
|
||||||
|
|
||||||
HMCCPacketManager.sendEntitySpawnPacket(thirdPersonLocation, itemDisplayId, EntityType.ITEM_DISPLAY, UUID.randomUUID(), viewer);
|
HMCCPacketManager.sendEntitySpawnPacket(thirdPersonLocation, armorStandId, EntityType.ARMOR_STAND, UUID.randomUUID(), viewer);
|
||||||
//HMCCPacketManager.sendInvisibilityPacket(itemDisplayId, viewer);
|
HMCCPacketManager.sendInvisibilityPacket(armorStandId, viewer);
|
||||||
HMCCPacketManager.sendLookPacket(itemDisplayId, thirdPersonLocation, viewer);
|
HMCCPacketManager.sendLookPacket(armorStandId, thirdPersonLocation, viewer);
|
||||||
|
|
||||||
HMCCPacketManager.gamemodeChangePacket(player, 3);
|
HMCCPacketManager.gamemodeChangePacket(player, 3);
|
||||||
HMCCPacketManager.sendCameraPacket(itemDisplayId, viewer);
|
HMCCPacketManager.sendCameraPacket(armorStandId, viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ public class UserEmoteModel extends PlayerModel {
|
|||||||
|
|
||||||
int entityId = player.getEntityId();
|
int entityId = player.getEntityId();
|
||||||
HMCCPacketManager.sendCameraPacket(entityId, viewer);
|
HMCCPacketManager.sendCameraPacket(entityId, viewer);
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(itemDisplayId, viewer);
|
HMCCPacketManager.sendEntityDestroyPacket(armorStandId, viewer);
|
||||||
if (this.originalGamemode != null) {
|
if (this.originalGamemode != null) {
|
||||||
HMCCPacketManager.gamemodeChangePacket(player, HMCCServerUtils.convertGamemode(this.originalGamemode));
|
HMCCPacketManager.gamemodeChangePacket(player, HMCCServerUtils.convertGamemode(this.originalGamemode));
|
||||||
player.setGameMode(this.originalGamemode);
|
player.setGameMode(this.originalGamemode);
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -47,7 +45,6 @@ public class UserEntity {
|
|||||||
|
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
CosmeticUser user = CosmeticUsers.getUser(player);
|
CosmeticUser user = CosmeticUsers.getUser(player);
|
||||||
IntList ids = new IntArrayList(this.ids);
|
|
||||||
if (user != null && owner != user.getUniqueId() && user.isInWardrobe()) { // Fixes issue where players in wardrobe would see other players cosmetics if they were not in wardrobe
|
if (user != null && owner != user.getUniqueId() && user.isInWardrobe()) { // Fixes issue where players in wardrobe would see other players cosmetics if they were not in wardrobe
|
||||||
removePlayers.add(player);
|
removePlayers.add(player);
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(ids, List.of(player));
|
HMCCPacketManager.sendEntityDestroyPacket(ids, List.of(player));
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.hibiscusmc.hmccosmetics.config.WardrobeLocation;
|
|||||||
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
||||||
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.CosmeticBackpackType;
|
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticBalloonType;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
@@ -14,7 +13,6 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
|||||||
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.misc.ItemDisplayMetadata;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
import com.hibiscusmc.hmccosmetics.util.packets.HMCCPacketManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -43,7 +41,7 @@ public class UserWardrobeManager {
|
|||||||
@Getter
|
@Getter
|
||||||
private final int NPC_ID;
|
private final int NPC_ID;
|
||||||
@Getter
|
@Getter
|
||||||
private final int ITEM_DISPLAY_ID;
|
private final int ARMORSTAND_ID;
|
||||||
@Getter
|
@Getter
|
||||||
private final UUID WARDROBE_UUID;
|
private final UUID WARDROBE_UUID;
|
||||||
@Getter
|
@Getter
|
||||||
@@ -74,7 +72,7 @@ public class UserWardrobeManager {
|
|||||||
|
|
||||||
public UserWardrobeManager(CosmeticUser user, Wardrobe wardrobe) {
|
public UserWardrobeManager(CosmeticUser user, Wardrobe wardrobe) {
|
||||||
NPC_ID = me.lojosho.hibiscuscommons.util.ServerUtils.getNextEntityId();
|
NPC_ID = me.lojosho.hibiscuscommons.util.ServerUtils.getNextEntityId();
|
||||||
ITEM_DISPLAY_ID = me.lojosho.hibiscuscommons.util.ServerUtils.getNextEntityId();
|
ARMORSTAND_ID = me.lojosho.hibiscuscommons.util.ServerUtils.getNextEntityId();
|
||||||
WARDROBE_UUID = UUID.randomUUID();
|
WARDROBE_UUID = UUID.randomUUID();
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
@@ -107,16 +105,16 @@ public class UserWardrobeManager {
|
|||||||
MessagesUtil.sendMessage(player, "opened-wardrobe");
|
MessagesUtil.sendMessage(player, "opened-wardrobe");
|
||||||
|
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
// ItemDisplay
|
// Armorstand
|
||||||
HMCCPacketManager.sendEntitySpawnPacket(viewingLocation, ITEM_DISPLAY_ID, EntityType.ITEM_DISPLAY, UUID.randomUUID(), viewer);
|
HMCCPacketManager.sendEntitySpawnPacket(viewingLocation, ARMORSTAND_ID, EntityType.ARMOR_STAND, UUID.randomUUID(), viewer);
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(ITEM_DISPLAY_ID, new ItemStack(Material.AIR), viewer);
|
HMCCPacketManager.sendArmorstandMetadata(ARMORSTAND_ID, viewer);
|
||||||
HMCCPacketManager.sendLookPacket(ITEM_DISPLAY_ID, viewingLocation, viewer);
|
HMCCPacketManager.sendLookPacket(ARMORSTAND_ID, viewingLocation, viewer);
|
||||||
|
|
||||||
// Player
|
// Player
|
||||||
user.getPlayer().teleport(viewingLocation, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
user.getPlayer().teleport(viewingLocation, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
user.getPlayer().setInvisible(true);
|
user.getPlayer().setInvisible(true);
|
||||||
HMCCPacketManager.gamemodeChangePacket(player, 3);
|
HMCCPacketManager.gamemodeChangePacket(player, 3);
|
||||||
HMCCPacketManager.sendCameraPacket(ITEM_DISPLAY_ID, viewer);
|
HMCCPacketManager.sendCameraPacket(ARMORSTAND_ID, viewer);
|
||||||
|
|
||||||
// NPC
|
// NPC
|
||||||
npcName = "WardrobeNPC-" + NPC_ID;
|
npcName = "WardrobeNPC-" + NPC_ID;
|
||||||
@@ -141,13 +139,11 @@ public class UserWardrobeManager {
|
|||||||
// Misc
|
// Misc
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK)) {
|
||||||
// Maybe null as backpack maybe despawned before entering
|
// Maybe null as backpack maybe despawned before entering
|
||||||
UserBackpackManager userBackpackManager = user.getUserBackpackManager();
|
if (user.getUserBackpackManager() == null) user.respawnBackpack();
|
||||||
if (userBackpackManager == null) user.respawnBackpack();
|
|
||||||
if (user.isBackpackSpawned()) {
|
if (user.isBackpackSpawned()) {
|
||||||
userBackpackManager.getEntityManager().teleport(npcLocation.clone());
|
user.getUserBackpackManager().getEntityManager().teleport(npcLocation.clone().add(0, 2, 0));
|
||||||
CosmeticBackpackType backpackCosmetic = (CosmeticBackpackType) user.getCosmetic(CosmeticSlot.BACKPACK);
|
PacketManager.equipmentSlotUpdate(user.getUserBackpackManager().getFirstArmorStandId(), EquipmentSlot.HEAD, user.getUserCosmeticItem(user.getCosmetic(CosmeticSlot.BACKPACK)), viewer);
|
||||||
HMCCPacketManager.sendItemDisplayMetadata(ITEM_DISPLAY_ID, backpackCosmetic.getMetadata(), user.getUserCosmeticItem(backpackCosmetic), viewer);
|
HMCCPacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorStandId(), viewer);
|
||||||
HMCCPacketManager.ridingMountPacket(NPC_ID, userBackpackManager.getFirstItemDisplayId(), viewer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +232,7 @@ public class UserWardrobeManager {
|
|||||||
user.getPlayer().setInvisible(false);
|
user.getPlayer().setInvisible(false);
|
||||||
|
|
||||||
// Armorstand
|
// Armorstand
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(ITEM_DISPLAY_ID, viewer); // Sucess
|
HMCCPacketManager.sendEntityDestroyPacket(ARMORSTAND_ID, viewer); // Sucess
|
||||||
|
|
||||||
//PacketManager.sendEntityDestroyPacket(player.getEntityId(), viewer); // Success
|
//PacketManager.sendEntityDestroyPacket(player.getEntityId(), viewer); // Success
|
||||||
if (WardrobeSettings.isForceExitGamemode()) {
|
if (WardrobeSettings.isForceExitGamemode()) {
|
||||||
@@ -319,10 +315,10 @@ public class UserWardrobeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK) && user.getUserBackpackManager() != null) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BACKPACK) && user.getUserBackpackManager() != null) {
|
||||||
HMCCPacketManager.sendTeleportPacket(user.getUserBackpackManager().getFirstItemDisplayId(), location, false, viewer);
|
HMCCPacketManager.sendTeleportPacket(user.getUserBackpackManager().getFirstArmorStandId(), location, false, viewer);
|
||||||
HMCCPacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstItemDisplayId(), viewer);
|
HMCCPacketManager.ridingMountPacket(NPC_ID, user.getUserBackpackManager().getFirstArmorStandId(), viewer);
|
||||||
user.getUserBackpackManager().getEntityManager().setRotation(nextyaw);
|
user.getUserBackpackManager().getEntityManager().setRotation(nextyaw);
|
||||||
HMCCPacketManager.sendEntityDestroyPacket(user.getUserBackpackManager().getFirstItemDisplayId(), outsideViewers);
|
HMCCPacketManager.sendEntityDestroyPacket(user.getUserBackpackManager().getFirstArmorStandId(), outsideViewers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON) && user.isBalloonSpawned()) {
|
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON) && user.isBalloonSpawned()) {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class HMCCInventoryUtils {
|
|||||||
case FEET -> CosmeticSlot.BOOTS;
|
case FEET -> CosmeticSlot.BOOTS;
|
||||||
case OFFHAND -> CosmeticSlot.OFFHAND;
|
case OFFHAND -> CosmeticSlot.OFFHAND;
|
||||||
case MAINHAND -> CosmeticSlot.MAINHAND;
|
case MAINHAND -> CosmeticSlot.MAINHAND;
|
||||||
|
default -> null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.util.misc;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Display;
|
|
||||||
import org.bukkit.entity.ItemDisplay;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.joml.Quaternionf;
|
|
||||||
import org.joml.Vector3f;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ItemDisplayMetadata {
|
|
||||||
|
|
||||||
public Vector3f translation;
|
|
||||||
public Vector3f scale;
|
|
||||||
public Quaternionf rotationLeft;
|
|
||||||
public Quaternionf rotationRight;
|
|
||||||
public Display.Billboard billboard;
|
|
||||||
public int skyLight;
|
|
||||||
public float viewRange;
|
|
||||||
public float width;
|
|
||||||
public float height;
|
|
||||||
public ItemDisplay.ItemDisplayTransform displayTransform;
|
|
||||||
public ItemStack itemStack;
|
|
||||||
|
|
||||||
public ItemDisplayMetadata() {
|
|
||||||
this.translation = new Vector3f();
|
|
||||||
this.scale = new Vector3f(1.0f, 1.0f, 1.0f);
|
|
||||||
this.rotationLeft = new Quaternionf();
|
|
||||||
this.rotationRight = new Quaternionf();
|
|
||||||
this.skyLight = 15;
|
|
||||||
this.viewRange = 1.0f;
|
|
||||||
this.width = 0.0f;
|
|
||||||
this.height = 0.0f;
|
|
||||||
this.displayTransform = ItemDisplay.ItemDisplayTransform.NONE;
|
|
||||||
this.itemStack = new ItemStack(Material.AIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemDisplayMetadata setFixed() {
|
|
||||||
this.billboard = Display.Billboard.FIXED;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemDisplayMetadata setVertical() {
|
|
||||||
this.billboard = Display.Billboard.VERTICAL;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,22 +12,17 @@ import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCInventoryUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCPlayerUtils;
|
||||||
import com.hibiscusmc.hmccosmetics.util.misc.ItemDisplayMetadata;
|
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerNamedEntitySpawn;
|
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerNamedEntitySpawn;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerPlayerInfo;
|
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerPlayerInfo;
|
||||||
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerRelEntityMove;
|
import com.hibiscusmc.hmccosmetics.util.packets.wrappers.WrapperPlayServerRelEntityMove;
|
||||||
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
import me.lojosho.hibiscuscommons.util.packets.PacketManager;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Display;
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.ItemDisplay;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.joml.Quaternionf;
|
|
||||||
import org.joml.Vector3f;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -38,7 +33,7 @@ public class HMCCPacketManager extends PacketManager {
|
|||||||
final int entityId,
|
final int entityId,
|
||||||
final EntityType entityType,
|
final EntityType entityType,
|
||||||
final UUID uuid
|
final UUID uuid
|
||||||
) {
|
) {
|
||||||
sendEntitySpawnPacket(location, entityId, entityType, uuid, getViewers(location));
|
sendEntitySpawnPacket(location, entityId, entityType, uuid, getViewers(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +44,16 @@ public class HMCCPacketManager extends PacketManager {
|
|||||||
final UUID uuid,
|
final UUID uuid,
|
||||||
final @NotNull List<Player> sendTo
|
final @NotNull List<Player> sendTo
|
||||||
) {
|
) {
|
||||||
PacketManager.sendEntitySpawnPacket(location, entityId, entityType, uuid, sendTo);
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
|
||||||
|
packet.getModifier().writeDefaults();
|
||||||
|
packet.getUUIDs().write(0, uuid);
|
||||||
|
packet.getIntegers().write(0, entityId);
|
||||||
|
packet.getEntityTypeModifier().write(0, entityType);
|
||||||
|
packet.getDoubles().
|
||||||
|
write(0, location.getX()).
|
||||||
|
write(1, location.getY()).
|
||||||
|
write(2, location.getZ());
|
||||||
|
for (Player p : sendTo) sendPacket(p, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void equipmentSlotUpdate(
|
public static void equipmentSlotUpdate(
|
||||||
@@ -92,17 +96,20 @@ public class HMCCPacketManager extends PacketManager {
|
|||||||
equipmentSlotUpdate(entityId, HMCCInventoryUtils.getEquipmentSlot(cosmeticSlot), user.getUserCosmeticItem(cosmeticSlot), sendTo);
|
equipmentSlotUpdate(entityId, HMCCInventoryUtils.getEquipmentSlot(cosmeticSlot), user.getUserCosmeticItem(cosmeticSlot), sendTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendItemDisplayMetadata(int entityId, ItemStack itemStack, List<Player> sendTo) {
|
public static void sendArmorstandMetadata(
|
||||||
ItemDisplayMetadata metadata = new ItemDisplayMetadata();
|
int entityId,
|
||||||
PacketManager.sendItemDisplayMetadataPacket(entityId, metadata.translation, metadata.scale, metadata.rotationLeft, metadata.rotationRight, metadata.billboard, 0, metadata.skyLight, metadata.viewRange, metadata.width, metadata.height, metadata.displayTransform, itemStack, sendTo);
|
List<Player> sendTo
|
||||||
}
|
) {
|
||||||
|
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
||||||
|
packet.getModifier().writeDefaults();
|
||||||
|
packet.getIntegers().write(0, entityId);
|
||||||
|
final List<WrappedDataValue> wrappedDataValueList = Lists.newArrayList();
|
||||||
|
|
||||||
public static void sendItemDisplayMetadata(int entityId, ItemDisplayMetadata metadata, List<Player> sendTo) {
|
// 0x21 = Invisible + Fire (Aka, burns to make it not take the light of the block its in, avoiding turning it black)
|
||||||
PacketManager.sendItemDisplayMetadataPacket(entityId, metadata.translation, metadata.scale, metadata.rotationLeft, metadata.rotationRight, metadata.billboard, 0, metadata.skyLight, metadata.viewRange, metadata.width, metadata.height, metadata.displayTransform, metadata.itemStack, sendTo);
|
wrappedDataValueList.add(new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x21));
|
||||||
}
|
wrappedDataValueList.add(new WrappedDataValue(15, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x10));
|
||||||
|
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
|
||||||
public static void sendItemDisplayMetadata(int entityId, ItemDisplayMetadata metadata, ItemStack itemStack, List<Player> sendTo) {
|
for (Player p : sendTo) sendPacket(p, packet);
|
||||||
PacketManager.sendItemDisplayMetadataPacket(entityId, metadata.translation, metadata.scale, metadata.rotationLeft, metadata.rotationRight, metadata.billboard, 0, metadata.skyLight, metadata.viewRange, metadata.width, metadata.height, metadata.displayTransform, itemStack, sendTo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendInvisibilityPacket(
|
public static void sendInvisibilityPacket(
|
||||||
|
|||||||
@@ -45,17 +45,8 @@ cosmetic-settings:
|
|||||||
emote-camera: true
|
emote-camera: true
|
||||||
# If a player should be able to move in an emote. This option really only affects if "emote-camera" is false
|
# If a player should be able to move in an emote. This option really only affects if "emote-camera" is false
|
||||||
emote-move: false
|
emote-move: false
|
||||||
|
|
||||||
|
|
||||||
# This make it so it always sends the riding packets for the backpack. This sends more packets but is more reliable for servers which modify player passengers.
|
# This make it so it always sends the riding packets for the backpack. This sends more packets but is more reliable for servers which modify player passengers.
|
||||||
backpack-force-riding-packet: false
|
backpack-force-riding-packet: false
|
||||||
# This makes the plugin either (true) always have the backpack eminate light to avoid the black backpack bug or (false) turns it off.
|
|
||||||
backpack-light-emination: true
|
|
||||||
# This activates the block detection for the backpack. This allows backpacks to not appear completely black when in a block.
|
|
||||||
# Requires backpack-light-emination to be true.
|
|
||||||
backpack-block-detection: true
|
|
||||||
|
|
||||||
|
|
||||||
# This helps reduce the amount of packets sent for packet entities, but reduces accuracy of the entity. This is in milliseconds. -1 to disable.
|
# This helps reduce the amount of packets sent for packet entities, but reduces accuracy of the entity. This is in milliseconds. -1 to disable.
|
||||||
# This is useful for servers with a lot of backpacks, as they are passengers, which means the client will update their position automatically within an area where the entity is located.
|
# This is useful for servers with a lot of backpacks, as they are passengers, which means the client will update their position automatically within an area where the entity is located.
|
||||||
entity-cooldown-teleport-packet: 500
|
entity-cooldown-teleport-packet: 500
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
51
gradlew
vendored
51
gradlew
vendored
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright <EFBFBD> 2015-2021 the original authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -32,10 +32,10 @@
|
|||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
# * functions;
|
# * functions;
|
||||||
# * expansions <EFBFBD>$var<EFBFBD>, <EFBFBD>${var}<EFBFBD>, <EFBFBD>${var:-default}<EFBFBD>, <EFBFBD>${var+SET}<EFBFBD>,
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
# <EFBFBD>${var#prefix}<EFBFBD>, <EFBFBD>${var%suffix}<EFBFBD>, and <EFBFBD>$( cmd )<EFBFBD>;
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
# * compound commands having a testable exit status, especially <EFBFBD>case<EFBFBD>;
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
# * various built-in commands including <EFBFBD>command<EFBFBD>, <EFBFBD>set<EFBFBD>, and <EFBFBD>ulimit<EFBFBD>.
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
#
|
#
|
||||||
# Important for patching:
|
# Important for patching:
|
||||||
#
|
#
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
@@ -205,6 +214,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|||||||
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
Reference in New Issue
Block a user