Skip to content

Commit

Permalink
added update time config section
Browse files Browse the repository at this point in the history
  • Loading branch information
NonSwag committed Jul 9, 2023
1 parent 50b12c2 commit be2d649
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "net.thenextlvl"
version = "1.3.3"
version = "1.3.4"

repositories {
mavenCentral()
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/thenextlvl/tweaks/TweaksPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class TweaksPlugin extends JavaPlugin {
new ConfigItem(Material.LIME_STAINED_GLASS_PANE, "§8» §aBoots"),
new ConfigItem(Material.LIGHT_BLUE_STAINED_GLASS_PANE, "§8» §bOff Hand"),
new ConfigItem(Material.CYAN_STAINED_GLASS_PANE, "§8» §3Cursor"),
new ConfigItem(Material.IRON_BARS, "§7-§8/§7-")
new ConfigItem(Material.IRON_BARS, "§7-§8/§7-"),
1000
)
)
) {{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ public class InventoryCommand extends PlayerCommand implements Listener {

public InventoryCommand(TweaksPlugin plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
var updateTime = Math.max(1, plugin.getTweaksConfig().inventoryConfig().updateTime());
plugin.getFoliaLib().getImpl().runTimer(() -> providers.forEach((provider, viewers) -> {
var inventory = inventories.get(provider);
if (inventory != null) updateInventory(inventory, provider);
}), 1, 1, TimeUnit.SECONDS);
}), updateTime, updateTime, TimeUnit.MILLISECONDS);
this.plugin = plugin;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record InventoryConfig(
@SerializedName("boots") ConfigItem boots,
@SerializedName("off-hand") ConfigItem offHand,
@SerializedName("cursor") ConfigItem cursor,
@SerializedName("placeholder") ConfigItem placeholder
@SerializedName("placeholder") ConfigItem placeholder,
@SerializedName("update-time") long updateTime
) {
}

0 comments on commit be2d649

Please sign in to comment.