9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-26 02:19:28 +00:00

small changes

Add a 24-hour time variable
Fix weather detection issue
This commit is contained in:
jhqwqmc
2024-04-07 21:00:50 +08:00
parent 8fb4b8317d
commit 40672aefb4
2 changed files with 9 additions and 2 deletions

View File

@@ -139,6 +139,14 @@ public class PluginPlaceholders extends PlaceholderExpansion {
if (minutes < 10) return hours + ":0" + 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" -> {
return plugin.getActionBarManager().getOtherPluginActionBar(onlinePlayer);
}

View File

@@ -378,9 +378,8 @@ public class RequirementManagerImpl implements RequirementManager {
return condition -> {
String currentWeather;
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.isClearWeather()) currentWeather = "clear";
else currentWeather = "rain";
for (String weather : weathers)
if (weather.equalsIgnoreCase(currentWeather))