4 Commits

Author SHA1 Message Date
Oliver
232f041df0 fancydialogs: Fix cast exception caused by close_timeout config option 2025-11-04 20:26:35 +01:00
Oliver
47e0714ec7 fancyholograms v3: Add total_amount_attached_traits metric 2025-11-04 20:22:38 +01:00
envizar
414da48403 fancynpcs: Add swing_arm_on_update option (#135) 2025-11-04 20:02:00 +01:00
Oliver
ac2a4f6e93 fancynpcs: Fix mirror skin for 1.21.9 2025-11-04 19:06:14 +01:00
9 changed files with 45 additions and 15 deletions

View File

@@ -1 +1 @@
0.0.27 0.0.28

View File

@@ -12,7 +12,7 @@ public class FancyDialogsConfig {
private String logLevel; private String logLevel;
private String welcomeDialogID; private String welcomeDialogID;
private String quickActionsDialogID; private String quickActionsDialogID;
private long closeTimeout; private int closeTimeout;
public void load() { public void load() {
FancyDialogsPlugin.get().reloadConfig(); FancyDialogsPlugin.get().reloadConfig();
@@ -30,7 +30,7 @@ public class FancyDialogsConfig {
quickActionsDialogID = (String) ConfigHelper.getOrDefault(config, "quick_actions_dialog_id", "quick_actions"); quickActionsDialogID = (String) ConfigHelper.getOrDefault(config, "quick_actions_dialog_id", "quick_actions");
config.setInlineComments("quick_actions_dialog_id", List.of("The ID of the dialog which will be shown to the player when they click on the quick actions key ('G' by default).")); config.setInlineComments("quick_actions_dialog_id", List.of("The ID of the dialog which will be shown to the player when they click on the quick actions key ('G' by default)."));
closeTimeout = (long) ConfigHelper.getOrDefault(config, "close_timeout", 1000L * 60 * 2); closeTimeout = (int) ConfigHelper.getOrDefault(config, "close_timeout", 1000 * 60 * 2);
config.setInlineComments("close_timeout", List.of("The time in milliseconds after which a dialog will be considered closed if the player does not respond. 0 means no timeout.")); config.setInlineComments("close_timeout", List.of("The time in milliseconds after which a dialog will be considered closed if the player does not respond. 0 means no timeout."));
FancyDialogsPlugin.get().saveConfig(); FancyDialogsPlugin.get().saveConfig();
@@ -52,7 +52,7 @@ public class FancyDialogsConfig {
return quickActionsDialogID; return quickActionsDialogID;
} }
public long getCloseTimeout() { public int getCloseTimeout() {
return closeTimeout; return closeTimeout;
} }
} }

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT.7 3.0.0-SNAPSHOT.8

View File

@@ -1,6 +1,7 @@
package com.fancyinnovations.fancyholograms.metrics; package com.fancyinnovations.fancyholograms.metrics;
import com.fancyinnovations.fancyholograms.api.HologramRegistry; import com.fancyinnovations.fancyholograms.api.HologramRegistry;
import com.fancyinnovations.fancyholograms.api.hologram.Hologram;
import com.fancyinnovations.fancyholograms.main.FancyHologramsPlugin; import com.fancyinnovations.fancyholograms.main.FancyHologramsPlugin;
import de.oliver.fancyanalytics.api.FancyAnalyticsAPI; import de.oliver.fancyanalytics.api.FancyAnalyticsAPI;
import de.oliver.fancyanalytics.api.metrics.MetricSupplier; import de.oliver.fancyanalytics.api.metrics.MetricSupplier;
@@ -74,6 +75,14 @@ public class FHMetrics {
.toArray(String[]::new); .toArray(String[]::new);
})); }));
fancyAnalytics.registerNumberMetric(new MetricSupplier<>("total_amount_attached_traits", () -> {
double total = 0d;
for (Hologram hologram : registry.getAll()) {
total += hologram.getData().getTraitTrait().getTraits().size();
}
return total;
}));
fancyAnalytics.initialize(); fancyAnalytics.initialize();
} }

View File

@@ -1 +1 @@
2.8.0.302 2.8.0.303

View File

@@ -35,6 +35,8 @@ public interface FancyNpcsConfig {
int getRemoveNpcsFromPlayerlistDelay(); int getRemoveNpcsFromPlayerlistDelay();
boolean isSwingArmOnUpdate();
String getMineSkinApiKey(); String getMineSkinApiKey();
List<String> getBlockedCommands(); List<String> getBlockedCommands();

View File

@@ -121,7 +121,7 @@ public abstract class Npc {
public abstract void update(Player player, boolean swingArm); public abstract void update(Player player, boolean swingArm);
public void update(Player player) { public void update(Player player) {
update(player, true); update(player, FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
} }
public void updateForAll(boolean swingArm) { public void updateForAll(boolean swingArm) {
@@ -131,13 +131,13 @@ public abstract class Npc {
} }
public void updateForAll() { public void updateForAll() {
updateForAll(true); updateForAll(FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
} }
public abstract void move(Player player, boolean swingArm); public abstract void move(Player player, boolean swingArm);
public void move(Player player) { public void move(Player player) {
move(player, true); move(player, FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
} }
public void moveForAll(boolean swingArm) { public void moveForAll(boolean swingArm) {
@@ -147,7 +147,7 @@ public abstract class Npc {
} }
public void moveForAll() { public void moveForAll() {
moveForAll(true); moveForAll(FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
} }
public void interact(Player player) { public void interact(Player player) {

View File

@@ -387,11 +387,19 @@ public class Npc_1_21_9 extends Npc {
} }
private ClientboundPlayerInfoUpdatePacket.Entry getEntry(ServerPlayer npcPlayer, ServerPlayer viewer) { private ClientboundPlayerInfoUpdatePacket.Entry getEntry(ServerPlayer npcPlayer, ServerPlayer viewer) {
GameProfile profile = npcPlayer.getGameProfile(); GameProfile profile;
if (data.isMirrorSkin()) { if (!data.isMirrorSkin()) {
GameProfile newProfile = new GameProfile(profile.id(), profile.name()); profile = npcPlayer.getGameProfile();
newProfile.properties().putAll(viewer.getGameProfile().properties()); } else {
profile = newProfile; Property textures = viewer.getGameProfile().properties().get("textures").iterator().next();
PropertyMap propertyMap = new PropertyMap(
ImmutableMultimap.of(
"textures",
new Property("textures", textures.value(), textures.signature())
)
);
profile = new GameProfile(uuid, localName, propertyMap);
} }
return new ClientboundPlayerInfoUpdatePacket.Entry( return new ClientboundPlayerInfoUpdatePacket.Entry(

View File

@@ -78,6 +78,12 @@ public class FancyNpcsConfigImpl implements FancyNpcsConfig {
*/ */
private int removeNpcsFromPlayerlistDelay; private int removeNpcsFromPlayerlistDelay;
/**
* Whether MPCs should swing arm on update.
*/
private boolean swingArmOnUpdate;
/** /**
* The API key for the MineSkin API. * The API key for the MineSkin API.
*/ */
@@ -139,6 +145,9 @@ public class FancyNpcsConfigImpl implements FancyNpcsConfig {
removeNpcsFromPlayerlistDelay = (int) ConfigHelper.getOrDefault(config, "remove_npcs_from_playerlist_delay", 2000); removeNpcsFromPlayerlistDelay = (int) ConfigHelper.getOrDefault(config, "remove_npcs_from_playerlist_delay", 2000);
config.setInlineComments("remove_npcs_from_playerlist_delay", List.of("The delay in milliseconds to remove NPCs from the player list. Increase this value if you have problems with skins not loading correctly when joining or switching worlds. You can set it to -1, if you don't have any npcs using the show_in_tab feature.")); config.setInlineComments("remove_npcs_from_playerlist_delay", List.of("The delay in milliseconds to remove NPCs from the player list. Increase this value if you have problems with skins not loading correctly when joining or switching worlds. You can set it to -1, if you don't have any npcs using the show_in_tab feature."));
swingArmOnUpdate = (boolean) ConfigHelper.getOrDefault(config, "swing_arm_on_update", true);
config.setInlineComments("swing_arm_on_update", List.of("Whether NPCs should swing arm on update."));
blockedCommands = (List<String>) ConfigHelper.getOrDefault(config, "blocked_commands", Arrays.asList("op", "ban")); blockedCommands = (List<String>) ConfigHelper.getOrDefault(config, "blocked_commands", Arrays.asList("op", "ban"));
config.setInlineComments("blocked_commands", List.of("The commands that are blocked for NPCs in the message.")); config.setInlineComments("blocked_commands", List.of("The commands that are blocked for NPCs in the message."));
@@ -231,6 +240,8 @@ public class FancyNpcsConfigImpl implements FancyNpcsConfig {
return removeNpcsFromPlayerlistDelay; return removeNpcsFromPlayerlistDelay;
} }
public boolean isSwingArmOnUpdate() { return swingArmOnUpdate; }
public String getMineSkinApiKey() { public String getMineSkinApiKey() {
if (mineskinApiKey.isEmpty()) { if (mineskinApiKey.isEmpty()) {
return null; return null;