mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-30 12:29:16 +00:00
latest changes
This commit is contained in:
@@ -25,6 +25,7 @@ import com.jeff_media.updatechecker.UpdateCheckSource;
|
||||
import com.jeff_media.updatechecker.UpdateChecker;
|
||||
import com.ticxo.playeranimator.PlayerAnimatorImpl;
|
||||
import com.ticxo.playeranimator.api.PlayerAnimator;
|
||||
import com.ticxo.playeranimator.api.animation.pack.AnimationPack;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -40,6 +41,9 @@ import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class HMCCosmeticsPlugin extends JavaPlugin {
|
||||
|
||||
@@ -234,8 +238,13 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
||||
File[] emotesFiles = emoteFolder.listFiles();
|
||||
for (File emoteFile : emotesFiles) {
|
||||
if (!emoteFile.getName().contains("bbmodel")) continue;
|
||||
String animationName = emoteFile.getName().replaceAll("bbmodel", "");
|
||||
PlayerAnimator.api.getAnimationManager().importAnimations(animationName, emoteFile);
|
||||
String animationName = emoteFile.getName().replaceAll(".bbmodel", "");
|
||||
PlayerAnimator.api.getAnimationManager().importAnimations(emoteFile.getName(), emoteFile);
|
||||
MessagesUtil.sendDebugMessages("Added '" + animationName + "' to Player Animator ");
|
||||
}
|
||||
|
||||
for (Map.Entry<String, AnimationPack> packEntry : PlayerAnimator.api.getAnimationManager().getRegistry().entrySet()) {
|
||||
//Set<String> animationNames = packEntry.getValue().getAnimations().keySet().stream().map(animation -> packEntry.getKey().replace(":", ".") + "." + animation).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||
import com.ticxo.playeranimator.api.PlayerAnimator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -77,6 +78,9 @@ public class CosmeticCommandTabComplete implements TabCompleter {
|
||||
completions.add("viewerlocation");
|
||||
completions.add("leavelocation");
|
||||
}
|
||||
case "emote" -> {
|
||||
completions.addAll(PlayerAnimator.api.getAnimationManager().getRegistry().keySet());
|
||||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[1], completions, finalCompletitons);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.hibiscusmc.hmccosmetics.cosmetic.types;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
||||
|
||||
public class CosmeticEmoteType extends Cosmetic {
|
||||
@@ -12,6 +13,7 @@ public class CosmeticEmoteType extends Cosmetic {
|
||||
super(id, config);
|
||||
|
||||
animationId = config.node("animation").getString();
|
||||
MessagesUtil.sendDebugMessages("CosmeticEmoteType Animation id " + animationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -133,6 +133,9 @@ public class CosmeticUser {
|
||||
}
|
||||
if (slot == CosmeticSlot.BALLOON) {
|
||||
despawnBalloon();
|
||||
}
|
||||
if (slot == CosmeticSlot.EMOTE) {
|
||||
|
||||
}
|
||||
colors.remove(slot);
|
||||
playerCosmetics.remove(slot);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.hibiscusmc.hmccosmetics.user.manager;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticEmoteType;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
|
||||
public class UserEmoteManager {
|
||||
|
||||
@@ -10,15 +11,17 @@ public class UserEmoteManager {
|
||||
|
||||
public UserEmoteManager(CosmeticUser user) {
|
||||
this.user = user;
|
||||
model = new UserEmoteModel(user);
|
||||
}
|
||||
|
||||
public void playEmote(CosmeticEmoteType cosmeticEmoteType) {
|
||||
MessagesUtil.sendDebugMessages("playEmote " + cosmeticEmoteType.getAnimationId());
|
||||
model = new UserEmoteModel(user);
|
||||
model.playAnimation(cosmeticEmoteType.getAnimationId());
|
||||
}
|
||||
|
||||
public boolean isPlayingEmote() {
|
||||
return model.isPlayingAnimation();
|
||||
if (model == null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void stopEmote() {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.hibiscusmc.hmccosmetics.user.manager;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
import com.ticxo.playeranimator.api.PlayerAnimator;
|
||||
import com.ticxo.playeranimator.api.model.player.PlayerModel;
|
||||
|
||||
public class UserEmoteModel extends PlayerModel {
|
||||
@@ -15,6 +17,8 @@ public class UserEmoteModel extends PlayerModel {
|
||||
|
||||
@Override
|
||||
public void playAnimation(String id) {
|
||||
id = id + "\\bbmodel\\" + id;
|
||||
MessagesUtil.sendDebugMessages("playAnimation " + id);
|
||||
super.playAnimation(id);
|
||||
user.hidePlayer();
|
||||
user.hideCosmetics(CosmeticUser.HiddenReason.EMOTE);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class PacketManager extends BasePacket {
|
||||
CosmeticSlot cosmeticSlot,
|
||||
List<Player> sendTo
|
||||
) {
|
||||
if (cosmeticSlot == CosmeticSlot.BACKPACK || cosmeticSlot == CosmeticSlot.BALLOON) return;
|
||||
if (cosmeticSlot == CosmeticSlot.BACKPACK || cosmeticSlot == CosmeticSlot.BALLOON || cosmeticSlot == CosmeticSlot.EMOTE) return;
|
||||
|
||||
NMSHandlers.getHandler().equipmentSlotUpdate(entityId, user, cosmeticSlot, sendTo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user