|
3 | 3 | import com.zaxxer.hikari.HikariConfig; |
4 | 4 | import com.zaxxer.hikari.HikariDataSource; |
5 | 5 | import net.kyori.adventure.text.Component; |
| 6 | +import org.bukkit.World; |
6 | 7 | import org.bukkit.plugin.java.JavaPlugin; |
7 | 8 | import org.jetbrains.annotations.NotNull; |
8 | 9 | import org.jetbrains.annotations.Nullable; |
|
11 | 12 | import pro.cloudnode.smp.smpcore.command.Command; |
12 | 13 | import pro.cloudnode.smp.smpcore.command.MainCommand; |
13 | 14 | import pro.cloudnode.smp.smpcore.command.SeenCommand; |
| 15 | +import pro.cloudnode.smp.smpcore.command.TimeCommand; |
14 | 16 | import pro.cloudnode.smp.smpcore.command.UnbanCommand; |
15 | 17 | import pro.cloudnode.smp.smpcore.listener.NationTeamUpdaterListener; |
16 | 18 |
|
@@ -73,6 +75,7 @@ public void onEnable() { |
73 | 75 | put("ban", new BanCommand()); |
74 | 76 | put("unban", new UnbanCommand()); |
75 | 77 | put("seen", new SeenCommand()); |
| 78 | + put("time", new TimeCommand()); |
76 | 79 | }}; |
77 | 80 | commands.put("alts", new AltsCommand(commands.get("smpcore"))); |
78 | 81 | for (final @NotNull Map.Entry<@NotNull String, @NotNull Command> entry : commands.entrySet()) |
@@ -192,4 +195,13 @@ public static boolean ifDisallowedCharacters(final @NotNull String source, final |
192 | 195 | public static @NotNull Component relativeTime(final @NotNull Date date) { |
193 | 196 | return relativeTime(date, new Date()); |
194 | 197 | } |
| 198 | + |
| 199 | + private static @NotNull World overworld() { |
| 200 | + return Objects.requireNonNull(getInstance().getServer().getWorlds().stream() |
| 201 | + .filter(w -> w.getEnvironment() == World.Environment.NORMAL).findFirst().orElse(null)); |
| 202 | + } |
| 203 | + |
| 204 | + public static @NotNull Date gameTime() { |
| 205 | + return new Date(overworld().getGameTime() * 72); |
| 206 | + } |
195 | 207 | } |
0 commit comments