mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-30 12:19:12 +00:00
small changes
Add a 24-hour time variable Fix weather detection issue
This commit is contained in:
@@ -139,6 +139,14 @@ public class PluginPlaceholders extends PlaceholderExpansion {
|
|||||||
if (minutes < 10) return hours + ":0" + minutes + ap;
|
if (minutes < 10) return hours + ":0" + minutes + ap;
|
||||||
else return hours + ":" + minutes + ap;
|
else return hours + ":" + minutes + ap;
|
||||||
}
|
}
|
||||||
|
case "time-24" -> {
|
||||||
|
long time = onlinePlayer.getWorld().getTime();
|
||||||
|
double converttime = time * 3.6;
|
||||||
|
int hours = (int) Math.floor(converttime % 86400 / 3600);
|
||||||
|
int minutes = (int) Math.floor(converttime % 3600 / 60);
|
||||||
|
int mchours = hours <= 17 ? hours + 6 : hours - 18;
|
||||||
|
return mchours + ":" + (minutes >= 10 ? minutes : "0"+minutes);
|
||||||
|
}
|
||||||
case "actionbar" -> {
|
case "actionbar" -> {
|
||||||
return plugin.getActionBarManager().getOtherPluginActionBar(onlinePlayer);
|
return plugin.getActionBarManager().getOtherPluginActionBar(onlinePlayer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,9 +378,8 @@ public class RequirementManagerImpl implements RequirementManager {
|
|||||||
return condition -> {
|
return condition -> {
|
||||||
String currentWeather;
|
String currentWeather;
|
||||||
World world = Objects.requireNonNull(condition.getOfflinePlayer().getPlayer()).getWorld();
|
World world = Objects.requireNonNull(condition.getOfflinePlayer().getPlayer()).getWorld();
|
||||||
if (world.hasStorm()) currentWeather = "rainstorm";
|
if (world.isClearWeather()) currentWeather = "clear";
|
||||||
else if (world.isThundering()) currentWeather = "thunder";
|
else if (world.isThundering()) currentWeather = "thunder";
|
||||||
else if (world.isClearWeather()) currentWeather = "clear";
|
|
||||||
else currentWeather = "rain";
|
else currentWeather = "rain";
|
||||||
for (String weather : weathers)
|
for (String weather : weathers)
|
||||||
if (weather.equalsIgnoreCase(currentWeather))
|
if (weather.equalsIgnoreCase(currentWeather))
|
||||||
|
|||||||
Reference in New Issue
Block a user