mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancynpcs: Update npc update interval to seconds
This commit is contained in:
@@ -316,7 +316,7 @@ public class FancyNpcs extends JavaPlugin implements FancyNpcsPlugin {
|
||||
npc.spawnForAll();
|
||||
}
|
||||
}
|
||||
}, 3, npcUpdateInterval, TimeUnit.MINUTES);
|
||||
}, 30, npcUpdateInterval, TimeUnit.SECONDS);
|
||||
|
||||
// Creating new instance of CloudCommandManager and registering all needed components.
|
||||
// NOTE: Brigadier is disabled by default. More detailed information about that can be found in CloudCommandManager class.
|
||||
|
||||
@@ -115,8 +115,8 @@ public class FancyNpcsConfigImpl implements FancyNpcsConfig {
|
||||
autoSaveInterval = (int) ConfigHelper.getOrDefault(config, "autosave_interval", 15);
|
||||
config.setInlineComments("autosave_interval", List.of("The interval at which autosave is performed in minutes."));
|
||||
|
||||
npcUpdateInterval = (int) ConfigHelper.getOrDefault(config, "npc_update_interval", 30);
|
||||
config.setInlineComments("npc_update_skin_interval", List.of("The interval at which the NPC is updated (in minutes). Only if the skin or displayName is a placeholder."));
|
||||
npcUpdateInterval = (int) ConfigHelper.getOrDefault(config, "npc_update_interval", 60);
|
||||
config.setInlineComments("npc_update_skin_interval", List.of("The interval at which the NPC is updated (in seconds). Only if the skin or displayName is a placeholder."));
|
||||
|
||||
npcUpdateVisibilityInterval = (int) ConfigHelper.getOrDefault(config, "npc_update_visibility_interval", 20);
|
||||
config.setInlineComments("npc_update_visibility_interval", List.of("The interval at which the NPC visibility is updated (in ticks)."));
|
||||
@@ -211,15 +211,15 @@ public class FancyNpcsConfigImpl implements FancyNpcsConfig {
|
||||
if (distance <= 0 && distance != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Update the config value in memory
|
||||
this.turnToPlayerDistance = distance;
|
||||
|
||||
|
||||
// Persist to config file
|
||||
FileConfiguration config = FancyNpcs.getInstance().getConfig();
|
||||
config.set("turn_to_player_distance", distance);
|
||||
FancyNpcs.getInstance().saveConfig();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PlaceholderApiEnv extends PlaceholderExpansion {
|
||||
public static String parsedString = "Grabsky";
|
||||
public static int i = 0;
|
||||
public static String[] strings = new String[]{
|
||||
"Grabsky",
|
||||
"OakLoaf",
|
||||
"GommeHD",
|
||||
};
|
||||
|
||||
public static void registerPlaceholders() {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
@@ -36,20 +41,20 @@ public class PlaceholderApiEnv extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
|
||||
if (player == null) {
|
||||
return null;
|
||||
i++;
|
||||
if (i >= strings.length) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
return parsedString;
|
||||
return strings[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
|
||||
if (player == null) {
|
||||
return null;
|
||||
i++;
|
||||
if (i >= strings.length) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
return parsedString;
|
||||
return strings[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user