mirror of
https://github.com/amalthea-mc/Ore-Market.git
synced 2024-11-22 10:22:29 +00:00
Implement toggling value update message
This commit is contained in:
parent
97d4187af3
commit
7a2868a165
@ -12,22 +12,24 @@ public class ValueUpdates {
|
|||||||
Placeholders plh = new Placeholders();
|
Placeholders plh = new Placeholders();
|
||||||
|
|
||||||
public void announceValue() {
|
public void announceValue() {
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(OreMarket.main(), () -> {
|
if(OreMarket.main().getConfig().getBoolean("valuemessage.enabled")) {
|
||||||
for (String key : Objects.requireNonNull(OreMarket.main().getGuiConfig().getConfigurationSection("items")).getKeys(false)) {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(OreMarket.main(), () -> {
|
||||||
ConfigurationSection keySection = Objects.requireNonNull(OreMarket.main().getGuiConfig().getConfigurationSection("items")).getConfigurationSection(key);
|
for (String key : Objects.requireNonNull(OreMarket.main().getGuiConfig().getConfigurationSection("items")).getKeys(false)) {
|
||||||
String message = OreMarket.main().getConfig().getString("valuemessage.format");
|
ConfigurationSection keySection = Objects.requireNonNull(OreMarket.main().getGuiConfig().getConfigurationSection("items")).getConfigurationSection(key);
|
||||||
|
String message = OreMarket.main().getConfig().getString("valuemessage.format");
|
||||||
|
|
||||||
assert keySection != null;
|
assert keySection != null;
|
||||||
assert message != null;
|
assert message != null;
|
||||||
|
|
||||||
for (Player player: Bukkit.getOnlinePlayers()) {
|
for (Player player: Bukkit.getOnlinePlayers()) {
|
||||||
if (keySection.getBoolean("hide")) {
|
if (keySection.getBoolean("hide")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
player.sendMessage(plh.format(message, player, keySection));
|
||||||
}
|
}
|
||||||
player.sendMessage(plh.format(message, player, keySection));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}, 0L, (OreMarket.main().getConfig().getInt("valuemessage.time")* 20L*60));
|
}, 0L, (OreMarket.main().getConfig().getInt("valuemessage.time")* 20L*60));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
prefix: '&bOreMarket '
|
prefix: '&bOreMarket '
|
||||||
|
|
||||||
valuemessage:
|
valuemessage:
|
||||||
|
enabled: true
|
||||||
# Time (in minutes) to send this message
|
# Time (in minutes) to send this message
|
||||||
time: 5
|
time: 5
|
||||||
# The below will look like: (These values are just examples)
|
# The below will look like: (These values are just examples)
|
||||||
|
Loading…
Reference in New Issue
Block a user