mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancynpcs: Add swing_arm_on_update option (#135)
This commit is contained in:
@@ -35,6 +35,8 @@ public interface FancyNpcsConfig {
|
||||
|
||||
int getRemoveNpcsFromPlayerlistDelay();
|
||||
|
||||
boolean isSwingArmOnUpdate();
|
||||
|
||||
String getMineSkinApiKey();
|
||||
|
||||
List<String> getBlockedCommands();
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class Npc {
|
||||
public abstract void update(Player player, boolean swingArm);
|
||||
|
||||
public void update(Player player) {
|
||||
update(player, true);
|
||||
update(player, FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
|
||||
}
|
||||
|
||||
public void updateForAll(boolean swingArm) {
|
||||
@@ -131,13 +131,13 @@ public abstract class Npc {
|
||||
}
|
||||
|
||||
public void updateForAll() {
|
||||
updateForAll(true);
|
||||
updateForAll(FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
|
||||
}
|
||||
|
||||
public abstract void move(Player player, boolean swingArm);
|
||||
|
||||
public void move(Player player) {
|
||||
move(player, true);
|
||||
move(player, FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
|
||||
}
|
||||
|
||||
public void moveForAll(boolean swingArm) {
|
||||
@@ -147,7 +147,7 @@ public abstract class Npc {
|
||||
}
|
||||
|
||||
public void moveForAll() {
|
||||
moveForAll(true);
|
||||
moveForAll(FancyNpcsPlugin.get().getFancyNpcConfig().isSwingArmOnUpdate());
|
||||
}
|
||||
|
||||
public void interact(Player player) {
|
||||
|
||||
@@ -78,6 +78,12 @@ public class FancyNpcsConfigImpl implements FancyNpcsConfig {
|
||||
*/
|
||||
private int removeNpcsFromPlayerlistDelay;
|
||||
|
||||
|
||||
/**
|
||||
* Whether MPCs should swing arm on update.
|
||||
*/
|
||||
private boolean swingArmOnUpdate;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
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"));
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean isSwingArmOnUpdate() { return swingArmOnUpdate; }
|
||||
|
||||
public String getMineSkinApiKey() {
|
||||
if (mineskinApiKey.isEmpty()) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user